"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["40731"],{13654:function(e,t,a){a.a(e,async function(e,s){try{a.r(t),a.d(t,{HuiAlarmPanelCardEditor:function(){return A}});a(74423),a(18111),a(22489),a(61701),a(62953);var i=a(40445),n=a(96196),l=a(77845),o=a(22786),c=a(63533),r=a(1087),h=a(82286),u=a(52763),d=a(9182),m=a(84329),p=a(84698),_=a(44155),f=e([u,m]);[u,m]=f.then?(await f)():f;let v,g=e=>e;const y=(0,c.kp)(p.H,(0,c.Ik)({entity:(0,c.lq)((0,c.Yj)()),name:(0,c.lq)(_.q),states:(0,c.lq)((0,c.YO)()),theme:(0,c.lq)((0,c.Yj)())})),b=Object.keys(m.ALARM_MODE_STATE_MAP);class A extends n.WF{setConfig(e){(0,c.vA)(e,y),this._config=e}render(){if(!this.hass||!this._config)return n.s6;const e=this.hass.states[this._config.entity],t=(0,m.filterSupportedAlarmStates)(e,m.DEFAULT_STATES),a=Object.assign({states:t},this._config);return(0,n.qy)(v||(v=g` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" @value-changed="${0}"></ha-form> `),this.hass,a,this._schema(this.hass.localize,e,a.states),this._computeLabelCallback,this._valueChanged)}_valueChanged(e){var t;const a=e.detail.value;if(a.states){const e=b.filter(e=>a.states.includes(e));a.states=e}if(a.states&&a.entity!==(null===(t=this._config)||void 0===t?void 0:t.entity)){var s;const e=null===(s=this.hass)||void 0===s?void 0:s.states[a.entity];e&&(a.states=(0,m.filterSupportedAlarmStates)(e,a.states))}(0,r.r)(this,"config-changed",{config:a})}constructor(...e){super(...e),this._schema=(0,o.A)((e,t,a)=>[{name:"entity",required:!0,selector:{entity:{domain:"alarm_control_panel"}}},{name:"name",selector:{entity_name:{}},context:{entity:"entity"}},{name:"theme",selector:{theme:{}}},{name:"states",selector:{select:{multiple:!0,mode:"list",options:b.map(s=>({value:s,label:e(`ui.card.alarm_control_panel.${s}`),disabled:!(a.includes(s)||t&&(0,h.$)(t,d.t[m.ALARM_MODE_STATE_MAP[s]].feature||0))}))}}}]),this._computeLabelCallback=e=>{switch(e.name){case"entity":return this.hass.localize("ui.panel.lovelace.editor.card.generic.entity");case"name":return this.hass.localize("ui.panel.lovelace.editor.card.generic.name");case"theme":return`${this.hass.localize("ui.panel.lovelace.editor.card.generic.theme")} (${this.hass.localize("ui.panel.lovelace.editor.card.config.optional")})`;default:return this.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states")}}}}(0,i.Cg)([(0,l.MZ)({attribute:!1})],A.prototype,"hass",void 0),(0,i.Cg)([(0,l.wk)()],A.prototype,"_config",void 0),A=(0,i.Cg)([(0,l.EM)("hui-alarm-panel-card-editor")],A),s()}catch(v){s(v)}})},84698:function(e,t,a){a.d(t,{H:function(){return i}});var s=a(63533);const i=(0,s.Ik)({type:(0,s.Yj)(),view_layout:(0,s.bz)(),layout_options:(0,s.bz)(),grid_options:(0,s.bz)(),visibility:(0,s.bz)(),disabled:(0,s.lq)((0,s.zM)())})}}]);
//# sourceMappingURL=40731.501689ed327d1150.js.map