iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
7 lines • 31.7 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[90108],{66033:function(e,t,a){a.d(t,{L:function(){return i}});const i=(e,t)=>{const a=e.floor_id;return{area:e,floor:(a?t[a]:void 0)||null}}},60353:function(e,t,a){a.d(t,{u:function(){return 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={}){var t,a;this._startY=0,this._delta=0,this._startTime=0,this._lastY=0,this._lastTime=0,this._velocityThreshold=null!==(t=e.velocitySwipeThreshold)&&void 0!==t?t:.5,this._movementTimeThreshold=null!==(a=e.movementTimeThreshold)&&void 0!==a?a:100}}},14693:function(e,t,a){a.a(e,async function(e,i){try{a.d(t,{r:function(){return A}});a(62953);var s=a(40445),r=a(35211),o=a(5124),n=a(67576),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;let g,v,m,b,_,y,f,w,C,x,$,k=e=>e;const M="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",L="(max-width: 870px), (max-height: 500px)";class A extends o.WF{connectedCallback(){super.connectedCallback(),this._unsubMediaQuery=(0,l.m)(L,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){var t,a,i;return this.hideCloseButton?(0,o.qy)(g||(g=k`<span slot="${0}"></span>`),e):(0,o.qy)(v||(v=k` <slot name="headerNavigationIcon" slot="${0}"> <ha-icon-button data-dialog="close" .label="${0}" .path="${0}"></ha-icon-button> </slot> `),e,null!==(t=null===(a=this._i18n)||void 0===a||null===(i=a.localize)||void 0===i?void 0:i.call(a,"ui.common.close"))&&void 0!==t?t:"Close",M)}_renderHeaderContent(){return(0,o.qy)(m||(m=k` <ha-dialog-header .subtitlePosition="${0}"> ${0} ${0} ${0} <slot name="headerActionItems" slot="actionItems"></slot> </ha-dialog-header> `),this.headerSubtitlePosition,this._renderCloseButton("navigationIcon"),void 0!==this.headerTitle?(0,o.qy)(b||(b=k`<span slot="title" class="title" id="ha-dialog-title"> ${0} </span>`),this.headerTitle):(0,o.qy)(_||(_=k`<slot name="headerTitle" slot="title"></slot>`)),void 0!==this.headerSubtitle?(0,o.qy)(y||(y=k`<span slot="subtitle">${0}</span>`),this.headerSubtitle):(0,o.qy)(f||(f=k`<slot name="headerSubtitle" slot="subtitle"></slot>`)))}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._unsubMediaQuery)||void 0===e||e.call(this),this._unsubMediaQuery=void 0,this._modeSet=!1}render(){return"bottom-sheet"===this.mode?(0,o.qy)(w||(w=k` <ha-bottom-sheet .ariaLabelledBy="${0}" .ariaDescribedBy="${0}" .flexContent="${0}" .open="${0}" .preventScrimClose="${0}"> ${0} <slot></slot> <slot name="footer" slot="footer"></slot> </ha-bottom-sheet> `),this._defaultAriaLabelledBy,this.ariaDescribedBy,this.flexContent,this.open,this.preventScrimClose,this.withoutHeader?o.s6:(0,o.qy)(C||(C=k` <slot name="header" slot="header">${0}</slot> `),this._renderHeaderContent())):(0,o.qy)(x||(x=k` <ha-dialog .open="${0}" .type="${0}" .width="${0}" .preventScrimClose="${0}" .ariaLabelledBy="${0}" .ariaDescribedBy="${0}" .headerTitle="${0}" .headerSubtitle="${0}" .headerSubtitlePosition="${0}" .flexContent="${0}" .withoutHeader="${0}"> ${0} <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> `),this.open,this.type,this.width,this.preventScrimClose,this.ariaLabelledBy,this.ariaDescribedBy,this.headerTitle,this.headerSubtitle,this.headerSubtitlePosition,this.flexContent,this.withoutHeader,this._renderCloseButton("headerNavigationIcon"))}static get styles(){return[(0,o.AH)($||($=k`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,s.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],A.prototype,"ariaLabelledBy",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],A.prototype,"ariaDescribedBy",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],A.prototype,"open",void 0),(0,s.Cg)([(0,n.MZ)({reflect:!0})],A.prototype,"type",void 0),(0,s.Cg)([(0,n.MZ)({type:String,reflect:!0,attribute:"width"})],A.prototype,"width",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],A.prototype,"preventScrimClose",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"header-title"})],A.prototype,"headerTitle",void 0),(0,s.Cg)([(0,n.MZ)({attribute:"header-subtitle"})],A.prototype,"headerSubtitle",void 0),(0,s.Cg)([(0,n.MZ)({type:String,attribute:"header-subtitle-position"})],A.prototype,"headerSubtitlePosition",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,attribute:"allow-mode-change"})],A.prototype,"allowModeChange",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,attribute:"without-header"})],A.prototype,"withoutHeader",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,attribute:"hide-close-button"})],A.prototype,"hideCloseButton",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],A.prototype,"flexContent",void 0),(0,s.Cg)([(0,n.wk)()],A.prototype,"mode",void 0),(0,s.Cg)([(0,n.wk)(),(0,r.Fg)({context:d.D5,subscribe:!0})],A.prototype,"_i18n",void 0),A=(0,s.Cg)([(0,n.EM)("ha-adaptive-dialog")],A),i()}catch(g){i(g)}})},66086:function(e,t,a){a.a(e,async function(e,t){try{a(74423),a(18111),a(22489),a(61701),a(3362),a(62953);var i=a(40445),s=a(5124),r=a(67576),o=a(22786),n=a(1087),l=a(65522),d=a(55931),h=a(66033),c=a(49852),p=a(53641),u=a(65063),g=a(34023),v=(a(75064),a(38508)),m=a(26300),b=(a(67094),e([v,m]));[v,m]=b.then?(await b)():b;let _,y,f,w,C,x,$,k=e=>e;const M="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",L="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",A="___ADD_NEW___";class S extends s.WF{willUpdate(e){var t;this._pendingAreaId&&e.has("hass")&&this.hass.areas!==(null===(t=e.get("hass"))||void 0===t?void 0:t.areas)&&this.hass.areas[this._pendingAreaId]&&(this._setValue(this._pendingAreaId),this._pendingAreaId=void 0)}async open(){var e;await this.updateComplete,await(null===(e=this._picker)||void 0===e?void 0:e.open())}render(){var e;const t=null!==(e=this.label)&&void 0!==e?e:this.hass.localize("ui.components.area-picker.area"),a=this._computeValueRenderer(this.hass.areas);let i=t;if(this.value&&t){const e=this.hass.areas[this.value];if(e){const{floor:t}=(0,h.L)(e,this.hass.floors);t&&(i=void 0)}}return(0,s.qy)(_||(_=k` <ha-generic-picker .hass="${0}" .autofocus="${0}" .label="${0}" .helper="${0}" .notFoundLabel="${0}" .emptyLabel="${0}" .disabled="${0}" .required="${0}" .value="${0}" .getItems="${0}" .getAdditionalItems="${0}" .valueRenderer="${0}" .addButtonLabel="${0}" .searchKeys="${0}" .unknownItemText="${0}" -changed="${0}"> </ha-generic-picker> `),this.hass,this.autofocus,i,this.helper,this._notFoundLabel,this.hass.localize("ui.components.area-picker.no_areas"),this.disabled,this.required,this.value,this._getItems,this._getAdditionalItems,a,this.addButtonLabel,c.P,this.hass.localize("ui.components.area-picker.unknown"),this._valueChanged)}_valueChanged(e){e.stopPropagation();const t=e.detail.value;if(t){if(t.startsWith(A)){this.hass.loadFragmentTranslation("config");const e=t.substring(A.length);return void(0,g.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(t){(0,u.showAlertDialog)(this,{title:this.hass.localize("ui.components.area-picker.failed_create_area"),text:t.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,o.A)(c.j),this._computeValueRenderer=(0,o.A)(e=>e=>{const t=this.hass.areas[e];if(!t)return(0,s.qy)(y||(y=k` <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> <span slot="headline">${0}</span> `),L,t);const{floor:a}=(0,h.L)(t,this.hass.floors),i=t?(0,l.A)(t):void 0,r=a?(0,d.X)(a):void 0,o=t.icon;return(0,s.qy)(f||(f=k` ${0} <span slot="headline">${0}</span> ${0} `),o?(0,s.qy)(w||(w=k`<ha-icon slot="start" .icon="${0}"></ha-icon>`),o):(0,s.qy)(C||(C=k`<ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>`),L),i,r?(0,s.qy)(x||(x=k`<span slot="supporting-text">${0}</span>`),r):s.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,o.A)(e=>Object.values(e).map(e=>{var t;return null===(t=(0,l.A)(e))||void 0===t?void 0:t.toLowerCase()}).filter(Boolean)),this._getAdditionalItems=e=>{if(this.noAdd)return[];const t=this._allAreaNames(this.hass.areas);return e&&!t.includes(e.toLowerCase())?[{id:A+e,primary:this.hass.localize("ui.components.area-picker.add_new_suggestion",{name:e}),icon_path:M}]:[{id:A,primary:this.hass.localize("ui.components.area-picker.add_new"),icon_path:M}]},this._notFoundLabel=e=>this.hass.localize("ui.components.area-picker.no_match",{term:(0,s.qy)($||($=k`<b>‘${0}’</b>`),e)})}}(0,i.Cg)([(0,r.MZ)({attribute:!1})],S.prototype,"hass",void 0),(0,i.Cg)([(0,r.MZ)()],S.prototype,"label",void 0),(0,i.Cg)([(0,r.MZ)()],S.prototype,"value",void 0),(0,i.Cg)([(0,r.MZ)()],S.prototype,"helper",void 0),(0,i.Cg)([(0,r.MZ)()],S.prototype,"placeholder",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,attribute:"no-add"})],S.prototype,"noAdd",void 0),(0,i.Cg)([(0,r.MZ)({type:Array,attribute:"include-domains"})],S.prototype,"includeDomains",void 0),(0,i.Cg)([(0,r.MZ)({type:Array,attribute:"exclude-domains"})],S.prototype,"excludeDomains",void 0),(0,i.Cg)([(0,r.MZ)({type:Array,attribute:"include-device-classes"})],S.prototype,"includeDeviceClasses",void 0),(0,i.Cg)([(0,r.MZ)({type:Array,attribute:"exclude-areas"})],S.prototype,"excludeAreas",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],S.prototype,"deviceFilter",void 0),(0,i.Cg)([(0,r.MZ)({attribute:!1})],S.prototype,"entityFilter",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean})],S.prototype,"disabled",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean})],S.prototype,"required",void 0),(0,i.Cg)([(0,r.MZ)({attribute:"add-button-label"})],S.prototype,"addButtonLabel",void 0),(0,i.Cg)([(0,r.P)("ha-generic-picker")],S.prototype,"_picker",void 0),(0,i.Cg)([(0,r.wk)()],S.prototype,"_pendingAreaId",void 0),S=(0,i.Cg)([(0,r.EM)("ha-area-picker")],S),t()}catch(_){t(_)}})},99611:function(e,t,a){a.a(e,async function(e,t){try{a(18111),a(13579),a(3362),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698),a(62953);var i=a(40445),s=a(1126),r=a(35211),o=a(5124),n=a(67576),l=a(1087),d=a(60353),h=a(22792),c=a(59992),p=a(14503),u=a(22348),g=e([s,c]);[s,c]=g.then?(await g)():g;let v,m,b=e=>e;const _=300,y=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"]),f=new Set(["volume-slider-container","forecast"]);class w extends((0,c.V)(o.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(0,o.qy)(v||(v=b` <wa-drawer id="drawer" placement="bottom" .open="${0}" .lightDismiss="${0}" .ariaLabelledby="${0}" .ariaDescribedby="${0}" ="${0}" -show="${0}" -after-show="${0}" -hide="${0}" -after-hide="${0}" ="${0}" without-header ="${0}"> <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> ${0} </div> <slot name="footer"></slot> </wa-drawer> `),this._drawerOpen,!this.preventScrimClose,this.ariaLabelledBy,this.ariaDescribedBy,this._handleKeyDown,this._handleShow,this._handleAfterShow,this._handleHide,this._handleAfterHide,this._handleCloseAction,this._handleTouchStart,this.renderScrollableFades())}_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 ${_}ms ease-out`),this.style.removeProperty("--dialog-transform"),setTimeout(()=>{this.style.removeProperty("--dialog-transition")},_)}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,(0,o.AH)(m||(m=b`wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:${0}ms;--hide-duration:${0}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)} (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(()=>{var e;const t=this._autofocusElement;null!==(e=this._hassConfig)&&void 0!==e&&e.auth.external&&(0,u.V)(this._hassConfig.auth.external)?t&&(t.id||(t.id="ha-bottom-sheet-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:t.id}})):null==t||t.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 a of t){if(a===this._drawer)break;if(a instanceof HTMLElement&&(a.scrollTop>0||y.has(a.localName)||Array.from(a.classList).some(e=>f.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=()=>{var e;this._unregisterResizeHandlers(),this._isDragging=!1;const t=this._gestureRecognizer.end();if(t.isSwipe)return void(t.isDownwardSwipe?this._drawerOpen=!1:this._animateSnapBack());const a=null===(e=this._drawer.shadowRoot)||void 0===e?void 0:e.querySelector('[part="body"]'),i=(null==a?void 0:a.offsetHeight)||0;i>0&&t.delta<0&&Math.abs(t.delta)>.5*i?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"})],w.prototype,"ariaLabelledBy",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],w.prototype,"ariaDescribedBy",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],w.prototype,"open",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],w.prototype,"flexContent",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],w.prototype,"preventScrimClose",void 0),(0,i.Cg)([(0,n.wk)()],w.prototype,"_drawerOpen",void 0),(0,i.Cg)([(0,n.wk)()],w.prototype,"_sliderInteractionActive",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:h.WF,subscribe:!0})],w.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,n.P)("#drawer")],w.prototype,"_drawer",void 0),(0,i.Cg)([(0,n.P)("#body")],w.prototype,"_bodyElement",void 0),(0,i.Cg)([(0,n.P)("[autofocus]")],w.prototype,"_autofocusElement",void 0),w=(0,i.Cg)([(0,n.EM)("ha-bottom-sheet")],w),t()}catch(v){t(v)}})},23430:function(e,t,a){a.a(e,async function(e,i){try{a.d(t,{l:function(){return v}});a(89463),a(42762),a(62953);var s=a(40445),r=a(5124),o=a(67576),n=a(78870),l=a(79622),d=a(86836),h=a(34127),c=e([h]);h=(c.then?(await c)():c)[0];let p,u,g=e=>e;const v=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 m extends r.WF{willUpdate(e){super.willUpdate(e),e.has("color")&&(this.style.cssText=v(this.color))}render(){var e;return(0,r.qy)(p||(p=g` <ha-tooltip .for="${0}" .disabled="${0}"> ${0} </ha-tooltip> <div class="container" .id="${0}"> <span class="content"> <slot name="icon"></slot> <slot></slot> </span> </div> `),this._elementId,!(null!==(e=this.description)&&void 0!==e&&e.trim()),this.description,this._elementId)}static get styles(){return[(0,r.AH)(u||(u=g`: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,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],m.prototype,"dense",void 0),(0,s.Cg)([(0,o.MZ)()],m.prototype,"color",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"description"})],m.prototype,"description",void 0),m=(0,s.Cg)([(0,o.EM)("ha-label")],m),i()}catch(p){i(p)}})},49852:function(e,t,a){a.d(t,{P:function(){return d},j:function(){return l}});a(74423),a(18111),a(81148),a(22489),a(61701),a(13579);var i=a(65522),s=a(71727),r=a(55931),o=a(66033),n=a(58594);const l=(e,t,a,l,d,h,c,p,u,g,v,m="")=>{let b,_,y={};const f=Object.values(e),w=Object.values(a),C=Object.values(l);(h||c||p||u||g)&&(y=(0,n.g2)(C),b=w,_=C.filter(e=>e.area_id),h&&(b=b.filter(e=>{const t=y[e.id];return!(!t||!t.length)&&y[e.id].some(e=>h.includes((0,s.m)(e.entity_id)))}),_=_.filter(e=>h.includes((0,s.m)(e.entity_id)))),c&&(b=b.filter(e=>{const t=y[e.id];return!t||!t.length||C.every(e=>!c.includes((0,s.m)(e.entity_id)))}),_=_.filter(e=>!c.includes((0,s.m)(e.entity_id)))),p&&(b=b.filter(e=>{const t=y[e.id];return!(!t||!t.length)&&y[e.id].some(e=>{const t=d[e.entity_id];return!!t&&(t.attributes.device_class&&p.includes(t.attributes.device_class))})}),_=_.filter(e=>{const t=d[e.entity_id];return t.attributes.device_class&&p.includes(t.attributes.device_class)})),u&&(b=b.filter(e=>u(e))),g&&(b=b.filter(e=>{const t=y[e.id];return!(!t||!t.length)&&y[e.id].some(e=>{const t=d[e.entity_id];return!!t&&g(t)})}),_=_.filter(e=>{const t=d[e.entity_id];return!!t&&g(t)})));let x,$=f;b&&(x=b.filter(e=>e.area_id).map(e=>e.area_id)),_&&(x=(null!=x?x:[]).concat(_.filter(e=>e.area_id).map(e=>e.area_id))),x&&($=$.filter(e=>x.includes(e.area_id))),v&&($=$.filter(e=>!v.includes(e.area_id)));return $.map(e=>{const{floor:a}=(0,o.L)(e,t),s=a?(0,r.X)(a):void 0,n=(0,i.A)(e);return{id:`${m}${e.area_id}`,primary:n||e.area_id,secondary:s,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}]},34023:function(e,t,a){a.d(t,{E:function(){return s},J:function(){return r}});a(3362),a(62953);var i=a(1087);const s=()=>Promise.all([a.e(32450),a.e(7305),a.e(92769),a.e(3283),a.e(85010),a.e(89100),a.e(33889),a.e(62574),a.e(26092),a.e(39005),a.e(8851),a.e(66201),a.e(52808),a.e(33887),a.e(33790),a.e(61023)]).then(a.bind(a,39803)),r=(e,t)=>{(0,i.r)(e,"show-dialog",{dialogTag:"dialog-area-registry-detail",dialogImport:s,dialogParams:t})}},22756:function(e,t,a){a.a(e,async function(e,i){try{a.r(t);a(3362),a(42762),a(62953);var s=a(40445),r=a(5124),o=a(67576),n=a(1087),l=a(37981),d=a(14693),h=a(38962),c=a(66086),p=a(18350),u=(a(93444),a(50176)),g=a(91485),v=a(14503),m=e([d,h,c,p,u,g]);[d,h,c,p,u,g]=m.then?(await m)():m;let b,_,y,f=e=>e;class w extends r.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 r.s6;const e=this._params.device;return(0,r.qy)(b||(b=f` <ha-adaptive-dialog .open="${0}" header-title="${0}" prevent-scrim-close ="${0}"> <div> ${0} <div class="form"> <ha-input autofocus .value="${0}" ="${0}" .label="${0}" .placeholder="${0}" .disabled="${0}"></ha-input> <ha-area-picker .hass="${0}" .value="${0}" -changed="${0}"></ha-area-picker> <ha-labels-picker .hass="${0}" .value="${0}" -changed="${0}"></ha-labels-picker> <div class="row"> <ha-switch .checked="${0}" .disabled="${0}" ="${0}"> </ha-switch> <div> <div> ${0} </div> <div class="secondary"> ${0} ${0} </div> </div> </div> </div> </div> <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" ="${0}" .disabled="${0}" appearance="plain"> ${0} </ha-button> <ha-button slot="primaryAction" ="${0}" .disabled="${0}"> ${0} </ha-button> </ha-dialog-footer> </ha-adaptive-dialog> `),this._open,(0,l.T)(e,this.hass.localize,this.hass.states),this._dialogClosed,this._error?(0,r.qy)(_||(_=f`<ha-alert alert-type="error">${0}</ha-alert> `),this._error):"",this._nameByUser,this._nameChanged,this.hass.localize("ui.dialogs.device-registry-detail.name"),e.name||"",this._submitting,this.hass,this._areaId,this._areaPicked,this.hass,this._labels,this._labelsChanged,!this._disabledBy,"config_entry"===this._params.device.disabled_by,this._disabledByChanged,this.hass.localize("ui.dialogs.device-registry-detail.enabled_label",{type:this.hass.localize(`ui.dialogs.device-registry-detail.type.${e.entry_type||"device"}`)}),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"),this.closeDialog,this._submitting,this.hass.localize("ui.common.cancel"),this._updateEntry,this._submitting,this.hass.localize("ui.dialogs.device-registry-detail.update"))}_nameChanged(e){var t;this._error=void 0,this._nameByUser=null!==(t=e.target.value)&&void 0!==t?t:""}_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[v.RF,v.nA,(0,r.AH)(y||(y=f`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,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,s.Cg)([(0,o.wk)()],w.prototype,"_open",void 0),(0,s.Cg)([(0,o.wk)()],w.prototype,"_nameByUser",void 0),(0,s.Cg)([(0,o.wk)()],w.prototype,"_error",void 0),(0,s.Cg)([(0,o.wk)()],w.prototype,"_params",void 0),(0,s.Cg)([(0,o.wk)()],w.prototype,"_areaId",void 0),(0,s.Cg)([(0,o.wk)()],w.prototype,"_labels",void 0),(0,s.Cg)([(0,o.wk)()],w.prototype,"_disabledBy",void 0),(0,s.Cg)([(0,o.wk)()],w.prototype,"_submitting",void 0),w=(0,s.Cg)([(0,o.EM)("dialog-device-registry-detail")],w),i()}catch(b){i(b)}})},69569:function(e,t,a){a.d(t,{f:function(){return r}});a(3362),a(62953);var i=a(1087);const s=()=>Promise.all([a.e(92769),a.e(3283),a.e(37941),a.e(26092),a.e(39005),a.e(13231)]).then(a.bind(a,427)),r=(e,t)=>{(0,i.r)(e,"show-dialog",{dialogTag:"dialog-label-detail",dialogImport:s,dialogParams:t})}}}]);