export const id=9034;export const ids=[9034];export const modules={7905:(e,t,i)=>{i.d(t,{I:()=>a});class n{constructor(e=window.localStorage){this.storage=void 0,this._storage={},this._listeners={},this.storage=e,e===window.localStorage&&window.addEventListener("storage",(e=>{e.key&&this.hasKey(e.key)&&(this._storage[e.key]=e.newValue?JSON.parse(e.newValue):e.newValue,this._listeners[e.key]&&this._listeners[e.key].forEach((t=>t(e.oldValue?JSON.parse(e.oldValue):e.oldValue,this._storage[e.key]))))}))}addFromStorage(e){if(!this._storage[e]){const t=this.storage.getItem(e);t&&(this._storage[e]=JSON.parse(t))}}subscribeChanges(e,t){return this._listeners[e]?this._listeners[e].push(t):this._listeners[e]=[t],()=>{this.unsubscribeChanges(e,t)}}unsubscribeChanges(e,t){if(!(e in this._listeners))return;const i=this._listeners[e].indexOf(t);-1!==i&&this._listeners[e].splice(i,1)}hasKey(e){return e in this._storage}getValue(e){return this._storage[e]}setValue(e,t){const i=this._storage[e];this._storage[e]=t;try{void 0===t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify(t))}catch(n){}finally{this._listeners[e]&&this._listeners[e].forEach((e=>e(i,t)))}}}const s={},a=e=>t=>{const i=e.storage||"localStorage";let a;i&&i in s?a=s[i]:(a=new n(window[i]),s[i]=a);const r=String(t.key),o=e.key||String(t.key),l=t.initializer?t.initializer():void 0;a.addFromStorage(o);const d=!1!==e.subscribe?e=>a.subscribeChanges(o,((i,n)=>{e.requestUpdate(t.key,i)})):void 0,u=()=>a.hasKey(o)?e.deserializer?e.deserializer(a.getValue(o)):a.getValue(o):l;return{kind:"method",placement:"prototype",key:t.key,descriptor:{set(i){((i,n)=>{let s;e.state&&(s=u()),a.setValue(o,e.serializer?e.serializer(n):n),e.state&&i.requestUpdate(t.key,s)})(this,i)},get(){return u()},enumerable:!0,configurable:!0},finisher(i){if(e.state&&e.subscribe){const e=i.prototype.connectedCallback,t=i.prototype.disconnectedCallback;i.prototype.connectedCallback=function(){e.call(this),this[`__unbsubLocalStorage${r}`]=d?.(this)},i.prototype.disconnectedCallback=function(){t.call(this),this[`__unbsubLocalStorage${r}`]?.(),this[`__unbsubLocalStorage${r}`]=void 0}}e.state&&i.createProperty(t.key,{noAccessor:!0,...e.stateOptions})}}}},5067:(e,t,i)=>{var n=i(5461),s=(i(9484),i(8597)),a=i(196),r=i(5081),o=i(3167),l=i(9263),d=i(1330),u=i(8848),c=(i(6442),i(6396),i(9222),i(185),i(6412));const h=()=>i.e(2882).then(i.bind(i,2882));var y=i(1238),m=i(3135);const k="___create-new-entity___";(0,n.A)([(0,a.EM)("ha-entity-picker")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,a.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,a.MZ)({type:Boolean})],key:"autofocus",value(){return!1}},{kind:"field",decorators:[(0,a.MZ)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,a.MZ)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,a.MZ)({type:Boolean,attribute:"allow-custom-entity"})],key:"allowCustomEntity",value:void 0},{kind:"field",decorators:[(0,a.MZ)()],key:"label",value:void 0},{kind:"field",decorators:[(0,a.MZ)()],key:"value",value:void 0},{kind:"field",decorators:[(0,a.MZ)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,a.MZ)({type:Array})],key:"createDomains",value:void 0},{kind:"field",decorators:[(0,a.MZ)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,a.MZ)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,a.MZ)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,a.MZ)({type:Array,attribute:"include-unit-of-measurement"})],key:"includeUnitOfMeasurement",value:void 0},{kind:"field",decorators:[(0,a.MZ)({type:Array,attribute:"include-entities"})],key:"includeEntities",value:void 0},{kind:"field",decorators:[(0,a.MZ)({type:Array,attribute:"exclude-entities"})],key:"excludeEntities",value:void 0},{kind:"field",decorators:[(0,a.MZ)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,a.MZ)({type:Boolean})],key:"hideClearIcon",value(){return!1}},{kind:"field",decorators:[(0,a.MZ)({attribute:"item-label-path"})],key:"itemLabelPath",value(){return"friendly_name"}},{kind:"field",decorators:[(0,a.wk)()],key:"_opened",value(){return!1}},{kind:"field",decorators:[(0,a.P)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"method",key:"open",value:async function(){await this.updateComplete,await(this.comboBox?.open())}},{kind:"method",key:"focus",value:async function(){await this.updateComplete,await(this.comboBox?.focus())}},{kind:"field",key:"_initedStates",value(){return!1}},{kind:"field",key:"_states",value(){return[]}},{kind:"field",key:"_rowRenderer",value(){return e=>s.qy`<ha-list-item graphic="avatar" .twoline=${!!e.entity_id}>
      ${e.state?s.qy`<state-badge
            slot="graphic"
            .stateObj=${e}
            .hass=${this.hass}
          ></state-badge>`:""}
      <span>${e.friendly_name}</span>
      <span slot="secondary"
        >${e.entity_id.startsWith(k)?this.hass.localize("ui.components.entity.entity-picker.new_entity"):e.entity_id}</span
      >
    </ha-list-item>`}},{kind:"field",key:"_getStates",value(){return(0,r.A)(((e,t,i,n,s,a,r,o,u,h)=>{let p=[];if(!t)return[];let _=Object.keys(t.states);const f=h?.length?h.map((e=>{const i=t.localize("ui.components.entity.entity-picker.create_helper",{domain:(0,m.z)(e)?t.localize(`ui.panel.config.helpers.types.${e}`):(0,y.p$)(t.localize,e)});return{entity_id:k+e,state:"on",last_changed:"",last_updated:"",context:{id:"",user_id:null,parent_id:null},friendly_name:i,attributes:{icon:"mdi:plus"},strings:[e,i]}})):[];return _.length?o?(_=_.filter((e=>this.includeEntities.includes(e))),_.map((e=>{const i=(0,d.u)(t.states[e])||e;return{...t.states[e],friendly_name:i,strings:[e,i]}})).sort(((e,t)=>(0,c.S)(e.friendly_name,t.friendly_name,this.hass.locale.language)))):(u&&(_=_.filter((e=>!u.includes(e)))),i&&(_=_.filter((e=>i.includes((0,l.m)(e))))),n&&(_=_.filter((e=>!n.includes((0,l.m)(e))))),p=_.map((e=>{const i=(0,d.u)(t.states[e])||e;return{...t.states[e],friendly_name:i,strings:[e,i]}})).sort(((e,t)=>(0,c.S)(e.friendly_name,t.friendly_name,this.hass.locale.language))),a&&(p=p.filter((e=>e.entity_id===this.value||e.attributes.device_class&&a.includes(e.attributes.device_class)))),r&&(p=p.filter((e=>e.entity_id===this.value||e.attributes.unit_of_measurement&&r.includes(e.attributes.unit_of_measurement)))),s&&(p=p.filter((e=>e.entity_id===this.value||s(e)))),p.length?(f?.length&&p.push(...f),p):[{entity_id:"",state:"",last_changed:"",last_updated:"",context:{id:"",user_id:null,parent_id:null},friendly_name:this.hass.localize("ui.components.entity.entity-picker.no_match"),attributes:{friendly_name:this.hass.localize("ui.components.entity.entity-picker.no_match"),icon:"mdi:magnify"},strings:[]},...f]):[{entity_id:"",state:"",last_changed:"",last_updated:"",context:{id:"",user_id:null,parent_id:null},friendly_name:this.hass.localize("ui.components.entity.entity-picker.no_entities"),attributes:{friendly_name:this.hass.localize("ui.components.entity.entity-picker.no_entities"),icon:"mdi:magnify"},strings:[]},...f]}))}},{kind:"method",key:"shouldUpdate",value:function(e){return!!(e.has("value")||e.has("label")||e.has("disabled"))||!(!e.has("_opened")&&this._opened)}},{kind:"method",key:"willUpdate",value:function(e){(!this._initedStates||e.has("_opened")&&this._opened)&&(this._states=this._getStates(this._opened,this.hass,this.includeDomains,this.excludeDomains,this.entityFilter,this.includeDeviceClasses,this.includeUnitOfMeasurement,this.includeEntities,this.excludeEntities,this.createDomains),this._initedStates&&(this.comboBox.filteredItems=this._states),this._initedStates=!0),e.has("createDomains")&&this.createDomains?.length&&this.hass.loadFragmentTranslation("config")}},{kind:"method",key:"render",value:function(){return s.qy`
      <ha-combo-box
        item-value-path="entity_id"
        .itemLabelPath=${this.itemLabelPath}
        .hass=${this.hass}
        .value=${this._value}
        .label=${void 0===this.label?this.hass.localize("ui.components.entity.entity-picker.entity"):this.label}
        .helper=${this.helper}
        .allowCustomValue=${this.allowCustomEntity}
        .filteredItems=${this._states}
        .renderer=${this._rowRenderer}
        .required=${this.required}
        .disabled=${this.disabled}
        @opened-changed=${this._openedChanged}
        @value-changed=${this._valueChanged}
        @filter-changed=${this._filterChanged}
      >
      </ha-combo-box>
    `}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation();const t=e.detail.value?.trim();if(t&&t.startsWith(k)){const e=t.substring(23);return i=this,n={domain:e,dialogClosedCallback:e=>{e.entityId&&this._setValue(e.entityId)}},void(0,o.r)(i,"show-dialog",{dialogTag:"dialog-helper-detail",dialogImport:h,dialogParams:n})}var i,n;t!==this._value&&this._setValue(t)}},{kind:"method",key:"_filterChanged",value:function(e){const t=e.target,i=e.detail.value.trim().toLowerCase();t.filteredItems=i.length?(0,u.H)(i,this._states):this._states}},{kind:"method",key:"_setValue",value:function(e){this.value=e,setTimeout((()=>{(0,o.r)(this,"value-changed",{value:e}),(0,o.r)(this,"change")}),0)}}]}}),s.WF)},920:(e,t,i)=>{var n=i(5461),s=i(9534),a=(i(7350),i(8597)),r=i(196),o=i(10),l=i(2994);(0,n.A)([(0,r.EM)("ha-button-menu")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",key:l.Xr,value:void 0},{kind:"field",decorators:[(0,r.MZ)()],key:"corner",value(){return"BOTTOM_START"}},{kind:"field",decorators:[(0,r.MZ)()],key:"menuCorner",value(){return"START"}},{kind:"field",decorators:[(0,r.MZ)({type:Number})],key:"x",value(){return null}},{kind:"field",decorators:[(0,r.MZ)({type:Number})],key:"y",value(){return null}},{kind:"field",decorators:[(0,r.MZ)({type:Boolean})],key:"multi",value(){return!1}},{kind:"field",decorators:[(0,r.MZ)({type:Boolean})],key:"activatable",value(){return!1}},{kind:"field",decorators:[(0,r.MZ)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,r.MZ)({type:Boolean})],key:"fixed",value(){return!1}},{kind:"field",decorators:[(0,r.MZ)({type:Boolean,attribute:"no-anchor"})],key:"noAnchor",value(){return!1}},{kind:"field",decorators:[(0,r.P)("mwc-menu",!0)],key:"_menu",value:void 0},{kind:"get",key:"items",value:function(){return this._menu?.items}},{kind:"get",key:"selected",value:function(){return this._menu?.selected}},{kind:"method",key:"focus",value:function(){this._menu?.open?this._menu.focusItemAtIndex(0):this._triggerButton?.focus()}},{kind:"method",key:"render",value:function(){return a.qy`
      <div @click=${this._handleClick}>
        <slot name="trigger" @slotchange=${this._setTriggerAria}></slot>
      </div>
      <mwc-menu
        .corner=${this.corner}
        .menuCorner=${this.menuCorner}
        .fixed=${this.fixed}
        .multi=${this.multi}
        .activatable=${this.activatable}
        .y=${this.y}
        .x=${this.x}
      >
        <slot></slot>
      </mwc-menu>
    `}},{kind:"method",key:"firstUpdated",value:function(e){(0,s.A)(i,"firstUpdated",this,3)([e]),"rtl"===o.G.document.dir&&this.updateComplete.then((()=>{this.querySelectorAll("mwc-list-item").forEach((e=>{const t=document.createElement("style");t.innerHTML="span.material-icons:first-of-type { margin-left: var(--mdc-list-item-graphic-margin, 32px) !important; margin-right: 0px !important;}",e.shadowRoot.appendChild(t)}))}))}},{kind:"method",key:"_handleClick",value:function(){this.disabled||(this._menu.anchor=this.noAnchor?null:this,this._menu.show())}},{kind:"get",key:"_triggerButton",value:function(){return this.querySelector('ha-icon-button[slot="trigger"], mwc-button[slot="trigger"]')}},{kind:"method",key:"_setTriggerAria",value:function(){this._triggerButton&&(this._triggerButton.ariaHasPopup="menu")}},{kind:"get",static:!0,key:"styles",value:function(){return a.AH`
      :host {
        display: inline-block;
        position: relative;
      }
      ::slotted([disabled]) {
        color: var(--disabled-text-color);
      }
    `}}]}}),a.WF)},1238:(e,t,i)=>{i.d(t,{QC:()=>a,fK:()=>s,p$:()=>n});const n=(e,t,i)=>e(`component.${t}.title`)||i?.name||t,s=(e,t)=>{const i={type:"manifest/list"};return t&&(i.integrations=t),e.callWS(i)},a=(e,t)=>e.callWS({type:"manifest/get",integration:t})}};
//# sourceMappingURL=fTDKVxoO.js.map