UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

18 lines 117 kB
export const __rspack_esm_id=50982;export const __rspack_esm_ids=[50982];export const __webpack_modules__={17451(e,t,i){i.d(t,{j:()=>a});const a=(e,t,i)=>(void 0!==i&&(i=!!i),e.hasAttribute(t)?!!i||(e.removeAttribute(t),!1):!1!==i&&(e.setAttribute(t,""),!0))},96986(e,t,i){i.d(t,{LR:()=>o,m9:()=>r});const a={10:"mdi:battery-10",20:"mdi:battery-20",30:"mdi:battery-30",40:"mdi:battery-40",50:"mdi:battery-50",60:"mdi:battery-60",70:"mdi:battery-70",80:"mdi:battery-80",90:"mdi:battery-90",100:"mdi:battery"},s={10:"M16,18H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",20:"M16,17H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",30:"M16,15H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",40:"M16,14H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",50:"M16,13H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",60:"M16,12H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",70:"M16,10H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",80:"M16,9H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",90:"M16,8H8V6H16M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z",100:"M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.67C6,21.4 6.6,22 7.33,22H16.67A1.33,1.33 0 0,0 18,20.67V5.33C18,4.6 17.4,4 16.67,4Z"},n={10:"mdi:battery-charging-10",20:"mdi:battery-charging-20",30:"mdi:battery-charging-30",40:"mdi:battery-charging-40",50:"mdi:battery-charging-50",60:"mdi:battery-charging-60",70:"mdi:battery-charging-70",80:"mdi:battery-charging-80",90:"mdi:battery-charging-90",100:"mdi:battery-charging"},o=(e,t)=>{const i=Number(e);if(isNaN(i))return"off"===e?"mdi:battery":"on"===e?"mdi:battery-alert":"mdi:battery-unknown";const s=10*Math.round(i/10);return t&&i>=10?n[s]:t?"mdi:battery-charging-outline":i<=5?"mdi:battery-alert-variant-outline":a[s]},r=e=>{const t=Number(e);if(isNaN(t))return"M15.07,12.25L14.17,13.17C13.63,13.71 13.25,14.18 13.09,15H11.05C11.16,14.1 11.56,13.28 12.17,12.67L13.41,11.41C13.78,11.05 14,10.55 14,10C14,8.89 13.1,8 12,8A2,2 0 0,0 10,10H8A4,4 0 0,1 12,6A4,4 0 0,1 16,10C16,10.88 15.64,11.68 15.07,12.25M13,19H11V17H13M16.67,4H15V2H9V4H7.33A1.33,1.33 0 0,0 6,5.33V20.66C6,21.4 6.6,22 7.33,22H16.67C17.4,22 18,21.4 18,20.66V5.33C18,4.59 17.4,4 16.67,4Z";if(t<=5)return"M14 20H6V6H14M14.67 4H13V2H7V4H5.33C4.6 4 4 4.6 4 5.33V20.67C4 21.4 4.6 22 5.33 22H14.67C15.4 22 16 21.4 16 20.67V5.33C16 4.6 15.4 4 14.67 4M21 7H19V13H21V8M21 15H19V17H21V15Z";const i=10*Math.round(t/10);return s[i]}},76774(e,t,i){i.d(t,{q:()=>a});const a=(e,t)=>{const i=e.area_id;return i?t[i]:void 0}},31290(e,t,i){i.d(t,{n:()=>a});const a=e=>e.replace(/^_*(.)|_+(.)/g,(e,t,i)=>t?t.toUpperCase():" "+i.toUpperCase())},22533(e,t,i){i.d(t,{i:()=>s});var a=i(52943);const s=(e,t)=>(e=>{switch(e){case"de":case"lb":return!0;default:return!1}})(t)?(0,a.Z)(e):e.toLocaleLowerCase(t)},72945(e,t,i){var a=i(62826),s=i(5124),n=i(22441),o=i(96986);i(47680);class r extends s.WF{render(){return this.batteryStateObj?s.qy` <ha-icon .icon="${(0,o.LR)(this.batteryStateObj.state,"on"===this.batteryChargingStateObj?.state)}"></ha-icon> `:s.s6}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],r.prototype,"batteryStateObj",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],r.prototype,"batteryChargingStateObj",void 0),r=(0,a.Cg)([(0,n.EM)("ha-battery-icon")],r)},76776(e,t,i){var a=i(62826),s=i(5124),n=i(22441);class o extends s.WF{render(){return s.qy` ${this.header?s.qy`<h1 class="card-header">${this.header}</h1>`:s.s6} <slot></slot> `}constructor(...e){super(...e),this.raised=!1}}o.styles=s.AH`:host{background:var(--ha-card-background,var(--card-background-color,#fff));-webkit-backdrop-filter:var(--ha-card-backdrop-filter,none);backdrop-filter:var(--ha-card-backdrop-filter,none);box-shadow:var(--ha-card-box-shadow,none);box-sizing:border-box;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border-width:var(--ha-card-border-width,1px);border-style:solid;border-color:var(--ha-card-border-color,var(--divider-color,#e0e0e0));color:var(--primary-text-color);display:block;transition:all .3s ease-out;position:relative}:host([raised]){border:none;box-shadow:var(--ha-card-box-shadow,0px 2px 1px -1px rgba(0,0,0,.2),0px 1px 1px 0px rgba(0,0,0,.14),0px 1px 3px 0px rgba(0,0,0,.12))}.card-header,:host ::slotted(.card-header){color:var(--ha-card-header-color,var(--primary-text-color));font-family:var(--ha-card-header-font-family, inherit);font-size:var(--ha-card-header-font-size, var(--ha-font-size-2xl));letter-spacing:-.012em;line-height:var(--ha-line-height-expanded);padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4);display:block;margin-block-start:0;margin-block-end:0;font-weight:var(--ha-font-weight-normal)}
    :host
      ::slotted(
        .card-content:not(:nth-child(1 of .card-content, .card-header))
      ),
    slot:not(:first-child)::slotted(.card-content) {
      padding-top: 0;
      margin-top: calc(var(--ha-space-2) * -1);
    }
    :host ::slotted(.card-content){padding:var(--ha-space-4)}:host ::slotted(.card-actions){border-top:1px solid var(--divider-color,#e8e8e8);padding:var(--ha-space-2)}`,(0,a.Cg)([(0,n.MZ)()],o.prototype,"header",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],o.prototype,"raised",void 0),o=(0,a.Cg)([(0,n.EM)("ha-card")],o)},43661(e,t,i){i.r(t),i.d(t,{HaIconNext:()=>r});var a=i(62826),s=i(22441),n=i(63091),o=i(67094);class r extends o.HaSvgIcon{constructor(...e){super(...e),this.path="rtl"===n.G.document.dir?"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z":"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}}(0,a.Cg)([(0,s.MZ)()],r.prototype,"path",void 0),r=(0,a.Cg)([(0,s.EM)("ha-icon-next")],r)},93367(e,t,i){i.a(e,async function(e,t){try{var a=i(62826),s=i(35211),n=i(5124),o=i(22441),r=i(91450),l=i(69093),c=i(22792),d=i(85694),h=(i(47680),i(67094),e([d]));d=(h.then?(await h)():h)[0];class u extends n.WF{render(){const e=this.icon||this.stateObj&&this._entities?.[this.stateObj.entity_id]?.icon||this.stateObj?.attributes.icon;if(e)return n.qy`<ha-icon .icon="${e}"></ha-icon>`;if(!this.stateObj)return n.s6;if(!this._config||!this._connection||!this._entities)return this._renderFallback();const t=(0,d.fq)(this._entities,this._config.config,this._connection.connection,this.stateObj,this.stateValue).then(e=>e?n.qy`<ha-icon .icon="${e}"></ha-icon>`:this._renderFallback());return n.qy`${(0,r.T)(t)}`}_renderFallback(){const e=(0,l.t)(this.stateObj);return n.qy` <ha-svg-icon .path="${d.l[e]||d.lW}"></ha-svg-icon> `}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],u.prototype,"stateObj",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],u.prototype,"stateValue",void 0),(0,a.Cg)([(0,o.MZ)()],u.prototype,"icon",void 0),(0,a.Cg)([(0,o.wk)(),(0,s.Fg)({context:c.WF,subscribe:!0})],u.prototype,"_config",void 0),(0,a.Cg)([(0,o.wk)(),(0,s.Fg)({context:c.Wq,subscribe:!0})],u.prototype,"_connection",void 0),(0,a.Cg)([(0,o.wk)(),(0,s.Fg)({context:c.X1,subscribe:!0})],u.prototype,"_entities",void 0),u=(0,a.Cg)([(0,o.EM)("ha-state-icon")],u),t()}catch(e){t(e)}})},59646(e,t,i){i.a(e,async function(e,t){try{var a=i(62826),s=i(29344),n=i(5124),o=i(22441),r=i(88360),l=e([s]);s=(l.then?(await l)():l)[0];class c extends s.A{updated(e){super.updated(e),e.has("haptic")&&(this.haptic?this.addEventListener("change",this._forwardHaptic):this.removeEventListener("change",this._forwardHaptic))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",this._forwardHaptic)}static get styles(){return[s.A.styles,n.AH`:host{--wa-form-control-toggle-size:var(--ha-switch-size, 24px);--wa-form-control-required-content:var(
            --ha-switch-required-marker,
            var(--ha-input-required-marker, "*")
          );--wa-form-control-required-content-offset:var(
            --ha-switch-required-marker-offset,
            0.1rem
          );--thumb-size:var(--ha-switch-thumb-size, 18px);--width:var(--ha-switch-width, 48px)}label{position:relative;height:max(var(--thumb-size),var(--wa-form-control-toggle-size))}label::before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;min-width:var(--ha-switch-min-touch-size,40px);min-height:var(--ha-switch-min-touch-size,40px)}label.disabled::before{pointer-events:none}.switch{background-color:var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-resting));border-color:var(--ha-switch-border-color,var(--ha-color-border-neutral-normal))}label:not(.disabled) .input:focus-visible~.switch,label:not(.disabled):hover .switch{background-color:var(--ha-switch-background-color-hover,var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-hover)))}.checked .switch{background-color:var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-resting));border-color:var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud))}label:not(.disabled).checked .input:focus-visible~.switch,label:not(.disabled).checked:hover .switch{background-color:var(--ha-switch-checked-background-color-hover,var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-hover)));border-color:var(--ha-switch-checked-border-color-hover,var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud)))}.switch .thumb{background-color:var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal));border-color:var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal));border-style:var(--wa-form-control-border-style);border-width:var(--wa-form-control-border-width);box-shadow:var(--ha-switch-thumb-box-shadow,var(--ha-box-shadow-s))}label:not(.disabled) .input:focus-visible~.switch .thumb,label:not(.disabled):hover .switch .thumb{background-color:var(--ha-switch-thumb-background-color-hover,var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal)));border-color:var(--ha-switch-thumb-border-color-hover,var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal)))}.checked .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal));border-color:var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal))}label:not(.disabled).checked .input:focus-visible~.switch .thumb,label:not(.disabled).checked:hover .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color-hover,var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal)));border-color:var(--ha-switch-checked-thumb-border-color-hover,var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal)))}label.disabled{opacity:var(--ha-switch-disabled-opacity, .3);cursor:not-allowed}label:not(.disabled) .input:focus-visible~.switch .thumb{outline:0;outline-offset:none}label:not(.disabled) .input:focus-visible~.switch{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}:host(:empty) slot.label{display:none}`]}constructor(...e){super(...e),this.haptic=!1,this._forwardHaptic=()=>{(0,r.j)(this,"light")}}}(0,a.Cg)([(0,o.MZ)({type:Boolean})],c.prototype,"haptic",void 0),c=(0,a.Cg)([(0,o.EM)("ha-switch")],c),t()}catch(e){t(e)}})},1671(e,t,i){var a=i(62826),s=i(5124),n=i(22441),o=i(63672),r=(i(54276),i(28170));class l extends r.o{activate(){this._item?.click()}_renderBase(e){return void 0!==this.href?s.qy`<a part="base" class="base interactive" id="item" href="${(0,o.J)(this.disabled?void 0:this.href)}" target="${(0,o.J)(this.target)}" rel="${(0,o.J)(this.rel)}" download="${(0,o.J)(this.download)}" tabindex="-1" aria-disabled="${this.disabled?"true":"false"}"> ${this._renderRipple()}${e} </a>`:s.qy`<button part="base" class="base interactive" id="item" type="button" ?disabled="${this.disabled}" tabindex="-1"> ${this._renderRipple()}${e} </button>`}_renderRipple(){return s.qy`<ha-ripple part="ripple" for="item" ?disabled="${this.disabled}"></ha-ripple>`}constructor(...e){super(...e),this.interactive=!0}}l.styles=[r.o.styles,s.AH`:host{cursor:pointer;--ha-ripple-color:var(--primary-text-color)}:host([disabled]){cursor:default}.base.interactive{width:100%;border:none;background:0 0;color:inherit;font:inherit;text-align:inherit;text-decoration:none;appearance:none;cursor:inherit}:host([disabled]) .base.interactive{color:var(--disabled-text-color)}`],(0,a.Cg)([(0,n.MZ)({type:String})],l.prototype,"href",void 0),(0,a.Cg)([(0,n.MZ)({type:String})],l.prototype,"target",void 0),(0,a.Cg)([(0,n.MZ)({type:String})],l.prototype,"rel",void 0),(0,a.Cg)([(0,n.MZ)({type:String})],l.prototype,"download",void 0),(0,a.Cg)([(0,n.P)("#item")],l.prototype,"_item",void 0),l=(0,a.Cg)([(0,n.EM)("ha-list-item-button")],l)},47819(e,t,i){var a=i(62826),s=i(5124),n=i(22441),o=i(63672),r=i(50723);class l extends r.N{render(){return s.qy`<nav part="nav" aria-label="${(0,o.J)(this.ariaLabel??void 0)}"> <div part="base" class="base" role="list"> <slot></slot> </div> </nav>`}constructor(...e){super(...e),this.hostRole="",this.ariaLabel=null}}(0,a.Cg)([(0,n.MZ)({type:String,attribute:"aria-label",reflect:!1})],l.prototype,"ariaLabel",void 0),l=(0,a.Cg)([(0,n.EM)("ha-list-nav")],l)},62351(e,t,i){i.d(t,{KC:()=>d,Vy:()=>l,ds:()=>n,ew:()=>r,g5:()=>c,tl:()=>o});var a=i(82286),s=i(22675);const n=(e,t,i)=>e.connection.subscribeMessage(i,{type:"assist_satellite/intercept_wake_word",entity_id:t}),o=(e,t)=>e.callWS({type:"assist_satellite/test_connection",entity_id:t}),r=(e,t,i)=>e.callService("assist_satellite","announce",i,{entity_id:t}),l=(e,t)=>e.callWS({type:"assist_satellite/get_configuration",entity_id:t}),c=(e,t,i)=>e.callWS({type:"assist_satellite/set_wake_words",entity_id:t,wake_word_ids:i}),d=e=>e&&e.state!==s.Hh&&(0,a.$)(e,1)},10897(e,t,i){i.d(t,{C4:()=>c,CK:()=>l,FX:()=>_,UC:()=>p,_Z:()=>y,bT:()=>f,j4:()=>m,sd:()=>n,su:()=>r,vc:()=>b,w8:()=>u,wv:()=>h,y3:()=>g,zS:()=>o});var a=i(3931),s=i(82e3);const n=[1,2,3,4,6,8],o="web_rtc",r=(e,t,i)=>`${e}&width=${t}&height=${i}`,l=e=>e.attributes.access_token?`/api/camera_proxy_stream/${e.entity_id}?token=${e.attributes.access_token}`:void 0,c=async(e,t,i,s)=>{const n=await(0,a.U)("_cameraTmbUrl",9e3,d,e,t);return r(n,i,s)},d=async(e,t)=>{const i=await(0,s.e0)(e,`/api/camera_proxy/${t}`);return e.hassUrl(i.path)},h=async(e,t,i)=>{const a={type:"camera/stream",entity_id:t};i&&(a.format=i);const s=await e.callWS(a);return s.url=e.hassUrl(s.url),s},u=(e,t,i,a)=>e.connection.subscribeMessage(a,{type:"camera/webrtc/offer",entity_id:t,offer:i}),p=(e,t,i,a)=>e.callWS({type:"camera/webrtc/candidate",entity_id:t,session_id:i,candidate:a}),g=(e,t)=>e.callWS({type:"camera/get_prefs",entity_id:t}),_=(e,t,i)=>e.callWS({type:"camera/update_prefs",entity_id:t,...i}),v="media-source://camera/",m=e=>e.startsWith(v),b=e=>e.substring(22),y=async(e,t)=>e.callWS({type:"camera/capabilities",entity_id:t}),f=async(e,t)=>e.callWS({type:"camera/webrtc/get_client_config",entity_id:t})},77001(e,t,i){i.d(t,{Dc:()=>s,_H:()=>n,fq:()=>o,iS:()=>a});i(74423),i(18111),i(7588),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);const a=e=>{const t={};return Object.entries(e).forEach(([e,i])=>{t[e]={value:i.value,items:i.items instanceof Set?Array.from(i.items):i.items}}),t},s=e=>{const t={};return Object.entries(e).forEach(([e,i])=>{t[e]={value:i.value,items:Array.isArray(i.items)?new Set(i.items):i.items}}),t},n=(e,t,i)=>e===i&&Array.isArray(t.value)&&t.value.length,o=(e,t,i)=>(e===i||i.includes(e))&&t.items},31422(e,t,i){i.d(t,{_o:()=>h,oG:()=>u,pq:()=>d});i(74423),i(18111),i(81148),i(22489),i(61701),i(13579);var a=i(65522),s=i(37981),n=i(71727),o=i(76774),r=i(15638),l=i(95350),c=i(58594);const d=(e,t,i,n,l,c,d,h)=>{const u=(0,o.q)(e,t),p=e.via_device_id?i[e.via_device_id]:void 0,g=p?(0,s.T)(p,l,n,h):void 0,_=p?(0,o.q)(p,t):void 0,v=_?(0,a.A)(_):void 0,m=(0,r.qC)(c,d.translations);return{areaName:u?(0,a.A)(u):v?`${v}${m?" ◂ ":" ▸ "}${g}`:g||void 0,viaDeviceName:g,viaDeviceAreaName:v}},h=[{name:"search_labels.deviceName",weight:10},{name:"search_labels.areaName",weight:8},{name:"search_labels.domainName",weight:4},{name:"search_labels.domain",weight:4},{name:"search_labels.viaDeviceName",weight:3},{name:"search_labels.viaDeviceArea",weight:3}],u=(e,t,i,a,o,r,h,u,p,g="")=>{const _=Object.values(e.devices),v=Object.values(e.entities);let m={};(i||a||o||h)&&(m=(0,c.g2)(v));let b=_.filter(e=>e.id===p||!e.disabled_by);i&&(b=b.filter(e=>{const t=m[e.id];return!(!t||!t.length)&&m[e.id].some(e=>i.includes((0,n.m)(e.entity_id)))})),a&&(b=b.filter(e=>{const t=m[e.id];return!t||!t.length||v.every(e=>!a.includes((0,n.m)(e.entity_id)))})),u&&(b=b.filter(e=>!u.includes(e.id))),o&&(b=b.filter(t=>{const i=m[t.id];return!(!i||!i.length)&&m[t.id].some(t=>{const i=e.states[t.entity_id];return!!i&&(i.attributes.device_class&&o.includes(i.attributes.device_class))})})),h&&(b=b.filter(t=>{const i=m[t.id];return!(!i||!i.length)&&i.some(t=>{const i=e.states[t.entity_id];return!!i&&h(i)})})),r&&(b=b.filter(e=>e.id===p||r(e)));return b.map(i=>{const a=(0,s.T)(i,e.localize,e.states,m[i.id]),{areaName:n,viaDeviceName:o,viaDeviceAreaName:r}=d(i,e.areas,e.devices,e.states,e.localize,e.language,e.translationMetadata,i.via_device_id?m[i.via_device_id]:void 0),c=i.primary_config_entry?t?.[i.primary_config_entry]:void 0,h=c?.domain,u=h?(0,l.p$)(e.localize,h):void 0,p=a||e.localize("ui.components.device-picker.unnamed_device");return{id:`${g}${i.id}`,label:"",primary:p,secondary:n,domain:c?.domain,domain_name:u,search_labels:{deviceName:a,areaName:n||null,domain:h||null,domainName:u||null,viaDeviceName:o||null,viaDeviceArea:r||null},sorting_label:[p,n,u].filter(Boolean).join("_")}})}},96204(e,t,i){i.d(t,{Dh:()=>a,It:()=>o,WV:()=>n,g9:()=>s});const a=e=>e.callWS({type:"diagnostics/list"}),s=(e,t)=>e.callWS({type:"diagnostics/get",domain:t}),n=e=>`/api/diagnostics/config_entry/${e}`,o=(e,t)=>`/api/diagnostics/config_entry/${e}/device/${t}`},16869(e,t,i){i.d(t,{B:()=>s,g:()=>a});i(74423);const a=window.externalAppV2||window.externalApp||window.webkit?.messageHandlers?.getExternalAuth||location.search.includes("external_auth=1"),s=window.externalApp||window.externalAppV2},86531(e,t,i){i.a(e,async function(e,a){try{i.d(t,{$O:()=>b,a$:()=>w,cj:()=>u,dG:()=>m,gM:()=>v,gd:()=>g,k$:()=>f,rc:()=>$});i(74423);var s=i(46190),n=i(71727),o=i(69093),r=i(22533),l=i(22675),c=i(25064),d=e([c]);c=(d.then?(await d)():d)[0];const h="ui.components.logbook.messages",u=["counter","proximity"],p={triggered_by_numeric_state_of:"numeric state of",triggered_by_state_of:"state of",triggered_by_event:"event",triggered_by_time_pattern:"time pattern",triggered_by_time:"time",triggered_by_homeassistant_stopping:"ioBroker stopping",triggered_by_homeassistant_starting:"ioBroker starting"},g=async(e,t,i)=>_(e,t,void 0,void 0,i),_=(e,t,i,a,s,n)=>{if((a||n)&&(!a||0===a.length)&&(!n||0===n.length))return Promise.resolve([]);const o={type:"logbook/get_events",start_time:t};return i&&(o.end_time=i),a?.length&&(o.entity_ids=a),n?.length&&(o.device_ids=n),s&&(o.context_id=s),e.callWS(o)},v=(e,t,i,a,s,n,o)=>{if((n||o)&&(!n||0===n.length)&&(!o||0===o.length))return Promise.reject("No entities or devices");const r={type:"logbook/event_stream",start_time:i,end_time:a};return n?.length&&(r.entity_ids=n),o?.length&&(r.device_ids=o),e.connection.subscribeMessage(e=>t(e,s),r)},m=(e,t)=>({entity_id:e.entity_id,state:t,attributes:{device_class:e?.attributes.device_class,source_type:e?.attributes.source_type,has_date:e?.attributes.has_date,has_time:e?.attributes.has_time,entity_picture_local:s.oL.has((0,n.m)(e.entity_id))?void 0:e?.attributes.entity_picture_local,entity_picture:s.oL.has((0,n.m)(e.entity_id))?void 0:e?.attributes.entity_picture}}),b=(e,t)=>{for(const i of Object.keys(p)){const a=p[i];if(t.startsWith(a))return t.replace(a,`${e(`ui.components.logbook.${i}`)}`)}return t},y={triggered_by_numeric_state_of:"numeric_state_of",triggered_by_state_of:"state_of",triggered_by_event:"event",triggered_by_time_pattern:"time_pattern",triggered_by_time:"time",triggered_by_homeassistant_stopping:"homeassistant_stopping",triggered_by_homeassistant_starting:"homeassistant_starting"},f=(e,t)=>{for(const i of Object.keys(p)){const a=p[i];if(t.startsWith(a)){const s=y[i];return t.replace(a,`${e(`ui.components.logbook.${s}`)}`)}}return t},w=(e,t,i,a,s)=>{switch(s){case"device_tracker":case"person":return"not_home"===i?t(`${h}.was_away`):"home"===i?t(`${h}.was_at_home`):t(`${h}.was_at_state`,{state:i});case"sun":return t("above_horizon"===i?`${h}.rose`:`${h}.set`);case"binary_sensor":{const s="on"===i,n="off"===i,o=a.attributes.device_class;if(o&&(s||n))return t(`${h}.${s?"detected_device_classes":"cleared_device_classes"}.${o}`,{device_class:(0,r.i)(t(`component.binary_sensor.entity_component.${o}.name`)||o,e.language)})||t(`${h}.${s?"detected_device_class":"cleared_device_class"}`,{device_class:(0,r.i)(t(`component.binary_sensor.entity_component.${o}.name`)||o,e.language)});break}case"cover":switch(i){case"open":return t(`${h}.was_opened`);case"opening":return t(`${h}.is_opening`);case"closing":return t(`${h}.is_closing`);case"closed":return t(`${h}.was_closed`)}break;case"event":return t(`${h}.detected_event_no_type`);case"lock":switch(i){case"unlocked":return t(`${h}.was_unlocked`);case"locking":return t(`${h}.is_locking`);case"unlocking":return t(`${h}.is_unlocking`);case"opening":return t(`${h}.is_opening`);case"open":return t(`${h}.is_opened`);case"locked":return t(`${h}.was_locked`);case"jammed":return t(`${h}.is_jammed`)}}return"on"===i?t(`${h}.turned_on`):"off"===i?t(`${h}.turned_off`):i===l.HV?t(`${h}.became_unknown`):i===l.Hh?t(`${h}.became_unavailable`):e.localize(`${h}.changed_to_state`,{state:a?e.formatEntityState(a,i):i})},$=(e,t=[])=>{const i=(0,o.t)(e);return!(u.includes(i)||"sensor"===i&&(0,c.Fp)(i,e,void 0,t))};a()}catch(e){a(e)}})},45291(e,t,i){i.d(t,{IP:()=>a,Iu:()=>h,J_:()=>n,O9:()=>r,b$:()=>c,bH:()=>o,c8:()=>d,wi:()=>l});i(18111),i(20116);const a="custom:",s=window;"customCards"in s||(s.customCards=[]),"customCardFeatures"in s||(s.customCardFeatures=[]),"customBadges"in s||(s.customBadges=[]),"customTileFeatures"in s||(s.customTileFeatures=[]);const n=s.customCards,o=()=>[...s.customCardFeatures,...s.customTileFeatures],r=s.customBadges,l=e=>n.find(t=>t.type===e),c=e=>r.find(t=>t.type===e),d=e=>e.startsWith(a),h=e=>e.slice(a.length)},53072(e,t,i){i.d(t,{$6:()=>m,EC:()=>_,ET:()=>v,H1:()=>g,HN:()=>w,Im:()=>x,QI:()=>$,Un:()=>y,Xm:()=>f,ce:()=>C,fh:()=>H,ie:()=>A,mm:()=>b,vj:()=>p});i(44114);var a=i(47129),s=i(82286),n=i(22675),o=i(52069);const r="M11,14C12,14 13.05,14.16 14.2,14.44C13.39,15.31 13,16.33 13,17.5C13,18.39 13.25,19.23 13.78,20H3V18C3,16.81 3.91,15.85 5.74,15.12C7.57,14.38 9.33,14 11,14M11,12C9.92,12 9,11.61 8.18,10.83C7.38,10.05 7,9.11 7,8C7,6.92 7.38,6 8.18,5.18C9,4.38 9.92,4 11,4C12.11,4 13.05,4.38 13.83,5.18C14.61,6 15,6.92 15,8C15,9.11 14.61,10.05 13.83,10.83C13.05,11.61 12.11,12 11,12M18.5,10H20L22,10V12H20V17.5A2.5,2.5 0 0,1 17.5,20A2.5,2.5 0 0,1 15,17.5A2.5,2.5 0 0,1 17.5,15C17.86,15 18.19,15.07 18.5,15.21V10Z",l="M14,19H18V5H14M6,19H10V5H6V19Z",c="M8,5.14V19.14L19,12.14L8,5.14Z",d="M13,3H11V13H13V3M17.83,5.17L16.41,6.59C18.05,7.91 19,9.9 19,12A7,7 0 0,1 12,19C8.14,19 5,15.88 5,12C5,9.91 5.95,7.91 7.58,6.58L6.17,5.17C2.38,8.39 1.92,14.07 5.14,17.86C8.36,21.64 14.04,22.1 17.83,18.88C19.85,17.17 21,14.65 21,12C21,9.37 19.84,6.87 17.83,5.17Z",h="M18,18H6V6H18V18Z",u="M8.16,3L6.75,4.41L9.34,7H4C2.89,7 2,7.89 2,9V19C2,20.11 2.89,21 4,21H20C21.11,21 22,20.11 22,19V9C22,7.89 21.11,7 20,7H14.66L17.25,4.41L15.84,3L12,6.84L8.16,3M4,9H17V19H4V9M19.5,9A1,1 0 0,1 20.5,10A1,1 0 0,1 19.5,11A1,1 0 0,1 18.5,10A1,1 0 0,1 19.5,9M19.5,12A1,1 0 0,1 20.5,13A1,1 0 0,1 19.5,14A1,1 0 0,1 18.5,13A1,1 0 0,1 19.5,12Z";var p=function(e){return e[e.PAUSE=1]="PAUSE",e[e.SEEK=2]="SEEK",e[e.VOLUME_SET=4]="VOLUME_SET",e[e.VOLUME_MUTE=8]="VOLUME_MUTE",e[e.PREVIOUS_TRACK=16]="PREVIOUS_TRACK",e[e.NEXT_TRACK=32]="NEXT_TRACK",e[e.TURN_ON=128]="TURN_ON",e[e.TURN_OFF=256]="TURN_OFF",e[e.PLAY_MEDIA=512]="PLAY_MEDIA",e[e.VOLUME_STEP=1024]="VOLUME_STEP",e[e.SELECT_SOURCE=2048]="SELECT_SOURCE",e[e.STOP=4096]="STOP",e[e.CLEAR_PLAYLIST=8192]="CLEAR_PLAYLIST",e[e.PLAY=16384]="PLAY",e[e.SHUFFLE_SET=32768]="SHUFFLE_SET",e[e.SELECT_SOUND_MODE=65536]="SELECT_SOUND_MODE",e[e.BROWSE_MEDIA=131072]="BROWSE_MEDIA",e[e.REPEAT_SET=262144]="REPEAT_SET",e[e.GROUPING=524288]="GROUPING",e}({});const g="browser",_={album:{icon:"M12,11A1,1 0 0,0 11,12A1,1 0 0,0 12,13A1,1 0 0,0 13,12A1,1 0 0,0 12,11M12,16.5C9.5,16.5 7.5,14.5 7.5,12C7.5,9.5 9.5,7.5 12,7.5C14.5,7.5 16.5,9.5 16.5,12C16.5,14.5 14.5,16.5 12,16.5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",layout:"grid"},app:{icon:"M21 2H3C1.9 2 1 2.9 1 4V20C1 21.1 1.9 22 3 22H21C22.1 22 23 21.1 23 20V4C23 2.9 22.1 2 21 2M21 7H3V4H21V7Z",layout:"grid",show_list_images:!0},artist:{icon:r,layout:"grid",show_list_images:!0},channel:{icon:u,thumbnail_ratio:"portrait",layout:"grid",show_list_images:!0},composer:{icon:"M11,4A4,4 0 0,1 15,8A4,4 0 0,1 11,12A4,4 0 0,1 7,8A4,4 0 0,1 11,4M11,6A2,2 0 0,0 9,8A2,2 0 0,0 11,10A2,2 0 0,0 13,8A2,2 0 0,0 11,6M11,13C12.1,13 13.66,13.23 15.11,13.69C14.5,14.07 14,14.6 13.61,15.23C12.79,15.03 11.89,14.9 11,14.9C8.03,14.9 4.9,16.36 4.9,17V18.1H13.04C13.13,18.8 13.38,19.44 13.76,20H3V17C3,14.34 8.33,13 11,13M18.5,10H20L22,10V12H20V17.5A2.5,2.5 0 0,1 17.5,20A2.5,2.5 0 0,1 15,17.5A2.5,2.5 0 0,1 17.5,15C17.86,15 18.19,15.07 18.5,15.21V10Z",layout:"grid",show_list_images:!0},contributing_artist:{icon:r,layout:"grid",show_list_images:!0},directory:{icon:"M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",layout:"grid",show_list_images:!0},episode:{icon:u,layout:"grid",thumbnail_ratio:"portrait",show_list_images:!0},game:{icon:"M7,6H17A6,6 0 0,1 23,12A6,6 0 0,1 17,18C15.22,18 13.63,17.23 12.53,16H11.47C10.37,17.23 8.78,18 7,18A6,6 0 0,1 1,12A6,6 0 0,1 7,6M6,9V11H4V13H6V15H8V13H10V11H8V9H6M15.5,12A1.5,1.5 0 0,0 14,13.5A1.5,1.5 0 0,0 15.5,15A1.5,1.5 0 0,0 17,13.5A1.5,1.5 0 0,0 15.5,12M18.5,9A1.5,1.5 0 0,0 17,10.5A1.5,1.5 0 0,0 18.5,12A1.5,1.5 0 0,0 20,10.5A1.5,1.5 0 0,0 18.5,9Z",layout:"grid",thumbnail_ratio:"portrait"},genre:{icon:"M8.11,19.45C5.94,18.65 4.22,16.78 3.71,14.35L2.05,6.54C1.81,5.46 2.5,4.4 3.58,4.17L13.35,2.1L13.38,2.09C14.45,1.88 15.5,2.57 15.72,3.63L16.07,5.3L20.42,6.23H20.45C21.5,6.47 22.18,7.53 21.96,8.59L20.3,16.41C19.5,20.18 15.78,22.6 12,21.79C10.42,21.46 9.08,20.61 8.11,19.45V19.45M20,8.18L10.23,6.1L8.57,13.92V13.95C8,16.63 9.73,19.27 12.42,19.84C15.11,20.41 17.77,18.69 18.34,16L20,8.18M16,16.5C15.37,17.57 14.11,18.16 12.83,17.89C11.56,17.62 10.65,16.57 10.5,15.34L16,16.5M8.47,5.17L4,6.13L5.66,13.94L5.67,13.97C5.82,14.68 6.12,15.32 6.53,15.87C6.43,15.1 6.45,14.3 6.62,13.5L7.05,11.5C6.6,11.42 6.21,11.17 6,10.81C6.06,10.2 6.56,9.66 7.25,9.5C7.33,9.5 7.4,9.5 7.5,9.5L8.28,5.69C8.32,5.5 8.38,5.33 8.47,5.17M15.03,12.23C15.35,11.7 16.03,11.42 16.72,11.57C17.41,11.71 17.91,12.24 18,12.86C17.67,13.38 17,13.66 16.3,13.5C15.61,13.37 15.11,12.84 15.03,12.23M10.15,11.19C10.47,10.66 11.14,10.38 11.83,10.53C12.5,10.67 13.03,11.21 13.11,11.82C12.78,12.34 12.11,12.63 11.42,12.5C10.73,12.33 10.23,11.8 10.15,11.19M11.97,4.43L13.93,4.85L13.77,4.05L11.97,4.43Z",layout:"grid",show_list_images:!0},image:{icon:"M8.5,13.5L11,16.5L14.5,12L19,18H5M21,19V5C21,3.89 20.1,3 19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19Z",layout:"grid",show_list_images:!0},movie:{icon:"M18,4L20,8H17L15,4H13L15,8H12L10,4H8L10,8H7L5,4H4A2,2 0 0,0 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V4H18Z",thumbnail_ratio:"portrait",layout:"grid",show_list_images:!0},music:{icon:"M21,3V15.5A3.5,3.5 0 0,1 17.5,19A3.5,3.5 0 0,1 14,15.5A3.5,3.5 0 0,1 17.5,12C18.04,12 18.55,12.12 19,12.34V6.47L9,8.6V17.5A3.5,3.5 0 0,1 5.5,21A3.5,3.5 0 0,1 2,17.5A3.5,3.5 0 0,1 5.5,14C6.04,14 6.55,14.12 7,14.34V6L21,3Z",show_list_images:!0},playlist:{icon:"M15,6H3V8H15V6M15,10H3V12H15V10M3,16H11V14H3V16M17,6V14.18C16.69,14.07 16.35,14 16,14A3,3 0 0,0 13,17A3,3 0 0,0 16,20A3,3 0 0,0 19,17V8H22V6H17Z",layout:"grid",show_list_images:!0},podcast:{icon:"M17,18.25V21.5H7V18.25C7,16.87 9.24,15.75 12,15.75C14.76,15.75 17,16.87 17,18.25M12,5.5A6.5,6.5 0 0,1 18.5,12C18.5,13.25 18.15,14.42 17.54,15.41L16,14.04C16.32,13.43 16.5,12.73 16.5,12C16.5,9.5 14.5,7.5 12,7.5C9.5,7.5 7.5,9.5 7.5,12C7.5,12.73 7.68,13.43 8,14.04L6.46,15.41C5.85,14.42 5.5,13.25 5.5,12A6.5,6.5 0 0,1 12,5.5M12,1.5A10.5,10.5 0 0,1 22.5,12C22.5,14.28 21.77,16.39 20.54,18.11L19.04,16.76C19.96,15.4 20.5,13.76 20.5,12A8.5,8.5 0 0,0 12,3.5A8.5,8.5 0 0,0 3.5,12C3.5,13.76 4.04,15.4 4.96,16.76L3.46,18.11C2.23,16.39 1.5,14.28 1.5,12A10.5,10.5 0 0,1 12,1.5M12,9.5A2.5,2.5 0 0,1 14.5,12A2.5,2.5 0 0,1 12,14.5A2.5,2.5 0 0,1 9.5,12A2.5,2.5 0 0,1 12,9.5Z",layout:"grid"},season:{icon:u,layout:"grid",thumbnail_ratio:"portrait",show_list_images:!0},track:{icon:"M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M13,13H11V18A2,2 0 0,1 9,20A2,2 0 0,1 7,18A2,2 0 0,1 9,16C9.4,16 9.7,16.1 10,16.3V11H13V13M13,9V3.5L18.5,9H13Z"},tv_show:{icon:u,layout:"grid",thumbnail_ratio:"portrait"},url:{icon:"M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z"},video:{icon:"M17,10.5V7A1,1 0 0,0 16,6H4A1,1 0 0,0 3,7V17A1,1 0 0,0 4,18H16A1,1 0 0,0 17,17V13.5L21,17.5V6.5L17,10.5Z",layout:"grid",show_list_images:!0}},v=(e,t,i,a)=>e.callWS({type:"media_player/browse_media",entity_id:t,media_content_id:i,media_content_type:a}),m=e=>{let t=e.attributes.media_position;return"playing"!==e.state?t:(t+=(Date.now()-new Date(e.attributes.media_position_updated_at).getTime())/1e3,t<0?0:t)},b=e=>{let t;switch(e.attributes.media_content_type){case"music":case"image":t=e.attributes.media_artist;break;case"playlist":t=e.attributes.media_playlist||e.attributes.media_artist;break;case"tvshow":t=e.attributes.media_series_title,e.attributes.media_season&&(t+=" S"+e.attributes.media_season,e.attributes.media_episode&&(t+="E"+e.attributes.media_episode));break;case"channel":t=e.attributes.media_channel;break;default:t=e.attributes.app_name||""}return t},y=(e,t=!1)=>{if(!e)return;const i=e.state;if(i===n.Hh)return;const o=!0===e.attributes.assumed_state;if(!(0,a.a)(e)&&!o)return(0,s.$)(e,128)?[{icon:d,action:"turn_on"}]:void 0;const r=[];o&&(0,s.$)(e,128)&&r.push({icon:"M11,3H13V21H11V3Z",action:"turn_on"}),(0,s.$)(e,256)&&r.push({icon:o?"M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M12,19A7,7 0 0,1 5,12A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19Z":d,action:"turn_off"});const u=e.attributes;return("playing"===i||"paused"===i||o)&&(0,s.$)(e,32768)&&t&&r.push({icon:!0===u.shuffle?"M14.83,13.41L13.42,14.82L16.55,17.95L14.5,20H20V14.5L17.96,16.54L14.83,13.41M14.5,4L16.54,6.04L4,18.59L5.41,20L17.96,7.46L20,9.5V4M10.59,9.17L5.41,4L4,5.41L9.17,10.58L10.59,9.17Z":"M16,4.5V7H5V9H16V11.5L19.5,8M16,12.5V15H5V17H16V19.5L19.5,16",action:"shuffle_set"}),("playing"===i||"paused"===i||o)&&(0,s.$)(e,16)&&r.push({icon:"M6,18V6H8V18H6M9.5,12L18,6V18L9.5,12Z",action:"media_previous_track"}),!o&&("playing"===i&&((0,s.$)(e,1)||(0,s.$)(e,4096))||("paused"===i||"idle"===i)&&(0,s.$)(e,16384)||"on"===i&&((0,s.$)(e,16384)||(0,s.$)(e,1)))&&r.push({icon:"on"===i?"M3,5V19L11,12M13,19H16V5H13M18,5V19H21V5":"playing"!==i?c:(0,s.$)(e,1)?l:h,action:"playing"!==i?"media_play":(0,s.$)(e,1)?"media_pause":"media_stop"}),o&&(0,s.$)(e,16384)&&r.push({icon:c,action:"media_play"}),o&&(0,s.$)(e,1)&&r.push({icon:l,action:"media_pause"}),o&&(0,s.$)(e,4096)&&r.push({icon:h,action:"media_stop"}),("playing"===i||"paused"===i||o)&&(0,s.$)(e,32)&&r.push({icon:"M16,18H18V6H16M6,18L14.5,12L6,6V18Z",action:"media_next_track"}),("playing"===i||"paused"===i||o)&&(0,s.$)(e,262144)&&t&&r.push({icon:"all"===u.repeat?"M17,17H7V14L3,18L7,22V19H19V13H17M7,7H17V10L21,6L17,2V5H5V11H7V7Z":"one"===u.repeat?"M13,15V9H12L10,10V11H11.5V15M17,17H7V14L3,18L7,22V19H19V13H17M7,7H17V10L21,6L17,2V5H5V11H7V7Z":"M2,5.27L3.28,4L20,20.72L18.73,22L15.73,19H7V22L3,18L7,14V17H13.73L7,10.27V11H5V8.27L2,5.27M17,13H19V17.18L17,15.18V13M17,5V2L21,6L17,10V7H8.82L6.82,5H17Z",action:"repeat_set"}),r.length>0?r:void 0},f=e=>{if(void 0===e||e===1/0)return"";const t=Math.max(0,Math.floor(e)),i=Math.floor(t/3600),a=Math.floor(t%3600/60),s=t%60,n=e=>e.toString().padStart(2,"0");return i>0?`${n(i)}:${n(a)}:${n(s)}`:`${n(a)}:${n(s)}`},w=e=>{if(!e)return;const t=e.indexOf("?authSig=");let i=t>0?e.slice(0,t):e;return i.startsWith("http")&&(i=decodeURIComponent(i.split("/").pop())),i},$=(e,t,i)=>e.callService("media_player","volume_set",{entity_id:t,volume_level:i}),C=(e,t,i)=>e.callService("media_player",i,"shuffle_set"===i?{entity_id:t.entity_id,shuffle:!t.attributes.shuffle}:"repeat_set"===i?{entity_id:t.entity_id,repeat:"all"===t.attributes.repeat?"one":"off"===t.attributes.repeat?"all":"off"}:{entity_id:t.entity_id}),A=(e,t,i,a,s={})=>(!s.enqueue&&void 0===s.announce&&(0,o.ni)(i)&&(s.announce=!0),e.callService("media_player","play_media",{entity_id:t,media_content_id:i,media_content_type:a,...s})),x=(e,t,i)=>e.callService("media_player","join",{group_members:i},{entity_id:t}),H=(e,t)=>e.callService("media_player","unjoin",{},{entity_id:t})},81023(e,t,i){i.d(t,{L:()=>n});var a=i(1087);const s=()=>Promise.all([i.e(92769),i.e(34995),i.e(3283),i.e(81034),i.e(27964),i.e(51455),i.e(26737),i.e(26092),i.e(8851),i.e(55076),i.e(92363),i.e(72091)]).then(i.bind(i,85027)),n=(e,t)=>{(0,a.r)(e,"show-dialog",{dialogTag:"ha-voice-assistant-setup-dialog",dialogImport:s,dialogParams:t})}},81310(e,t,i){i.a(e,async function(e,t){try{var a=i(62826),s=i(5124),n=i(22441),o=i(6412),r=i(26218),l=i(91926),c=i(90248),d=i(2054),h=i(14503),u=e([c,d]);[c,d]=u.then?(await u)():u;class p extends s.WF{render(){return s.qy` <div class="toolbar ${(0,o.H)({narrow:this.narrow})}"> <div class="toolbar-content"> ${this.mainPage||history.state?.root?s.qy` <ha-menu-button .hass="${this.hass}" .narrow="${this.narrow}"></ha-menu-button> `:this.backPath?s.qy` <ha-icon-button-arrow-prev href="${this.backPath}" .hass="${this.hass}"></ha-icon-button-arrow-prev> `:s.qy` <ha-icon-button-arrow-prev .hass="${this.hass}" @click="${this._backTapped}"></ha-icon-button-arrow-prev> `} <div class="main-title"> <slot name="header">${this.header}</slot> </div> <slot name="toolbar-icon"></slot> </div> </div> <div class="${(0,o.H)({content:!0,"ha-scrollbar":this.scrollable,"not-scrollable":!this.scrollable})}" @scroll="${this._saveScrollPos}"> <slot></slot> </div> <div id="fab"> <slot name="fab"></slot> </div> `}_saveScrollPos(e){this._savedScrollPos=e.target.scrollTop}_backTapped(){this.backCallback?this.backCallback():(0,l.OE)()}static get styles(){return[h.dp,s.AH`:host{display:block;height:100%;background-color:var(--primary-background-color);overflow:hidden;position:relative}:host([narrow]){width:100%;position:fixed}.toolbar{background-color:var(--app-header-background-color);padding-top:var(--safe-area-inset-top);padding-right:var(--safe-area-inset-right)}:host([narrow]) .toolbar{padding-left:var(--safe-area-inset-left)}.toolbar-content{display:flex;align-items:center;font-size:var(--ha-font-size-xl);height:var(--header-height);font-weight:var(--ha-font-weight-normal);color:var(--app-header-text-color,#fff);border-bottom:var(--app-header-border-bottom,none);box-sizing:border-box;padding:8px 12px}.toolbar a{color:var(--sidebar-text-color);text-decoration:none}::slotted([slot=toolbar-icon]),ha-icon-button-arrow-prev,ha-menu-button{display:flex;align-items:center;pointer-events:auto;color:var(--sidebar-icon-color)}.main-title{margin-inline-start:var(--ha-space-6);line-height:var(--ha-line-height-normal);min-width:0;flex-grow:1;overflow-wrap:break-word;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}.narrow .main-title{margin-inline-start:var(--ha-space-2)}.content{position:relative;width:calc(100% - var(--safe-area-inset-right,0px));height:calc(100% - 1px - var(--header-height,0px) - var(--safe-area-inset-top,0px) - var(--safe-area-inset-bottom,0px));padding-bottom:var(--safe-area-inset-bottom,0px);margin-right:var(--safe-area-inset-right);overflow-y:auto;overflow:auto;-webkit-overflow-scrolling:touch}.content.not-scrollable{overflow:hidden;display:flex;flex-direction:column}:host([narrow]) .content{width:calc(100% - var(--safe-area-inset-left,0px) - var(--safe-area-inset-right,0px));margin-left:var(--safe-area-inset-left)}#fab{position:absolute;right:calc(16px + var(--safe-area-inset-right,0px));inset-inline-end:calc(16px + var(--safe-area-inset-right,0px));inset-inline-start:initial;bottom:calc(16px + var(--safe-area-inset-bottom,0px));z-index:1;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:var(--ha-space-2);--ha-button-box-shadow:var(--ha-box-shadow-l)}:host([narrow]) #fab.tabs{bottom:calc(84px + var(--safe-area-inset-bottom,0px))}#fab[is-wide]{bottom:calc(24px + var(--safe-area-inset-bottom,0px));right:calc(24px + var(--safe-area-inset-right,0px));inset-inline-end:calc(24px + var(--safe-area-inset-right,0px));inset-inline-start:initial}`]}constructor(...e){super(...e),this.mainPage=!1,this.narrow=!1,this.scrollable=!0}}(0,a.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)()],p.prototype,"header",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,attribute:"main-page"})],p.prototype,"mainPage",void 0),(0,a.Cg)([(0,n.MZ)({type:String,attribute:"back-path"})],p.prototype,"backPath",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],p.prototype,"backCallback",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],p.prototype,"narrow",void 0),(0,a.Cg)([(0,n.MZ)({type:Boolean})],p.prototype,"scrollable",void 0),(0,a.Cg)([(0,r.a)(".content")],p.prototype,"_savedScrollPos",void 0),(0,a.Cg)([(0,n.Ls)({passive:!0})],p.prototype,"_saveScrollPos",null),p=(0,a.Cg)([(0,n.EM)("hass-subpage")],p),t()}catch(e){t(e)}})},85728(e,t,i){i.a(e,async function(e,t){try{i(44114),i(18111),i(22489),i(7588),i(61701);var a=i(62826),s=i(5124),n=i(22441),o=i(6412),r=i(75751),l=i(91450),c=i(18350),d=(i(76776),i(47680),i(8630),i(28732),i(85694)),h=i(42269),u=i(40747),p=i(12496),g=i(70384),_=e([c,g,d]);[c,g,d]=_.then?(await _)():_;class v extends s.WF{render(){if(!this.entities.length)return s.qy` <ha-card outlined .header="${this.header}"> <div class="empty card-content"> ${this.hass.localize("ui.panel.config.devices.entities.none")} </div> </ha-card> `;const e=[],t=[];return this.entities.forEach(i=>{i.disabled_by?t.push(i):e.push(i)}),s.qy` <ha-card outlined .header="${this.header}"> ${e.length?s.qy` <div id="entities" class="move-up"> <ha-list> ${(0,r.u)(e,e=>e.entity_id,e=>this.hass.states[e.entity_id]?this._renderEntity(e):this._renderUnavailableEntity(e))} </ha-list> </div> `:s.s6} ${t.length?s.qy`<div class="${(0,o.H)({"move-up":!e.length})}"> ${this.showHidden?s.qy` <ha-list> ${t.map(e=>this._renderUnavailableEntity(e))} </ha-list> <button class="show-more" @click="${this._toggleShowHidden}"> ${this.hass.localize("ui.panel.config.devices.entities.show_less")} </button> `:s.qy` <button class="show-more" @click="${this._toggleShowHidden}"> ${this.hass.localize("ui.panel.config.devices.entities.disabled_entities",{count:t.length})} </button> `} </div>`:s.s6} <div class="card-actions"> <ha-button appearance="plain" @click="${this._addToLovelaceView}"> ${this.hass.localize("ui.panel.config.devices.entities.add_entities_lovelace")} </ha-button> </div> </ha-card> `}_toggleShowHidden(){this.showHidden=!this.showHidden}_renderEntity(e){let t=e.stateName||this.deviceName;return e.hidden_by&&(t+=` (${this.hass.localize("ui.panel.config.devices.entities.hidden")})`),s.qy`<div> ${(0,g.g)(e.entity_id,t,this.hass)} </div>`}_renderUnavailableEntity(e){const t=e.stateName||this.deviceName,i=(0,l.T)((0,d.u7)(this.hass,e));return s.qy` <ha-list-item graphic="icon" class="disabled-entry" .entry="${e}" @click="${this._openEditEntry}"> <ha-icon slot="graphic" .icon="${i}"></ha-icon> <div class="name">${t}</div> </ha-list-item> `}_openEditEntry(e){const t=e.currentTarget.entry;(0,h.p)(this,{entityId:t.entity_id})}_addToLovelaceView(){const e=this.entities.filter(e=>!e.disabled_by).map(e=>e.entity_id);(0,p.Q)(this,this.hass,(0,u.Bi)(this.hass,e,{title:this.deviceName}),(0,u.ZI)(e,{title:this.deviceName}),e)}constructor(...e){super(...e),this.showHidden=!1}}v.styles=s.AH`:host{display:block}ha-icon{margin-left:-8px}.entity-id{color:var(--secondary-text-color)}.buttons{text-align:right;margin:0 0 0 8px}.disabled-entry{color:var(--secondary-text-color)}.move-up{margin-top:-13px}.move-up:has(> ha-list){margin-top:-24px}:not(.move-up)>ha-list{margin-top:-24px}.move-up+:not(:has(ha-list))>button.show-more,ha-list+button.show-more{margin-top:-12px}#entities>ha-list{margin:0 16px 0 8px}#entities>ha-list>ha-list-item{padding:0 16px 0 12px}.name{font-size:var(--ha-font-size-m)}.name:dir(rtl){margin-inline-start:8px}.empty{text-align:center}button.show-more{color:var(--primary-color);text-align:left;cursor:pointer;background:0 0;border-width:initial;border-style:none;border-color:initial;border-image:initial;padding:16px;font:inherit}button.show-more:focus{outline:0;text-decoration:underline}ha-list>*{margin:8px 0px}ha-list-item{height:40px;--mdc-ripple-color:transparent}.card-actions{padding:4px 16px 4px 4px}`,(0,a.Cg)([(0,n.MZ)()],v.prototype,"header",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"deviceName",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],v.prototype,"entities",void 0),(0,a.Cg)([(0,n.MZ)({attribute:"show-hidden",type:Boolean})],v.prototype,"showHidden",void 0),v=(0,a.Cg)([(0,n.EM)("ha-device-entities-card")],v),t()}catch(e){t(e)}})},31005(e,t,i){i.a(e,async function(e,t){try{i(74423),i(18111),i(22489),i(61701),i(45367),i(92731);var a=i(62826),s=i(35211),n=i(5124),o=i(22441),r=i(22786),l=i(36312),c=i(37981),d=i(52220),h=i(31290),u=i(6030),p=(i(76776),i(47680),i(23430)),g=i(22792),_=i(14503),v=e([p]);p=(v.then?(await v)():v)[0];class m extends n.WF{render(){const{map:e,ids:t}=this._labelsData(this._labelRegistry,this.device.labels,this.hass.locale.language);return n.qy` <ha-card outlined .header="${this.hass.localize("ui.panel.config.devices.device_info",{type:this.hass.localize(`ui.panel.config.devices.type.${this.device.entry_type||"device"}_heading`)})}"> <div class="card-content"> ${this.device.model?n.qy`<div class="model"> ${this.device.model} ${this.device.model_id?n.qy`(${this.device.model_id})`:""} </div>`:this.device.model_id?n.qy`<div class="model">${this.device.model_id}</div>`:""} ${this.device.manufacturer?n.qy` <div class="manuf"> ${this.hass.localize("ui.panel.config.integrations.config_entry.manuf",{manufacturer:this.device.manufacturer})} </div> `:""} ${this.device.via_device_id?n.qy` <div class="extra-info"> ${this.hass.localize("ui.panel.config.integrations.config_entry.via")} <span class="hub"><a href="/config/devices/device/${this.device.via_device_id}">${this._computeDeviceNameDisplay(this.device.via_device_id)}</a></span> </div> `:""} ${this.device.sw_version?n.qy` <div class="extra-info"> ${this.hass.localize("ui.panel.config.integrations.config_entry."+("service"!==this.device.entry_type||this.device.hw_version?"firmware":"version"),{version:this.device.sw_version})} </div> `:""} ${this.device.hw_version?n.qy` <div class="extra-info"> ${this.hass.localize("ui.panel.config.integrations.config_entry.hardware",{version:this.device.hw_version})} </div> `:""} ${this.device.serial_number?n.qy` <div class="extra-info"> ${this.hass.localize("ui.panel.config.integrations.config_entry.serial_number",{serial_number:this.device.serial_number})} </div> `:""} ${this._getAddresses().map(([e,t])=>n.qy` <div class="extra-info"> ${"bluetooth"===e&&(0,l.x)(this.hass.config,"bluetooth")?n.qy`${(0,h.n)(e)}: <a href="/config/bluetooth/advertisement-monitor?${(0,u.KH)({address:t})}">${t.toUpperCase()}</a>`:"mac"===e&&(0,l.x)(this.hass.config,"dhcp")?n.qy`MAC: <a href="/config/dhcp?${(0,u.KH)({mac_address:t})}">${t.toUpperCase()}</a>`:n.qy`${"mac"===e?"MAC":(0,h.n)(e)}: ${t.toUpperCase()}`} </div> `)} ${t.length>0?n.qy` <div class="extra-info labels"> ${t.map(t=>{const i=e.get(t);return n.qy` <ha-label .color="${i?.color}" .description="${i?.description}"> ${i?.icon?n.qy`<ha-icon slot="icon" .icon="${i.icon}"></ha-icon>`:n.s6} ${i?.name||t} </ha-label> `})} </div> `:n.s6} <slot></slot> </div> <slot name="actions"></slot> </ha-card> `}_getAddresses(){return this.device.connections.filter(e=>["mac","bluetooth","zigbee"].includes(e[0]))}_computeDeviceNameDisplay(e){const t=this.hass.devices[e];return t?(0,c.T)(t,this.hass.localize,this.hass.states):`<${this.hass.localize("ui.panel.config.integrations.config_entry.unknown_via_device")}>`}static get styles(){return[_.RF,n.AH`:host{display:block}ha-card{flex:1 0 100%;min-width:0}.device{width:30%}.labels{display:flex;flex-wrap:wrap;gap:var(--ha-space-1);width:100%;max-width:100%}.labels ha-label{min-width:0;max-width:100%;flex:0 1 auto}.extra-info{margin-top:var(--ha-space-2);word-wrap:break-word}.manuf,.model{color:var(--secondary-text-color);word-wrap:break-word}`]}constructor(...e){super(...e),this.narrow=!1,this._labelsData=(0,r.A)((e,t,i)=>{const a=e?new Map(e.map(e=>[e.label_id,e])):new Map,s=[...t].sort((e,t)=>(0,d.xL)(a.get(e)?.name||e,a.get(t)?.name||t,i));return{map:a,ids:s}})}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],m.prototype,"device",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean})],m.prototype,"narrow",void 0),(0,a.Cg)([(0,s.Fg)({context:g.HD,subscribe:!0}),(0,o.wk)()],m.prototype,"_labelRegistry",void 0),m=(0,a.Cg)([(0,o.EM)("ha-device-info-card")],m),t()}catch(e){t(e)}})},97605(e,t,i){i(18111),i(22489),i(61701);var a=i(62826),s=i(5124),n=i(22441),o=i(22786),r=i(37981),l=i(52220);i(76776),i(43661),i(28732);class c extends s.WF{render(){const e=this._viaDevices(this.deviceId,this.hass.devices);return 0===e.length?s.s6:s.qy` <ha-card> <h1 class="card-header"> ${this.hass.localize("ui.panel.config.devices.connected_devices.heading")} </h1> ${(this._showAll?e:e.slice(0,10)).map(e=>s.qy` <a href="${`/config/devices/device/${e.id}`}"> <ha-list-item hasMeta> ${(0,r.T)(e,this.hass.localize,this.hass.states)} <ha-icon-next slot="meta"></ha-icon-next> </ha-list-item> </a> `)} ${!this._showAll&&e.length>10?s.qy` <button class="show-more" @click="${this._toggleShowAll}"> ${this.hass.localize("ui.panel.config.devices.connected_devices.show_more",{count:e.length-10})} </button> `:""} </ha-card> `}_toggleShowAll(){this._showAll=!this._showAll}constructor(...e){super(...e),this._showAll=!1,this._viaDevices=(0,o.A)((e,t)=>Object.values(t).filter(t=>t.via_device_id===e).sort((e,t)=>(0,l.SH)((0,r.T)(e,this.hass.localize,this.hass.states),(0,r.T)(t,this.hass.localize,this.hass.states),this.hass.locale.language)))}}c.styles=s.AH`:host{display:block}.card-header{padding-bottom:0}a{text-decoration:none;color:var(--primary-text-color)}button.show-more{color:var(--primary-color);text-align:left;cursor:pointer;background:0 0;border-width:initial;border-style:none;border-color:initial;border-image:initial;padding:16px;font:inherit}button.show-more:focus{outline:0;text-decoration:underline}`,(0,a.Cg)([(0,n.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,a.Cg)([(0,n.MZ)({attribute:!1})],c.prototype,"deviceId",void 0),(0,a.Cg)([(0,n.wk)()],c.prototype,"_showAll",void 0),c=(0,a.Cg)([(0,n.EM)("ha-device-via-devices-card")],c)},71762(e,t,i){i.d(t,{i:()=>n});var a=i(1087);const s=()=>i.e(15175).then(i.bind(i,71706)),n=(e,t)=>{(0,a.r)(e,"show-dialog",{dialogTag:"dialog-device-add-to",dialogImport:s,dialogParams:t})}},8872(e,t,i){i.d(t,{F:()=>s,_:()=>n});var a=i(1087);const s=()=>Promise.all([i.e(92769),i.e(3283),i.e(33192),i.e(26092),i.e(66201),i.e(90108)]).then(i.bind(i,22756)),n=(e,t)=>{(0,a.r)(e,"show-dialog",{dialogTag:"dialog-device-registry-detail",dialogImport:s,dialogParams:t})}},98129(e,t,i){i.a(e,async function(e,t){try{i(74423),i(44114),i(18111),i(22489),i(20116),i(7588),i(61701),i(13579);var a=i(62826),s=(i(68825),i(35211)),n=i(5124),o=i(22441),r=i(63672),l=i(22786),c=i(36312),d=i(46190),h=i(1087),u=i(37981),p=i(71727),g=i(81816),_=i(69093),v=i(28978),m=i(91926),b=i(52220),y=i(80880),f=i(15638),w=i(5911),$=(i(72945),i(38962)),C=i(18350),A=i(29823),x=(i(70947),i(26300)),H=(i(43661),i(28170),i(1671),i(47819),i(65829)),k=(i(67094),i(34127)),L=i(62351),M=i(82e3),V=i(77423),E=i(22792),z=i(58594),S=i(93758),q=i(96204),I=i(59241),Z=i(95350),T=i(86973),D=i(71606),O=i(41250),P=i(65063),F=i(81023),N=i(28794),U=i(81310),j=i(14503),W=i(24367),R=i(44144),B=i(30039),J=i(89434),K=i(85728),G=i(31005),X=(i(97605),i(71762)),Y=i(8872),Q=e([$,C,A,x,H,k,N,U,J,K,G]);[$,C,A,x,H,k,N,U,J,K,G]=Q.then?(await Q)():Q;const ee="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",te="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",ie="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",ae="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z",se="M12,2A3,3 0 0,1 15,5V11A3,3 0 0,1 12,14A3,3 0 0,1 9,11V5A3,3 0 0,1 12,2M19,11C19,14.53 16.39,17.44 13,17.93V21H11V17.93C7.61,17.44 5,14.53 5,11H7A5,5 0 0,0 12,16A5,5 0 0,0 17,11H19Z",ne="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z",oe="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",re="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",le="M13,3A9,9 0 0,0 4,12H1L4.89,15.89L4.96,16.03L9,12H6A7,7 0 0,1 13,5A7,7 0 0,1 20,12A7,7 0 0,1 13,19C11.07,19 9.32,18.21 8.06,16.94L6.64,18.36C8.27,20 10.5,21 13,21A9,9 0 0,0 22,12A9,9 0 0,0 13,3Z",ce=[{value:"navigate-entities",path:"/config/entities",icon:"M11,13.5V21.5H3V13.5H11M9,15.5H5V19.5H9V15.5M12,2L17.5,11H6.5L12,2M12,5.86L10.08,9H13.92L12,5.86M17.5,13C20,13 22,15 22,17.5C22,20 20,22 17.5,22C15,22 13,20 13,17.5C13,15 15,13 17.5,13M17.5,15A2.5,2.5 0 0,0 15,17.5A2.5,2.5 0 0,0 17.5,20A2.5,2.5 0 0,0 20,17.5A2.5,2.5 0 0,0 17.5,15Z",countKey:"entities"},{value:"navigate-helpers",path:"/config/helpers",icon:"M21.71 20.29L20.29 21.71A1 1 0 0 1 18.88 21.71L7 9.85A3.81 3.81 0 0 1 6 10A4 4 0 0 1 2.22 4.7L4.76 7.24L5.29 6.71L6.71 5.29L7.24 4.76L4.7 2.22A4 4 0 0 1 10 6A3.81 3.81 0 0 1 9.85 7L21.71 18.88A1 1 0 0 1 21.71 20.29M2.29 18.88A1 1 0 0 0 2.29 20.29L3.71 21.71A1 1 0 0 0 5.12 21.71L10.59 16.25L7.76 13.42M20 2L16 4V6L13.83 8.17L15.83 10.17L18 8H20L22 4Z",countKey:"helpers"},{value:"navigate-automations",path:"/config/automation/dashboard",icon:"M12,2A2,2 0 0,1 14,4C14,4.74 13.6,5.39 13,5.73V7H14A7,7 0 0,1 21,14H22A1,1 0 0,1 23,15V18A1,1 0 0,1 22,19H21V20A2,2 0 0,1 19,22H5A2,2 0 0,1 3,20V19H2A1,1 0 0,1 1,18V15A1,1 0 0,1 2,14H3A7,7 0 0,1 10,7H11V5.73C10.4,5.39 10,4.74 10,4A2,2 0 0,1 12,2M7.5,13A2.5,2.5 0 0,0 5,15.5A2.5,2.5 0 0,0 7.5,18A2.5,2.5 0 0,0 10,15.5A2.5,2.5 0 0,0 7.5,13M16.5,13A2.5,2.5 0 0,0 14,15.5A2.5,2.5 0 0,0 16.5,18A2.5,2.5 0 0,0 19,15.5A2.5,2.5 0 0,0 16.5,13Z",countKey:"automations"},{value:"navigate-scenes",path:"/config/scene/dashboard",icon:"M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z",countKey:"scenes"},{value:"navigate-scripts",path:"/config/script/dashboard",icon:"M17.8,20C17.4,21.2 16.3,22 15,22H5C3.3,22 2,20.7 2,19V18H5L14.2,18C14.6,19.2 15.7,20 17,20H17.8M19,2C20.7,2 22,3.3 22,5V6H20V5C20,4.4 19.6,4 19,4C18.4,4 18,4.4 18,5V18H17C16.4,18 16,17.6 16,17V16H5V5C5,3.3 6.3,2 8,2H19M8,6V8H15V6H8M8,10V12H14V10H8Z",countKey:"scripts"}],de=3e4;class he extends n.WF{willUpdate(e){super.willUpdate(e),e.has("deviceId")&&(this._related=void 0,this._deviceActions=[],this._deviceAlerts=[],this._deleteButtons=[],this._diagnosticDownloadLinks=[]),(e.has("deviceId")||e.has("entries"))&&this._fetchData()}firstUpdated(e){super.firstUpdated(e),(0,Y.F)(),this._subscribeLabFeature()}updated(e){super.updated(e),e.has("deviceId")&&(this._findRelated(),(0,h.r)(this,"hass-quick-bar-context",{itemType:"device",itemId:this.deviceId}))}disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this._deviceAlertsActionsTimeout),this._unsubLabFeature?.()}render(){if(!this.hass||!this.deviceId)return n.s6;const e=this.hass.devices[this.deviceId];if(!e)return n.qy` <hass-error-screen .hass="${this.hass}" .error="${this.hass.localize("ui.panel.config.devices.device_not_found")}"></hass-error-screen> `;const t=(0,u.T)(e,this.hass.localize,this.hass.states),i=this._integrations(e,this.entries,this.manifests),a=this._entities(this.deviceId,this._entityReg,this.hass.devices),s=(0,O.cJ)(this._entityIds(a),this._entityReg,this.hass.states),o=this._entitiesByCategory(a),l=this._getQuickLinkCounts(a,this._related),d=this._batteryEntity(a),h=this._batteryChargingEntity(a),p=d?this.hass.states[d.entity_id]:void 0,g=p?(0,_.t)(p):void 0,m=h?this.hass.states[h.entity_id]:void 0,b=e.area_id?this.hass.areas[e.area_id]:void 0,w=i.length?[n.qy`<ha-list-nav slot="actions"> ${i.map(e=>n.qy`<ha-list-item-button href="${`/config/integrations/integration/${e.domain}#config_entry=${e.entry_id}`}" .headline="${(0,Z.p$)(this.hass.localize,e.domain)}"> <img slot="start" alt="${(0,Z.p$)(this.hass.localize,e.domain)}" src="${(0,R.MR)({domain:e.domain,type:"icon",darkOptimized:this.hass.themes?.darkMode},this.hass.auth.data.hassUrl)}" crossorigin="anonymous" referrerpolicy="no-referrer" width="24" height="24" @error="${this._onImageError}" @load="${this._onImageLoad}"> <ha-icon-next slot="end"></ha-icon-next> </ha-list-item-button>`)} </ha-list-nav>`]:[],$=[...this._deviceActions||[]];Array.isArray(this._diagnosticDownloadLinks)&&$.push(...this._diagnosticDownloadLinks),this._deleteButtons&&$.push(...this._deleteButtons),$.sort((e,t)=>"warning"===e.classes&&"warning"!==t.classes?1:"warning"!==e.classes&&"warning"===t.classes?-1:0);const C=$.shift();e.disabled_by&&w.push(n.qy` <ha-alert alert-type="warning"> ${this.hass.localize("ui.panel.config.devices.enabled_cause",{type:this.hass.localize(`ui.panel.config.devices.type.${e.entry_type||"device"}`),cause:this.hass.localize(`ui.panel.config.devices.disabled_by.${e.disabled_by}`)})} </ha-alert> ${"user"===e.disabled_by?n.qy` <div class="card-actions" slot="actions"> <ha-button variant="warning" size="small" @click="${this._enableDevice}"> ${this.hass.localize("ui.common.enable")} </ha-button> </div> `:""} `),this._renderIntegrationInfo(e,i,w);const A=e.disabled_by?this.hass.localize("ui.panel.config.devices.add_prompt_disabled"):this.hass.localize("ui.panel.config.devices.add_prompt_enabled"),x=(0,c.x)(this.hass.config,"scene")&&s.length,H=(0,c.x)(this.hass.config,"automation")||(0,c.x)(this.hass.config,"script")||x?n.qy` <ha-card outlined> <h1 class="card-header"> ${this.hass.localize("ui.panel.config.devices.automation.related_heading")} <ha-button appearance="filled" variant="brand" @click="${this._showAddToDialog}" .disabled="${e.disabled_by}"> <ha-svg-icon slot="start" .path="${re}"></ha-svg-icon> ${this.hass.localize("ui.dialogs.more_info_control.add_to.item")} </ha-button> </h1> ${this._related?this._related.automation?.length||this._related.script?.length||this._related.scene?.length?n.qy` ${(0,c.x)(this.hass.config,"automation")?n.qy` <h3 class="section-header"> ${this.hass.localize("ui.panel.config.devices.automation.automations_heading")} </h3> <ha-list-nav .ariaLabel="${this.hass.localize("ui.panel.config.devices.automation.automations_heading")}"> ${this._related.automation?.length?this._getRelated(this._related).automation.map(e=>e?n.qy`<ha-list-item-button .headline="${(0,v.u)(e)}" .href="${e.attributes.id?`/config/automation/edit/${encodeURIComponent(e.attributes.id)}`:`/config/automation/show/${e.entity_id}`}"> <ha-icon-next slot="end"></ha-icon-next> </ha-list-item-button>`:n.s6):n.qy`<ha-list-item-base .headline="${this.hass.localize("ui.panel.config.devices.automation.no_automations")}"></ha-list-item-base>`} </ha-list-nav> `:n.s6} ${(0,c.x)(this.hass.config,"script")?n.qy` <h3 class="section-header"> ${this.hass.localize("ui.panel.config.devices.script.scripts_heading")} </h3> <ha-list-nav .ariaLabel="${this.hass.localize("ui.panel.config.devices.script.scripts_heading")}"> ${this._related.script?.length?this._getRelated(this._related).script.map(e=>{if(!e)return n.s6;const t=this._entityReg.find(t=>t.entity_id===e.entity_id),i=t?`/config/script/edit/${t.unique_id}`:`/config/script/show/${e.entity_id}`;return n.qy` <ha-list-item-button .headline="${(0,v.u)(e)}" .href="${i}"> <ha-icon-next slot="end"></ha-icon-next> </ha-list-item-button> `}):n.qy`<ha-list-item-base .headline="${this.hass.localize("ui.panel.config.devices.script.no_scripts")}"></ha-list-item-base>`} </ha-list-nav> `:n.s6} ${x?n.qy` <h3 class="section-header"> ${this.hass.localize("ui.panel.config.devices.scene.scenes_heading")} </h3> <ha-list-nav .ariaLabel="${this.hass.localize("ui.panel.config.devices.scene.scenes_heading")}"> ${this._related.scene?.length?this._getRelated(this._related).scene.map(e=>{if(!e)return n.s6;const t=`scene-${(0,y.Y)(e.entity_id)}`;return e.attributes.id?n.qy` <ha-list-item-button .headline="${(0,v.u)(e)}" .href="${`/config/scene/edit/${e.attributes.id}`}"> <ha-icon-next slot="end"></ha-icon-next> </ha-list-item-button> `:n.qy` <ha-list-item-base id="${t}" .headline="${(0,v.u)(e)}"> <ha-icon-next slot="end"></ha-icon-next> </ha-list-item-base> <ha-tooltip .for="${t}" placement="${(0,f.qC)(this.hass.language,this.hass.translationMetadata.translations)?"left":"right"}"> ${this.hass.localize("ui.panel.config.devices.cant_edit")} </ha-tooltip> `}):n.qy`<ha-list-item-base .headline="${this.hass.localize("ui.panel.config.devices.scene.no_scenes")}"></ha-list-item-base>`} </ha-list-nav> `:n.s6} `:n.qy` <div class="card-content"> ${this.hass.localize("ui.panel.config.devices.add_prompt",{name:this.hass.localize("ui.panel.config.devices.automation.automations_scripts_or_scenes"),type:this.hass.localize(`ui.panel.config.devices.type.${e.entry_type||"device"}`)})} ${A} </div> `:n.qy` <div class="card-content loading"> <ha-spinner></ha-spinner> </div> `} </ha-card> `:"";return n.qy`<hass-subpage .hass="${this.hass}" .narrow="${this.narrow}" .header="${t}"> <ha-tooltip for="edit-settings-button" slot="toolbar-icon"> ${this.hass.localize("ui.panel.config.devices.edit_settings")} </ha-tooltip> <ha-icon-button id="edit-settings-button" slot="toolbar-icon" .path="${oe}" @click="${this._showSettings}" hide-title .label="${this.hass.localize("ui.panel.config.devices.edit_settings")}"></ha-icon-button> <ha-dropdown slot="toolbar-icon" @wa-select="${this._handleToolbarMenuAction}"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${ie}"></ha-icon-button> ${ce.map(e=>n.qy` <ha-dropdown-item value="${e.value}"> <ha-svg-icon slot="icon" .path="${e.icon}"></ha-svg-icon> ${this.hass.localize(`ui.panel.config.devices.quick_links.${e.countKey}`,{count:l[e.countKey]})} <ha-icon-next slot="details"></ha-icon-next> </ha-dropdown-item> `)} <wa-divider></wa-divider> <ha-dropdown-item value="reset_entity_ids"> <ha-svg-icon slot="icon" .path="${le}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.devices.restore_entity_ids")} </ha-dropdown-item> </ha-dropdown> <div class="container"> <div class="header fullwidth"> ${b?n.qy`<div class="header-name"> <a href="/config/areas/area/${b.area_id}">${this.hass.localize("ui.panel.config.integrations.config_entry.area",{area:b.name||"Unnamed Area"})}</a> </div>`:""} <div class="header-right"> ${!p||"binary_sensor"!==g&&Number.isNaN(Number(p.state))?"":n.qy` <div class="battery"> ${"sensor"===g?this.hass.formatEntityState(p):n.s6} <ha-battery-icon .hass="${this.hass}" .batteryStateObj="${p}" .batteryChargingStateObj="${m}"></ha-battery-icon> </div> `} ${i.length?n.qy` <img alt="${(0,Z.p$)(this.hass.localize,i[0].domain)}" src="${(0,R.MR)({domain:i[0].domain,type:"logo",darkOptimized:this.hass.themes?.darkMode},this.hass.auth.data.hassUrl)}" crossorigin="anonymous" referrerpolicy="no-referrer" @load="${this._onImageLoad}" @error="${this._onImageError}"> `:""} </div> </div> <div class="column"> ${this._deviceAlerts?.length?n.qy` <div> ${this._deviceAlerts.map(e=>n.qy` <ha-alert .alertType="${e.level}"> ${e.text} </ha-alert> `)} </div> `:""} <ha-device-info-card .hass="${this.hass}" .device="${e}"> ${w} ${C||$.length?n.qy` <div class="card-actions" slot="actions"> <ha-button href="${(0,r.J)(C.href)}" rel="${(0,r.J)(C.target?"noreferrer":void 0)}" appearance="plain" target="${(0,r.J)(C.target)}" class="${(0,r.J)(C.classes)}" .variant="${C.classes?.includes("warning")?"danger":"brand"}" .action="${C.action}" @click="${this._deviceActionClicked}"> ${C.label} ${C.icon?n.qy` <ha-svg-icon class="${(0,r.J)(C.classes)}" .path="${C.icon}" slot="start"></ha-svg-icon> `:n.s6} ${C.trailingIcon?n.qy` <ha-svg-icon .path="${C.trailingIcon}" slot="end"></ha-svg-icon> `:n.s6} </ha-button> ${$.length?n.qy` <ha-dropdown @wa-select="${this._deviceActionSelected}" placement="bottom-end"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${ie}"></ha-icon-button> ${$.map((e,t)=>{const i=n.qy`<ha-dropdown-item .value="${t}" .data="${e}" .variant="${e.classes?.includes("warning")?"danger":"default"}"> ${e.icon?n.qy` <ha-svg-icon .path="${e.icon}" slot="icon"></ha-svg-icon> `:""} ${e.label} ${e.trailingIcon?n.qy` <ha-svg-icon slot="details" .path="${e.trailingIcon}"></ha-svg-icon> `:""} </ha-dropdown-item>`;return e.href?n.qy`<a href="${e.href}" target="${(0,r.J)(e.target)}" rel="${(0,r.J)(e.target?"noreferrer":void 0)}">${i} </a>`:i})} </ha-dropdown> `:""} </div> `:""} </ha-device-info-card> ${this.narrow?"":H} </div> <div class="column"> ${["control","sensor","notify","event","assist","config","diagnostic"].map(i=>o[i].length>0||0===a.length&&"control"===i?n.qy` <ha-device-entities-card .hass="${this.hass}" .header="${this.hass.localize(`ui.panel.config.devices.entities.${i}`)}" .deviceName="${t}" .entities="${o[i]}" .showHidden="${null!==e.disabled_by}"> </ha-device-entities-card> `:"")} <ha-device-via-devices-card .hass="${this.hass}" .deviceId="${this.deviceId}"></ha-device-via-devices-card> </div> <div class="column"> ${this.narrow?H:""} ${(0,c.x)(this.hass.config,"logbook")?n.qy` <ha-card outlined> <h1 class="card-header"> ${this.hass.localize("panel.logbook")} </h1> <ha-logbook .hass="${this.hass}" .time="${this._logbookTime}" .entityIds="${this._entityIds(a)}" .deviceIds="${this._deviceIdInList(this.deviceId)}" virtualize narrow no-icon></ha-logbook> </ha-card> `:""} </div> </div> </hass-subpage>`}_fetchData(){this.deviceId&&this.entries.length&&(this._getDiagnosticButtons(),this._getDeleteActions(),clearTimeout(this._deviceAlertsActionsTimeout),this._getDeviceActions(),this._getDeviceAlerts())}async _getDiagnosticButtons(){const e=this.deviceId;if(!(0,c.x)(this.hass.config,"diagnostics"))return;const t=this.hass.devices[this.deviceId];if(!t)return;let i=await Promise.all(this._integrations(t,this.entries,this.manifests).map(async e=>{if("loaded"!==e.state)return!1;let t;try{t=await(0,q.g9)(this.hass,e.domain)}catch(e){if(e instanceof Error&&e.message.includes("not_found"))return!1;throw e}return!(!t.handlers.device&&!t.handlers.config_entry)&&{link:t.handlers.device?(0,q.It)(e.entry_id,this.deviceId):(0,q.WV)(e.entry_id),domain:e.domain}}));i=i.filter(Boolean),this.deviceId===e&&i.length>0&&(this._diagnosticDownloadLinks=i.map(e=>({icon:ae,action:()=>this._signUrl(e.link),label:i.length>1?this.hass.localize("ui.panel.config.devices.download_diagnostics_integration",{integration:(0,Z.p$)(this.hass.localize,e.domain)}):this.hass.localize("ui.panel.config.devices.download_diagnostics")})))}_getDeleteActions(){const e=this.deviceId,t=this.hass.devices[this.deviceId];if(!t)return;const i=[];this._integrations(t,this.entries,this.manifests).forEach(e=>{"loaded"===e.state&&e.supports_remove_device&&i.push({action:async()=>{if(await(0,P.dk)(this,{text:this._integrations(t,this.entries,this.manifests).length>1?this.hass.localize("ui.panel.config.devices.confirm_delete_integration",{integration:(0,Z.p$)(this.hass.localize,e.domain)}):this.hass.localize("ui.panel.config.devices.confirm_delete"),confirmText:this.hass.localize("ui.common.delete"),dismissText:this.hass.localize("ui.common.cancel"),destructive:!0}))try{await(0,z.nO)(this.hass,this.deviceId,e.entry_id)}catch(e){(0,P.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.devices.error_delete"),text:e instanceof Error?e.message:String(e)})}},classes:"warning",icon:te,label:this._integrations(t,this.entries,this.manifests).length>1?this.hass.localize("ui.panel.config.devices.delete_device_integration",{integration:(0,Z.p$)(this.hass.localize,e.domain)}):this.hass.localize("ui.panel.config.devices.delete_device")})}),this.deviceId===e&&i.length>0&&(this._deleteButtons=i)}async _getDeviceActions(){const e=this.deviceId,t=this.hass.devices[this.deviceId];if(!t)return;const a=[],s=t.configuration_url?.startsWith("homeassistant://")||!1,n=s?t.configuration_url?.replace("homeassistant://","/"):t.configuration_url;n&&a.push({href:n,target:s?void 0:"_blank",icon:ee,label:this.hass.localize("ui.panel.config.devices.open_configuration_url"),trailingIcon:ne});const o=this._entities(this.deviceId,this._entityReg,this.hass.devices).find(e=>"assist_satellite"===(0,p.m)(e.entity_id)),r=this._integrations(t,this.entries,this.manifests).map(e=>e.domain);if(!r.includes("voip")&&o&&(0,L.KC)(this.hass.states[o.entity_id])&&a.push({action:this._voiceAssistantSetup,label:this.hass.localize("ui.panel.config.devices.set_up_voice_assistant"),icon:se}),r.includes("mqtt")){const e=(await i.e(3114).then(i.bind(i,62129))).getMQTTDeviceActions(this,t);a.push(...e)}if(r.includes("zha")){const e=await i.e(29478).then(i.bind(i,19525)),s=await e.getZHADeviceActions(this,this.hass,t);a.push(...s)}if(r.includes("zwave_js")){const e=await i.e(63597).then(i.bind(i,74524)),s=await e.getZwaveDeviceActions(this,this.hass,t);a.push(...s)}if(r.includes("esphome")){const e=await i.e(81748).then(i.bind(i,46463)),s=await e.getESPHomeDeviceActions(this,this.hass,t);a.push(...s)}if(r.includes("matter")){const s=await i.e(77589).then(i.bind(i,47988)),n=s.getMatterDeviceDefaultActions(this,this.hass,t);a.push(...n),s.getMatterDeviceActions(this,this.hass,t).then(t=>{this.deviceId===e&&(this._deviceActions=[...t,...this._deviceActions||[]])})}this.deviceId===e&&(this._deviceActions=a)}async _getDeviceAlerts(){const e=this.deviceId,t=this.hass.devices[this.deviceId];if(!t)return;const a=[];if(this._integrations(t,this.entries,this.manifests).map(e=>e.domain).includes("zwave_js")){const e=await i.e(19203).then(i.bind(i,10958)),s=await e.getZwaveDeviceAlerts(this.hass,t);a.push(...s)}this.deviceId===e&&(this._deviceAlerts=a,a.length&&(this._deviceAlertsActionsTimeout=window.setTimeout(()=>{this._getDeviceAlerts(),this._getDeviceActions()},de)))}_computeEntityName(e,t){const i=t[this.deviceId];return(0,g.cx)(e,t)||(0,u.T)(i,this.hass.localize,this.hass.states)}_onImageLoad(e){e.target.style.display="inline-block"}_onImageError(e){e.target.style.display="none"}async _findRelated(){this._related=await(0,D.f)(this.hass,"device",this.deviceId)}_showAddToDialog(){const e=this.hass.devices[this.deviceId];if(!e)return;const t=this._entities(this.deviceId,this._entityReg,this.hass.devices).map(e=>e.entity_id),i=(0,O.cJ)(t,this._entityReg,this.hass.states);(0,X.i)(this,{device:e,newTriggersConditions:this._newTriggersConditions,entityIds:i,canCreateScene:(0,c.x)(this.hass.config,"scene")&&i.length>0})}_subscribeLabFeature(){(0,c.x)(this.hass.config,"automation")&&(0,S.CO)(this.hass.connection,"automation","new_triggers_conditions",e=>{this._newTriggersConditions=e.enabled}).then(e=>{this._unsubLabFeature=e})}_renderIntegrationInfo(e,t,a){const s=t.map(e=>e.domain);s.includes("zha")&&(i.e(88330).then(i.bind(i,39057)),a.push(n.qy` <ha-device-info-zha .hass="${this.hass}" .device="${e}"></ha-device-info-zha> `)),s.includes("zwave_js")&&(i.e(314).then(i.bind(i,13153)),a.push(n.qy` <ha-device-info-zwave_js .hass="${this.hass}" .device="${e}"></ha-device-info-zwave_js> `)),s.includes("matter")&&(i.e(62568).then(i.bind(i,20187)),a.push(n.qy` <ha-device-info-matter .hass="${this.hass}" .device="${e}"></ha-device-info-matter> `))}_handleToolbarMenuAction(e){const t=e.detail?.item?.value,i=ce.find(e=>e.value===t);i?(0,m.oo)(`${i.path}?historyBack=1&device=${this.deviceId}`):"reset_entity_ids"===t&&this._resetEntityIds()}async _enableDevice(){await(0,z.FB)(this.hass,this.deviceId,{disabled_by:null})}async _signUrl(e){const t=await(0,M.e0)(this.hass,e);(0,B.R)(t.path)}_deviceActionSelected(e){const t=e.detail?.item?.data;t?.action&&t.action(e)}_deviceActionClicked(e){e.currentTarget.action&&(e.preventDefault(),e.currentTarget.action(e))}static get styles(){return[j.RF,n.AH`.container{display:flex;flex-wrap:wrap;margin:auto;max-width:1000px;margin-top:var(--ha-space-8);margin-bottom:var(--ha-space-8)}:host([narrow]) .container{margin-top:0}.card-header{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--ha-space-3)}.card-header ha-button{margin-right:calc(var(--ha-space-2) * -1);margin-inline-end:calc(var(--ha-space-2) * -1);margin-inline-start:initial;direction:var(--direction)}.section-header{font-size:var(--ha-font-size-s);font-weight:500;color:var(--secondary-text-color);margin:0;padding:var(--ha-space-2) var(--ha-space-4) 0}.device-info{padding:var(--ha-space-4)}h1{margin:0;font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-2xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);opacity:var(--dark-primary-opacity)}.header{display:flex;justify-content:space-between}.header-name{display:flex;align-items:center;padding-left:var(--ha-space-2);padding-inline-start:var(--ha-space-2);padding-inline-end:initial;direction:var(--direction)}.column,.fullwidth{padding:var(--ha-space-2);box-sizing:border-box}.column{width:33%;flex-grow:1}.fullwidth{width:100%;flex-grow:1}.header-right{align-self:center}.header-right img{height:30px}.header-right{display:flex}.header-right:first-child{width:100%;justify-content:flex-end}.header-right>:not(:first-child){margin-left:var(--ha-space-4);margin-inline-start:var(--ha-space-4);margin-inline-end:initial;direction:var(--direction)}.battery{align-self:center;align-items:center;display:flex;white-space:nowrap}.column>:not(:first-child){margin-top:var(--ha-space-4)}:host([narrow]) .column{width:100%}a{text-decoration:none;color:var(--primary-color)}ha-card a{color:var(--primary-text-color)}ha-svg-icon[slot=trailingIcon]{display:block;width:18px;height:18px;margin-inline-start:var(--ha-space-2);margin-inline-end:initial}ha-svg-icon[slot=meta]{width:18px;height:18px}ha-list-item-base ha-icon-next,ha-list-item-button ha-icon-next{color:var(--secondary-text-color);--mdc-icon-size:24px;display:block}ha-card:has(ha-logbook){padding-bottom:var(--ha-card-border-radius,var(--ha-border-radius-lg))}ha-logbook{height:400px}:host([narrow]) ha-logbook{height:235px}.card-content{padding-top:var(--ha-space-2)}.card-content.loading{display:flex;justify-content:center}.card-actions{display:flex;justify-content:space-between;align-items:center;padding:var(--ha-space-1) var(--ha-space-4) var(--ha-space-1) var(--ha-space-1)}`]}constructor(...e){super(...e),this.narrow=!1,this.isWide=!1,this._diagnosticDownloadLinks=[],this._deleteButtons=[],this._deviceActions=[],this._deviceAlerts=[],this._newTriggersConditions=!1,this._entityReg=[],this._logbookTime={recent:86400},this._integrations=(0,l.A)((e,t,i)=>{const a={};for(const e of t)a[e.entry_id]=e;const s={};for(const e of i)s[e.domain]=e;const n=e.config_entries.filter(e=>e in a).map(e=>a[e]);return(0,V.JW)(n,e.primary_config_entry)}),this._entities=(0,l.A)((e,t,i)=>t.filter(t=>t.device_id===e).map(e=>({...e,stateName:this._computeEntityName(e,i)})).sort((e,t)=>(0,b.xL)(e.stateName||`zzz${e.entity_id}`,t.stateName||`zzz${t.entity_id}`,this.hass.locale.language))),this._getEntitiesSorted=e=>e.sort((e,t)=>(0,b.xL)(e.attributes.friendly_name||`zzz${e.entity_id}`,t.attributes.friendly_name||`zzz${t.entity_id}`,this.hass.locale.language)),this._getRelated=(0,l.A)(e=>({automation:this._getEntitiesSorted((e?.automation??[]).map(e=>this.hass.states[e])),scene:this._getEntitiesSorted((e?.scene??[]).map(e=>this.hass.states[e])),script:this._getEntitiesSorted((e?.script??[]).map(e=>this.hass.states[e]))})),this._getQuickLinkCounts=(0,l.A)((e,t)=>({entities:e.length,helpers:e.filter(e=>(0,W.z)((0,p.m)(e.entity_id))).length,automations:t?.automation?.length??0,scenes:t?.scene?.length??0,scripts:t?.script?.length??0})),this._deviceIdInList=(0,l.A)(e=>[e]),this._entityIds=(0,l.A)(e=>e.map(e=>e.entity_id)),this._entitiesByCategory=(0,l.A)(e=>{const t=(0,w.$)(e,e=>{const t=(0,p.m)(e.entity_id);return d.gt.includes(t)?"assist":"event"===t||"notify"===t?t:e.entity_category?e.entity_category:d.JF.includes(t)?"sensor":"control"});for(const e of["assist","config","control","diagnostic","event","notify","sensor"])e in t||(t[e]=[]);return t}),this._batteryEntity=(0,l.A)(e=>(0,I.Er)(this.hass,e)),this._batteryChargingEntity=(0,l.A)(e=>(0,I.DW)(this.hass,e)),this._resetEntityIds=()=>{const e=this._entities(this.deviceId,this._entityReg,this.hass.devices).map(e=>e.entity_id);(0,T._)(this,this.hass,e)},this._showSettings=async()=>{const e=this.hass.devices[this.deviceId];(0,Y._)(this,{device:e,updateEntry:async t=>{const i=e.name_by_user||e.name,a=t.name_by_user;if("user"===t.disabled_by&&"user"!==e.disabled_by){for(const i of e.config_entries)if(!Object.values(this.hass.devices).some(t=>t.id!==e.id&&t.config_entries.includes(i))){const e=this.entries.find(e=>e.entry_id===i);if(e&&!e.disabled_by&&await(0,P.dk)(this,{title:this.hass.localize("ui.panel.config.devices.confirm_disable_config_entry_title"),text:this.hass.localize("ui.panel.config.devices.confirm_disable_config_entry_message",{name:e.title}),destructive:!0,confirmText:this.hass.localize("ui.common.yes"),dismissText:this.hass.localize("ui.common.no")})){let e;try{e=await(0,V.XQ)(this.hass,i)}catch(e){return void(0,P.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.integrations.config_entry.disable_error"),text:e instanceof Error?e.message:String(e)})}e.require_restart&&(0,P.showAlertDialog)(this,{text:this.hass.localize("ui.panel.config.integrations.config_entry.disable_restart_confirm")}),delete t.disabled_by}}}else null!==t.disabled_by&&"user"!==t.disabled_by&&delete t.disabled_by;try{await(0,z.FB)(this.hass,this.deviceId,t)}catch(e){return void(0,P.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.devices.update_device_error"),text:e instanceof Error?e.message:String(e)})}if(!i||!a||i===a)return;const s=this._entities(this.deviceId,this._entityReg,this.hass.devices).map(e=>{const t=e.name||e.stateName;let s;if(!e.has_entity_name||e.name){if(!e.has_entity_name||e.name!==i&&e.name!==a){if(!t?.includes(i))return;s=t.replace(i,a)}else s=null;return(0,I.G_)(this.hass,e.entity_id,{name:s})}});await Promise.all(s)}})},this._voiceAssistantSetup=()=>{(0,F.L)(this,{deviceId:this.deviceId})}}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],he.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],he.prototype,"entries",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],he.prototype,"manifests",void 0),(0,a.Cg)([(0,o.MZ)({attribute:!1})],he.prototype,"deviceId",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],he.prototype,"narrow",void 0),(0,a.Cg)([(0,o.MZ)({attribute:"is-wide",type:Boolean})],he.prototype,"isWide",void 0),(0,a.Cg)([(0,o.wk)()],he.prototype,"_related",void 0),(0,a.Cg)([(0,o.wk)()],he.prototype,"_diagnosticDownloadLinks",void 0),(0,a.Cg)([(0,o.wk)()],he.prototype,"_deleteButtons",void 0),(0,a.Cg)([(0,o.wk)()],he.prototype,"_deviceActions",void 0),(0,a.Cg)([(0,o.wk)()],he.prototype,"_deviceAlerts",void 0),(0,a.Cg)([(0,o.wk)()],he.prototype,"_newTriggersConditions",void 0),(0,a.Cg)([(0,o.wk)(),(0,s.Fg)({context:E.ih,subscribe:!0})],he.prototype,"_entityReg",void 0),he=(0,a.Cg)([(0,o.EM)("ha-config-device-page")],he),t()}catch(e){t(e)}})},99949(e,t,i){i.a(e,async function(e,t){try{i(74423),i(44114),i(18111),i(81148),i(22489),i(20116),i(7588),i(61701),i(13579),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698),i(14603),i(47566),i(98721);var a=i(62826),s=(i(68825),i(88696)),n=i(35211),o=i(5124),r=i(22441),l=i(22786),c=i(93905),d=i(37981),h=i(55931),u=i(69093),p=i(76774),g=i(89020),_=i(91926),v=i(87710),m=i(86171),b=(i(72945),i(38962)),y=i(18350),f=(i(30716),i(29823)),w=(i(70947),i(52190)),$=i(72644),C=i(63817),A=i(138),x=i(64263),H=i(26300),k=(i(82988),i(2514)),L=i(77423),M=i(22792),V=i(77001),E=i(31422),z=i(58594),S=i(59241),q=i(92557),I=i(65063),Z=i(72553),T=i(14503),D=i(44144),O=i(34023),P=i(29303),F=i(25635),N=i(5317),U=i(76559),j=i(69569),W=e([m,b,y,f,w,$,C,A,x,H,Z,N,P]);[m,b,y,f,w,$,C,A,x,H,Z,N,P]=W.then?(await W)():W;const R="M12 2C17.5 2 22 6.5 22 12S17.5 22 12 22 2 17.5 2 12 6.5 2 12 2M12 4C10.1 4 8.4 4.6 7.1 5.7L18.3 16.9C19.3 15.5 20 13.8 20 12C20 7.6 16.4 4 12 4M16.9 18.3L5.7 7.1C4.6 8.4 4 10.1 4 12C4 16.4 7.6 20 12 20C13.9 20 15.6 19.4 16.9 18.3Z",B="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",J="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",K="M7,10L12,15L17,10H7Z",G="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",X="M20 2H4C2.9 2 2 2.9 2 4V20C2 21.11 2.9 22 4 22H20C21.11 22 22 21.11 22 20V4C22 2.9 21.11 2 20 2M4 6L6 4H10.9L4 10.9V6M4 13.7L13.7 4H18.6L4 18.6V13.7M20 18L18 20H13.1L20 13.1V18M20 10.3L10.3 20H5.4L20 5.4V10.3Z";class Y extends o.WF{connectedCallback(){super.connectedCallback(),window.addEventListener("location-changed",this._locationChanged),window.addEventListener("popstate",this._popState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("location-changed",this._locationChanged),window.removeEventListener("popstate",this._popState)}willUpdate(e){super.willUpdate(e),this.hasUpdated||(this._filters=this._storageFilters,this._setFiltersFromUrl()),e.has("_selected")&&(this._selectedCanDelete=this._selected.filter(e=>this.hass.devices[e].config_entries.some(e=>this.entries.find(t=>t.entry_id===e)?.supports_remove_device)))}_setFiltersFromUrl(){const e=this._searchParms.get("area"),t=this._searchParms.get("domain"),i=this._searchParms.get("config_entry"),a=this._searchParms.get("sub_entry"),s=this._searchParms.has("label");(e||t||i||s)&&(this._fromUrl=!0,this._filter=history.state?.filter||"",this._filters={"ha-filter-states":{value:[...this._filters["ha-filter-states"]?.value||[],"disabled"],items:void 0},"ha-filter-floor-areas":{value:e?{areas:[e]}:void 0,items:void 0},"ha-filter-integrations":{value:t?[t]:[],items:void 0},config_entry:{value:i?[i]:[],items:void 0},sub_entry:{value:a?[a]:[],items:void 0}},this._filterLabel())}_filterLabel(){const e=this._searchParms.get("label");e&&(this._filters={...this._filters,"ha-filter-labels":{value:[e],items:void 0}})}_clearFilter(){this._filters={},this._fromUrl||(this._storageFilters={})}render(){const{devicesOutput:e}=this._devicesAndFilterDomains(this.hass.devices,this.entries,this.entities,this.hass.areas,this.manifests,this._filters,this.hass.localize,this._labels),t=this._sizeController.value&&this._sizeController.value<700||!this._sizeController.value&&"docked"===this.hass.dockedSidebar;return o.qy` <hass-tabs-subpage-data-table .hass="${this.hass}" .narrow="${this.narrow}" .backPath="${this._searchParms.has("historyBack")?void 0:"/config"}" .tabs="${F.configSections.devices}" .route="${this.route}" .searchLabel="${this.hass.localize("ui.panel.config.devices.picker.search",{number:e.length})}" .columns="${this._columns(this.hass.localize)}" .data="${e}" selectable .selected="${this._selected.length}" @selection-changed="${this._handleSelectionChanged}" .filter="${this._filter}" has-filters .filters="${Object.values(this._filters).filter(e=>Array.isArray(e.value)?e.value.length:e.value&&Object.values(e.value).some(e=>Array.isArray(e)?e.length:e)).length}" .initialGroupColumn="${this._activeGrouping}" .initialCollapsedGroups="${this._activeCollapsed}" .initialSorting="${this._activeSorting}" .columnOrder="${this._activeColumnOrder}" .hiddenColumns="${this._activeHiddenColumns}" @columns-changed="${this._handleColumnsChanged}" @clear-filter="${this._clearFilter}" @search-changed="${this._handleSearchChange}" @sorting-changed="${this._handleSortingChanged}" @grouping-changed="${this._handleGroupingChanged}" @collapsed-changed="${this._handleCollapseChanged}" @row-click="${this._handleRowClicked}" clickable has-fab class="${this.narrow?"narrow":""}"> <ha-integration-overflow-menu .hass="${this.hass}" slot="toolbar-icon"></ha-integration-overflow-menu> <ha-button slot="fab" size="large" @click="${this._addDevice}"> <ha-svg-icon slot="start" .path="${G}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.devices.add_device")} </ha-button> ${Array.isArray(this._filters.config_entry?.value)&&this._filters.config_entry?.value.length?o.qy`<ha-alert slot="filter-pane"> ${this.hass.localize("ui.panel.config.devices.filtering_by_config_entry")} ${this.entries?.find(e=>e.entry_id===this._filters.config_entry.value[0])?.title||this._filters.config_entry.value[0]}${1===this._filters.config_entry.value.length&&Array.isArray(this._filters.sub_entry?.value)&&this._filters.sub_entry.value.length?o.qy` (${this._subEntries?.find(e=>e.subentry_id===this._filters.sub_entry.value[0])?.title||this._filters.sub_entry.value[0]})`:o.s6} </ha-alert>`:o.s6} <ha-filter-floor-areas .hass="${this.hass}" type="device" .value="${this._filters["ha-filter-floor-areas"]?.value}" @data-table-filter-changed="${this._filterChanged}" slot="filter-pane" .expanded="${"ha-filter-floor-areas"===this._expandedFilter}" .narrow="${this.narrow}" @expanded-changed="${this._filterExpanded}"></ha-filter-floor-areas> <ha-filter-integrations .hass="${this.hass}" .value="${this._filters["ha-filter-integrations"]?.value}" @data-table-filter-changed="${this._filterChanged}" slot="filter-pane" .expanded="${"ha-filter-integrations"===this._expandedFilter}" .narrow="${this.narrow}" @expanded-changed="${this._filterExpanded}"></ha-filter-integrations> <ha-filter-states .hass="${this.hass}" .value="${this._filters["ha-filter-states"]?.value}" .states="${this._states(this.hass.localize)}" .label="${this.hass.localize("ui.panel.config.devices.picker.state")}" @data-table-filter-changed="${this._filterChanged}" slot="filter-pane" .expanded="${"ha-filter-states"===this._expandedFilter}" .narrow="${this.narrow}" @expanded-changed="${this._filterExpanded}"></ha-filter-states> <ha-filter-labels .hass="${this.hass}" .value="${this._filters["ha-filter-labels"]?.value}" @data-table-filter-changed="${this._filterChanged}" slot="filter-pane" .expanded="${"ha-filter-labels"===this._expandedFilter}" .narrow="${this.narrow}" @expanded-changed="${this._filterExpanded}"></ha-filter-labels> ${this.narrow?o.s6:o.qy`<ha-dropdown slot="selection-bar" @wa-select="${this._handleBulkLabel}"> <ha-assist-chip slot="trigger" .label="${this.hass.localize("ui.panel.config.automation.picker.bulk_actions.add_label")}"> <ha-svg-icon slot="trailing-icon" .path="${K}"></ha-svg-icon> </ha-assist-chip> ${this._renderLabelItems()} </ha-dropdown> ${t?o.s6:o.qy`<ha-dropdown slot="selection-bar" @wa-select="${this._handleBulkArea}"> <ha-assist-chip slot="trigger" .label="${this.hass.localize("ui.panel.config.devices.picker.bulk_actions.move_area")}"> <ha-svg-icon slot="trailing-icon" .path="${K}"></ha-svg-icon> </ha-assist-chip> ${this._renderAreaItems()} </ha-dropdown>`}`} <ha-dropdown slot="selection-bar" @wa-select="${this._handleBulkAction}"> ${this.narrow?o.qy`<ha-assist-chip .label="${this.hass.localize("ui.panel.config.automation.picker.bulk_action")}" slot="trigger"> <ha-svg-icon slot="trailing-icon" .path="${K}"></ha-svg-icon> </ha-assist-chip>`:o.qy`<ha-icon-button .path="${J}" .label="${this.hass.localize("ui.panel.config.automation.picker.bulk_action")}" slot="trigger"></ha-icon-button>`} ${this.narrow?o.qy`<ha-dropdown-item> ${this.hass.localize("ui.panel.config.automation.picker.bulk_actions.add_label")} ${this._renderLabelItems("submenu")} </ha-dropdown-item>`:o.s6} ${t?o.qy`<ha-dropdown-item> ${this.hass.localize("ui.panel.config.devices.picker.bulk_actions.move_area")} ${this._renderAreaItems("submenu")} </ha-dropdown-item> <wa-divider></wa-divider>`:o.s6} <ha-dropdown-item value="delete_selected" .disabled="${!this._selectedCanDelete.length}" variant="danger"> <ha-svg-icon slot="icon" .path="${B}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.devices.picker.bulk_actions.delete_selected.button")} </ha-dropdown-item> </ha-dropdown> </hass-tabs-subpage-data-table> `}async _loadSubEntries(e){this._subEntries=await(0,L.t0)(this.hass,e)}_filterExpanded(e){e.detail.expanded?this._expandedFilter=e.target.localName:this._expandedFilter===e.target.localName&&(this._expandedFilter=void 0)}_filterChanged(e){const t=e.target.localName;this._filters={...this._filters,[t]:e.detail},this._fromUrl||(this._storageFilters=this._filters)}_batteryEntity(e,t){const i=(0,S.Er)(this.hass,t[e]||[]);return i?i.entity_id:void 0}_batteryChargingEntity(e,t){const i=(0,S.DW)(this.hass,t[e]||[]);return i?i.entity_id:void 0}_handleRowClicked(e){const t=e.detail.id;this._ignoreLocationChange=!0,(0,_.oo)(`/config/devices/device/${t}`)}_handleSearchChange(e){this._filter=e.detail.value,history.replaceState({filter:this._filter},"")}_addDevice(){const{filteredConfigEntry:e,filteredDomains:t}=this._devicesAndFilterDomains(this.hass.devices,this.entries,this.entities,this.hass.areas,this.manifests,this._filters,this.hass.localize,this._labels);1===t.size&&g.x.includes([...t][0])?(0,g.P)(this,this.hass,[...t][0],{config_entry:e?.entry_id}):(0,U.X)(this,{domain:this._searchParms.get("domain")||void 0,navigateToResult:!0})}_handleSelectionChanged(e){this._selected=e.detail.value}_handleBulkArea(e){const t=e.detail.item.value;"area_create"!==t?"area_no"!==t?this._bulkAddArea(t.substring(5)):this._bulkAddArea(null):this._bulkCreateArea()}async _bulkAddArea(e){const t=[];this._selected.forEach(i=>{t.push((0,z.FB)(this.hass,i,{area_id:e}))});const i=await Promise.allSettled(t);if((0,v.$)(i)){const e=(0,v.N)(i);(0,I.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.common.multiselect.failed",{number:e.length}),text:o.qy`<pre>
${e.map(e=>e.reason.message||e.reason.code||e.reason).join("\r\n")}</pre>`})}}async _handleBulkLabel(e){const t=e.detail.item.value;if("label_create"===t)return void this._bulkCreateLabel();if(!t)return;const i=e.detail.item.action;this._bulkLabel(t.substring(6),i)}async _bulkLabel(e,t){const i=[];this._selected.forEach(a=>{i.push((0,z.FB)(this.hass,a,{labels:"add"===t?this.hass.devices[a].labels.concat(e):this.hass.devices[a].labels.filter(t=>t!==e)}))});const a=await Promise.allSettled(i);if((0,v.$)(a)){const e=(0,v.N)(a);(0,I.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.common.multiselect.failed",{number:e.length}),text:o.qy`<pre>
${e.map(e=>e.reason.message||e.reason.code||e.reason).join("\r\n")}</pre>`})}}_clearSelection(){this._dataTable.clearSelection()}_handleSortingChanged(e){this._activeSorting=e.detail}_handleGroupingChanged(e){this._activeGrouping=e.detail.value}_handleCollapseChanged(e){this._activeCollapsed=e.detail.value}_handleColumnsChanged(e){this._activeColumnOrder=e.detail.columnOrder,this._activeHiddenColumns=e.detail.hiddenColumns}_handleBulkAction(e){const t=e.detail.item.value;t&&("delete_selected"===t&&this._deleteSelected(),t.startsWith("label_")?this._handleBulkLabel(e):t.startsWith("area_")&&this._handleBulkArea(e))}static get styles(){return[o.AH`:host{display:block}hass-tabs-subpage-data-table{--data-table-row-height:60px}hass-tabs-subpage-data-table.narrow{--data-table-row-height:72px}.clear{color:var(--primary-color);padding-left:8px;padding-inline-start:8px;text-transform:uppercase;direction:var(--direction)}ha-assist-chip{--ha-assist-chip-container-shape:10px}ha-dropdown::part(menu),ha-dropdown::part(submenu){--auto-size-available-width:calc(50vw - var(--ha-space-4))}ha-dropdown ha-assist-chip{--md-assist-chip-trailing-space:8px}`,T.RF]}constructor(...e){super(...e),this.narrow=!1,this.isWide=!1,this.entities=[],this._searchParms=new URLSearchParams(window.location.search),this._selected=[],this._selectedCanDelete=[],this._filter=history.state?.filter||"",this._filters={},this._storageFilters={},this._sizeController=new s.P(this,{callback:e=>e[0]?.contentRect.width}),this._ignoreLocationChange=!1,this._fromUrl=!1,this._locationChanged=()=>{this._ignoreLocationChange?this._ignoreLocationChange=!1:window.location.search.substring(1)!==this._searchParms.toString()&&(this._searchParms=new URLSearchParams(window.location.search),this._setFiltersFromUrl())},this._popState=()=>{window.location.search.substring(1)!==this._searchParms.toString()&&(this._searchParms=new URLSearchParams(window.location.search),this._setFiltersFromUrl())},this._states=(0,l.A)(e=>[{value:"disabled",label:e("ui.panel.config.devices.data_table.disabled_by")}]),this._devicesAndFilterDomains=(0,l.A)((e,t,i,a,s,n,o,r)=>{let l=Object.values(e).map(e=>({...e,label_entries:[]}));const c={};for(const e of i)e.device_id&&(e.device_id in c||(c[e.device_id]=[]),c[e.device_id].push(e));const u={};for(const e of t)u[e.entry_id]=e;const g={};for(const e of s)g[e.domain]=e;let _;const v=new Set;Object.entries(n).forEach(([e,i])=>{if("config_entry"===e&&Array.isArray(i.value)&&i.value.length){l=l.filter(e=>e.config_entries.some(e=>i.value.includes(e)));const e=t.filter(e=>e.entry_id&&i.value.includes(e.entry_id));e.forEach(e=>{v.add(e.domain)}),1===e.length&&(_=e[0])}else if("sub_entry"===e&&Array.isArray(i.value)&&i.value.length){if(!Array.isArray(this._filters.config_entry?.value)||1!==this._filters.config_entry.value.length)return;const e=this._filters.config_entry.value[0];l=l.filter(t=>t.config_entries_subentries[e]&&i.value.some(i=>t.config_entries_subentries[e].includes(i))),this._subEntries||this._loadSubEntries(e)}else if("ha-filter-integrations"===e&&Array.isArray(i.value)&&i.value.length){const e=t.filter(e=>i.value.includes(e.domain)).map(e=>e.entry_id);l=l.filter(t=>t.config_entries.some(t=>e.includes(t))),i.value.forEach(e=>v.add(e))}else"ha-filter-labels"===e&&Array.isArray(i.value)&&i.value.length?l=l.filter(e=>e.labels.some(e=>i.value.includes(e))):i.items&&(l=l.filter(e=>i.items.has(e.id)))});const m=n["ha-filter-states"]?.value;m?.length&&m.includes("disabled")||(l=l.filter(e=>!e.disabled_by));return{devicesOutput:l.map(e=>{const t=(0,L.JW)(e.config_entries.filter(e=>e in u).map(e=>u[e]),e.primary_config_entry),i=(r&&e?.labels||[]).map(e=>r.find(t=>t.label_id===e)).filter(e=>void 0!==e),{areaName:s}=(0,E.pq)(e,this.hass.areas,this.hass.devices,this.hass.states,this.hass.localize,this.hass.language,this.hass.translationMetadata,e.via_device_id?c[e.via_device_id]:void 0),n=(0,p.q)(e,a)??(e.via_device_id&&this.hass.devices[e.via_device_id]?(0,p.q)(this.hass.devices[e.via_device_id],a):void 0),l=n?.floor_id,g=l&&this.hass.floors?.[l]?(0,h.X)(this.hass.floors[l]):void 0;return{...e,name:(0,d.T)(e,this.hass.localize,this.hass.states,c[e.id]),model:e.model||`<${o("ui.panel.config.devices.data_table.unknown")}>`,manufacturer:e.manufacturer||`<${o("ui.panel.config.devices.data_table.unknown")}>`,area:s,floor:g,integration:t.length?t.map(e=>o(`component.${e.domain}.title`)||e.domain).join(", "):this.hass.localize("ui.panel.config.devices.data_table.no_integration"),domains:t.map(e=>e.domain),firmware_version:e.sw_version||void 0,battery_entity:[this._batteryEntity(e.id,c),this._batteryChargingEntity(e.id,c)],battery_level:this.hass.states[this._batteryEntity(e.id,c)||""]?.state,label_entries:i}}),filteredConfigEntry:_,filteredDomains:v}}),this._columns=(0,l.A)(e=>({icon:{title:"",label:e("ui.panel.config.devices.data_table.icon"),type:"icon",moveable:!1,showNarrow:!0,template:e=>e.domains.length?o.qy`<img alt="" crossorigin="anonymous" referrerpolicy="no-referrer" src="${(0,D.MR)({domain:e.domains[0],type:"icon",darkOptimized:this.hass.themes?.darkMode},this.hass.auth.data.hassUrl)}">`:""},name:{title:e("ui.panel.config.devices.data_table.device"),main:!0,sortable:!0,filterable:!0,direction:"asc",grows:!0,flex:2,minWidth:"150px",extraTemplate:e=>o.qy` ${e.label_entries.length?o.qy` <ha-data-table-labels .labels="${e.label_entries}"></ha-data-table-labels> `:o.s6} `},area:(0,P.A7)(e),floor:(0,P.f8)(e),integration:{title:e("ui.panel.config.devices.data_table.integration"),sortable:!0,filterable:!0,groupable:!0,minWidth:"120px"},manufacturer:{title:e("ui.panel.config.devices.data_table.manufacturer"),sortable:!0,filterable:!0,groupable:!0,minWidth:"120px"},model:{title:e("ui.panel.config.devices.data_table.model"),sortable:!0,filterable:!0,minWidth:"120px"},firmware_version:{title:e("ui.panel.config.devices.data_table.firmware_version"),sortable:!0,filterable:!0,defaultHidden:!0,minWidth:"120px"},battery_entity:{title:e("ui.panel.config.devices.data_table.battery"),showNarrow:!0,sortable:!0,type:"numeric",maxWidth:"101px",minWidth:"101px",valueColumn:"battery_level",template:e=>{const t=e.battery_entity,i=t&&t[0]?this.hass.states[t[0]]:void 0,a=i?(0,u.t)(i):void 0,s=t&&t[1]?this.hass.states[t[1]]:void 0;return!i||"binary_sensor"!==a&&isNaN(i.state)?"—":o.qy` ${"sensor"===a?this.hass.formatEntityState(i):o.s6} <ha-battery-icon .hass="${this.hass}" .batteryStateObj="${i}" .batteryChargingStateObj="${s}"></ha-battery-icon> `}},created_at:(0,P.oO)(e,this.hass),modified_at:(0,P.Tr)(e,this.hass),disabled_by:{title:e("ui.panel.config.devices.picker.state"),type:"icon",defaultHidden:!0,sortable:!0,filterable:!0,minWidth:"80px",maxWidth:"80px",template:e=>e.disabled_by?o.qy` <div tabindex="0" style="display:inline-block;position:relative"> <ha-svg-icon .id="svg-icon-${e.id}" .path="${R}"></ha-svg-icon> <ha-tooltip .for="svg-icon-${e.id}" placement="left"> ${this.hass.localize("ui.panel.config.entities.picker.status.disabled")} </ha-tooltip> </div> `:"—"},labels:(0,P.AI)()})),this._renderAreaItems=(e="")=>o.qy`${Object.values(this.hass.areas).map(t=>o.qy`<ha-dropdown-item .value="${`area_${t.area_id}`}" .slot="${e}"> ${t.icon?o.qy`<ha-icon slot="icon" .icon="${t.icon}"></ha-icon>`:o.qy`<ha-svg-icon slot="icon" .path="${X}"></ha-svg-icon>`} ${t.name} </ha-dropdown-item>`)} <ha-dropdown-item value="area_no" .slot="${e}"> ${this.hass.localize("ui.panel.config.devices.picker.bulk_actions.no_area")} </ha-dropdown-item> <wa-divider .slot="${e}"></wa-divider> <ha-dropdown-item value="area_create" .slot="${e}"> ${this.hass.localize("ui.panel.config.devices.picker.bulk_actions.add_area")} </ha-dropdown-item>`,this._renderLabelItems=(e="")=>o.qy`${this._labels?.map(t=>{const i=this._selected.every(e=>this.hass.devices[e]?.labels.includes(t.label_id)),a=!i&&this._selected.some(e=>this.hass.devices[e]?.labels.includes(t.label_id));return o.qy`<ha-dropdown-item .slot="${e}" .value="${`label_${t.label_id}`}" .action="${i?"remove":"add"}" keep-open> <ha-checkbox slot="icon" .checked="${i}" .indeterminate="${a}"></ha-checkbox> <ha-label .color="${t.color}" .description="${t.description||void 0}"> ${t.icon?o.qy`<ha-icon slot="icon" .icon="${t.icon}"></ha-icon>`:o.s6} ${t.name} </ha-label> </ha-dropdown-item>`})} <wa-divider .slot="${e}"></wa-divider> <ha-dropdown-item value="label_create" .slot="${e}"> ${this.hass.localize("ui.panel.config.labels.add_label")} </ha-dropdown-item>`,this._bulkCreateArea=()=>{(0,O.J)(this,{createEntry:async e=>{const t=await(0,k.L3)(this.hass,e);return this._bulkAddArea(t.area_id),t}})},this._bulkCreateLabel=()=>{(0,j.f)(this,{createEntry:async e=>{const t=await(0,q._9)(this.hass,e);this._bulkLabel(t.label_id,"add")}})},this._deleteSelected=()=>{(0,I.dk)(this,{title:this.hass.localize("ui.panel.config.devices.picker.bulk_actions.delete_selected.confirm_title"),text:this._selectedCanDelete.length===this._selected.length?this.hass.localize("ui.panel.config.devices.picker.bulk_actions.delete_selected.confirm_text"):this.hass.localize("ui.panel.config.devices.picker.bulk_actions.delete_selected.confirm_partly_text",{deletable:this._selectedCanDelete.length,selected:this._selected.length}),confirmText:this.hass.localize("ui.common.delete"),dismissText:this.hass.localize("ui.common.cancel"),destructive:!0,confirm:async()=>{const e=[];this._selectedCanDelete.forEach(t=>{const i=this.hass.devices[t]?.config_entries;i.forEach(i=>{this.entries.find(e=>e.entry_id===i)?.supports_remove_device&&e.push((0,z.nO)(this.hass,t,i))})});const t=await Promise.allSettled(e);(0,v.$)(t)&&(0,I.showAlertDialog)(this,{text:this.hass.localize("ui.panel.config.devices.picker.bulk_actions.delete_selected.partial_failure"),title:this.hass.localize("ui.panel.config.devices.picker.bulk_actions.delete_selected.partial_failure_title")}),this._clearSelection()}})}}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],Y.prototype,"hass",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean})],Y.prototype,"narrow",void 0),(0,a.Cg)([(0,r.MZ)({attribute:"is-wide",type:Boolean})],Y.prototype,"isWide",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],Y.prototype,"entries",void 0),(0,a.Cg)([(0,r.wk)()],Y.prototype,"_subEntries",void 0),(0,a.Cg)([(0,r.wk)(),(0,n.Fg)({context:M.ih,subscribe:!0})],Y.prototype,"entities",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],Y.prototype,"manifests",void 0),(0,a.Cg)([(0,r.MZ)({attribute:!1})],Y.prototype,"route",void 0),(0,a.Cg)([(0,r.wk)()],Y.prototype,"_searchParms",void 0),(0,a.Cg)([(0,r.wk)()],Y.prototype,"_selected",void 0),(0,a.Cg)([(0,r.P)("hass-tabs-subpage-data-table",!0)],Y.prototype,"_dataTable",void 0),(0,a.Cg)([(0,r.wk)(),(0,c.I)({storage:"sessionStorage",key:"devices-table-search",state:!0,subscribe:!1})],Y.prototype,"_filter",void 0),(0,a.Cg)([(0,r.wk)()],Y.prototype,"_filters",void 0),(0,a.Cg)([(0,c.I)({storage:"sessionStorage",key:"devices-table-filters-full",state:!1,subscribe:!1,serializer:V.iS,deserializer:V.Dc})],Y.prototype,"_storageFilters",void 0),(0,a.Cg)([(0,r.wk)()],Y.prototype,"_expandedFilter",void 0),(0,a.Cg)([(0,n.Fg)({context:M.HD,subscribe:!0}),(0,r.wk)()],Y.prototype,"_labels",void 0),(0,a.Cg)([(0,c.I)({key:"devices-table-sort",state:!1,subscribe:!1})],Y.prototype,"_activeSorting",void 0),(0,a.Cg)([(0,c.I)({key:"devices-table-grouping",state:!1,subscribe:!1})],Y.prototype,"_activeGrouping",void 0),(0,a.Cg)([(0,c.I)({key:"devices-table-collapsed",state:!1,subscribe:!1})],Y.prototype,"_activeCollapsed",void 0),(0,a.Cg)([(0,c.I)({key:"devices-table-column-order",state:!1,subscribe:!1})],Y.prototype,"_activeColumnOrder",void 0),(0,a.Cg)([(0,c.I)({key:"devices-table-hidden-columns",state:!1,subscribe:!1})],Y.prototype,"_activeHiddenColumns",void 0),Y=(0,a.Cg)([(0,r.EM)("ha-config-devices-dashboard")],Y),t()}catch(e){t(e)}})},73692(e,t,i){i.a(e,async function(e,a){try{i.r(t);var s=i(62826),n=i(22441),o=i(77423),r=i(95350),l=i(324),c=i(98129),d=i(99949),h=e([c,d]);[c,d]=h.then?(await h)():h;class u extends l.a{firstUpdated(e){super.firstUpdated(e),this._loadData()}updatePageEl(e){e.hass=this.hass,"device"===this._currentPage&&(e.deviceId=this.routeTail.path.substr(1)),e.entries=this._configEntries,e.manifests=this._manifests,e.narrow=this.narrow,e.isWide=this.isWide,e.route=this.routeTail}async _loadData(){this._configEntries=await(0,o.VN)(this.hass),this._manifests=await(0,r.fK)(this.hass)}constructor(...e){super(...e),this.narrow=!1,this.isWide=!1,this.routerOptions={defaultPage:"dashboard",routes:{dashboard:{tag:"ha-config-devices-dashboard",cache:!0},device:{tag:"ha-config-device-page"}}},this._configEntries=[],this._manifests=[]}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean})],u.prototype,"narrow",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"is-wide",type:Boolean})],u.prototype,"isWide",void 0),(0,s.Cg)([(0,n.wk)()],u.prototype,"_configEntries",void 0),(0,s.Cg)([(0,n.wk)()],u.prototype,"_manifests",void 0),u=(0,s.Cg)([(0,n.EM)("ha-config-devices")],u),a()}catch(e){a(e)}})},40747(e,t,i){i.d(t,{KT:()=>v,Bi:()=>_,ZI:()=>g,Yp:()=>m});i(74423),i(44114),i(18111),i(22489),i(20116),i(7588),i(61701),i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);var a=i(46190),s=i(71727),n=i(69093),o=i(28978);var r=i(79461),l=i(52220),c=i(95350),d=i(28669),h=i(24367);const u=new Set(["ai_task","automation","configurator","device_tracker","event","geo_location","notify","persistent_notification","script","sun","tag","todo","zone",...a.gt]),p=new Set(["backup","mobile_app"]),g=(e,t)=>({type:"grid",cards:e.map(e=>({type:"tile",entity:e,show_entity_picture:["camera","image","person"].includes((0,s.m)(e))||void 0})),...t}),_=(e,t,i,n=!0)=>{const c=[],d=e.states,h=[],u=i.title?i.title.toLowerCase():void 0,p=[];for(const e of t){const t=d[e],i=(0,s.m)(e);if("alarm_control_panel"===i){const t={type:"alarm-panel",entity:e};c.push(t)}else if("camera"===i){const t={type:"picture-entity",entity:e};c.push(t)}else if("image"===i){const t={type:"picture",image_entity:e};c.push(t)}else if("climate"===i){const t={type:"thermostat",entity:e,features:(d[e]?.attributes?.hvac_modes?.length??0)>1?[{type:"climate-hvac-modes",hvac_modes:d[e]?.attributes?.hvac_modes}]:void 0};c.push(t)}else if("humidifier"===i){const t={type:"humidifier",entity:e,features:[{type:"humidifier-toggle"}]};c.push(t)}else if("media_player"===i){const t={type:"media-control",entity:e};c.push(t)}else if("plant"===i){const t={type:"plant-status",entity:e};c.push(t)}else if("weather"===i){const t={type:"weather-forecast",entity:e,show_forecast:!1};c.push(t)}else if(!n||"scene"!==i&&"script"!==i){let i;const a=u&&t&&(i=(0,r.p)((0,o.u)(t),u))?{entity:e,name:i}:e;h.push(a)}else{const i={entity:e,show_icon:!0,show_name:!0};let a;u&&t&&(a=(0,r.p)((0,o.u)(t),u))&&(i.name=a),p.push(i)}}if(h.sort((t,i)=>{const n="string"==typeof t?t:t.entity,r="string"==typeof i?i:i.entity,c=a.JF.includes((0,s.m)(n))?"sensor":"control";return c!==(a.JF.includes((0,s.m)(r))?"sensor":"control")?"sensor"===c?1:-1:(0,l.xL)("string"==typeof t?d[t]?(0,o.u)(d[t]):"":d[t.entity]?e.formatEntityName(d[t.entity],t.name):"","string"==typeof i?d[i]?(0,o.u)(d[i]):"":d[i.entity]?e.formatEntityName(d[i.entity],i.name):"")}),0===h.length&&p.length>0)return _(e,t,i,!1);if(h.length>0||p.length>0){const e={type:"entities",entities:h,...i};p.length>0&&(e.footer={type:"buttons",entities:p}),c.unshift(e)}return c.length<2?c:[{type:"grid",square:!1,columns:1,cards:c}]},v=(e,t)=>{const i=[];for(const e of t){const t={type:"entity",entity:e};i.push(t)}return i},m=(e,t,i,a,r,g)=>{const v=e.states,m=e.areas,b=e.devices,y=e.entities,f=((e,t)=>{const i={},a=new Set(Object.values(t).filter(e=>e.entity_category||e.platform&&p.has(e.platform)||e.hidden).map(e=>e.entity_id));for(const t of Object.keys(e)){const s=e[t];u.has((0,n.t)(s))||a.has(s.entity_id)||(i[t]=e[t])}return i})(v,y),w={};for(const e of Object.keys(f)){const t=f[e];t.attributes.order&&(w[e]=t.attributes.order)}const $=((e,t,i,a)=>{const s={...a},n={},o={};for(const a of Object.values(i)){const i=a.area_id||a.device_id&&t[a.device_id]?.area_id;i&&i in e&&a.entity_id in s?(i in n||(n[i]=[]),n[i].push(s[a.entity_id]),delete s[a.entity_id]):a.device_id&&a.device_id in t&&a.entity_id in s&&(a.device_id in o||(o[a.device_id]=[]),o[a.device_id].push(s[a.entity_id]),delete s[a.entity_id])}for(const[e,t]of Object.entries(o))1===t.length&&(s[t[0].entity_id]=t[0],delete o[e]);return{areasWithEntities:n,devicesWithEntities:o,otherEntities:s}})(m,b,y,f);if(a?.hidden)for(const e of a.hidden)delete $.areasWithEntities[e];r&&($.devicesWithEntities={},$.otherEntities={});const C=(e=>{const t=[],i={};return Object.keys(e).forEach(a=>{const n=e[a];"group"===(0,s.m)(a)?t.push(n):i[a]=n}),t.forEach(e=>e.attributes.entity_id.forEach(e=>{delete i[e]})),{groups:t,ungrouped:i}})($.otherEntities);C.groups.sort((e,t)=>w[e.entity_id]-w[t.entity_id]);const A=[];for(const t of C.groups)A.push(..._(e,t.attributes.entity_id,{title:(0,o.u)(t),show_header_toggle:"hidden"!==t.attributes.control}));const x=((e,t,i,a,s,r)=>{const u={},{localize:p}=e;for(const e of Object.keys(r)){const t=r[e],i=(0,n.t)(t);i in u||(u[i]=[]),u[i].push(t.entity_id)}const g=[];if("person"in u){const e=[];if(1===u.person.length)g.push({type:"entities",entities:u.person});else{let t,i="";for(const a of u.person){const s=r[a];let n=s.attributes.entity_picture;if(!n){if(void 0===t){const e=getComputedStyle(document.body);t=encodeURIComponent(e.getPropertyValue("--light-primary-color").trim()),i=encodeURIComponent((e.getPropertyValue("--text-light-primary-color")||e.getPropertyValue("--primary-text-color")).trim())}n=`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50' width='50' height='50' style='background-color:${t}'%3E%3Cg%3E%3Ctext font-family='roboto' x='50%25' y='50%25' text-anchor='middle' stroke='${i}' font-size='1.3em' dy='.3em'%3E${(0,d._2)(s.attributes.friendly_name||"")}%3C/text%3E%3C/g%3E%3C/svg%3E`}e.push({type:"picture-entity",entity:a,aspect_ratio:"1",show_name:!1,image:n})}g.push({type:"grid",square:!0,columns:3,cards:e})}delete u.person}const v=[];for(const e of h.L)e in u&&(v.push(...u[e]),delete u[e]);const m={};for(const e of Object.keys(u))m[e]=(0,c.p$)(p,e);v.length&&(u._helpers=v,m._helpers=p("ui.panel.lovelace.strategy.original-states.helpers")),Object.keys(u).sort((e,t)=>(0,l.xL)(m[e],m[t])).forEach(t=>{g.push(..._(e,u[t].sort((e,t)=>(0,l.xL)((0,o.u)(r[e]),(0,o.u)(r[t]))),{title:m[t]}))});const b={path:t,title:i,cards:g};return a&&(b.icon=a),s&&(b.show_icon_and_title=s),b})(e,"default_view","Home",void 0,void 0,C.ungrouped),H=[],k=Object.keys(m);if(a?.order){const e=a.order;k.sort((0,l.u1)(e))}for(const t of k){if(!(t in $.areasWithEntities))continue;const i=$.areasWithEntities[t],a=m[t];H.push(..._(e,i.map(e=>e.entity_id),{title:a.name}))}const L=[],M=Object.entries($.devicesWithEntities).sort((e,t)=>{const i=b[e[0]],a=b[t[0]];return(0,l.xL)(i.name_by_user||i.name||"",a.name_by_user||a.name||"")});for(const[i,a]of M){const s=b[i];L.push(..._(e,a.map(e=>e.entity_id),{title:s.name_by_user||s.name||t("ui.panel.config.devices.unnamed_device",{type:t(`ui.panel.config.devices.type.${s.entry_type||"device"}`)})}))}let V;if(i&&!g){const e=i.energy_sources.find(e=>"grid"===e.type);e&&e.stat_energy_from&&(V={title:t("ui.panel.lovelace.cards.energy.energy_distribution.title_today"),type:"energy-distribution",link_dashboard:!0})}return x.cards.unshift(...H,...A,...V?[V]:[]),x.cards.push(...L),x}},20939(e,t,i){i.d(t,{L:()=>s});i(18111),i(61701);var a=i(78649);const s=(e,t=!0)=>{if(!e||!Array.isArray(e))throw new Error("Entities need to be an array");return e.map((e,i)=>{if("object"==typeof e&&!Array.isArray(e)&&e.type)return e;let s;if("string"==typeof e)s={entity:e};else{if("object"!=typeof e||Array.isArray(e))throw new Error(`Invalid entity ID at position ${i}`);if(!("entity"in e))throw new Error(`Object at position ${i} is missing entity field`);s=e}if(t&&!(0,a.n)(s.entity))throw new Error(`Invalid entity ID at position ${i}: ${s.entity}`);return s})}},34128(e,t,i){i.d(t,{G9:()=>o,Ni:()=>n,Ue:()=>d,Vd:()=>h,gh:()=>u});i(74423);var a=i(1087),s=i(45291);const n=e=>{const t=document.createElement("hui-error-card");return customElements.get("hui-error-card")?t.setConfig(e):(Promise.resolve().then(i.bind(i,4397)),customElements.whenDefined("hui-error-card").then(()=>{customElements.upgrade(t),t.setConfig(e)})),t},o=(e,t)=>({type:"error",error:e,origConfig:t}),r=(e,t)=>{const i=document.createElement(e);return i.setConfig(t),i},l=(e,t,a)=>"badge"===e?(e=>{const t=document.createElement("hui-error-badge");return customElements.get("hui-error-badge")?t.setConfig(e):(Promise.all([i.e(92769),i.e(3283),i.e(72130),i.e(85010),i.e(67218),i.e(58416),i.e(99788),i.e(22398),i.e(82134),i.e(26092),i.e(34310),i.e(59704),i.e(25322),i.e(90790),i.e(89747),i.e(59532),i.e(36332),i.e(77563),i.e(15862),i.e(99143),i.e(41344),i.e(12009),i.e(66990),i.e(3025),i.e(38108),i.e(66006),i.e(38260)]).then(i.bind(i,50655)),customElements.whenDefined("hui-error-badge").then(()=>{customElements.upgrade(t),t.setConfig(e)})),t})(o(t,a)):"heading-badge"===e?(e=>{const t=document.createElement("hui-error-heading-badge");return customElements.get("hui-error-heading-badge")?t.setConfig(e):(Promise.all([i.e(92769),i.e(3283),i.e(72130),i.e(85010),i.e(67218),i.e(58416),i.e(99788),i.e(22398),i.e(82134),i.e(26092),i.e(34310),i.e(59704),i.e(25322),i.e(90790),i.e(89747),i.e(59532),i.e(36332),i.e(77563),i.e(15862),i.e(99143),i.e(41344),i.e(12009),i.e(66990),i.e(3025),i.e(38108),i.e(66006),i.e(21614)]).then(i.bind(i,13469)),customElements.whenDefined("hui-error-heading-badge").then(()=>{customElements.upgrade(t),t.setConfig(e)})),t})(((e,t)=>({type:"error",error:e,origConfig:t}))(t,a)):n({type:"error",message:t}),c=e=>(0,s.c8)(e)?(0,s.Iu)(e):void 0,d=(e,t,i,a,s,n)=>{try{return h(e,t,i,a,s,n)}catch(i){return console.error(e,t.type,i),l(e,i.message,t)}},h=(e,t,i,s,n,o)=>{if(!t||"object"!=typeof t)throw new Error("Config is not an object");if(!(t.type||o||n&&"entity"in t))throw new Error("No card type configured");const d=t.type?c(t.type):void 0;if(d)return((e,t,i)=>{if(customElements.get(t))return r(t,i);const s=l(e,`Custom element doesn't exist: ${t}.`,i);if(!t.includes("-"))return s;s.style.display="None";const n=window.setTimeout(()=>{s.style.display=""},2e3);return customElements.whenDefined(t).then(()=>{clearTimeout(n),(0,a.r)(s,"ll-rebuild")}),s})(e,d,t);let h;if(n&&!t.type&&t.entity){h=`${n[t.entity.split(".",1)[0]]||n._domain_not_found}-entity`}else h=t.type||o;if(void 0===h)throw new Error("No type specified");const u=`hui-${h}-${e}`;if(s&&h in s)return s[h](),((e,t)=>{if(customElements.get(e))return r(e,t);const i=document.createElement(e);return customElements.whenDefined(e).then(()=>{try{customElements.upgrade(i),(0,a.r)(i,"ll-upgrade"),i.setConfig(t)}catch(e){(0,a.r)(i,"ll-rebuild")}}),i})(u,t);if(i&&i.has(h))return r(u,t);throw new Error(`Unknown type encountered: ${h}`)},u=async(e,t,i,a)=>{const s=c(e);if(s){const e=customElements.get(s);if(e)return e;if(!s.includes("-"))throw new Error(`Custom element not found: ${s}`);return new Promise((e,t)=>{setTimeout(()=>t(new Error(`Custom element not found: ${s}`)),2e3),customElements.whenDefined(s).then(()=>e(customElements.get(s)))})}const n=`hui-${e}-${t}`,o=customElements.get(n);if(i&&i.has(e))return o;if(a&&e in a)return o||a[e]().then(()=>customElements.get(n));throw new Error(`Unknown type: ${e}`)}},94225(e,t,i){i.a(e,async function(e,a){try{i.d(t,{T:()=>y,t:()=>f});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);var s=i(99799),n=i(29003),o=i(92055),r=i(19396),l=i(74323),c=i(51199),d=i(43721),h=i(65509),u=i(21659),p=i(82525),g=i(34128),_=e([s,n,o,r,l,c,d,h,u,p]);[s,n,o,r,l,c,d,h,u,p]=_.then?(await _)():_;const v=new Set(["media-player-entity","scene-entity","script-entity","sensor-entity","simple-entity","toggle-entity","button","call-service"]),m={"button-entity":()=>i.e(26846).then(i.bind(i,21869)),"climate-entity":()=>i.e(56995).then(i.bind(i,2798)),"cover-entity":()=>i.e(41243).then(i.bind(i,79734)),"date-entity":()=>i.e(17418).then(i.bind(i,75473)),"datetime-entity":()=>Promise.all([i.e(99194),i.e(81767)]).then(i.bind(i,69690)),"event-entity":()=>Promise.resolve().then(i.bind(i,99799)),"group-entity":()=>i.e(68827).then(i.bind(i,53110)),"input-button-entity":()=>i.e(19825).then(i.bind(i,46472)),"humidifier-entity":()=>i.e(378).then(i.bind(i,53537)),"input-datetime-entity":()=>i.e(71748).then(i.bind(i,1391)),"input-number-entity":()=>i.e(17600).then(i.bind(i,58723)),"input-select-entity":()=>i.e(44325).then(i.bind(i,54596)),"input-text-entity":()=>i.e(8086).then(i.bind(i,51765)),"lock-entity":()=>i.e(28245).then(i.bind(i,49748)),"number-entity":()=>i.e(71523).then(i.bind(i,57198)),"select-entity":()=>i.e(9374).then(i.bind(i,78157)),"text-entity":()=>i.e(67973).then(i.bind(i,58212)),"time-entity":()=>i.e(61331).then(i.bind(i,87550)),"timer-entity":()=>i.e(94097).then(i.bind(i,6344)),"update-entity":()=>i.e(80275).then(i.bind(i,38238)),"valve-entity":()=>i.e(96654).then(i.bind(i,46493)),conditional:()=>Promise.all([i.e(67218),i.e(77563),i.e(78490)]).then(i.bind(i,80725)),"weather-entity":()=>Promise.all([i.e(12009),i.e(77547)]).then(i.bind(i,80395)),divider:()=>i.e(45249).then(i.bind(i,38584)),section:()=>i.e(51255).then(i.bind(i,39082)),weblink:()=>i.e(69148).then(i.bind(i,65751)),cast:()=>i.e(10405).then(i.bind(i,96612)),buttons:()=>i.e(50777).then(i.bind(i,65728)),attribute:()=>Promise.resolve().then(i.bind(i,65509)),text:()=>i.e(95421).then(i.bind(i,3980))},b={_domain_not_found:"simple",alert:"toggle",automation:"toggle",button:"button",climate:"climate",cover:"cover",date:"date",datetime:"datetime",event:"event",fan:"toggle",group:"group",humidifier:"humidifier",input_boolean:"toggle",input_button:"input-button",input_datetime:"input-datetime",input_number:"input-number",input_select:"input-select",input_text:"input-text",light:"toggle",lock:"lock",media_player:"media-player",number:"number",remote:"toggle",scene:"scene",script:"script",select:"select",sensor:"sensor",siren:"toggle",switch:"toggle",text:"text",time:"time",timer:"timer",update:"update",vacuum:"toggle",valve:"valve",water_heater:"climate",weather:"weather"},y=e=>(0,g.Ue)("row",e,v,m,b,void 0),f=e=>(0,g.gh)(e,"row",v,m);a()}catch(e){a(e)}})},70384(e,t,i){i.a(e,async function(e,a){try{i.d(t,{g:()=>c});var s=i(42017),n=i(71727),o=i(94225),r=e([o]);o=(r.then?(await r)():r)[0];class l extends s.WL{render(e,t,i){return!this._element||this._entityId!==e&&(0,n.m)(e)!==(0,n.m)(this._entityId)?this._element=(0,o.T)({entity:e,name:t}):this._entityId===e&&this._name===t||this._element.setConfig?.({entity:e,name:t}),this._entityId=e,this._name=t,this._element.hass=i,this._element}}const c=(0,s.u$)(l);a()}catch(e){a(e)}})},88438(e,t,i){i.d(t,{C:()=>a});const a="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}};