"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["40731"],{13654:function(e,t,a){a.a(e,async function(e,n){try{a.r(t),a.d(t,{HuiAlarmPanelCardEditor:function(){return C}});var i,s=a(72153),l=a(44734),r=a(43080),o=a(69683),c=a(6454),u=(a(28706),a(2008),a(74423),a(62062),a(18111),a(22489),a(61701),a(69085),a(79432),a(26099),a(21699),a(40445)),h=a(96196),d=a(77845),f=a(22786),m=a(63533),v=a(1087),_=a(82286),p=(a(52763),a(9182)),y=a(84329),g=a(84698),A=a(44155),b=e([y]);y=(b.then?(await b)():b)[0];var k=(0,m.kp)(g.H,(0,m.Ik)({entity:(0,m.lq)((0,m.Yj)()),name:(0,m.lq)(A.q),states:(0,m.lq)((0,m.YO)()),theme:(0,m.lq)((0,m.Yj)())})),z=Object.keys(y.ALARM_MODE_STATE_MAP),C=function(e){function t(){var e;(0,l.A)(this,t);for(var a=arguments.length,n=new Array(a),i=0;i<a;i++)n[i]=arguments[i];return(e=(0,o.A)(this,t,[].concat(n)))._schema=(0,f.A)(function(e,t,a){return[{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:z.map(function(n){return{value:n,label:e("ui.card.alarm_control_panel.".concat(n)),disabled:!(a.includes(n)||t&&(0,_.$)(t,p.t[y.ALARM_MODE_STATE_MAP[n]].feature||0))}})}}}]}),e._computeLabelCallback=function(t){switch(t.name){case"entity":return e.hass.localize("ui.panel.lovelace.editor.card.generic.entity");case"name":return e.hass.localize("ui.panel.lovelace.editor.card.generic.name");case"theme":return"".concat(e.hass.localize("ui.panel.lovelace.editor.card.generic.theme")," (").concat(e.hass.localize("ui.panel.lovelace.editor.card.config.optional"),")");default:return e.hass.localize("ui.panel.lovelace.editor.card.alarm-panel.available_states")}},e}return(0,c.A)(t,e),(0,r.A)(t,[{key:"setConfig",value:function(e){(0,m.vA)(e,k),this._config=e}},{key:"render",value:function(){if(!this.hass||!this._config)return h.s6;var e=this.hass.states[this._config.entity],t=(0,y.filterSupportedAlarmStates)(e,y.DEFAULT_STATES),a=Object.assign({states:t},this._config);return(0,h.qy)(i||(i=(0,s.A)([' <ha-form .hass="','" .data="','" .schema="','" .computeLabel="','" @value-changed="','"></ha-form> '])),this.hass,a,this._schema(this.hass.localize,e,a.states),this._computeLabelCallback,this._valueChanged)}},{key:"_valueChanged",value:function(e){var t,a=e.detail.value;if(a.states){var n=z.filter(function(e){return a.states.includes(e)});a.states=n}if(a.states&&a.entity!==(null===(t=this._config)||void 0===t?void 0:t.entity)){var i,s=null===(i=this.hass)||void 0===i?void 0:i.states[a.entity];s&&(a.states=(0,y.filterSupportedAlarmStates)(s,a.states))}(0,v.r)(this,"config-changed",{config:a})}}])}(h.WF);(0,u.Cg)([(0,d.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,u.Cg)([(0,d.wk)()],C.prototype,"_config",void 0),C=(0,u.Cg)([(0,d.EM)("hui-alarm-panel-card-editor")],C),n()}catch(M){n(M)}})},84698:function(e,t,a){a.d(t,{H:function(){return i}});var n=a(63533),i=(0,n.Ik)({type:(0,n.Yj)(),view_layout:(0,n.bz)(),layout_options:(0,n.bz)(),grid_options:(0,n.bz)(),visibility:(0,n.bz)(),disabled:(0,n.lq)((0,n.zM)())})}}]);
//# sourceMappingURL=40731.4e16daeb9b5ad0f0.js.map