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