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