export const __rspack_esm_id="51277";export const __rspack_esm_ids=["51277"];export const __webpack_modules__={16988(e,t,i){i.a(e,async function(e,a){try{i.r(t),i.d(t,{HuiPictureElementsCardEditor:()=>f});var n=i(62826),o=i(22786),s=i(96196),l=i(44457),c=i(63533),r=i(1087),d=(i(76776),i(52763),i(88945),i(59646),i(81287)),m=i(84698),_=i(7382),h=i(37258),g=e([d,h]);[d,h]=g.then?(await g)():g;const p=(0,c.NW)({type:(0,c.Yj)()}),u=(0,c.kp)(m.H,(0,c.Ik)({image:(0,c.lq)((0,c.KC)([(0,c.Yj)(),(0,c.Ik)()])),camera_image:(0,c.lq)((0,c.Yj)()),camera_view:(0,c.lq)((0,c.Yj)()),elements:(0,c.YO)(p),title:(0,c.lq)((0,c.Yj)()),state_filter:(0,c.lq)((0,c.bz)()),theme:(0,c.lq)((0,c.Yj)()),dark_mode_image:(0,c.lq)((0,c.KC)([(0,c.Yj)(),(0,c.Ik)()])),dark_mode_filter:(0,c.lq)((0,c.bz)())}));class f extends s.WF{setConfig(e){(0,c.vA)(e,u),this._config=e}render(){return this.hass&&this._config?this._subElementEditorConfig?s.qy` <hui-sub-element-editor .hass="${this.hass}" .config="${this._subElementEditorConfig}" @go-back="${this._goBack}" @config-changed="${this._handleSubElementChanged}"> </hui-sub-element-editor> `:s.qy` <ha-form .hass="${this.hass}" .data="${this._processData(this._config)}" .schema="${this._schema(this.hass.localize)}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._formChanged}"></ha-form> <hui-picture-elements-card-row-editor .hass="${this.hass}" .elements="${this._config.elements}" @elements-changed="${this._elementsChanged}" @edit-detail-element="${this._editDetailElement}"></hui-picture-elements-card-row-editor> `:s.s6}_formChanged(e){e.stopPropagation(),this._config&&this.hass&&(0,r.r)(this,"config-changed",{config:e.detail.value})}_elementsChanged(e){e.stopPropagation();const t=this._config?.elements?.length||0,i={...this._config,elements:e.detail.elements};(0,r.r)(this,"config-changed",{config:i});const a=e.detail.elements?.length||0;if(a===t+1){const t=a-1;this._subElementEditorConfig={index:t,type:"element",elementConfig:{...e.detail.elements[t]}}}}_handleSubElementChanged(e){if(e.stopPropagation(),!this._config||!this.hass)return;const t=this._subElementEditorConfig?.type,i=e.detail.config;if("element"===t){const e=this._config.elements.concat();i?e[this._subElementEditorConfig.index]=i:(e.splice(this._subElementEditorConfig.index,1),this._goBack()),this._config={...this._config,elements:e}}this._subElementEditorConfig={...this._subElementEditorConfig,elementConfig:i},(0,r.r)(this,"config-changed",{config:this._config})}_editDetailElement(e){this._subElementEditorConfig=e.detail.subElementConfig}_goBack(){this._subElementEditorConfig=void 0}static get styles(){return[_.U]}constructor(...e){super(...e),this._schema=(0,o.A)(e=>[{name:"",type:"expandable",title:e("ui.panel.lovelace.editor.card.picture-elements.card_options"),schema:[{name:"title",selector:{text:{}}},{name:"image",selector:{media:{accept:["image/*"],clearable:!0,image_upload:!0,hide_content_type:!0,content_id_helper:e("ui.panel.lovelace.editor.card.picture.content_id_helper")}}},{name:"dark_mode_image",selector:{media:{accept:["image/*"],clearable:!0,image_upload:!0,hide_content_type:!0,content_id_helper:e("ui.panel.lovelace.editor.card.picture.content_id_helper")}}},{name:"camera_image",selector:{entity:{domain:"camera"}}},{name:"camera_view",selector:{select:{options:["auto","live"].map(t=>({value:t,label:e(`ui.panel.lovelace.editor.card.generic.camera_view_options.${t}`)})),mode:"dropdown"}}},{name:"theme",selector:{theme:{}}},{name:"state_filter",selector:{object:{}}},{name:"dark_mode_filter",selector:{object:{}}}]}]),this._processData=(0,o.A)(e=>({...e,..."string"==typeof e.image?{image:{media_content_id:e.image}}:{},..."string"==typeof e.dark_mode_image?{dark_mode_image:{media_content_id:e.dark_mode_image}}:{}})),this._computeLabelCallback=e=>{switch(e.name){case"dark_mode_image":case"state_filter":case"dark_mode_filter":return this.hass.localize(`ui.panel.lovelace.editor.card.picture-elements.${e.name}`)||e.name;default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)||e.name}}}}(0,n.Cg)([(0,l.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,n.Cg)([(0,l.wk)()],f.prototype,"_config",void 0),(0,n.Cg)([(0,l.wk)()],f.prototype,"_subElementEditorConfig",void 0),f=(0,n.Cg)([(0,l.EM)("hui-picture-elements-card-editor")],f),a()}catch(e){a(e)}})},84698(e,t,i){i.d(t,{H:()=>n});var a=i(63533);const n=(0,a.Ik)({type:(0,a.Yj)(),view_layout:(0,a.bz)(),layout_options:(0,a.bz)(),grid_options:(0,a.bz)(),visibility:(0,a.bz)(),disabled:(0,a.lq)((0,a.zM)())})}};
//# sourceMappingURL=51277.09ca063dbbf96082.js.map