"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["97504"],{26691:function(e,t,o){o.a(e,async function(e,s){try{o.r(t),o.d(t,{HuiWaterHeaterOperationModesCardFeatureEditor:function(){return v}});var i=o(20054),a=(o(26910),o(18111),o(61701),o(62953),o(40445)),n=o(96196),r=o(77845),c=o(22786),l=o(1087),d=o(52763),h=o(62091),u=e([d]);d=(u.then?(await u)():u)[0];const m=["customize_modes"];let p,_=e=>e;class v extends n.WF{setConfig(e){this._config=e}render(){var e,t;if(!this.hass||!this._config)return n.s6;const o=null!==(e=this.context)&&void 0!==e&&e.entity_id?this.hass.states[null===(t=this.context)||void 0===t?void 0:t.entity_id]:void 0,s=Object.assign(Object.assign({style:"icons"},this._config),{},{customize_modes:void 0!==this._config.operation_modes}),i=this._schema(this.hass.localize,this.hass.formatEntityState,o,s.customize_modes);return(0,n.qy)(p||(p=_` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> `),this.hass,s,i,this._computeLabelCallback,this._valueChanged)}_valueChanged(e){var t,o;const s=e.detail.value,{customize_modes:a}=s,n=(0,i.A)(s,m),r=null!==(t=this.context)&&void 0!==t&&t.entity_id?this.hass.states[null===(o=this.context)||void 0===o?void 0:o.entity_id]:void 0;a&&!n.operation_modes&&(n.operation_modes=((null==r?void 0:r.attributes.operation_list)||[]).concat().sort(h.im)),!a&&n.operation_modes&&delete n.operation_modes,(0,l.r)(this,"config-changed",{config:n})}constructor(...e){super(...e),this._schema=(0,c.A)((e,t,o,s)=>[{name:"style",selector:{select:{multiple:!1,mode:"list",options:["dropdown","icons"].map(t=>({value:t,label:e(`ui.panel.lovelace.editor.features.types.water-heater-operation-modes.style_list.${t}`)}))}}},{name:"customize_modes",selector:{boolean:{}}},...s?[{name:"operation_modes",selector:{select:{reorder:!0,multiple:!0,options:((null==o?void 0:o.attributes.operation_list)||[]).concat().sort(h.im).map(e=>({value:e,label:o?t(o,e):e}))}}}]:[]]),this._computeLabelCallback=e=>{switch(e.name){case"operation_modes":case"style":case"customize_modes":return this.hass.localize(`ui.panel.lovelace.editor.features.types.water-heater-operation-modes.${e.name}`);default:return""}}}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"context",void 0),(0,a.Cg)([(0,r.wk)()],v.prototype,"_config",void 0),v=(0,a.Cg)([(0,r.EM)("hui-water-heater-operation-modes-card-feature-editor")],v),s()}catch(m){s(m)}})}}]);
//# sourceMappingURL=97504.acfaec5021b718f8.js.map