UNPKG

iobroker.lovelace

Version:

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

19 lines 25.5 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[56740],{64481:function(e,t,i){i.d(t,{D:function(){return o},J:function(){return s}});i(16280),i(3362),i(55815),i(64979),i(79739);let a=!1;try{a="true"===window.localStorage.getItem("disableViewTransition")}catch(l){}const o=e=>{a=e},r=e=>{if(!(e=>(e instanceof DOMException||e instanceof Error)&&"AbortError"===e.name)(e))throw e},s=e=>{if(!document.startViewTransition||a)return e(!1),Promise.resolve();let t=!1;try{const i=document.startViewTransition(()=>{t=!0,e(!0)});return i.ready.catch(r),i.finished.catch(r)}catch(i){return console.warn("View transition failed, falling back to direct execution.",i),t?Promise.reject(i):(e(!1),Promise.resolve())}}},93444:function(e,t,i){var a=i(40445),o=i(5124),r=i(67576);let s,l,n=e=>e;class d extends o.WF{render(){return(0,o.qy)(s||(s=n` <footer> <slot name="secondaryAction"></slot> <slot name="primaryAction"></slot> </footer> `))}static get styles(){return[(0,o.AH)(l||(l=n`footer{display:flex;gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`))]}}d=(0,a.Cg)([(0,r.EM)("ha-dialog-footer")],d)},76538:function(e,t,i){i(62953);var a=i(40445),o=i(5124),r=i(67576);let s,l,n,d,h,c,p=e=>e;class u extends o.WF{render(){const e=(0,o.qy)(s||(s=p`<div class="header-title"> <slot name="title"></slot> </div>`)),t=(0,o.qy)(l||(l=p`<div class="header-subtitle"> <slot name="subtitle"></slot> </div>`));return(0,o.qy)(n||(n=p` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> ${0} </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `),"above"===this.subtitlePosition?(0,o.qy)(d||(d=p`${0}${0}`),t,e):(0,o.qy)(h||(h=p`${0}${0}`),e,t))}static get styles(){return[(0,o.AH)(c||(c=p`:host{display:block}:host([show-border]){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.header-bar{display:flex;flex-direction:row;align-items:center;padding:0 var(--ha-space-1);box-sizing:border-box}.header-content{flex:1;padding:10px var(--ha-space-1);display:flex;flex-direction:column;justify-content:center;min-height:var(--ha-space-12);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.header-title{height:var(--ha-dialog-header-title-height,calc(var(--ha-font-size-xl) + var(--ha-space-1)));font-size:var(--ha-font-size-xl);line-height:var(--ha-line-height-condensed);font-weight:var(--ha-font-weight-medium);color:var(--ha-dialog-header-title-color,var(--primary-text-color))}.header-subtitle{font-size:var(--ha-font-size-m);line-height:var(--ha-line-height-normal);color:var(--ha-dialog-header-subtitle-color,var(--secondary-text-color))}@media all and (min-width:450px) and (min-height:500px){.header-bar{padding:0 var(--ha-space-2)}}.header-navigation-icon{flex:none;min-width:var(--ha-space-2);height:100%;display:flex;flex-direction:row}.header-action-items{flex:none;min-width:var(--ha-space-2);height:100%;display:flex;flex-direction:row}`))]}constructor(...e){super(...e),this.subtitlePosition="below",this.showBorder=!1}}(0,a.Cg)([(0,r.MZ)({type:String,attribute:"subtitle-position"})],u.prototype,"subtitlePosition",void 0),(0,a.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"show-border"})],u.prototype,"showBorder",void 0),u=(0,a.Cg)([(0,r.EM)("ha-dialog-header")],u)},72554:function(e,t,i){i.a(e,async function(e,t){try{i(3362),i(62953),i(49255);var a=i(40445),o=i(93900),r=i(35211),s=i(5124),l=i(67576),n=i(63672),d=i(1087),h=i(64481),c=i(22792),p=i(59992),u=i(14503),v=i(22348),g=(i(76538),i(26300)),f=e([o,g,p]);[o,g,p]=f.then?(await f)():f;let m,b,_,y,w,x,C,S=e=>e;const k="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z";class E extends((0,p.V)(s.WF)){connectedCallback(){super.connectedCallback(),this.addEventListener("dialog-set-fullscreen",this._handleFullscreenChanged)}get scrollableElement(){return this.bodyContainer}updated(e){super.updated(e),e.has("open")&&(this._open=this.open)}render(){var e,t,i;return(0,s.qy)(m||(m=S` <wa-dialog .open="${0}" .lightDismiss="${0}" without-header aria-labelledby="${0}" aria-describedby="${0}" @keydown="${0}" @wa-hide="${0}" @wa-show="${0}" @wa-after-show="${0}" @wa-after-hide="${0}"> ${0} <div class="content-wrapper"> <div class="body ha-scrollbar" @scroll="${0}"> <slot></slot> </div> ${0} </div> <slot name="footer" slot="footer"></slot> </wa-dialog> `),this._open,!this.preventScrimClose,(0,n.J)(this.ariaLabelledBy||(void 0!==this.headerTitle?"ha-dialog-title":void 0)),(0,n.J)(this.ariaDescribedBy),this._handleKeyDown,this._handleHide,this._handleShow,this._handleAfterShow,this._handleAfterHide,this.withoutHeader?s.s6:(0,s.qy)(b||(b=S`<slot name="header"> <ha-dialog-header .subtitlePosition="${0}" .showBorder="${0}"> <slot name="headerNavigationIcon" slot="navigationIcon"> <ha-icon-button data-dialog="close" .label="${0}" .path="${0}"></ha-icon-button> </slot> ${0} ${0} <slot name="headerActionItems" slot="actionItems"></slot> </ha-dialog-header> </slot>`),this.headerSubtitlePosition,this._bodyScrolled,null!==(e=null===(t=this._i18n)||void 0===t||null===(i=t.localize)||void 0===i?void 0:i.call(t,"ui.common.close"))&&void 0!==e?e:"Close",k,void 0!==this.headerTitle?(0,s.qy)(_||(_=S`<span slot="title" class="title" id="ha-dialog-title"> ${0} </span>`),this.headerTitle):(0,s.qy)(y||(y=S`<slot name="headerTitle" slot="title"></slot>`)),void 0!==this.headerSubtitle?(0,s.qy)(w||(w=S`<span slot="subtitle">${0}</span>`),this.headerSubtitle):(0,s.qy)(x||(x=S`<slot name="headerSubtitle" slot="subtitle"></slot>`))),this._handleBodyScroll,this.renderScrollableFades())}disconnectedCallback(){this.removeEventListener("dialog-set-fullscreen",this._handleFullscreenChanged),this._setFullscreen(!1),super.disconnectedCallback(),this._open=!1}_handleFullscreenChanged(e){this._open?(0,h.J)(()=>{this._setFullscreen(e.detail)}):this._setFullscreen(e.detail)}_setFullscreen(e){this.toggleAttribute("fullscreen",e)}_handleBodyScroll(e){this._bodyScrolled=e.target.scrollTop>0}_handleKeyDown(e){"Escape"===e.key&&(this._escapePressed=!0,this.preventScrimClose&&e.preventDefault(),e.stopPropagation(),e.currentTarget.open=!1)}_handleHide(e){var t;const i=(null===(t=e.detail)||void 0===t?void 0:t.source)===e.target.dialog;this.preventScrimClose&&this._escapePressed&&i&&e.preventDefault(),this._escapePressed=!1}static get styles(){return[...super.styles,u.dp,(0,s.AH)(C||(C=S`wa-dialog{--full-width:var( --ha-dialog-width-full, min(95vw, var(--safe-width)) );--width:min(var(--ha-dialog-width-md, 580px), var(--full-width));--spacing:var(--dialog-content-padding, var(--ha-space-6));--show-duration:var(--ha-dialog-show-duration, 200ms);--hide-duration:var(--ha-dialog-hide-duration, 200ms);--wa-color-surface-raised:var( --ha-dialog-surface-background, var(--card-background-color, var(--ha-color-surface-default)) );--wa-panel-border-radius:var( --ha-dialog-border-radius, var(--ha-border-radius-3xl) );max-width:var(--ha-dialog-max-width,var(--safe-width))}@media (prefers-reduced-motion:reduce){wa-dialog{--show-duration:0ms;--hide-duration:0ms}}:host([width=small]) wa-dialog{--width:min(var(--ha-dialog-width-sm, 320px), var(--full-width))}:host([width=large]) wa-dialog{--width:min(var(--ha-dialog-width-lg, 1024px), var(--full-width))}:host([fullscreen]) wa-dialog,:host([width=full]) wa-dialog{--width:var(--full-width)}:host([fullscreen]) wa-dialog::part(dialog){min-height:var(--safe-height);max-height:var(--safe-height);margin-top:0;transform:none}:host([fullscreen]) .content-wrapper{overflow:hidden}:host([fullscreen]) .body{overflow:hidden;padding:0}wa-dialog::part(dialog){-webkit-backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);box-shadow:var(--dialog-box-shadow,var(--wa-shadow-l));color:var(--primary-text-color);min-width:var(--width,var(--full-width));max-width:var(--width,var(--full-width));max-height:var(--ha-dialog-max-height,calc(var(--safe-height) - var(--ha-space-20)));min-height:var(--ha-dialog-min-height);margin-top:var(--dialog-surface-margin-top,auto);transform:translate(calc(var(--safe-area-offset-left,0px) - var(--safe-area-offset-right,0px)),calc(var(--safe-area-offset-top,0px) - var(--safe-area-offset-bottom,0px)));display:flex;flex-direction:column;overflow:hidden}wa-dialog::part(dialog)::backdrop{-webkit-backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));background-color:var(--mdc-dialog-scrim-color,none)}@media all and (max-width:450px),all and (max-height:500px){:host([type=standard]){--ha-dialog-border-radius:0}:host([type=standard]) wa-dialog{--full-width:var(--ha-dialog-width-full, 100vw);--width:var(--full-width)}:host([type=standard]) wa-dialog::part(dialog){min-height:var(--ha-dialog-min-height,100vh);min-height:var(--ha-dialog-min-height,100dvh);max-height:var(--ha-dialog-max-height,100vh);max-height:var(--ha-dialog-max-height,100dvh);margin-top:0;margin-bottom:0;padding-top:var(--safe-area-inset-top);padding-bottom:var(--safe-area-inset-bottom);padding-left:var(--safe-area-inset-left);padding-right:var(--safe-area-inset-right);transform:none}}.header-title-container{display:flex;align-items:center}.header-title{margin:0;margin-bottom:0;color:var(--ha-dialog-header-title-color,var(--primary-text-color));font-size:var( --ha-dialog-header-title-font-size, var(--ha-font-size-2xl) );line-height:var( --ha-dialog-header-title-line-height, var(--ha-line-height-condensed) );font-weight:var(--ha-dialog-header-title-font-weight,var(--ha-font-weight-normal));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-right:var(--ha-space-3)}wa-dialog::part(body){padding:0;display:flex;flex-direction:column;max-width:100%;overflow:hidden}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{position:var(--dialog-content-position,relative);padding:var(--dialog-content-padding,0 var(--ha-space-6) var(--ha-space-6) var(--ha-space-6));overflow:auto;flex-grow:1}:host([flexcontent]) .body{max-width:100%;flex:1;display:flex;flex-direction:column}wa-dialog::part(footer){padding:0}::slotted([slot=footer]){display:flex;padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4) var(--ha-space-4);gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`))]}constructor(...e){super(...e),this.open=!1,this.type="standard",this.width="medium",this.preventScrimClose=!1,this.headerSubtitlePosition="below",this.flexContent=!1,this.withoutHeader=!1,this._open=!1,this._bodyScrolled=!1,this._escapePressed=!1,this._handleShow=async e=>{e.eventPhase===Event.AT_TARGET&&(this._open=!0,(0,d.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{var e,t;if(null!==(e=this._hassConfig)&&void 0!==e&&e.auth.external&&(0,v.V)(this._hassConfig.auth.external)){const e=this.querySelector("[autofocus]");return void(null!==e&&(e.id||(e.id="ha-dialog-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:e.id}})))}null===(t=this.querySelector("[autofocus]"))||void 0===t||t.focus()}))},this._handleAfterShow=e=>{e.eventPhase===Event.AT_TARGET&&(0,d.r)(this,"after-show")},this._handleAfterHide=e=>{e.eventPhase===Event.AT_TARGET&&(this._open=!1,this._setFullscreen(!1),(0,d.r)(this,"closed"))}}}(0,a.Cg)([(0,l.MZ)({attribute:"aria-labelledby"})],E.prototype,"ariaLabelledBy",void 0),(0,a.Cg)([(0,l.MZ)({attribute:"aria-describedby"})],E.prototype,"ariaDescribedBy",void 0),(0,a.Cg)([(0,l.MZ)({type:Boolean,reflect:!0})],E.prototype,"open",void 0),(0,a.Cg)([(0,l.MZ)({reflect:!0})],E.prototype,"type",void 0),(0,a.Cg)([(0,l.MZ)({type:String,reflect:!0,attribute:"width"})],E.prototype,"width",void 0),(0,a.Cg)([(0,l.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],E.prototype,"preventScrimClose",void 0),(0,a.Cg)([(0,l.MZ)({attribute:"header-title"})],E.prototype,"headerTitle",void 0),(0,a.Cg)([(0,l.MZ)({attribute:"header-subtitle"})],E.prototype,"headerSubtitle",void 0),(0,a.Cg)([(0,l.MZ)({type:String,attribute:"header-subtitle-position"})],E.prototype,"headerSubtitlePosition",void 0),(0,a.Cg)([(0,l.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],E.prototype,"flexContent",void 0),(0,a.Cg)([(0,l.MZ)({type:Boolean,attribute:"without-header"})],E.prototype,"withoutHeader",void 0),(0,a.Cg)([(0,l.wk)()],E.prototype,"_open",void 0),(0,a.Cg)([(0,l.P)(".body")],E.prototype,"bodyContainer",void 0),(0,a.Cg)([(0,l.wk)(),(0,r.Fg)({context:c.D5,subscribe:!0})],E.prototype,"_i18n",void 0),(0,a.Cg)([(0,l.wk)(),(0,r.Fg)({context:c.WF,subscribe:!0})],E.prototype,"_hassConfig",void 0),(0,a.Cg)([(0,l.wk)()],E.prototype,"_bodyScrolled",void 0),(0,a.Cg)([(0,l.Ls)({passive:!0})],E.prototype,"_handleBodyScroll",null),E=(0,a.Cg)([(0,l.EM)("ha-dialog")],E),t()}catch(m){t(m)}})},65829:function(e,t,i){i.a(e,async function(e,a){try{i.r(t),i.d(t,{HaSpinner:function(){return c}});var o=i(40445),r=i(55262),s=i(5124),l=i(67576),n=e([r]);r=(n.then?(await n)():n)[0];let d,h=e=>e;class c extends r.A{updated(e){if(super.updated(e),e.has("size"))switch(this.size){case"tiny":this.style.setProperty("--ha-spinner-size","16px");break;case"small":this.style.setProperty("--ha-spinner-size","28px");break;case"medium":this.style.setProperty("--ha-spinner-size","48px");break;case"large":this.style.setProperty("--ha-spinner-size","68px");break;case void 0:this.style.removeProperty("--ha-progress-ring-size")}}static get styles(){return[r.A.styles,(0,s.AH)(d||(d=h`:host{--indicator-color:var( --ha-spinner-indicator-color, var(--primary-color) );--track-color:var(--ha-spinner-divider-color, var(--divider-color));--track-width:4px;--speed:3.5s;font-size:var(--ha-spinner-size, 48px)}`))]}}(0,o.Cg)([(0,l.MZ)()],c.prototype,"size",void 0),c=(0,o.Cg)([(0,l.EM)("ha-spinner")],c),a()}catch(d){a(d)}})},59992:function(e,t,i){i.a(e,async function(e,a){try{i.d(t,{V:function(){return v}});i(62953);var o=i(40445),r=i(88696),s=i(5124),l=i(6412),n=i(67576),d=e([r]);r=(d.then?(await d)():d)[0];let h,c,p=e=>e;const u=e=>void 0===e?[]:Array.isArray(e)?e:[e],v=e=>{class t extends e{get scrollableElement(){return t.DEFAULT_SCROLLABLE_ELEMENT}firstUpdated(e){var t;null===(t=super.firstUpdated)||void 0===t||t.call(this,e),this.scrollableElement&&this._updateScrollableState(this.scrollableElement),this._attachScrollableElement()}updated(e){var t;null===(t=super.updated)||void 0===t||t.call(this,e),this._attachScrollableElement()}disconnectedCallback(){this._detachScrollableElement(),this._contentScrolled=!1,this._contentScrollable=!1,super.disconnectedCallback()}renderScrollableFades(e=!1){return(0,s.qy)(h||(h=p` <div class="${0}"></div> <div class="${0}"></div> `),(0,l.H)({"fade-top":!0,rounded:e,visible:this._contentScrolled}),(0,l.H)({"fade-bottom":!0,rounded:e,visible:this._contentScrollable}))}static get styles(){var e;const t=Object.getPrototypeOf(this);return[...u(null!==(e=null==t?void 0:t.styles)&&void 0!==e?e:[]),(0,s.AH)(c||(c=p`.fade-bottom,.fade-top{position:absolute;left:0;right:0;height:var(--ha-space-2);pointer-events:none;transition:opacity 180ms ease-in-out;border-radius:var(--ha-border-radius-square);opacity:0;background:linear-gradient(to bottom,var(--ha-color-shadow-scrollable-fade),transparent)}.fade-top{top:0}.fade-bottom{bottom:0;transform:rotate(180deg)}.fade-bottom.visible,.fade-top.visible{opacity:1}.fade-bottom.rounded,.fade-top.rounded{border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border-bottom-left-radius:var(--ha-border-radius-square);border-bottom-right-radius:var(--ha-border-radius-square)}.fade-top.rounded{border-top-left-radius:var(--ha-border-radius-square);border-top-right-radius:var(--ha-border-radius-square)}.fade-bottom.rounded{border-bottom-left-radius:var(--ha-border-radius-square);border-bottom-right-radius:var(--ha-border-radius-square)}`))]}_attachScrollableElement(){const e=this.scrollableElement;e!==this._scrollTarget&&(this._detachScrollableElement(),e&&(this._scrollTarget=e,e.addEventListener("scroll",this._onScroll,{passive:!0}),this._resize.observe(e),this._updateScrollableState(e)))}_detachScrollableElement(){var e,t;this._scrollTarget&&(this._scrollTarget.removeEventListener("scroll",this._onScroll),null===(e=(t=this._resize).unobserve)||void 0===e||e.call(t,this._scrollTarget),this._scrollTarget=void 0)}_updateScrollableState(e){const t=parseFloat(getComputedStyle(e).getPropertyValue("--safe-area-inset-bottom"))||0,{scrollHeight:i=0,clientHeight:a=0,scrollTop:o=0}=e;this._contentScrollable=i-a>o+t+this.scrollFadeSafeAreaPadding}constructor(...e){super(...e),this._contentScrolled=!1,this._contentScrollable=!1,this._onScroll=e=>{var t;const i=e.currentTarget;this._contentScrolled=(null!==(t=i.scrollTop)&&void 0!==t?t:0)>this.scrollFadeThreshold,this._updateScrollableState(i)},this._resize=new r.P(this,{target:null,callback:e=>{var t;const i=null===(t=e[0])||void 0===t?void 0:t.target;i&&this._updateScrollableState(i)}}),this.scrollFadeSafeAreaPadding=4,this.scrollFadeThreshold=4}}return t.DEFAULT_SCROLLABLE_ELEMENT=null,(0,o.Cg)([(0,n.wk)()],t.prototype,"_contentScrolled",void 0),(0,o.Cg)([(0,n.wk)()],t.prototype,"_contentScrollable",void 0),t};a()}catch(h){a(h)}})},81199:function(e,t,i){i.a(e,async function(e,a){try{i.r(t);i(74423),i(18111),i(22489),i(7588),i(61701),i(13579),i(3362),i(42762),i(62953);var o=i(40445),r=i(5124),s=i(67576),l=i(1087),n=i(18350),d=i(72554),h=(i(93444),i(26300)),c=i(36866),p=(i(86698),i(83492),i(65829)),u=i(84621),v=i(14503),g=i(85614),f=e([n,d,h,c,p]);[n,d,h,c,p]=f.then?(await f)():f;let m,b,_,y,w,x,C,S,k,E=e=>e;const $="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z";class A extends r.WF{showDialog(e){this._params=e,this._deviceEndpoints=[],this._filter="",this._group=void 0,this._selectedDevicesToAdd=[],this._open=!0,this._fetchData()}closeDialog(){return!this._processingAdd&&(this._open=!1,!0)}_dialogClosed(){this._params=void 0,this._deviceEndpoints=[],this._filter="",this._group=void 0,this._loading=!1,this._processingAdd=!1,this._selectedDevicesToAdd=[],this._virtualizerReady=!1,(0,l.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params)return r.s6;const e=this._filteredDeviceEndpoints,t=this._availableDeviceEndpoints.length>5||this._filter;return(0,r.qy)(m||(m=E` <ha-dialog .open="${0}" header-title="${0}" ?prevent-scrim-close="${0}" @after-show="${0}" @closed="${0}"> <ha-icon-button slot="headerNavigationIcon" .label="${0}" .path="${0}" .disabled="${0}" @click="${0}"></ha-icon-button> <div class="content"> ${0} </div> <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click="${0}" .disabled="${0}"> ${0} </ha-button> <ha-button slot="primaryAction" .disabled="${0}" .loading="${0}" @click="${0}"> ${0} </ha-button> </ha-dialog-footer> </ha-dialog> `),this._open,this.hass.localize("ui.panel.config.zha.groups.add_members"),this._selectedDevicesToAdd.length>0,this._loadVirtualizer,this._dialogClosed,this.hass.localize("ui.common.close"),$,this._processingAdd,this.closeDialog,this._loading?this._renderLoadingSpinner():(0,r.qy)(b||(b=E` ${0} <div class="list-container"> ${0} </div> `),t?(0,r.qy)(_||(_=E` <ha-input-search appearance="outlined" .value="${0}" @input="${0}"></ha-input-search> `),this._filter,this._handleFilterChanged):r.s6,e.length?(0,r.qy)(y||(y=E` ${0} `),this._virtualizerReady?(0,r.qy)(w||(w=E` <ha-list-selectable multi @ha-list-selected="${0}"> <lit-virtualizer scroller class="ha-scrollbar" .items="${0}" .renderItem="${0}" .keyFunction="${0}"></lit-virtualizer> </ha-list-selectable> `),this._handleSelected,e,this._renderDeviceEndpoint,this._keyFunction):this._renderLoadingSpinner()):(0,r.qy)(x||(x=E` <div class="empty-list"> ${0} </div> `),this._filter?this.hass.localize("ui.panel.config.zha.groups.no_devices_found"):this.hass.localize("ui.panel.config.zha.groups.no_devices_to_add"))),this.closeDialog,this._processingAdd,this.hass.localize("ui.common.cancel"),this._loading||!this._selectedDevicesToAdd.length||this._processingAdd,this._processingAdd,this._addMembersToGroup,this.hass.localize("ui.panel.config.zha.groups.add_members"))}_renderLoadingSpinner(){return(0,r.qy)(C||(C=E` <div class="spinner-container"> <ha-spinner size="medium"></ha-spinner> </div> `))}get _availableDeviceEndpoints(){return this._group?this._deviceEndpoints.filter(e=>!this._group.members.some(t=>t.device.ieee===e.device.ieee&&t.endpoint_id===e.endpoint_id)):[]}get _filteredDeviceEndpoints(){const e=this._filter.trim().toLowerCase(),t=this._availableDeviceEndpoints;return e?t.filter(t=>[this._deviceEndpointName(t),this._deviceEndpointDetails(t),t.device.ieee,t.device.manufacturer,t.device.model].filter(Boolean).some(t=>t.toLowerCase().includes(e))):t}async _loadVirtualizer(){await(0,g.i)(),this._virtualizerReady=!0}_deviceEndpointId(e){return`${e.device.ieee}_${e.endpoint_id}`}_deviceEndpointName(e){return e.device.user_given_name||e.device.name}_deviceEndpointDetails(e){var t;const i=e.entities.map(e=>e.name||e.original_name||e.entity_id),a=i.length?i.length>2?`${i.slice(0,2).join(", ")} +${i.length-2}`:i.join(", "):this.hass.localize("ui.panel.config.zha.groups.no_entities");return[e.device.area_id?null===(t=this.hass.areas[e.device.area_id])||void 0===t?void 0:t.name:void 0,`${this.hass.localize("ui.panel.config.zha.groups.endpoint")} ${e.endpoint_id}`,a].filter(Boolean).join(" · ")}async _fetchData(){const e=++this._fetchDataToken;this._loading=!0;const[t,i]=await Promise.all([(0,u.Ui)(this.hass,this._params.groupId),(0,u.zt)(this.hass)]);e===this._fetchDataToken&&this._params&&(this._group=t,this._deviceEndpoints=i,this._loading=!1)}_handleFilterChanged(e){this._filter=e.currentTarget.value}_handleSelected(e){var t,i;const a=e.currentTarget;let o=this._selectedDevicesToAdd;null===(t=e.detail.diff)||void 0===t||t.added.forEach(e=>{const t=a.items[e];null!=t&&t.value&&!o.includes(t.value)&&(o=[...o,t.value])}),null===(i=e.detail.diff)||void 0===i||i.removed.forEach(e=>{const t=a.items[e];null!=t&&t.value&&(o=o.filter(e=>e!==t.value))}),this._selectedDevicesToAdd=o}async _addMembersToGroup(){this._processingAdd=!0;try{const e=this._selectedDevicesToAdd.map(e=>{const t=e.split("_");return{ieee:t[0],endpoint_id:t[1]}}),t=await(0,u.hi)(this.hass,this._params.groupId,e);this._params.devicesAddedCallback(t),this._processingAdd=!1,this.closeDialog()}finally{this._processingAdd=!1}}static get styles(){return[v.dp,(0,r.AH)(S||(S=E`ha-dialog{--dialog-content-padding:0}.content{display:flex;flex-direction:column;height:min(520px,calc(100vh - 240px))}ha-input-search{display:block;margin:0 var(--ha-space-4) var(--ha-space-2)}ha-list-selectable{display:block;width:100%;height:100%}ha-list-selectable::part(base){width:100%;height:100%}.list-container{flex:1 1 auto;width:100%;min-height:0;overflow:hidden}lit-virtualizer{display:block;width:100%;height:100%;contain:size layout!important}ha-list-item-option{display:block;width:100%;height:64px;box-sizing:border-box;--ha-row-item-min-height:64px}.spinner-container{display:flex;flex:1 1 auto;align-items:center;justify-content:center;min-height:160px}ha-spinner{display:block}.empty-list{padding:var(--ha-space-6);color:var(--secondary-text-color);text-align:center}`))]}constructor(...e){super(...e),this._deviceEndpoints=[],this._filter="",this._loading=!1,this._open=!1,this._processingAdd=!1,this._selectedDevicesToAdd=[],this._virtualizerReady=!1,this._fetchDataToken=0,this._keyFunction=e=>this._deviceEndpointId(e),this._renderDeviceEndpoint=e=>{const t=this._deviceEndpointId(e);return(0,r.qy)(k||(k=E` <ha-list-item-option appearance="checkbox" .value="${0}" .selected="${0}"> <span slot="headline">${0}</span> <span slot="supporting-text"> ${0} </span> </ha-list-item-option> `),t,this._selectedDevicesToAdd.includes(t),this._deviceEndpointName(e),this._deviceEndpointDetails(e))}}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],A.prototype,"hass",void 0),(0,o.Cg)([(0,s.wk)()],A.prototype,"_deviceEndpoints",void 0),(0,o.Cg)([(0,s.wk)()],A.prototype,"_filter",void 0),(0,o.Cg)([(0,s.wk)()],A.prototype,"_group",void 0),(0,o.Cg)([(0,s.wk)()],A.prototype,"_loading",void 0),(0,o.Cg)([(0,s.wk)()],A.prototype,"_open",void 0),(0,o.Cg)([(0,s.wk)()],A.prototype,"_params",void 0),(0,o.Cg)([(0,s.wk)()],A.prototype,"_processingAdd",void 0),(0,o.Cg)([(0,s.wk)()],A.prototype,"_selectedDevicesToAdd",void 0),(0,o.Cg)([(0,s.wk)()],A.prototype,"_virtualizerReady",void 0),A=(0,o.Cg)([(0,s.EM)("dialog-zha-add-group-members")],A),a()}catch(m){a(m)}})},85614:function(e,t,i){i.d(t,{i:function(){return a}});i(3362),i(62953);const a=async()=>{await Promise.all([i.e(38085),i.e(22309)]).then(i.bind(i,40772))}},22348:function(e,t,i){i.d(t,{V:function(){return o}});var a=i(37177);const o=e=>!!e&&a.n},37177:function(e,t,i){i.d(t,{n:function(){return a}});i(27495);const a=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}}]);