"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[83894],{65109:function(e,t,i){i.a(e,async function(e,n){try{i.r(t);var o,s,a=i(97058),l=i(28430),c=i(57567),h=i(25979),d=i(12463),r=i(16472),g=(i(28706),i(54554),i(15697)),u=i(57527),f=i(51209),m=i(49588),_=i(148),v=i(55682),C=i(7170),E=i(5221),p=i(30652),b=e([v,C,E,p]);[v,C,E,p]=b.then?(await b)():b;var k=(0,m.Ik)({type:(0,m.eu)("conditional"),conditions:(0,m.lq)((0,m.YO)((0,m.bz)())),elements:(0,m.lq)((0,m.YO)((0,m.bz)())),title:(0,m.lq)((0,m.Yj)())}),y=[{name:"title",selector:{text:{}}}],A=function(e){function t(){var e;(0,c.A)(this,t);for(var i=arguments.length,n=new Array(i),o=0;o<i;o++)n[o]=arguments[o];return(e=(0,r.A)(this,t,[].concat(n)))._computeLabelCallback=function(t){return e.hass.localize("ui.panel.lovelace.editor.card.generic.".concat(t.name))||e.hass.localize("ui.panel.lovelace.editor.elements.".concat(t.name))||t.name},e}return(0,d.A)(t,e),(0,h.A)(t,[{key:"setConfig",value:function(e){(0,m.vA)(e,k),this._config=e}},{key:"render",value:function(){return this.hass&&this._config?this._subElementEditorConfig?(0,u.qy)(o||(o=(0,l.A)([" <hui-sub-element-editor .hass="," .config="," @go-back="," @config-changed=","> </hui-sub-element-editor> "])),this.hass,this._subElementEditorConfig,this._goBack,this._handleSubElementChanged):(0,u.qy)(s||(s=(0,l.A)([" <ha-form .hass="," .data="," .schema="," .computeLabel="," @value-changed=","></ha-form> <ha-card-conditions-editor .hass="," .conditions="," @value-changed=","> </ha-card-conditions-editor> <hui-picture-elements-card-row-editor .hass="," .elements="," @elements-changed="," @edit-detail-element=","></hui-picture-elements-card-row-editor> "])),this.hass,this._config,y,this._computeLabelCallback,this._formChanged,this.hass,this._config.conditions||[],this._conditionChanged,this.hass,this._config.elements||[],this._elementsChanged,this._editDetailElement):u.s6}},{key:"_formChanged",value:function(e){(0,_.r)(this,"config-changed",{config:e.detail.value})}},{key:"_conditionChanged",value:function(e){if(e.stopPropagation(),this._config){var t=e.detail.value;this._config=(0,a.A)((0,a.A)({},this._config),{},{conditions:t}),(0,_.r)(this,"config-changed",{config:this._config})}}},{key:"_elementsChanged",value:function(e){var t,i;e.stopPropagation();var n=(null===(t=this._config)||void 0===t||null===(t=t.elements)||void 0===t?void 0:t.length)||0,o=(0,a.A)((0,a.A)({},this._config),{},{elements:e.detail.elements});(0,_.r)(this,"config-changed",{config:o});var s=(null===(i=e.detail.elements)||void 0===i?void 0:i.length)||0;if(s===n+1){var l=s-1;this._subElementEditorConfig={index:l,type:"element",elementConfig:(0,a.A)({},e.detail.elements[l])}}}},{key:"_handleSubElementChanged",value:function(e){var t;if(e.stopPropagation(),this._config&&this.hass){var i=null===(t=this._subElementEditorConfig)||void 0===t?void 0:t.type,n=e.detail.config;if("element"===i){var o=this._config.elements.concat();n?o[this._subElementEditorConfig.index]=n:(o.splice(this._subElementEditorConfig.index,1),this._goBack()),this._config=(0,a.A)((0,a.A)({},this._config),{},{elements:o})}this._subElementEditorConfig=(0,a.A)((0,a.A)({},this._subElementEditorConfig),{},{elementConfig:n}),(0,_.r)(this,"config-changed",{config:this._config})}}},{key:"_editDetailElement",value:function(e){this._subElementEditorConfig=e.detail.subElementConfig}},{key:"_goBack",value:function(e){null==e||e.stopPropagation(),this._subElementEditorConfig=void 0}}])}(u.WF);(0,g.Cg)([(0,f.MZ)({attribute:!1})],A.prototype,"hass",void 0),(0,g.Cg)([(0,f.wk)()],A.prototype,"_config",void 0),(0,g.Cg)([(0,f.wk)()],A.prototype,"_subElementEditorConfig",void 0),A=(0,g.Cg)([(0,f.EM)("hui-conditional-element-editor")],A),i.d(t,{HuiConditionalElementEditor:function(){return A}}),n()}catch(w){n(w)}})}}]);
//# sourceMappingURL=83894.17657a2e7c98144a.js.map