UNPKG

iobroker.lovelace

Version:

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

22 lines 55.2 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[13231],{93421:function(e,t,a){a.d(t,{IW:function(){return d},dH:function(){return h},fI:function(){return l}});a(44114),a(62953);var i=a(35211),o=a(22792),r=a(32172);const s=(e,t)=>{let a=e;for(const i of t){if(null==a)return;a=a[i]}return a},n=(e,t,a)=>{const o=(0,r.p)({transformer:function(e){return a.call(this,e)},watch:t?[t]:[]}),s=(0,i.Fg)({context:e,subscribe:!0});return(e,t)=>{o(e,t),s(e,t)}},l=e=>n(o.iN,e.entityIdPath[0],function(t){const a=s(this,e.entityIdPath);return"string"==typeof a?null==t?void 0:t[a]:void 0}),h=e=>n(o.X1,e.entityIdPath[0],function(t){const a=s(this,e.entityIdPath);return"string"==typeof a?null==t?void 0:t[a]:void 0}),d=()=>n(o.D5,void 0,({localize:e})=>e)},32172:function(e,t,a){a.d(t,{p:function(){return i}});a(16280),a(18111),a(7588),a(45367),a(92731),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698),a(62953);function i(e){return(t,a)=>{if("object"==typeof a)throw new Error("This decorator does not support this compilation type.");const i=String(a),o=t;if(o._transformers){if(!o.hasOwnProperty("_transformers")){const e=o._transformers;o._transformers=new Map,e.forEach((e,t)=>o._transformers.set(t,e))}}else{o._transformers=new Map,o._watching=new Map;const e=o.willUpdate;o.willUpdate=function(t){e.call(this,t);const a=new Set;t.forEach((e,t)=>{const i=this._watching.get(t);void 0!==i&&i.forEach(e=>a.add(e))}),a.forEach(e=>{this[e]=this[`__original_${String(e)}`]})}}o._transformers.set(a,e.transformer),e.watch&&e.watch.forEach(e=>{let t=o._watching.get(e);t||(t=new Set,o._watching.set(e,t)),t.add(a)});const r=Object.getOwnPropertyDescriptor(t,a);let s;if(void 0===r)s={get(){return this[`__transform_${i}`]},set(e){const t=this[`__transform_${i}`],a=this._transformers.get(i);this[`__transform_${i}`]=a?a.call(this,e):e,this[`__original_${i}`]=e,this.requestUpdate(i,t)},configurable:!0,enumerable:!0};else{const e=r.set;s=Object.assign(Object.assign({},r),{},{set(t){const a=this[`__transform_${i}`],o=this._transformers.get(i);this[`__transform_${i}`]=o?o.call(this,t):t,this[`__original_${i}`]=t,this.requestUpdate(i,a),null==e||e.call(this,t)}})}Object.defineProperty(t,a,s)}}},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}}},64481:function(e,t,a){a.d(t,{D:function(){return o},J:function(){return s}});a(16280),a(3362),a(55815),a(64979),a(79739);let i=!1;try{i="true"===window.localStorage.getItem("disableViewTransition")}catch(n){}const o=e=>{i=e},r=e=>{if(!(e=>(e instanceof DOMException||e instanceof Error)&&"AbortError"===e.name)(e))throw e},s=e=>{if(!document.startViewTransition||i)return e(!1),Promise.resolve();let t=!1;try{const a=document.startViewTransition(()=>{t=!0,e(!0)});return a.ready.catch(r),a.finished.catch(r)}catch(a){return console.warn("View transition failed, falling back to direct execution.",a),t?Promise.reject(a):(e(!1),Promise.resolve())}}},38962:function(e,t,a){a.a(e,async function(e,i){try{a.r(t);a(62953);var o=a(40445),r=a(5124),s=a(67576),n=a(6412),l=a(93421),h=a(1087),d=a(26300),c=(a(67094),e([d]));d=(c.then?(await c)():c)[0];let p,u,v,g,m=e=>e;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",f={info:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z",warning:"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16",error:"M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z",success:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2,4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"};class w extends r.WF{render(){var e;return(0,r.qy)(p||(p=m` <div class="issue-type ${0}" role="alert"> <div class="icon ${0}"> <slot name="icon"> <ha-svg-icon .path="${0}"></ha-svg-icon> </slot> </div> <div class="${0}"> <div class="main-content"> ${0} <slot></slot> </div> <div class="action"> <slot name="action"> ${0} </slot> </div> </div> </div> `),(0,n.H)({[this.alertType]:!0}),this.title?"":"no-title",f[this.alertType],(0,n.H)({content:!0,narrow:this.narrow}),this.title?(0,r.qy)(u||(u=m`<div class="title">${0}</div>`),this.title):r.s6,this.dismissable?(0,r.qy)(v||(v=m`<ha-icon-button @click="${0}" .label="${0}" .path="${0}"></ha-icon-button>`),this._dismissClicked,null===(e=this._localize)||void 0===e?void 0:e.call(this,"ui.common.dismiss_alert"),b):r.s6)}_dismissClicked(){(0,h.r)(this,"alert-dismissed-clicked")}constructor(...e){super(...e),this.title="",this.alertType="info",this.dismissable=!1,this.narrow=!1}}w.styles=(0,r.AH)(g||(g=m`.issue-type{position:relative;padding:8px;display:flex}.icon{height:var(--ha-alert-icon-size,24px);width:var(--ha-alert-icon-size,24px)}.issue-type::after{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.12;pointer-events:none;content:"";border-radius:var(--ha-border-radius-sm)}.icon.no-title{align-self:center}.content{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:var(--float-start)}.content.narrow{flex-direction:column;align-items:flex-end}.action{z-index:1;width:min-content;--mdc-theme-primary:var(--primary-text-color)}.main-content{overflow-wrap:anywhere;word-break:break-word;line-height:normal;margin-left:8px;margin-right:0;margin-inline-start:8px;margin-inline-end:8px}.title{margin-top:2px;font-weight:var(--ha-font-weight-bold)}.action ha-icon-button{--mdc-theme-primary:var(--primary-text-color);--ha-icon-button-size:36px}.issue-type.info>.icon{color:var(--info-color)}.issue-type.info::after{background-color:var(--info-color)}.issue-type.warning>.icon{color:var(--warning-color)}.issue-type.warning::after{background-color:var(--warning-color)}.issue-type.error>.icon{color:var(--error-color)}.issue-type.error::after{background-color:var(--error-color)}.issue-type.success>.icon{color:var(--success-color)}.issue-type.success::after{background-color:var(--success-color)}:host ::slotted(ul){margin:0;padding-inline-start:20px}`)),(0,o.Cg)([(0,s.MZ)()],w.prototype,"title",void 0),(0,o.Cg)([(0,s.MZ)({attribute:"alert-type"})],w.prototype,"alertType",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],w.prototype,"dismissable",void 0),(0,o.Cg)([(0,s.wk)(),(0,l.IW)()],w.prototype,"_localize",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],w.prototype,"narrow",void 0),w=(0,o.Cg)([(0,s.EM)("ha-alert")],w),i()}catch(p){i(p)}})},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),o=a(1126),r=a(35211),s=a(5124),n=a(67576),l=a(1087),h=a(60353),d=a(22792),c=a(59992),p=a(14503),u=a(22348),v=e([o,c]);[o,c]=v.then?(await v)():v;let g,m,b=e=>e;const f=300,w=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"]),y=new Set(["volume-slider-container","forecast"]);class _ extends((0,c.V)(s.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,s.qy)(g||(g=b` <wa-drawer id="drawer" placement="bottom" .open="${0}" .lightDismiss="${0}" .ariaLabelledby="${0}" .ariaDescribedby="${0}" @keydown="${0}" @wa-show="${0}" @wa-after-show="${0}" @wa-hide="${0}" @wa-after-hide="${0}" @click="${0}" without-header @touchstart="${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 ${f}ms ease-out`),this.style.removeProperty("--dialog-transform"),setTimeout(()=>{this.style.removeProperty("--dialog-transition")},f)}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,s.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)}@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}`),f,f)]}constructor(...e){super(...e),this.open=!1,this.flexContent=!1,this.preventScrimClose=!1,this._drawerOpen=!1,this._sliderInteractionActive=!1,this._gestureRecognizer=new h.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||w.has(a.localName)||Array.from(a.classList).some(e=>y.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"})],_.prototype,"ariaLabelledBy",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],_.prototype,"ariaDescribedBy",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],_.prototype,"open",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],_.prototype,"flexContent",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],_.prototype,"preventScrimClose",void 0),(0,i.Cg)([(0,n.wk)()],_.prototype,"_drawerOpen",void 0),(0,i.Cg)([(0,n.wk)()],_.prototype,"_sliderInteractionActive",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:d.WF,subscribe:!0})],_.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,n.P)("#drawer")],_.prototype,"_drawer",void 0),(0,i.Cg)([(0,n.P)("#body")],_.prototype,"_bodyElement",void 0),(0,i.Cg)([(0,n.P)("[autofocus]")],_.prototype,"_autofocusElement",void 0),_=(0,i.Cg)([(0,n.EM)("ha-bottom-sheet")],_),t()}catch(g){t(g)}})},986:function(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(20116),a(7588),a(45367),a(92731),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698),a(42762),a(62953);var i=a(40445),o=a(35211),r=a(5124),s=a(67576),n=a(89784),l=a(22786),h=a(78870),d=a(1087),c=a(22792),p=(a(75064),a(38508)),u=(a(47680),a(67094),e([p]));p=(u.then?(await u)():u)[0];let v,g,m,b,f,w,y,_,x,k,C,$,M=e=>e;const A="M20.65,20.87L18.3,18.5L12,12.23L8.44,8.66L7,7.25L4.27,4.5L3,5.77L5.78,8.55C3.23,11.69 3.42,16.31 6.34,19.24C7.9,20.8 9.95,21.58 12,21.58C13.79,21.58 15.57,21 17.03,19.8L19.73,22.5L21,21.23L20.65,20.87M12,19.59C10.4,19.59 8.89,18.97 7.76,17.83C6.62,16.69 6,15.19 6,13.59C6,12.27 6.43,11 7.21,10L12,14.77V19.59M12,5.1V9.68L19.25,16.94C20.62,14 20.09,10.37 17.65,7.93L12,2.27L8.3,5.97L9.71,7.38L12,5.1Z",L="M17.5,12A1.5,1.5 0 0,1 16,10.5A1.5,1.5 0 0,1 17.5,9A1.5,1.5 0 0,1 19,10.5A1.5,1.5 0 0,1 17.5,12M14.5,8A1.5,1.5 0 0,1 13,6.5A1.5,1.5 0 0,1 14.5,5A1.5,1.5 0 0,1 16,6.5A1.5,1.5 0 0,1 14.5,8M9.5,8A1.5,1.5 0 0,1 8,6.5A1.5,1.5 0 0,1 9.5,5A1.5,1.5 0 0,1 11,6.5A1.5,1.5 0 0,1 9.5,8M6.5,12A1.5,1.5 0 0,1 5,10.5A1.5,1.5 0 0,1 6.5,9A1.5,1.5 0 0,1 8,10.5A1.5,1.5 0 0,1 6.5,12M12,3A9,9 0 0,0 3,12A9,9 0 0,0 12,21A1.5,1.5 0 0,0 13.5,19.5C13.5,19.11 13.35,18.76 13.11,18.5C12.88,18.23 12.73,17.88 12.73,17.5A1.5,1.5 0 0,1 14.23,16H16A5,5 0 0,0 21,11C21,6.58 16.97,3 12,3Z";class S extends r.WF{render(){var e,t,a,i;const o=null!==(e=null!==(t=this.value)&&void 0!==t?t:this.defaultColor)&&void 0!==e?e:"";return(0,r.qy)(v||(v=M` <ha-generic-picker .disabled="${0}" .required="${0}" .hideClearIcon="${0}" .label="${0}" .helper="${0}" .value="${0}" .getItems="${0}" .rowRenderer="${0}" .valueRenderer="${0}" @value-changed="${0}" .notFoundLabel="${0}" .getAdditionalItems="${0}"> </ha-generic-picker> `),this.disabled,this.required,!this.value&&!!this.defaultColor,this.label,this.helper,o,this._getItems,this._rowRenderer,this._valueRenderer,this._valueChanged,null===(a=this._i18n)||void 0===a||null===(i=a.localize)||void 0===i?void 0:i.call(a,"ui.components.color-picker.no_colors_found"),this._getAdditionalItems)}_renderItemIcon(e){var t,a;if(e.icon_path)return(0,r.qy)(g||(g=M`<ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>`),e.icon_path);if(e.icon)return(0,r.qy)(m||(m=M`<ha-icon slot="start" .icon="${0}"></ha-icon>`),e.icon);const i=null!==(t=null===(a=this._extraOptionsColorMap(this.extraOptions))||void 0===a?void 0:a.get(e.id))&&void 0!==t?t:e.id;return(0,r.qy)(b||(b=M`<span slot="start">${0}</span>`),this._renderColorCircle(i))}_renderColorCircle(e){return(0,r.qy)(f||(f=M` <span style="${0}"></span> `),(0,n.W)({"--circle-color":(0,h.MP)(e),display:"block","background-color":"var(--circle-color, var(--divider-color))",border:"1px solid var(--outline-color)","border-radius":"var(--ha-border-radius-pill)",width:"20px",height:"20px","box-sizing":"border-box"}))}_valueChanged(e){e.stopPropagation();const t=e.detail.value,a=t&&t===this.defaultColor?void 0:null!=t?t:void 0;this.value=a,(0,d.r)(this,"value-changed",{value:this.value})}constructor(...e){super(...e),this.includeState=!1,this.includeNone=!1,this.disabled=!1,this._extraOptionsColorMap=(0,l.A)(e=>{if(!e)return;const t=new Map;for(const a of e)a.display_color&&t.set(a.value,a.display_color);return t.size>0?t:void 0}),this.required=!1,this._getAdditionalItems=e=>{var t,a;if(!e||""===e.trim())return[];return this._getColors(this.includeNone,this.includeState,this.extraOptions,this.defaultColor,this.value).find(t=>t.id===e)?[]:[{id:e,primary:(null===(t=this._i18n)||void 0===t||null===(a=t.localize)||void 0===a?void 0:a.call(t,"ui.components.color-picker.custom_color"))||"Custom color",secondary:e}]},this._getItems=()=>this._getColors(this.includeNone,this.includeState,this.extraOptions,this.defaultColor,this.value),this._getColors=(0,l.A)((e,t,a,i,o)=>{var r,s;const n=[],l=(null===(r=this._i18n)||void 0===r||null===(s=r.localize)||void 0===s?void 0:s.call(r,"ui.components.color-picker.default"))||"Default",d=(e,t)=>t&&l?`${e} (${l})`:e;if(e){var c,p;const e=(null===(c=this._i18n)||void 0===c||null===(p=c.localize)||void 0===p?void 0:p.call(c,"ui.components.color-picker.none"))||"None";n.push({id:"none",primary:d(e,"none"===i),icon_path:A})}if(t){var u,v;const e=(null===(u=this._i18n)||void 0===u||null===(v=u.localize)||void 0===v?void 0:v.call(u,"ui.components.color-picker.state"))||"State";n.push({id:"state",primary:d(e,"state"===i),icon_path:L})}a&&a.forEach(e=>{n.push(Object.assign({id:e.value,primary:d(e.label,i===e.value)},e.icon?{icon:e.icon}:{}))}),Array.from(h.lt).forEach(e=>{var t,a;const o=(null===(t=this._i18n)||void 0===t||null===(a=t.localize)||void 0===a?void 0:a.call(t,`ui.components.color-picker.colors.${e}`))||e;n.push({id:e,primary:d(o,i===e)})});const g=new Set(n.map(e=>e.id));return o&&o.length>0&&!g.has(o)&&n.push({id:o,primary:o}),n}),this._rowRenderer=e=>(0,r.qy)(w||(w=M` <ha-combo-box-item type="button" compact="compact"> ${0} <span slot="headline">${0}</span> ${0} </ha-combo-box-item> `),this._renderItemIcon(e),e.primary,e.secondary?(0,r.qy)(y||(y=M`<span slot="supporting-text">${0}</span>`),e.secondary):r.s6),this._valueRenderer=e=>{var t,a,i,o,s,n,l,h,d;if("none"===e)return(0,r.qy)(_||(_=M` <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> <span slot="headline"> ${0} </span> `),A,(null===(n=this._i18n)||void 0===n||null===(l=n.localize)||void 0===l?void 0:l.call(n,"ui.components.color-picker.none"))||"None");if("state"===e)return(0,r.qy)(x||(x=M` <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> <span slot="headline"> ${0} </span> `),L,(null===(h=this._i18n)||void 0===h||null===(d=h.localize)||void 0===d?void 0:d.call(h,"ui.components.color-picker.state"))||"State");const c=null===(t=this.extraOptions)||void 0===t?void 0:t.find(t=>t.value===e),p=(null==c?void 0:c.label)||(null===(a=this._i18n)||void 0===a||null===(i=a.localize)||void 0===i?void 0:i.call(a,`ui.components.color-picker.colors.${e}`))||e,u=null!==(o=null===(s=this._extraOptionsColorMap(this.extraOptions))||void 0===s?void 0:s.get(e))&&void 0!==o?o:e,v=null!=c&&c.icon?(0,r.qy)(k||(k=M`<ha-icon slot="start" .icon="${0}"></ha-icon>`),c.icon):(0,r.qy)(C||(C=M`<span slot="start">${0}</span>`),this._renderColorCircle(u));return(0,r.qy)($||($=M` ${0} <span slot="headline">${0}</span> `),v,p)}}}(0,i.Cg)([(0,s.MZ)()],S.prototype,"label",void 0),(0,i.Cg)([(0,s.MZ)()],S.prototype,"helper",void 0),(0,i.Cg)([(0,s.MZ)()],S.prototype,"value",void 0),(0,i.Cg)([(0,s.MZ)({type:String,attribute:"default_color"})],S.prototype,"defaultColor",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"include_state"})],S.prototype,"includeState",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"include_none"})],S.prototype,"includeNone",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],S.prototype,"extraOptions",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],S.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],S.prototype,"required",void 0),(0,i.Cg)([(0,s.wk)(),(0,o.Fg)({context:c.D5,subscribe:!0})],S.prototype,"_i18n",void 0),S=(0,i.Cg)([(0,s.EM)("ha-color-picker")],S),t()}catch(v){t(v)}})},93444:function(e,t,a){var i=a(40445),o=a(5124),r=a(67576);let s,n,l=e=>e;class h extends o.WF{render(){return(0,o.qy)(s||(s=l` <footer> <slot name="secondaryAction"></slot> <slot name="primaryAction"></slot> </footer> `))}static get styles(){return[(0,o.AH)(n||(n=l`footer{display:flex;gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`))]}}h=(0,i.Cg)([(0,r.EM)("ha-dialog-footer")],h)},76538:function(e,t,a){a(62953);var i=a(40445),o=a(5124),r=a(67576);let s,n,l,h,d,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)(n||(n=p`<div class="header-subtitle"> <slot name="subtitle"></slot> </div>`));return(0,o.qy)(l||(l=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)(h||(h=p`${0}${0}`),t,e):(0,o.qy)(d||(d=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,i.Cg)([(0,r.MZ)({type:String,attribute:"subtitle-position"})],u.prototype,"subtitlePosition",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"show-border"})],u.prototype,"showBorder",void 0),u=(0,i.Cg)([(0,r.EM)("ha-dialog-header")],u)},72554:function(e,t,a){a.a(e,async function(e,t){try{a(3362),a(62953),a(49255);var i=a(40445),o=a(93900),r=a(35211),s=a(5124),n=a(67576),l=a(63672),h=a(1087),d=a(64481),c=a(22792),p=a(59992),u=a(14503),v=a(22348),g=(a(76538),a(26300)),m=e([o,g,p]);[o,g,p]=m.then?(await m)():m;let b,f,w,y,_,x,k,C=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 M 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,a;return(0,s.qy)(b||(b=C` <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,l.J)(this.ariaLabelledBy||(void 0!==this.headerTitle?"ha-dialog-title":void 0)),(0,l.J)(this.ariaDescribedBy),this._handleKeyDown,this._handleHide,this._handleShow,this._handleAfterShow,this._handleAfterHide,this.withoutHeader?s.s6:(0,s.qy)(f||(f=C`<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===(a=t.localize)||void 0===a?void 0:a.call(t,"ui.common.close"))&&void 0!==e?e:"Close",$,void 0!==this.headerTitle?(0,s.qy)(w||(w=C`<span slot="title" class="title" id="ha-dialog-title"> ${0} </span>`),this.headerTitle):(0,s.qy)(y||(y=C`<slot name="headerTitle" slot="title"></slot>`)),void 0!==this.headerSubtitle?(0,s.qy)(_||(_=C`<span slot="subtitle">${0}</span>`),this.headerSubtitle):(0,s.qy)(x||(x=C`<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,d.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 a=(null===(t=e.detail)||void 0===t?void 0:t.source)===e.target.dialog;this.preventScrimClose&&this._escapePressed&&a&&e.preventDefault(),this._escapePressed=!1}static get styles(){return[...super.styles,u.dp,(0,s.AH)(k||(k=C`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,h.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,h.r)(this,"after-show")},this._handleAfterHide=e=>{e.eventPhase===Event.AT_TARGET&&(this._open=!1,this._setFullscreen(!1),(0,h.r)(this,"closed"))}}}(0,i.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],M.prototype,"ariaLabelledBy",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],M.prototype,"ariaDescribedBy",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],M.prototype,"open",void 0),(0,i.Cg)([(0,n.MZ)({reflect:!0})],M.prototype,"type",void 0),(0,i.Cg)([(0,n.MZ)({type:String,reflect:!0,attribute:"width"})],M.prototype,"width",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],M.prototype,"preventScrimClose",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"header-title"})],M.prototype,"headerTitle",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"header-subtitle"})],M.prototype,"headerSubtitle",void 0),(0,i.Cg)([(0,n.MZ)({type:String,attribute:"header-subtitle-position"})],M.prototype,"headerSubtitlePosition",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],M.prototype,"flexContent",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,attribute:"without-header"})],M.prototype,"withoutHeader",void 0),(0,i.Cg)([(0,n.wk)()],M.prototype,"_open",void 0),(0,i.Cg)([(0,n.P)(".body")],M.prototype,"bodyContainer",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:c.D5,subscribe:!0})],M.prototype,"_i18n",void 0),(0,i.Cg)([(0,n.wk)(),(0,r.Fg)({context:c.WF,subscribe:!0})],M.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,n.wk)()],M.prototype,"_bodyScrolled",void 0),(0,i.Cg)([(0,n.Ls)({passive:!0})],M.prototype,"_handleBodyScroll",null),M=(0,i.Cg)([(0,n.EM)("ha-dialog")],M),t()}catch(b){t(b)}})},64138:function(e,t,a){a.a(e,async function(e,i){try{a.r(t),a.d(t,{HaIconPicker:function(){return x}});a(74423),a(44114),a(26910),a(18111),a(22489),a(7588),a(61701),a(13579),a(3362),a(27495),a(25440),a(62953);var o=a(40445),r=a(5124),s=a(67576),n=a(22786),l=a(1087),h=a(700),d=(a(75064),a(38508)),c=(a(47680),e([d]));d=(c.then?(await c)():c)[0];let p,u,v,g=e=>e,m=[],b=!1;const f=(e,t)=>{var a;const i=`${t}:${e.name}`,o=e.name,r=o.split("-"),s=null!==(a=e.keywords)&&void 0!==a?a:[],n={iconName:o};return r.forEach((e,t)=>{n[`part${t}`]=e}),s.forEach((e,t)=>{n[`keyword${t}`]=e}),{id:i,primary:i,icon:i,search_labels:n,sorting_label:i}},w=async()=>{b=!0;const e=await a.e(81340).then(a.t.bind(a,25143,19));m=e.default.map(e=>f(e,"mdi"));const t=[];Object.keys(h.y).forEach(e=>{t.push(y(e))}),(await Promise.all(t)).forEach(e=>{m.push(...e)})},y=async e=>{try{const t=h.y[e].getIconList;if("function"!=typeof t)return[];return(await t()).map(t=>f(t,e))}catch(t){return console.warn(`Unable to load icon list for ${e} iconset`),[]}},_=e=>(0,r.qy)(p||(p=g` <ha-combo-box-item type="button"> <ha-icon .icon="${0}" slot="start"></ha-icon> ${0} </ha-combo-box-item> `),e.id,e.id);class x extends r.WF{render(){return(0,r.qy)(u||(u=g` <ha-generic-picker allow-custom-value .getItems="${0}" .helper="${0}" .disabled="${0}" .required="${0}" .errorMessage="${0}" .invalid="${0}" .rowRenderer="${0}" .icon="${0}" .label="${0}" .value="${0}" .searchFn="${0}" @value-changed="${0}"> <slot name="start"></slot> </ha-generic-picker> `),this._getIconPickerItems,this.helper,this.disabled,this.required,this.errorMessage,this.invalid,_,this._icon,this.label,this._value,this._filterIcons,this._valueChanged)}firstUpdated(){b||w().then(()=>{this._getIconPickerItems=()=>m,this.requestUpdate()})}_valueChanged(e){e.stopPropagation(),this._setValue(e.detail.value)}_setValue(e){this.value=e,(0,l.r)(this,"value-changed",{value:this._value},{bubbles:!1,composed:!1})}get _icon(){var e;return null!==(e=this.value)&&void 0!==e&&e.length?this.value:this.placeholder}get _value(){return this.value||""}constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.invalid=!1,this._getIconPickerItems=()=>m,this._filterIcons=(0,n.A)((e,t,a)=>{const i=e.toLowerCase().replace(/\s+/g,"-"),o=null!=a&&a.length?a:t;if(!i.length)return o;const r=[];for(const s of o){const e=(s.id.split(":")[1]||s.id).toLowerCase().split("-"),t=s.search_labels?Object.values(s.search_labels).filter(e=>null!==e).map(e=>e.toLowerCase()):[],a=s.id.toLowerCase();e.includes(i)?r.push({item:s,rank:1}):t.includes(i)?r.push({item:s,rank:2}):a.includes(i)?r.push({item:s,rank:3}):t.some(e=>e.includes(i))&&r.push({item:s,rank:4})}return r.sort((e,t)=>e.rank-t.rank).map(e=>e.item)})}}x.styles=(0,r.AH)(v||(v=g`ha-generic-picker{width:100%;display:block}`)),(0,o.Cg)([(0,s.MZ)()],x.prototype,"value",void 0),(0,o.Cg)([(0,s.MZ)()],x.prototype,"label",void 0),(0,o.Cg)([(0,s.MZ)()],x.prototype,"helper",void 0),(0,o.Cg)([(0,s.MZ)()],x.prototype,"placeholder",void 0),(0,o.Cg)([(0,s.MZ)({attribute:"error-message"})],x.prototype,"errorMessage",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],x.prototype,"disabled",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],x.prototype,"required",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],x.prototype,"invalid",void 0),x=(0,o.Cg)([(0,s.EM)("ha-icon-picker")],x),i()}catch(p){i(p)}})},59646:function(e,t,a){a.a(e,async function(e,t){try{a(62953);var i=a(40445),o=a(29344),r=a(5124),s=a(67576),n=a(88360),l=e([o]);o=(l.then?(await l)():l)[0];let h,d=e=>e;class c extends o.A{updated(e){super.updated(e),e.has("haptic")&&(this.haptic?this.addEventListener("change",this._forwardHaptic):this.removeEventListener("change",this._forwardHaptic))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",this._forwardHaptic)}static get styles(){return[o.A.styles,(0,r.AH)(h||(h=d`:host{--wa-form-control-toggle-size:var(--ha-switch-size, 24px);--wa-form-control-required-content:var(
            --ha-switch-required-marker,
            var(--ha-input-required-marker, "*")
          );--wa-form-control-required-content-offset:var(
            --ha-switch-required-marker-offset,
            0.1rem
          );--thumb-size:var(--ha-switch-thumb-size, 18px);--width:var(--ha-switch-width, 48px)}label{position:relative;height:max(var(--thumb-size),var(--wa-form-control-toggle-size))}label::before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:100%;height:100%;min-width:var(--ha-switch-min-touch-size,40px);min-height:var(--ha-switch-min-touch-size,40px)}label.disabled::before{pointer-events:none}.switch{background-color:var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-resting));border-color:var(--ha-switch-border-color,var(--ha-color-border-neutral-normal))}label:not(.disabled) .input:focus-visible~.switch,label:not(.disabled):hover .switch{background-color:var(--ha-switch-background-color-hover,var(--ha-switch-background-color,var(--ha-color-fill-disabled-quiet-hover)))}.checked .switch{background-color:var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-resting));border-color:var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud))}label:not(.disabled).checked .input:focus-visible~.switch,label:not(.disabled).checked:hover .switch{background-color:var(--ha-switch-checked-background-color-hover,var(--ha-switch-checked-background-color,var(--ha-color-fill-primary-normal-hover)));border-color:var(--ha-switch-checked-border-color-hover,var(--ha-switch-checked-border-color,var(--ha-color-border-primary-loud)))}.switch .thumb{background-color:var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal));border-color:var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal));border-style:var(--wa-form-control-border-style);border-width:var(--wa-form-control-border-width);box-shadow:var(--ha-switch-thumb-box-shadow,var(--ha-box-shadow-s))}label:not(.disabled) .input:focus-visible~.switch .thumb,label:not(.disabled):hover .switch .thumb{background-color:var(--ha-switch-thumb-background-color-hover,var(--ha-switch-thumb-background-color,var(--ha-color-on-neutral-normal)));border-color:var(--ha-switch-thumb-border-color-hover,var(--ha-switch-thumb-border-color,var(--ha-color-on-neutral-normal)))}.checked .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal));border-color:var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal))}label:not(.disabled).checked .input:focus-visible~.switch .thumb,label:not(.disabled).checked:hover .switch .thumb{background-color:var(--ha-switch-checked-thumb-background-color-hover,var(--ha-switch-checked-thumb-background-color,var(--ha-color-on-primary-normal)));border-color:var(--ha-switch-checked-thumb-border-color-hover,var(--ha-switch-checked-thumb-border-color,var(--ha-color-on-primary-normal)))}label.disabled{opacity:var(--ha-switch-disabled-opacity, .3);cursor:not-allowed}label:not(.disabled) .input:focus-visible~.switch .thumb{outline:0;outline-offset:none}label:not(.disabled) .input:focus-visible~.switch{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}:host(:empty) slot.label{display:none}`))]}constructor(...e){super(...e),this.haptic=!1,this._forwardHaptic=()=>{(0,n.j)(this,"light")}}}(0,i.Cg)([(0,s.MZ)({type:Boolean})],c.prototype,"haptic",void 0),c=(0,i.Cg)([(0,s.EM)("ha-switch")],c),t()}catch(h){t(h)}})},56304:function(e,t,a){a.a(e,async function(e,t){try{a(3362),a(27495),a(62953),a(49255);var i=a(40445),o=a(99324),r=a(92070),s=a(5124),n=a(67576),l=a(6412),h=a(63672),d=a(57237),c=a(53305),p=e([o]);o=(p.then?(await p)():p)[0];let u,v,g,m,b=e=>e;class f extends((0,c.w)(s.WF)){get _formControl(){return this._textarea}setFocused(e){e?this.toggleAttribute("focused",!0):this.removeAttribute("focused")}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",d.d)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",d.d)}async firstUpdated(e){var t,a;(super.firstUpdated(e),this.autofocus)&&(await(null===(t=this._textarea)||void 0===t?void 0:t.updateComplete),null===(a=this._textarea)||void 0===a||a.focus())}focus(e){var t;null===(t=this._textarea)||void 0===t||t.focus(e)}render(){var e,t,a;const i=!this.label&&this._hasSlotController.test("label"),o=!this.hint&&this._hasSlotController.test("hint");return(0,s.qy)(u||(u=b` <wa-textarea .value="${0}" .placeholder="${0}" .readonly="${0}" .required="${0}" .rows="${0}" .resize="${0}" .disabled="${0}" name="${0}" autocapitalize="${0}" autocomplete="${0}" .autofocus="${0}" .spellcheck="${0}" inputmode="${0}" enterkeyhint="${0}" minlength="${0}" maxlength="${0}" class="${0}" @input="${0}" @change="${0}" @blur="${0}" @wa-invalid="${0}" exportparts="base:wa-base, hint:wa-hint, textarea:wa-textarea"> ${0} <div slot="hint" class="${0}" role="${0}" aria-live="polite"> ${0} </div> </wa-textarea> `),null!==(e=this.value)&&void 0!==e?e:null,this.placeholder,this.readonly,this.required,null!==(t=this.rows)&&void 0!==t?t:4,this.resize,this.disabled,(0,h.J)(this.name),(0,h.J)(this.autocapitalize||void 0),(0,h.J)(this.autocomplete),this.autofocus,this.spellcheck,(0,h.J)(this.inputmode||void 0),(0,h.J)(this.enterkeyhint||void 0),(0,h.J)(this.minlength),(0,h.J)(this.maxlength),(0,l.H)({input:!0,invalid:this.invalid||this._invalid,"label-raised":void 0!==this.value&&""!==this.value||this.label&&this.placeholder,"no-label":!this.label,"hint-hidden":!(this.hint||o||this.required||this._invalid||this.invalid)}),this._handleInput,this._handleChange,this._handleBlur,this._handleInvalid,this.label||i?(0,s.qy)(v||(v=b`<slot name="label" slot="label">${0}</slot>`),this.label?this._renderLabel(this.label,this.required):s.s6):s.s6,(0,l.H)({error:this.invalid||this._invalid}),(0,h.J)(this.invalid||this._invalid?"alert":void 0),this._invalid||this.invalid?this.validationMessage||(null===(a=this._textarea)||void 0===a?void 0:a.validationMessage):this.hint||(o?(0,s.qy)(g||(g=b`<slot name="hint"></slot>`)):s.s6))}constructor(...e){super(...e),this.resize="none",this._hasSlotController=new r.X(this,"label","hint"),this._requiredMarkerCSSVar="--ha-textarea-required-marker"}}f.styles=[c.N,(0,s.AH)(m||(m=b`:host{display:flex;align-items:flex-start;padding-bottom:var(--ha-textarea-padding-bottom)}wa-textarea::part(label){width:calc(100% - var(--ha-space-2));background-color:var(--ha-color-form-background);transition:all var(--wa-transition-normal) ease-in-out,background-color var(--wa-transition-normal) ease-in-out;padding-inline-start:var(--ha-space-3);padding-inline-end:var(--ha-space-3);margin:var(--ha-space-1) var(--ha-space-1) 0;padding-top:var(--ha-space-4);white-space:nowrap;overflow:hidden}:host(:focus-within) wa-textarea::part(label),:host([focused]) wa-textarea::part(label){color:var(--primary-color)}:host(:focus-within) wa-textarea::part(label),:host([focused]) wa-textarea::part(label),wa-textarea.label-raised::part(label){padding-top:var(--ha-space-2);font-size:var(--ha-font-size-xs)}wa-textarea.no-label::part(label){height:0;padding:0}wa-textarea::part(base){min-height:56px;padding-top:var(--ha-space-6);padding-bottom:var(--ha-space-2)}wa-textarea.no-label::part(base){padding-top:var(--ha-space-3)}wa-textarea::part(base)::after{content:"";position:absolute;bottom:0;left:0;right:0;height:1px;background-color:var(--ha-color-border-neutral-loud);transition:height var(--wa-transition-normal) ease-in-out,background-color var(--wa-transition-normal) ease-in-out}:host(:focus-within) wa-textarea::part(base)::after,:host([focused]) wa-textarea::part(base)::after{height:2px;background-color:var(--primary-color)}:host(:focus-within) wa-textarea.invalid::part(base)::after,wa-textarea.invalid:not([disabled])::part(base)::after{background-color:var(--ha-color-border-danger-normal)}wa-textarea::part(textarea){padding:0 var(--ha-space-4);font-family:var(--ha-font-family-body);font-size:var(--ha-font-size-m)}:host([resize=auto]) wa-textarea::part(textarea){max-height:var(--ha-textarea-max-height,200px);overflow-y:auto}wa-textarea:hover::part(base),wa-textarea:hover::part(label){background-color:var(--ha-color-form-background-hover)}wa-textarea[disabled]::part(textarea){cursor:not-allowed}wa-textarea[disabled]::part(base),wa-textarea[disabled]::part(label){background-color:var(--ha-color-form-background-disabled)}`))],(0,i.Cg)([(0,n.MZ)({type:Number})],f.prototype,"rows",void 0),(0,i.Cg)([(0,n.MZ)()],f.prototype,"resize",void 0),(0,i.Cg)([(0,n.P)("wa-textarea")],f.prototype,"_textarea",void 0),f=(0,i.Cg)([(0,n.EM)("ha-textarea")],f),t()}catch(u){t(u)}})},88360:function(e,t,a){a.d(t,{j:function(){return o}});var i=a(1087);const o=(e,t)=>{(0,i.r)(e,"haptic",t)}},89441:function(e,t,a){a.d(t,{O:function(){return o}});a(3362),a(62953);var i=a(1087);const o=e=>class extends e{closeDialog(e){var t;if(this._closePromise)return this._closePromise;const a=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("ha-adaptive-popover, ha-adaptive-dialog, ha-dialog, ha-bottom-sheet");return a&&(this._closePromise=new Promise(e=>{this._closeResolve=e}),a.open=!1),this._closePromise||!0}connectedCallback(){super.connectedCallback(),this.addEventListener("closed",this._removeDialog,{once:!0})}disconnectedCallback(){this._dialogClosedFired||(0,i.r)(this,"dialog-closed",{dialog:this.localName}),this.removeEventListener("closed",this._removeDialog),super.disconnectedCallback()}constructor(...e){super(...e),this.dialogNext=!0,this._dialogClosedFired=!1,this._removeDialog=e=>{var t;e.stopPropagation(),null===(t=this._closeResolve)||void 0===t||t.call(this,!0),this._closePromise=void 0,this._closeResolve=void 0,this._dialogClosedFired=!0,(0,i.r)(this,"dialog-closed",{dialog:this.localName}),this.remove()}}}},427:function(e,t,a){a.a(e,async function(e,i){try{a.r(t);a(89463),a(3362),a(42762),a(62953);var o=a(40445),r=a(35211),s=a(5124),n=a(67576),l=a(38962),h=a(18350),d=a(986),c=a(72554),p=(a(93444),a(64138)),u=a(59646),v=a(56304),g=a(91485),m=a(22792),b=a(89441),f=a(14503),w=e([l,h,d,c,p,u,v,g]);[l,h,d,c,p,u,v,g]=w.then?(await w)():w;let y,_,x,k,C,$=e=>e;class M extends((0,b.O)(s.WF)){connectedCallback(){var e,t;(super.connectedCallback(),null!==(e=this.params)&&void 0!==e&&e.entry)?(this._name=this.params.entry.name||"",this._icon=this.params.entry.icon||"",this._color=this.params.entry.color||"",this._description=this.params.entry.description||""):(this._name=(null===(t=this.params)||void 0===t?void 0:t.suggestedName)||"",this._icon="",this._color="",this._description="")}render(){return this.params?(0,s.qy)(y||(y=$` <ha-dialog open header-title="${0}" prevent-scrim-close> <div> ${0} <div class="form"> <ha-input autofocus .value="${0}" .configValue="${0}" @input="${0}" .label="${0}" .validationMessage="${0}" required></ha-input> <ha-icon-picker .value="${0}" .configValue="${0}" @value-changed="${0}" .label="${0}"></ha-icon-picker> <ha-color-picker .value="${0}" .configValue="${0}" @value-changed="${0}" .label="${0}"></ha-color-picker> <ha-textarea .value="${0}" .configValue="${0}" @input="${0}" .label="${0}"></ha-textarea> </div> </div> <ha-dialog-footer slot="footer"> ${0} <ha-button slot="primaryAction" @click="${0}" .disabled="${0}"> ${0} </ha-button> </ha-dialog-footer> </ha-dialog> `),this.params.entry?this.params.entry.name||this.params.entry.label_id:this._i18n.localize("ui.dialogs.label-detail.new_label"),this._error?(0,s.qy)(_||(_=$`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):"",this._name,"name",this._input,this._i18n.localize("ui.dialogs.label-detail.name"),this._i18n.localize("ui.dialogs.label-detail.required_error_msg"),this._icon,"icon",this._valueChanged,this._i18n.localize("ui.dialogs.label-detail.icon"),this._color,"color",this._valueChanged,this._i18n.localize("ui.dialogs.label-detail.color"),this._description,"description",this._input,this._i18n.localize("ui.dialogs.label-detail.description"),this.params.entry&&this.params.removeEntry?(0,s.qy)(x||(x=$` <ha-button slot="secondaryAction" variant="danger" appearance="plain" @click="${0}" .disabled="${0}"> ${0} </ha-button> `),this._deleteEntry,this._submitting,this._i18n.localize("ui.common.delete")):(0,s.qy)(k||(k=$` <ha-button appearance="plain" slot="secondaryAction" @click="${0}"> ${0} </ha-button> `),this.closeDialog,this._i18n.localize("ui.common.cancel")),this._updateEntry,this._submitting||!this._name,this.params.entry?this._i18n.localize("ui.common.update"):this._i18n.localize("ui.common.create")):s.s6}_input(e){const t=e.target,a=t.configValue;this._error=void 0,this[`_${a}`]=t.value}_valueChanged(e){const t=e.target.configValue;this._error=void 0,this[`_${t}`]=e.detail.value||""}async _updateEntry(){this._submitting=!0;try{const e={name:this._name.trim(),icon:this._icon.trim()||null,color:this._color.trim()||null,description:this._description.trim()||null};this.params.entry?await this.params.updateEntry(e):await this.params.createEntry(e),this.closeDialog()}catch(e){this._error=e?e.message:"Unknown error"}finally{this._submitting=!1}}async _deleteEntry(){this._submitting=!0;try{await this.params.removeEntry()&&(this.params=void 0)}finally{this._submitting=!1}}static get styles(){return[f.nA,(0,s.AH)(C||(C=$`a{color:var(--primary-color)}ha-color-picker,ha-icon-picker,ha-textarea{display:block;margin-bottom:var(--ha-space-5)}ha-input{--ha-input-padding-bottom:0}`))]}constructor(...e){super(...e),this._submitting=!1}}(0,o.Cg)([(0,n.wk)(),(0,r.Fg)({context:m.D5,subscribe:!0})],M.prototype,"_i18n",void 0),(0,o.Cg)([(0,n.wk)()],M.prototype,"_name",void 0),(0,o.Cg)([(0,n.wk)()],M.prototype,"_icon",void 0),(0,o.Cg)([(0,n.wk)()],M.prototype,"_color",void 0),(0,o.Cg)([(0,n.wk)()],M.prototype,"_description",void 0),(0,o.Cg)([(0,n.wk)()],M.prototype,"_error",void 0),(0,o.Cg)([(0,n.wk)()],M.prototype,"_submitting",void 0),M=(0,o.Cg)([(0,n.EM)("dialog-label-detail")],M),i()}catch(y){i(y)}})},88438:function(e,t,a){a.d(t,{C:function(){return i}});const i="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}}]);