UNPKG

iobroker.lovelace

Version:

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

10 lines 44.7 kB
export const __rspack_esm_id=90108;export const __rspack_esm_ids=[90108];export const __webpack_modules__={66033(e,t,a){a.d(t,{L:()=>i});const i=(e,t)=>{const a=e.floor_id;return{area:e,floor:(a?t[a]:void 0)||null}}},60353(e,t,a){a.d(t,{u:()=>i});class i{start(e){const t=Date.now();this._startY=e,this._startTime=t,this._lastY=e,this._lastTime=t,this._delta=0}move(e){const t=Date.now();return this._delta=this._startY-e,this._lastY=e,this._lastTime=t,this._delta}end(){const e=this.getVelocity(),t=Math.abs(e)>this._velocityThreshold;return{velocity:e,delta:this._delta,isSwipe:t,isDownwardSwipe:e>0}}getDelta(){return this._delta}getVelocity(){if(Date.now()-this._lastTime>=this._movementTimeThreshold)return 0;const e=this._lastTime-this._startTime;return e>0?(this._lastY-this._startY)/e:0}reset(){this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0}constructor(e={}){this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0,this._velocityThreshold=e.velocitySwipeThreshold??.5,this._movementTimeThreshold=e.movementTimeThreshold??100}}},14693(e,t,a){a.a(e,async function(e,i){try{a.d(t,{r:()=>m});var o=a(62826),s=a(35211),r=a(5124),n=a(22441),l=a(71769),d=a(22792),h=a(99611),c=(a(76538),a(26300)),p=a(72554),u=e([h,c,p]);[h,c,p]=u.then?(await u)():u;const b="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",g="(max-width: 870px), (max-height: 500px)";class m extends r.WF{connectedCallback(){super.connectedCallback(),this._unsubMediaQuery=(0,l.m)(g,e=>{this._modeSet&&!this.allowModeChange||(this.mode=e?"bottom-sheet":"dialog",this._modeSet=!0)})}get _defaultAriaLabelledBy(){return this.ariaLabelledBy||(void 0!==this.headerTitle?"ha-dialog-title":void 0)}_renderCloseButton(e){return this.hideCloseButton?r.qy`<span slot="${e}"></span>`:r.qy` <slot name="headerNavigationIcon" slot="${e}"> <ha-icon-button data-dialog="close" .label="${this._i18n?.localize?.("ui.common.close")??"Close"}" .path="${b}"></ha-icon-button> </slot> `}_renderHeaderContent(){return r.qy` <ha-dialog-header .subtitlePosition="${this.headerSubtitlePosition}"> ${this._renderCloseButton("navigationIcon")} ${void 0!==this.headerTitle?r.qy`<span slot="title" class="title" id="ha-dialog-title"> ${this.headerTitle} </span>`:r.qy`<slot name="headerTitle" slot="title"></slot>`} ${void 0!==this.headerSubtitle?r.qy`<span slot="subtitle">${this.headerSubtitle}</span>`:r.qy`<slot name="headerSubtitle" slot="subtitle"></slot>`} <slot name="headerActionItems" slot="actionItems"></slot> </ha-dialog-header> `}disconnectedCallback(){super.disconnectedCallback(),this._unsubMediaQuery?.(),this._unsubMediaQuery=void 0,this._modeSet=!1}render(){return"bottom-sheet"===this.mode?r.qy` <ha-bottom-sheet .ariaLabelledBy="${this._defaultAriaLabelledBy}" .ariaDescribedBy="${this.ariaDescribedBy}" .flexContent="${this.flexContent}" .open="${this.open}" .preventScrimClose="${this.preventScrimClose}"> ${this.withoutHeader?r.s6:r.qy` <slot name="header" slot="header">${this._renderHeaderContent()}</slot> `} <slot></slot> <slot name="footer" slot="footer"></slot> </ha-bottom-sheet> `:r.qy` <ha-dialog .open="${this.open}" .type="${this.type}" .width="${this.width}" .preventScrimClose="${this.preventScrimClose}" .ariaLabelledBy="${this.ariaLabelledBy}" .ariaDescribedBy="${this.ariaDescribedBy}" .headerTitle="${this.headerTitle}" .headerSubtitle="${this.headerSubtitle}" .headerSubtitlePosition="${this.headerSubtitlePosition}" .flexContent="${this.flexContent}" .withoutHeader="${this.withoutHeader}"> ${this._renderCloseButton("headerNavigationIcon")} <slot name="headerTitle" slot="headerTitle"></slot> <slot name="headerSubtitle" slot="headerSubtitle"></slot> <slot name="headerActionItems" slot="headerActionItems"></slot> <slot></slot> <slot name="footer" slot="footer"></slot> </ha-dialog> `}static get styles(){return[r.AH`ha-bottom-sheet{--ha-bottom-sheet-border-radius:var(--ha-border-radius-2xl);--ha-bottom-sheet-surface-background:var( --ha-dialog-surface-background, var(--card-background-color, var(--ha-color-surface-default)) );--ha-bottom-sheet-padding:0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left);--ha-bottom-sheet-content-padding:var( --dialog-content-padding, 0 var(--ha-space-6) var(--ha-space-6) var(--ha-space-6) )}`]}constructor(...e){super(...e),this.open=!1,this.type="standard",this.width="medium",this.preventScrimClose=!1,this.headerSubtitlePosition="below",this.allowModeChange=!1,this.withoutHeader=!1,this.hideCloseButton=!1,this.flexContent=!1,this.mode="dialog",this._modeSet=!1}}(0,o.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],m.prototype,"ariaLabelledBy",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],m.prototype,"ariaDescribedBy",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],m.prototype,"open",void 0),(0,o.Cg)([(0,n.MZ)({reflect:!0})],m.prototype,"type",void 0),(0,o.Cg)([(0,n.MZ)({type:String,reflect:!0,attribute:"width"})],m.prototype,"width",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],m.prototype,"preventScrimClose",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"header-title"})],m.prototype,"headerTitle",void 0),(0,o.Cg)([(0,n.MZ)({attribute:"header-subtitle"})],m.prototype,"headerSubtitle",void 0),(0,o.Cg)([(0,n.MZ)({type:String,attribute:"header-subtitle-position"})],m.prototype,"headerSubtitlePosition",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"allow-mode-change"})],m.prototype,"allowModeChange",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"without-header"})],m.prototype,"withoutHeader",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"hide-close-button"})],m.prototype,"hideCloseButton",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],m.prototype,"flexContent",void 0),(0,o.Cg)([(0,n.wk)()],m.prototype,"mode",void 0),(0,o.Cg)([(0,n.wk)(),(0,s.Fg)({context:d.D5,subscribe:!0})],m.prototype,"_i18n",void 0),m=(0,o.Cg)([(0,n.EM)("ha-adaptive-dialog")],m),i()}catch(e){i(e)}})},66086(e,t,a){a.a(e,async function(e,t){try{a(74423),a(18111),a(22489),a(61701);var i=a(62826),o=a(5124),s=a(22441),r=a(22786),n=a(1087),l=a(65522),d=a(55931),h=a(66033),c=a(49852),p=a(2514),u=a(65063),b=a(34023),g=(a(75064),a(38508)),m=a(26300),v=(a(67094),e([g,m]));[g,m]=v.then?(await v)():v;const y="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",_="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",f="___ADD_NEW___";class w extends o.WF{willUpdate(e){this._pendingAreaId&&e.has("hass")&&this.hass.areas!==e.get("hass")?.areas&&this.hass.areas[this._pendingAreaId]&&(this._setValue(this._pendingAreaId),this._pendingAreaId=void 0)}async open(){await this.updateComplete,await(this._picker?.open())}render(){const e=this.label??this.hass.localize("ui.components.area-picker.area"),t=this._computeValueRenderer(this.hass.areas);let a=e;if(this.value&&e){const e=this.hass.areas[this.value];if(e){const{floor:t}=(0,h.L)(e,this.hass.floors);t&&(a=void 0)}}return o.qy` <ha-generic-picker .hass="${this.hass}" .autofocus="${this.autofocus}" .label="${a}" .helper="${this.helper}" .notFoundLabel="${this._notFoundLabel}" .emptyLabel="${this.hass.localize("ui.components.area-picker.no_areas")}" .disabled="${this.disabled}" .required="${this.required}" .value="${this.value}" .getItems="${this._getItems}" .getAdditionalItems="${this._getAdditionalItems}" .valueRenderer="${t}" .addButtonLabel="${this.addButtonLabel}" .searchKeys="${c.P}" .unknownItemText="${this.hass.localize("ui.components.area-picker.unknown")}" @value-changed="${this._valueChanged}"> </ha-generic-picker> `}_valueChanged(e){e.stopPropagation();const t=e.detail.value;if(t){if(t.startsWith(f)){this.hass.loadFragmentTranslation("config");const e=t.substring(f.length);return void(0,b.J)(this,{suggestedName:e,createEntry:async e=>{try{const t=await(0,p.L3)(this.hass,e);this.hass.areas[t.area_id]?this._setValue(t.area_id):this._pendingAreaId=t.area_id}catch(e){(0,u.showAlertDialog)(this,{title:this.hass.localize("ui.components.area-picker.failed_create_area"),text:e.message})}}})}this._setValue(t)}else this._setValue(void 0)}_setValue(e){this.value=e,(0,n.r)(this,"value-changed",{value:e}),(0,n.r)(this,"change")}constructor(...e){super(...e),this.noAdd=!1,this.disabled=!1,this.required=!1,this._getAreasMemoized=(0,r.A)(c.j),this._computeValueRenderer=(0,r.A)(e=>e=>{const t=this.hass.areas[e];if(!t)return o.qy` <ha-svg-icon slot="start" .path="${_}"></ha-svg-icon> <span slot="headline">${t}</span> `;const{floor:a}=(0,h.L)(t,this.hass.floors),i=t?(0,l.A)(t):void 0,s=a?(0,d.X)(a):void 0,r=t.icon;return o.qy` ${r?o.qy`<ha-icon slot="start" .icon="${r}"></ha-icon>`:o.qy`<ha-svg-icon slot="start" .path="${_}"></ha-svg-icon>`} <span slot="headline">${i}</span> ${s?o.qy`<span slot="supporting-text">${s}</span>`:o.s6} `}),this._getItems=()=>this._getAreasMemoized(this.hass.areas,this.hass.floors,this.hass.devices,this.hass.entities,this.hass.states,this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.excludeAreas),this._allAreaNames=(0,r.A)(e=>Object.values(e).map(e=>(0,l.A)(e)?.toLowerCase()).filter(Boolean)),this._getAdditionalItems=e=>{if(this.noAdd)return[];const t=this._allAreaNames(this.hass.areas);return e&&!t.includes(e.toLowerCase())?[{id:f+e,primary:this.hass.localize("ui.components.area-picker.add_new_suggestion",{name:e}),icon_path:y}]:[{id:f,primary:this.hass.localize("ui.components.area-picker.add_new"),icon_path:y}]},this._notFoundLabel=e=>this.hass.localize("ui.components.area-picker.no_match",{term:o.qy`<b>‘${e}’</b>`})}}(0,i.Cg)([(0,s.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)()],w.prototype,"label",void 0),(0,i.Cg)([(0,s.MZ)()],w.prototype,"value",void 0),(0,i.Cg)([(0,s.MZ)()],w.prototype,"helper",void 0),(0,i.Cg)([(0,s.MZ)()],w.prototype,"placeholder",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"no-add"})],w.prototype,"noAdd",void 0),(0,i.Cg)([(0,s.MZ)({type:Array,attribute:"include-domains"})],w.prototype,"includeDomains",void 0),(0,i.Cg)([(0,s.MZ)({type:Array,attribute:"exclude-domains"})],w.prototype,"excludeDomains",void 0),(0,i.Cg)([(0,s.MZ)({type:Array,attribute:"include-device-classes"})],w.prototype,"includeDeviceClasses",void 0),(0,i.Cg)([(0,s.MZ)({type:Array,attribute:"exclude-areas"})],w.prototype,"excludeAreas",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],w.prototype,"deviceFilter",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],w.prototype,"entityFilter",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],w.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],w.prototype,"required",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"add-button-label"})],w.prototype,"addButtonLabel",void 0),(0,i.Cg)([(0,s.P)("ha-generic-picker")],w.prototype,"_picker",void 0),(0,i.Cg)([(0,s.wk)()],w.prototype,"_pendingAreaId",void 0),w=(0,i.Cg)([(0,s.EM)("ha-area-picker")],w),t()}catch(e){t(e)}})},99611(e,t,a){a.a(e,async function(e,t){try{a(18111),a(13579),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);var i=a(62826),o=a(1126),s=a(35211),r=a(5124),n=a(22441),l=a(1087),d=a(60353),h=a(22792),c=a(59992),p=a(14503),u=a(22348),b=e([o]);o=(b.then?(await b)():b)[0];const g=300,m=new Set(["ha-control-slider","ha-slider","ha-control-switch","ha-control-circular-slider","ha-hs-color-picker","ha-map","ha-more-info-control-select-container","ha-filter-chip"]),v=new Set(["volume-slider-container","forecast"]);class y extends((0,c.V)(r.WF)){get scrollableElement(){return this._bodyElement}connectedCallback(){super.connectedCallback(),this.addEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.addEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0})}updated(e){super.updated(e),e.has("open")&&(this._drawerOpen=this.open)}render(){return r.qy` <wa-drawer id="drawer" placement="bottom" .open="${this._drawerOpen}" .lightDismiss="${!this.preventScrimClose}" .ariaLabelledby="${this.ariaLabelledBy}" .ariaDescribedby="${this.ariaDescribedBy}" @keydown="${this._handleKeyDown}" @wa-show="${this._handleShow}" @wa-after-show="${this._handleAfterShow}" @wa-hide="${this._handleHide}" @wa-after-hide="${this._handleAfterHide}" @click="${this._handleCloseAction}" without-header @touchstart="${this._handleTouchStart}"> <div class="handle-wrapper" aria-hidden="true"> <div class="handle"></div> </div> <slot name="header"></slot> <div class="content-wrapper"> <div id="body" class="body ha-scrollbar"> <slot></slot> </div> ${this.renderScrollableFades()} </div> <slot name="footer"></slot> </wa-drawer> `}_startResizing(e){document.addEventListener("touchmove",this._handleTouchMove,{passive:!1}),document.addEventListener("touchend",this._handleTouchEnd),document.addEventListener("touchcancel",this._handleTouchEnd),this._gestureRecognizer.start(e)}_animateSnapBack(){this.style.setProperty("--dialog-transition",`transform ${g}ms ease-out`),this.style.removeProperty("--dialog-transform"),setTimeout(()=>{this.style.removeProperty("--dialog-transition")},g)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.removeEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0}),this._unregisterResizeHandlers(),this._isDragging=!1}static get styles(){return[...super.styles,p.dp,r.AH`wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:${g}ms;--hide-duration:${g}ms}wa-drawer::part(dialog){max-height:min(var(--ha-bottom-sheet-max-height,90vh),calc(100vh - max(var(--safe-area-inset-top),48px)));max-height:min(var(--ha-bottom-sheet-max-height,90dvh),calc(100dvh - max(var(--safe-area-inset-top),48px)));align-items:center;transform:var(--dialog-transform);transition:var(--dialog-transition)}@media (prefers-reduced-motion:reduce){wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:1ms;--hide-duration:1ms}wa-drawer::part(dialog){transition:1ms}}wa-drawer::part(dialog)::backdrop{-webkit-backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));background-color:var(--ha-bottom-sheet-scrim-color,var(--mdc-dialog-scrim-color,none))}wa-drawer::part(body){max-width:var(--ha-bottom-sheet-max-width);width:100%;position:relative;border-top-left-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));border-top-right-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));background-color:var(--ha-bottom-sheet-surface-background,var(--ha-dialog-surface-background,var(--card-background-color,var(--ha-color-surface-default))));-webkit-backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));padding:var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left))}:host([flexcontent]) wa-drawer::part(body){display:flex;flex-direction:column}:host([prevent-scrim-close]) .handle-wrapper{display:none}.handle-wrapper{position:absolute;top:0;inset-inline-start:0;width:100%;padding-bottom:2px;display:flex;justify-content:center;align-items:center;pointer-events:none;z-index:1}.handle-wrapper .handle{height:16px;width:200px;display:flex;justify-content:center;align-items:center}.handle-wrapper .handle::after{content:"";border-radius:var(--ha-border-radius-md);height:4px;background:var(--ha-bottom-sheet-handle-color,var(--divider-color));width:40px}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{padding:var(--ha-bottom-sheet-content-padding,0);box-sizing:border-box}:host([flexcontent]) .body{flex:1;max-width:100%;display:flex;flex-direction:column;padding:var(--ha-bottom-sheet-content-padding,var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)));box-sizing:border-box}slot[name=footer]{display:block;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%;box-sizing:border-box}:host([flexcontent]) slot[name=footer]{flex-shrink:0}`]}constructor(...e){super(...e),this.open=!1,this.flexContent=!1,this.preventScrimClose=!1,this._drawerOpen=!1,this._sliderInteractionActive=!1,this._gestureRecognizer=new d.u,this._isDragging=!1,this._escapePressed=!1,this._handleShow=async()=>{this._drawerOpen=!0,this.open=!0,(0,l.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{const e=this._autofocusElement;this._hassConfig?.auth.external&&(0,u.V)(this._hassConfig.auth.external)?e&&(e.id||(e.id="ha-bottom-sheet-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:e.id}})):e?.focus()})},this._handleAfterShow=()=>{(0,l.r)(this,"after-show")},this._handleSliderInteractionStart=()=>{this._sliderInteractionActive=!0},this._handleSliderInteractionStop=()=>{this._sliderInteractionActive=!1},this._handleAfterHide=e=>{if(this._sliderInteractionActive)return this._drawerOpen=!0,void(this.open=!0);e.eventPhase===Event.AT_TARGET&&(this.open=!1,this._drawerOpen=!1,(0,l.r)(this,"closed"))},this._handleHide=e=>{if(e.eventPhase!==Event.AT_TARGET)return;const t=e.detail.source===e.target.drawer;if(this._sliderInteractionActive)return e.preventDefault(),this._drawerOpen=!0,this.open=!0,void(this._escapePressed=!1);this.preventScrimClose&&this._escapePressed&&t&&e.preventDefault(),this._escapePressed=!1},this._handleKeyDown=e=>{"Escape"===e.key&&(this._escapePressed=!0,this.preventScrimClose&&e.preventDefault(),e.stopPropagation(),e.currentTarget.open=!1)},this._handleCloseAction=e=>{e.composedPath().some(e=>e instanceof HTMLElement&&("close"===e.getAttribute("data-dialog")||"close"===e.getAttribute("data-drawer")))&&(this._drawerOpen=!1)},this._handleTouchStart=e=>{if(this.preventScrimClose)return;const t=e.composedPath();for(const e of t){if(e===this._drawer)break;if(e instanceof HTMLElement&&(e.scrollTop>0||m.has(e.localName)||Array.from(e.classList).some(e=>v.has(e))))return}e.stopPropagation(),this._startResizing(e.touches[0].clientY)},this._handleTouchMove=e=>{const t=e.touches[0].clientY,a=this._gestureRecognizer.move(t);a<0&&(e.preventDefault(),this._isDragging=!0,requestAnimationFrame(()=>{this._isDragging&&this.style.setProperty("--dialog-transform",`translateY(${-1*a}px)`)}))},this._handleTouchEnd=()=>{this._unregisterResizeHandlers(),this._isDragging=!1;const e=this._gestureRecognizer.end();if(e.isSwipe)return void(e.isDownwardSwipe?this._drawerOpen=!1:this._animateSnapBack());const t=this._drawer.shadowRoot?.querySelector('[part="body"]'),a=t?.offsetHeight||0;a>0&&e.delta<0&&Math.abs(e.delta)>.5*a?this._drawerOpen=!1:this._animateSnapBack()},this._unregisterResizeHandlers=()=>{document.removeEventListener("touchmove",this._handleTouchMove),document.removeEventListener("touchend",this._handleTouchEnd),document.removeEventListener("touchcancel",this._handleTouchEnd)}}}(0,i.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],y.prototype,"ariaLabelledBy",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],y.prototype,"ariaDescribedBy",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],y.prototype,"open",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],y.prototype,"flexContent",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],y.prototype,"preventScrimClose",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_drawerOpen",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_sliderInteractionActive",void 0),(0,i.Cg)([(0,n.wk)(),(0,s.Fg)({context:h.WF,subscribe:!0})],y.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,n.P)("#drawer")],y.prototype,"_drawer",void 0),(0,i.Cg)([(0,n.P)("#body")],y.prototype,"_bodyElement",void 0),(0,i.Cg)([(0,n.P)("[autofocus]")],y.prototype,"_autofocusElement",void 0),y=(0,i.Cg)([(0,n.EM)("ha-bottom-sheet")],y),t()}catch(e){t(e)}})},38508(e,t,a){a.a(e,async function(e,t){try{a(18111),a(13579);var i=a(62826),o=a(61366),s=a(35211),r=a(5124),n=a(22441),l=a(63672),d=a(91335),h=a(1087),c=a(22792),p=a(17894),u=a(22348),b=a(99611),g=a(18350),m=(a(75064),a(3449),a(49639)),v=a(88285),y=(a(67094),e([o,b,g,m,v]));[o,b,g,m,v]=y.then?(await y)():y;const _="M3 16H10V14H3M18 14V10H16V14H12V16H16V20H18V16H22V14M14 6H3V8H14M14 10H3V12H14V10Z";class f extends((0,p.c)(r.WF)){willUpdate(e){e.has("value")&&this._setUnknownValue()}setFieldValue(e){this._comboBox?this._comboBox.setFieldValue(e):this._initialFieldValue=e}render(){const e=this.useTopLabel&&this.value?void 0:this.label;return r.qy`<div class="container"> ${this.useTopLabel&&this.label?r.qy`<label ?disabled="${this.disabled}">${this.label}</label>`:r.s6} <div id="picker"> <slot name="field"> ${this.addButtonLabel&&!this.value?r.qy`<ha-button size="small" appearance="filled" @click="${this.open}" .disabled="${this.disabled}"> <ha-svg-icon .path="${_}" slot="start"></ha-svg-icon> ${this.addButtonLabel} </ha-button>`:r.qy`<ha-picker-field type="button" class="${this._opened?"opened":""}" compact="compact" .unknown="${this._unknownValue}" .unknownItemText="${this.unknownItemText}" aria-label="${(0,l.J)(this.label)}" @click="${this.open}" @clear="${this._clear}" .icon="${this.icon}" .image="${this.image}" .label="${e}" .placeholder="${this.placeholder}" .value="${this.value}" .valueRenderer="${this.valueRenderer}" .required="${this.required}" .disabled="${this.disabled}" .invalid="${this.invalid}" .hideClearIcon="${this.hideClearIcon}"> <slot name="start"></slot> </ha-picker-field>`} </slot> </div> ${this._pickerWrapperOpen||this._opened?this._openedNarrow?r.qy` <ha-bottom-sheet flexcontent .open="${this._pickerWrapperOpen}" @wa-after-show="${this._dialogOpened}" @closed="${this._hidePicker}" role="dialog" aria-modal="true" aria-label="${this.label||"Select option"}"> ${this._renderComboBox(!0)} </ha-bottom-sheet> `:r.qy` <wa-popover .open="${this._pickerWrapperOpen}" style="--body-width:${this._popoverWidth}px" without-arrow distance="-4" .placement="${this.popoverPlacement}" .for="${this.popoverAnchor?null:"picker"}" .anchor="${this.popoverAnchor??null}" auto-size="vertical" auto-size-padding="16" @wa-after-show="${this._dialogOpened}" @wa-after-hide="${this._hidePicker}" trap-focus role="dialog" aria-modal="true" aria-label="${this.label||"Select option"}"> ${this._renderComboBox()} </wa-popover> `:r.s6} </div> ${this._renderHelper()}`}_renderComboBox(e=!1){return this._opened?r.qy` <ha-picker-combo-box id="combo-box" .allowCustomValue="${this.allowCustomValue}" .label="${this.searchLabel}" .value="${this._selectedValue??this.value}" @value-changed="${this._valueChanged}" .rowRenderer="${this.rowRenderer}" .notFoundLabel="${this.notFoundLabel}" .emptyLabel="${this.emptyLabel}" .getItems="${this.getItems}" .getAdditionalItems="${this.getAdditionalItems}" .searchFn="${this.searchFn}" .mode="${e?"dialog":"popover"}" .sections="${this.sections}" .sectionTitleFunction="${this.sectionTitleFunction}" .selectedSection="${this.selectedSection}" .searchKeys="${this.searchKeys}" .customValueLabel="${this.customValueLabel}" .noSort="${this.noSort}"></ha-picker-combo-box> `:r.s6}_renderHelper(){const e=this.invalid&&this.errorMessage,t=!e&&this.helper;return e||t?r.qy`<ha-input-helper-text .disabled="${this.disabled}"> ${e?this.errorMessage:this.helper} </ha-input-helper-text>`:r.s6}refreshItems(){this._comboBox?.refreshItems()}_hidePicker(e){e.stopPropagation(),this._newValue&&((0,h.r)(this,"value-changed",{value:this._newValue}),this._newValue=void 0),this._opened=!1,this._pickerWrapperOpen=!1,this._selectedValue=void 0,this._unsubscribeTinyKeys?.(),(0,h.r)(this,"picker-closed")}_valueChanged(e){e.stopPropagation();const t=e.detail.value;t&&(this._pickerWrapperOpen=!1,this._newValue=t)}_clear(e){e.stopPropagation(),this._setValue(void 0)}_setValue(e){this.value=e,(0,h.r)(this,"value-changed",{value:e})}async open(e,t){e?.stopPropagation(),this.disabled||(this._selectedValue=t?.selectedValue,this._openedNarrow=this._narrow,this._popoverWidth=this._containerElement?.offsetWidth||250,this._pickerWrapperOpen=!0,this._unsubscribeTinyKeys=(0,d.Tc)(this,{Escape:this._handleEscClose}))}connectedCallback(){super.connectedCallback(),this._handleResize(),window.addEventListener("resize",this._handleResize)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize),this._unsubscribeTinyKeys?.()}static get styles(){return[r.AH`.container{position:relative;display:block;max-width:100%}label[disabled]{color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}label{display:block;margin:0 0 8px}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}:host([invalid]) ha-input-helper-text{color:var(--mdc-theme-error,var(--error-color,#b00020))}wa-popover{--wa-space-l:0}wa-popover::part(dialog)::backdrop{background:0 0}wa-popover::part(body){width:var(--ha-generic-picker-width,max(var(--body-width),250px));max-width:var(--ha-generic-picker-max-width,var(--ha-generic-picker-width,max(var(--body-width),250px)));max-height:500px;height:70vh;overflow:hidden}@media (max-height:1000px){wa-popover::part(body){max-height:400px}}ha-bottom-sheet{--ha-bottom-sheet-height:90vh;--ha-bottom-sheet-height:calc(100dvh - var(--ha-space-12));--ha-bottom-sheet-max-height:var(--ha-bottom-sheet-height);--ha-bottom-sheet-max-width:600px;--ha-bottom-sheet-padding:0;--ha-bottom-sheet-surface-background:var(--card-background-color);--ha-bottom-sheet-border-radius:var(--ha-border-radius-2xl);--ha-bottom-sheet-content-padding:0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}`]}constructor(...e){super(...e),this.popoverPlacement="bottom",this.useTopLabel=!1,this.noSort=!1,this._opened=!1,this._pickerWrapperOpen=!1,this._popoverWidth=0,this._openedNarrow=!1,this._unknownValue=!1,this._narrow=!1,this.invalid=!1,this._setUnknownValue=()=>{const e=this.getItems();!this.allowCustomValue&&void 0!==this.value&&null!==this.value&&""!==this.value&&e?this._unknownValue=!e.some(e=>"string"!=typeof e&&e.id===this.value):this._unknownValue=!1},this._dialogOpened=()=>{this._opened=!0,(0,h.r)(this,"picker-opened"),requestAnimationFrame(()=>{this._initialFieldValue&&(this._comboBox?.setFieldValue(this._initialFieldValue),this._initialFieldValue=void 0),this._hassConfig?.auth.external&&(0,u.V)(this._hassConfig.auth.external)?this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:"combo-box"}}):this._comboBox?.focus()})},this._handleResize=()=>{this._narrow=window.matchMedia("(max-width: 870px)").matches||window.matchMedia("(max-height: 500px)").matches,!this._openedNarrow&&this._pickerWrapperOpen&&(this._popoverWidth=this._containerElement?.offsetWidth||250)},this._handleEscClose=e=>{e.stopPropagation()}}}f.shadowRootOptions={...r.WF.shadowRootOptions,delegatesFocus:!0},(0,i.Cg)([(0,n.MZ)({type:Boolean,attribute:"allow-custom-value"})],f.prototype,"allowCustomValue",void 0),(0,i.Cg)([(0,n.MZ)({type:String,attribute:"search-label"})],f.prototype,"searchLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"getItems",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"getAdditionalItems",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"rowRenderer",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"searchFn",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"searchKeys",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"notFoundLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"empty-label"})],f.prototype,"emptyLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"popover-placement"})],f.prototype,"popoverPlacement",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"add-button-label"})],f.prototype,"addButtonLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"sections",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"sectionTitleFunction",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"selected-section"})],f.prototype,"selectedSection",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"popoverAnchor",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,attribute:"use-top-label"})],f.prototype,"useTopLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"custom-value-label"})],f.prototype,"customValueLabel",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,attribute:"no-sort"})],f.prototype,"noSort",void 0),(0,i.Cg)([(0,n.P)(".container")],f.prototype,"_containerElement",void 0),(0,i.Cg)([(0,n.P)("ha-picker-combo-box")],f.prototype,"_comboBox",void 0),(0,i.Cg)([(0,n.wk)(),(0,s.Fg)({context:c.WF,subscribe:!0})],f.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_opened",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_pickerWrapperOpen",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_popoverWidth",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_openedNarrow",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_unknownValue",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_selectedValue",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"error-message"})],f.prototype,"errorMessage",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],f.prototype,"invalid",void 0),f=(0,i.Cg)([(0,n.EM)("ha-generic-picker")],f),t()}catch(e){t(e)}})},3449(e,t,a){var i=a(62826),o=a(5124),s=a(22441);class r extends o.WF{render(){return o.qy`<slot></slot>`}constructor(...e){super(...e),this.disabled=!1}}r.styles=o.AH`:host{display:block;color:var(--mdc-text-field-label-ink-color,rgba(0,0,0,.6));font-size:var(--ha-font-size-s);padding-left:16px;padding-right:16px;padding-inline-start:16px;padding-inline-end:16px;letter-spacing:var( --mdc-typography-caption-letter-spacing, .0333333333em );line-height:normal}:host([disabled]){color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}`,(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],r.prototype,"disabled",void 0),r=(0,i.Cg)([(0,s.EM)("ha-input-helper-text")],r)},23430(e,t,a){a.a(e,async function(e,i){try{a.d(t,{l:()=>p});var o=a(62826),s=a(5124),r=a(22441),n=a(78870),l=a(79622),d=a(86836),h=a(34127),c=e([h]);h=(c.then?(await c)():c)[0];const p=e=>{const t=e?(0,n.MP)(e):void 0;return t?`--ha-label-background-color: ${t};\n --primary-text-color: ${(0,l.gJ)(e)};`:"--ha-label-background-color: rgba(var(--rgb-primary-text-color), 0.15);"};class u extends s.WF{willUpdate(e){super.willUpdate(e),e.has("color")&&(this.style.cssText=p(this.color))}render(){return s.qy` <ha-tooltip .for="${this._elementId}" .disabled="${!this.description?.trim()}"> ${this.description} </ha-tooltip> <div class="container" .id="${this._elementId}"> <span class="content"> <slot name="icon"></slot> <slot></slot> </span> </div> `}static get styles(){return[s.AH`:host{--ha-label-text-color:var(--primary-text-color);--ha-label-icon-color:var(--primary-text-color);--ha-label-background-opacity:1;border:1px solid var(--outline-color);position:relative;box-sizing:border-box;display:inline-flex;flex-direction:row;align-items:center;font-size:var(--ha-font-size-s);font-weight:var(--ha-font-weight-medium);line-height:var(--ha-line-height-condensed);letter-spacing:.1px;height:32px;border-radius:var(--ha-border-radius-xl);color:var(--ha-label-text-color);--mdc-icon-size:12px;text-wrap:nowrap}.content>*{position:relative;display:inline-flex;flex-direction:row;align-items:center}:host:before{position:absolute;content:"";inset:0;border-radius:inherit;background-color:var(--ha-label-background-color);opacity:var(--ha-label-background-opacity)}::slotted([slot=icon]){margin-right:8px;margin-left:-8px;margin-inline-start:-8px;margin-inline-end:8px;display:flex}.container{display:flex;align-items:center;position:relative;height:100%;padding:0 16px}span{display:inline-flex}:host([dense]){height:20px;border-radius:var(--ha-border-radius-md)}:host([dense]) .container{padding:0 12px}:host([dense]) ::slotted([slot=icon]){margin-right:4px;margin-left:-4px;margin-inline-start:-4px;margin-inline-end:4px}`]}constructor(...e){super(...e),this.dense=!1,this._elementId="label-"+(0,d.L)()}}(0,o.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],u.prototype,"dense",void 0),(0,o.Cg)([(0,r.MZ)()],u.prototype,"color",void 0),(0,o.Cg)([(0,r.MZ)({attribute:"description"})],u.prototype,"description",void 0),u=(0,o.Cg)([(0,r.EM)("ha-label")],u),i()}catch(e){i(e)}})},88285(e,t,a){a.a(e,async function(e,t){try{var i=a(62826),o=a(35211),s=a(5124),r=a(22441),n=a(63672),l=a(1087),d=a(22792),h=a(17894),c=(a(75064),a(47680),a(26300)),p=e([c]);c=(p.then?(await p)():p)[0];const u="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",b="M7,10L12,15L17,10H7Z";class g extends((0,h.c)(s.WF)){async focus(){await this.updateComplete,await(this.item?.focus())}render(){const e=!!this.value,t=!(!this.value||this.required||this.disabled||this.hideClearIcon),a=this.placeholder??this.label,i=this.label&&e?s.qy`<span slot="overline">${this.label}${this.required?" *":""}</span>`:s.s6,o=e?this.valueRenderer?this.valueRenderer(this.value??""):s.qy`<span slot="headline">${this.value}</span>`:a?s.qy`<span slot="headline" class="placeholder"> ${a}${this.required?" *":""} </span>`:s.s6;return s.qy` <ha-combo-box-item aria-label="${(0,n.J)(this.label||this.placeholder)}" .disabled="${this.disabled}" type="button" compact="compact"> ${this.image?s.qy`<img alt="${this.label??""}" slot="start" .src="${this.image}" crossorigin="anonymous" referrerpolicy="no-referrer">`:this.icon?s.qy`<ha-icon slot="start" .icon="${this.icon}"></ha-icon>`:s.qy`<slot name="start"></slot>`} ${i}${o} ${this.unknown?s.qy`<div slot="supporting-text" class="unknown"> ${this.unknownItemText||this._i18n?.localize("ui.components.combo-box.unknown_item")} </div>`:s.s6} ${t?s.qy` <ha-icon-button class="clear" slot="end" @click="${this._clear}" .path="${u}"></ha-icon-button> `:s.s6} <ha-svg-icon class="arrow" slot="end" .path="${b}"></ha-svg-icon> </ha-combo-box-item> `}_clear(e){e.stopPropagation(),(0,l.r)(this,"clear")}static get styles(){return[s.AH`ha-combo-box-item[disabled]{background-color:var(--ha-color-form-background-disabled);--md-list-item-disabled-opacity:0.5;opacity:.5;cursor:not-allowed}ha-combo-box-item{position:relative;background-color:var(--ha-color-form-background);border-radius:var(--ha-border-radius-sm);border-end-end-radius:0;border-end-start-radius:0;--md-list-item-one-line-container-height:56px;--md-list-item-two-line-container-height:56px;--md-list-item-top-space:0px;--md-list-item-bottom-space:0px;--md-list-item-leading-space:var(--ha-space-4);--md-list-item-trailing-space:var(--ha-space-2);--ha-md-list-item-gap:var(--ha-space-2);--md-focus-ring-width:0px;--md-focus-ring-duration:0s}ha-combo-box-item:after{display:block;content:"";position:absolute;pointer-events:none;bottom:0;left:0;right:0;height:1px;width:100%;background-color:var(--ha-color-border-neutral-loud);transform:height 180ms ease-in-out,background-color 180ms ease-in-out}ha-combo-box-item:focus:after{height:2px;background-color:var(--mdc-theme-primary)}:host([unknown]) ha-combo-box-item{background-color:var(--ha-color-fill-warning-quiet-resting)}:host([invalid]) ha-combo-box-item:after{height:2px;background-color:var(--mdc-theme-error,var(--error-color,#b00020))}.clear{margin:0 -8px;--ha-icon-button-size:32px;--ha-icon-button-padding-inline:var(--ha-space-1)}.arrow{--mdc-icon-size:20px;width:32px}.placeholder{color:var(--secondary-text-color)}:host([invalid]) .placeholder{color:var(--mdc-theme-error,var(--error-color,#b00020))}.unknown{color:var(--ha-color-on-warning-normal)}`]}constructor(...e){super(...e),this.invalid=!1}}(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],g.prototype,"invalid",void 0),(0,i.Cg)([(0,r.P)("ha-combo-box-item",!0)],g.prototype,"item",void 0),(0,i.Cg)([(0,r.wk)(),(0,o.Fg)({context:d.D5,subscribe:!0})],g.prototype,"_i18n",void 0),g=(0,i.Cg)([(0,r.EM)("ha-picker-field")],g),t()}catch(e){t(e)}})},49852(e,t,a){a.d(t,{P:()=>d,j:()=>l});a(74423),a(18111),a(81148),a(22489),a(61701),a(13579);var i=a(65522),o=a(71727),s=a(55931),r=a(66033),n=a(58594);const l=(e,t,a,l,d,h,c,p,u,b,g,m="")=>{let v,y,_={};const f=Object.values(e),w=Object.values(a),x=Object.values(l);(h||c||p||u||b)&&(_=(0,n.g2)(x),v=w,y=x.filter(e=>e.area_id),h&&(v=v.filter(e=>{const t=_[e.id];return!(!t||!t.length)&&_[e.id].some(e=>h.includes((0,o.m)(e.entity_id)))}),y=y.filter(e=>h.includes((0,o.m)(e.entity_id)))),c&&(v=v.filter(e=>{const t=_[e.id];return!t||!t.length||x.every(e=>!c.includes((0,o.m)(e.entity_id)))}),y=y.filter(e=>!c.includes((0,o.m)(e.entity_id)))),p&&(v=v.filter(e=>{const t=_[e.id];return!(!t||!t.length)&&_[e.id].some(e=>{const t=d[e.entity_id];return!!t&&(t.attributes.device_class&&p.includes(t.attributes.device_class))})}),y=y.filter(e=>{const t=d[e.entity_id];return t.attributes.device_class&&p.includes(t.attributes.device_class)})),u&&(v=v.filter(e=>u(e))),b&&(v=v.filter(e=>{const t=_[e.id];return!(!t||!t.length)&&_[e.id].some(e=>{const t=d[e.entity_id];return!!t&&b(t)})}),y=y.filter(e=>{const t=d[e.entity_id];return!!t&&b(t)})));let C,$=f;v&&(C=v.filter(e=>e.area_id).map(e=>e.area_id)),y&&(C=(C??[]).concat(y.filter(e=>e.area_id).map(e=>e.area_id))),C&&($=$.filter(e=>C.includes(e.area_id))),g&&($=$.filter(e=>!g.includes(e.area_id)));return $.map(e=>{const{floor:a}=(0,r.L)(e,t),o=a?(0,s.X)(a):void 0,n=(0,i.A)(e);return{id:`${m}${e.area_id}`,primary:n||e.area_id,secondary:o,icon:e.icon||void 0,icon_path:e.icon?void 0:"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",search_labels:{areaId:e.area_id,aliases:e.aliases.join(" ")}}})},d=[{name:"primary",weight:10},{name:"search_labels.aliases",weight:8},{name:"secondary",weight:6},{name:"search_labels.domain",weight:4},{name:"search_labels.areaId",weight:2}]},17894(e,t,a){a.d(t,{c:()=>s});var i=a(62826),o=a(22441);const s=e=>{class t extends e{constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.unknown=!1,this.hideClearIcon=!1}}return(0,i.Cg)([(0,o.MZ)({type:Boolean})],t.prototype,"disabled",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],t.prototype,"required",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"icon",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"image",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"placeholder",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"helper",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"value",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],t.prototype,"unknown",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"unknown-item-text"})],t.prototype,"unknownItemText",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"hide-clear-icon",type:Boolean})],t.prototype,"hideClearIcon",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],t.prototype,"valueRenderer",void 0),t}},34023(e,t,a){a.d(t,{E:()=>o,J:()=>s});var i=a(1087);const o=()=>Promise.all([a.e(32450),a.e(7305),a.e(92769),a.e(3283),a.e(85010),a.e(89100),a.e(42209),a.e(26092),a.e(8851),a.e(66201),a.e(26295),a.e(52808),a.e(93e3),a.e(61023)]).then(a.bind(a,39803)),s=(e,t)=>{(0,i.r)(e,"show-dialog",{dialogTag:"dialog-area-registry-detail",dialogImport:o,dialogParams:t})}},22756(e,t,a){a.a(e,async function(e,i){try{a.r(t);var o=a(62826),s=a(5124),r=a(22441),n=a(1087),l=a(37981),d=a(14693),h=a(38962),c=a(66086),p=a(18350),u=(a(93444),a(50176)),b=a(91485),g=a(14503),m=e([d,h,c,p,u,b]);[d,h,c,p,u,b]=m.then?(await m)():m;class v extends s.WF{async showDialog(e){this._params=e,this._error=void 0,this._nameByUser=this._params.device.name_by_user||"",this._areaId=this._params.device.area_id||"",this._labels=this._params.device.labels||[],this._disabledBy=this._params.device.disabled_by,this._open=!0,await this.updateComplete}closeDialog(){this._open=!1}_dialogClosed(){this._error="",this._params=void 0,(0,n.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params)return s.s6;const e=this._params.device;return s.qy` <ha-adaptive-dialog .open="${this._open}" header-title="${(0,l.T)(e,this.hass.localize,this.hass.states)}" prevent-scrim-close @closed="${this._dialogClosed}"> <div> ${this._error?s.qy`<ha-alert alert-type="error">${this._error}</ha-alert> `:""} <div class="form"> <ha-input autofocus .value="${this._nameByUser}" @input="${this._nameChanged}" .label="${this.hass.localize("ui.dialogs.device-registry-detail.name")}" .placeholder="${e.name||""}" .disabled="${this._submitting}"></ha-input> <ha-area-picker .hass="${this.hass}" .value="${this._areaId}" @value-changed="${this._areaPicked}"></ha-area-picker> <ha-labels-picker .hass="${this.hass}" .value="${this._labels}" @value-changed="${this._labelsChanged}"></ha-labels-picker> <div class="row"> <ha-switch .checked="${!this._disabledBy}" .disabled="${"config_entry"===this._params.device.disabled_by}" @change="${this._disabledByChanged}"> </ha-switch> <div> <div> ${this.hass.localize("ui.dialogs.device-registry-detail.enabled_label",{type:this.hass.localize(`ui.dialogs.device-registry-detail.type.${e.entry_type||"device"}`)})} </div> <div class="secondary"> ${this._disabledBy&&"user"!==this._disabledBy?this.hass.localize("ui.dialogs.device-registry-detail.enabled_cause",{type:this.hass.localize(`ui.dialogs.device-registry-detail.type.${e.entry_type||"device"}`),cause:this.hass.localize(`config_entry.disabled_by.${this._disabledBy}`)}):""} ${this.hass.localize("ui.dialogs.device-registry-detail.enabled_description")} </div> </div> </div> </div> </div> <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" @click="${this.closeDialog}" .disabled="${this._submitting}" appearance="plain"> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-button slot="primaryAction" @click="${this._updateEntry}" .disabled="${this._submitting}"> ${this.hass.localize("ui.dialogs.device-registry-detail.update")} </ha-button> </ha-dialog-footer> </ha-adaptive-dialog> `}_nameChanged(e){this._error=void 0,this._nameByUser=e.target.value??""}_areaPicked(e){this._areaId=e.detail.value}_labelsChanged(e){this._labels=e.detail.value}_disabledByChanged(e){this._disabledBy=e.target.checked?null:"user"}async _updateEntry(){this._submitting=!0;try{await this._params.updateEntry({name_by_user:this._nameByUser.trim()||null,area_id:this._areaId||null,labels:this._labels||null,disabled_by:this._disabledBy||null}),this.closeDialog()}catch(e){this._error=e.message||this.hass.localize("ui.dialogs.device-registry-detail.unknown_error")}finally{this._submitting=!1}}static get styles(){return[g.RF,g.nA,s.AH`ha-button.warning{margin-right:auto;margin-inline-end:auto;margin-inline-start:initial}ha-area-picker,ha-input,ha-labels-picker{display:block;margin-bottom:var(--ha-space-4);--ha-input-padding-bottom:0}ha-switch{margin-right:16px;margin-inline-end:16px;margin-inline-start:initial;direction:var(--direction)}.row{margin-top:8px;color:var(--primary-text-color);display:flex;align-items:center}`]}constructor(...e){super(...e),this._open=!1,this._submitting=!1}}(0,o.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_open",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_nameByUser",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_error",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_params",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_areaId",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_labels",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_disabledBy",void 0),(0,o.Cg)([(0,r.wk)()],v.prototype,"_submitting",void 0),v=(0,o.Cg)([(0,r.EM)("dialog-device-registry-detail")],v),i()}catch(e){i(e)}})},69569(e,t,a){a.d(t,{f:()=>s});var i=a(1087);const o=()=>Promise.all([a.e(92769),a.e(3283),a.e(37941),a.e(26092),a.e(18965)]).then(a.bind(a,427)),s=(e,t)=>{(0,i.r)(e,"show-dialog",{dialogTag:"dialog-label-detail",dialogImport:o,dialogParams:t})}}};