iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
16 lines • 25.7 kB
JavaScript
export const __rspack_esm_id=29602;export const __rspack_esm_ids=[29602];export const __webpack_modules__={93421(t,e,a){a.d(e,{IW:()=>h,dH:()=>d,fI:()=>n});a(44114);var i=a(35211),o=a(22792),r=a(32172);const s=(t,e)=>{let a=t;for(const t of e){if(null==a)return;a=a[t]}return a},l=(t,e,a)=>{const o=(0,r.p)({transformer:function(t){return a.call(this,t)},watch:e?[e]:[]}),s=(0,i.Fg)({context:t,subscribe:!0});return(t,e)=>{o(t,e),s(t,e)}},n=t=>l(o.iN,t.entityIdPath[0],function(e){const a=s(this,t.entityIdPath);return"string"==typeof a?e?.[a]:void 0}),d=t=>l(o.X1,t.entityIdPath[0],function(e){const a=s(this,t.entityIdPath);return"string"==typeof a?e?.[a]:void 0}),h=()=>l(o.D5,void 0,({localize:t})=>t)},32172(t,e,a){a.d(e,{p:()=>i});a(18111),a(7588),a(45367),a(92731),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);function i(t){return(e,a)=>{if("object"==typeof a)throw new Error("This decorator does not support this compilation type.");const i=String(a),o=e;if(o._transformers){if(!o.hasOwnProperty("_transformers")){const t=o._transformers;o._transformers=new Map,t.forEach((t,e)=>o._transformers.set(e,t))}}else{o._transformers=new Map,o._watching=new Map;const t=o.willUpdate;o.willUpdate=function(e){t.call(this,e);const a=new Set;e.forEach((t,e)=>{const i=this._watching.get(e);void 0!==i&&i.forEach(t=>a.add(t))}),a.forEach(t=>{this[t]=this[`__original_${String(t)}`]})}}o._transformers.set(a,t.transformer),t.watch&&t.watch.forEach(t=>{let e=o._watching.get(t);e||(e=new Set,o._watching.set(t,e)),e.add(a)});const r=Object.getOwnPropertyDescriptor(e,a);let s;if(void 0===r)s={get(){return this[`__transform_${i}`]},set(t){const e=this[`__transform_${i}`],a=this._transformers.get(i);this[`__transform_${i}`]=a?a.call(this,t):t,this[`__original_${i}`]=t,this.requestUpdate(i,e)},configurable:!0,enumerable:!0};else{const t=r.set;s={...r,set(e){const a=this[`__transform_${i}`],o=this._transformers.get(i);this[`__transform_${i}`]=o?o.call(this,e):e,this[`__original_${i}`]=e,this.requestUpdate(i,a),t?.call(this,e)}}}Object.defineProperty(e,a,s)}}},21050(t,e,a){a.d(e,{b:()=>i});const i=(t,e,a)=>{const i=6378e3;return[t[0]+a/i*(180/Math.PI),t[1]+e/i*(180/Math.PI)/Math.cos(t[0]*Math.PI/180)]}},64481(t,e,a){a.d(e,{D:()=>o,J:()=>s});a(64979);let i=!1;try{i="true"===window.localStorage.getItem("disableViewTransition")}catch{}const o=t=>{i=t},r=t=>{if(!(t=>(t instanceof DOMException||t instanceof Error)&&"AbortError"===t.name)(t))throw t},s=t=>{if(!document.startViewTransition||i)return t(!1),Promise.resolve();let e=!1;try{const a=document.startViewTransition(()=>{e=!0,t(!0)});return a.ready.catch(r),a.finished.catch(r)}catch(a){return console.warn("View transition failed, falling back to direct execution.",a),e?Promise.reject(a):(t(!1),Promise.resolve())}}},38962(t,e,a){a.a(t,async function(t,i){try{a.r(e);var o=a(62826),r=a(5124),s=a(22441),l=a(6412),n=a(93421),d=a(1087),h=a(26300),c=(a(67094),t([h]));h=(c.then?(await c)():c)[0];const p="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",u={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 g extends r.WF{render(){return r.qy` <div class="issue-type ${(0,l.H)({[this.alertType]:!0})}" role="alert"> <div class="icon ${this.title?"":"no-title"}"> <slot name="icon"> <ha-svg-icon .path="${u[this.alertType]}"></ha-svg-icon> </slot> </div> <div class="${(0,l.H)({content:!0,narrow:this.narrow})}"> <div class="main-content"> ${this.title?r.qy`<div class="title">${this.title}</div>`:r.s6} <slot></slot> </div> <div class="action"> <slot name="action"> ${this.dismissable?r.qy`<ha-icon-button ="${this._dismissClicked}" .label="${this._localize?.("ui.common.dismiss_alert")}" .path="${p}"></ha-icon-button>`:r.s6} </slot> </div> </div> </div> `}_dismissClicked(){(0,d.r)(this,"alert-dismissed-clicked")}constructor(...t){super(...t),this.title="",this.alertType="info",this.dismissable=!1,this.narrow=!1}}g.styles=r.AH`.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)()],g.prototype,"title",void 0),(0,o.Cg)([(0,s.MZ)({attribute:"alert-type"})],g.prototype,"alertType",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],g.prototype,"dismissable",void 0),(0,o.Cg)([(0,s.wk)(),(0,n.IW)()],g.prototype,"_localize",void 0),(0,o.Cg)([(0,s.MZ)({type:Boolean})],g.prototype,"narrow",void 0),g=(0,o.Cg)([(0,s.EM)("ha-alert")],g),i()}catch(t){i(t)}})},93444(t,e,a){var i=a(62826),o=a(5124),r=a(22441);class s extends o.WF{render(){return o.qy` <footer> <slot name="secondaryAction"></slot> <slot name="primaryAction"></slot> </footer> `}static get styles(){return[o.AH`footer{display:flex;gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%}`]}}s=(0,i.Cg)([(0,r.EM)("ha-dialog-footer")],s)},76538(t,e,a){var i=a(62826),o=a(5124),r=a(22441);class s extends o.WF{render(){const t=o.qy`<div class="header-title"> <slot name="title"></slot> </div>`,e=o.qy`<div class="header-subtitle"> <slot name="subtitle"></slot> </div>`;return o.qy` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> ${"above"===this.subtitlePosition?o.qy`${e}${t}`:o.qy`${t}${e}`} </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `}static get styles(){return[o.AH`: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))} 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(...t){super(...t),this.subtitlePosition="below",this.showBorder=!1}}(0,i.Cg)([(0,r.MZ)({type:String,attribute:"subtitle-position"})],s.prototype,"subtitlePosition",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"show-border"})],s.prototype,"showBorder",void 0),s=(0,i.Cg)([(0,r.EM)("ha-dialog-header")],s)},72554(t,e,a){a.a(t,async function(t,e){try{var i=a(62826),o=a(93900),r=a(35211),s=a(5124),l=a(22441),n=a(63672),d=a(1087),h=a(64481),c=a(22792),p=a(59992),u=a(14503),g=a(22348),v=(a(76538),a(26300)),m=t([o,v]);[o,v]=m.then?(await m)():m;const f="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 b extends((0,p.V)(s.WF)){connectedCallback(){super.connectedCallback(),this.addEventListener("dialog-set-fullscreen",this._handleFullscreenChanged)}get scrollableElement(){return this.bodyContainer}updated(t){super.updated(t),t.has("open")&&(this._open=this.open)}render(){return s.qy` <wa-dialog .open="${this._open}" .lightDismiss="${!this.preventScrimClose}" without-header aria-labelledby="${(0,n.J)(this.ariaLabelledBy||(void 0!==this.headerTitle?"ha-dialog-title":void 0))}" aria-describedby="${(0,n.J)(this.ariaDescribedBy)}" ="${this._handleKeyDown}" -hide="${this._handleHide}" -show="${this._handleShow}" -after-show="${this._handleAfterShow}" -after-hide="${this._handleAfterHide}"> ${this.withoutHeader?s.s6:s.qy`<slot name="header"> <ha-dialog-header .subtitlePosition="${this.headerSubtitlePosition}" .showBorder="${this._bodyScrolled}"> <slot name="headerNavigationIcon" slot="navigationIcon"> <ha-icon-button data-dialog="close" .label="${this._i18n?.localize?.("ui.common.close")??"Close"}" .path="${f}"></ha-icon-button> </slot> ${void 0!==this.headerTitle?s.qy`<span slot="title" class="title" id="ha-dialog-title"> ${this.headerTitle} </span>`:s.qy`<slot name="headerTitle" slot="title"></slot>`} ${void 0!==this.headerSubtitle?s.qy`<span slot="subtitle">${this.headerSubtitle}</span>`:s.qy`<slot name="headerSubtitle" slot="subtitle"></slot>`} <slot name="headerActionItems" slot="actionItems"></slot> </ha-dialog-header> </slot>`} <div class="content-wrapper"> <div class="body ha-scrollbar" ="${this._handleBodyScroll}"> <slot></slot> </div> ${this.renderScrollableFades()} </div> <slot name="footer" slot="footer"></slot> </wa-dialog> `}disconnectedCallback(){this.removeEventListener("dialog-set-fullscreen",this._handleFullscreenChanged),this._setFullscreen(!1),super.disconnectedCallback(),this._open=!1}_handleFullscreenChanged(t){this._open?(0,h.J)(()=>{this._setFullscreen(t.detail)}):this._setFullscreen(t.detail)}_setFullscreen(t){this.toggleAttribute("fullscreen",t)}_handleBodyScroll(t){this._bodyScrolled=t.target.scrollTop>0}_handleKeyDown(t){"Escape"===t.key&&(this._escapePressed=!0,this.preventScrimClose&&t.preventDefault(),t.stopPropagation(),t.currentTarget.open=!1)}_handleHide(t){const e=t.detail?.source===t.target.dialog;this.preventScrimClose&&this._escapePressed&&e&&t.preventDefault(),this._escapePressed=!1}static get styles(){return[...super.styles,u.dp,s.AH`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))} (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)} 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(...t){super(...t),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 t=>{t.eventPhase===Event.AT_TARGET&&(this._open=!0,(0,d.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{if(this._hassConfig?.auth.external&&(0,g.V)(this._hassConfig.auth.external)){const t=this.querySelector("[autofocus]");return void(null!==t&&(t.id||(t.id="ha-dialog-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:t.id}})))}this.querySelector("[autofocus]")?.focus()}))},this._handleAfterShow=t=>{t.eventPhase===Event.AT_TARGET&&(0,d.r)(this,"after-show")},this._handleAfterHide=t=>{t.eventPhase===Event.AT_TARGET&&(this._open=!1,this._setFullscreen(!1),(0,d.r)(this,"closed"))}}}(0,i.Cg)([(0,l.MZ)({attribute:"aria-labelledby"})],b.prototype,"ariaLabelledBy",void 0),(0,i.Cg)([(0,l.MZ)({attribute:"aria-describedby"})],b.prototype,"ariaDescribedBy",void 0),(0,i.Cg)([(0,l.MZ)({type:Boolean,reflect:!0})],b.prototype,"open",void 0),(0,i.Cg)([(0,l.MZ)({reflect:!0})],b.prototype,"type",void 0),(0,i.Cg)([(0,l.MZ)({type:String,reflect:!0,attribute:"width"})],b.prototype,"width",void 0),(0,i.Cg)([(0,l.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],b.prototype,"preventScrimClose",void 0),(0,i.Cg)([(0,l.MZ)({attribute:"header-title"})],b.prototype,"headerTitle",void 0),(0,i.Cg)([(0,l.MZ)({attribute:"header-subtitle"})],b.prototype,"headerSubtitle",void 0),(0,i.Cg)([(0,l.MZ)({type:String,attribute:"header-subtitle-position"})],b.prototype,"headerSubtitlePosition",void 0),(0,i.Cg)([(0,l.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],b.prototype,"flexContent",void 0),(0,i.Cg)([(0,l.MZ)({type:Boolean,attribute:"without-header"})],b.prototype,"withoutHeader",void 0),(0,i.Cg)([(0,l.wk)()],b.prototype,"_open",void 0),(0,i.Cg)([(0,l.P)(".body")],b.prototype,"bodyContainer",void 0),(0,i.Cg)([(0,l.wk)(),(0,r.Fg)({context:c.D5,subscribe:!0})],b.prototype,"_i18n",void 0),(0,i.Cg)([(0,l.wk)(),(0,r.Fg)({context:c.WF,subscribe:!0})],b.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,l.wk)()],b.prototype,"_bodyScrolled",void 0),(0,i.Cg)([(0,l.Ls)({passive:!0})],b.prototype,"_handleBodyScroll",null),b=(0,i.Cg)([(0,l.EM)("ha-dialog")],b),e()}catch(t){e(t)}})},59992(t,e,a){a.d(e,{V:()=>n});var i=a(62826),o=a(88696),r=a(5124),s=a(6412),l=a(22441);const n=t=>{class e extends t{get scrollableElement(){return e.DEFAULT_SCROLLABLE_ELEMENT}firstUpdated(t){super.firstUpdated?.(t),this.scrollableElement&&this._updateScrollableState(this.scrollableElement),this._attachScrollableElement()}updated(t){super.updated?.(t),this._attachScrollableElement()}disconnectedCallback(){this._detachScrollableElement(),this._contentScrolled=!1,this._contentScrollable=!1,super.disconnectedCallback()}renderScrollableFades(t=!1){return r.qy` <div class="${(0,s.H)({"fade-top":!0,rounded:t,visible:this._contentScrolled})}"></div> <div class="${(0,s.H)({"fade-bottom":!0,rounded:t,visible:this._contentScrollable})}"></div> `}static get styles(){const t=Object.getPrototypeOf(this);var e;return[...void 0===(e=t?.styles??[])?[]:Array.isArray(e)?e:[e],r.AH`.fade-bottom,.fade-top{position:absolute;left:0;right:0;height:var(--ha-space-2);pointer-events:none;transition:opacity 180ms ease-in-out;border-radius:var(--ha-border-radius-square);opacity:0;background:linear-gradient(to bottom,var(--ha-color-shadow-scrollable-fade),transparent)}.fade-top{top:0}.fade-bottom{bottom:0;transform:rotate(180deg)}.fade-bottom.visible,.fade-top.visible{opacity:1}.fade-bottom.rounded,.fade-top.rounded{border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border-bottom-left-radius:var(--ha-border-radius-square);border-bottom-right-radius:var(--ha-border-radius-square)}.fade-top.rounded{border-top-left-radius:var(--ha-border-radius-square);border-top-right-radius:var(--ha-border-radius-square)}.fade-bottom.rounded{border-bottom-left-radius:var(--ha-border-radius-square);border-bottom-right-radius:var(--ha-border-radius-square)}`]}_attachScrollableElement(){const t=this.scrollableElement;t!==this._scrollTarget&&(this._detachScrollableElement(),t&&(this._scrollTarget=t,t.addEventListener("scroll",this._onScroll,{passive:!0}),this._resize.observe(t),this._updateScrollableState(t)))}_detachScrollableElement(){this._scrollTarget&&(this._scrollTarget.removeEventListener("scroll",this._onScroll),this._resize.unobserve?.(this._scrollTarget),this._scrollTarget=void 0)}_updateScrollableState(t){const e=parseFloat(getComputedStyle(t).getPropertyValue("--safe-area-inset-bottom"))||0,{scrollHeight:a=0,clientHeight:i=0,scrollTop:o=0}=t;this._contentScrollable=a-i>o+e+this.scrollFadeSafeAreaPadding}constructor(...t){super(...t),this._contentScrolled=!1,this._contentScrollable=!1,this._onScroll=t=>{const e=t.currentTarget;this._contentScrolled=(e.scrollTop??0)>this.scrollFadeThreshold,this._updateScrollableState(e)},this._resize=new o.P(this,{target:null,callback:t=>{const e=t[0]?.target;e&&this._updateScrollableState(e)}}),this.scrollFadeSafeAreaPadding=4,this.scrollFadeThreshold=4}}return e.DEFAULT_SCROLLABLE_ELEMENT=null,(0,i.Cg)([(0,l.wk)()],e.prototype,"_contentScrolled",void 0),(0,i.Cg)([(0,l.wk)()],e.prototype,"_contentScrollable",void 0),e}},24367(t,e,a){a.d(e,{L:()=>o,z:()=>r});var i=a(23832);const o=["input_boolean","input_button","input_text","input_number","input_datetime","input_select","counter","timer","schedule"],r=(0,i.g)(o)},29508(t,e,a){a.a(t,async function(t,i){try{a.r(e);a(74423);var o=a(62826),r=a(5124),s=a(22441),l=a(22786),n=a(1087),d=a(21050),h=(a(93444),a(72554)),c=a(52763),p=a(18350),u=a(53812),g=a(14503),v=t([h,c,p]);[h,c,p]=v.then?(await v)():v;class m extends r.WF{showDialog(t){if(this._params=t,this._error=void 0,this._params.entry)this._data=this._params.entry;else{const t=(0,u.kg)();let e;t?.latitude&&t?.longitude||(e=(0,d.b)([this.hass.config.latitude,this.hass.config.longitude],500*Math.random()*(Math.random()<.5?-1:1),500*Math.random()*(Math.random()<.5?-1:1))),this._data={latitude:t?.latitude||e[0],longitude:t?.longitude||e[1],name:t?.name||"",icon:t?.icon||"mdi:map-marker",passive:!1,radius:100}}this._open=!0}closeDialog(){this._open=!1}_dialogClosed(){this._params=void 0,this._data=void 0,(0,n.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params||!this._data)return r.s6;const t=""===this._data.name.trim(),e=Boolean(this._data.icon&&!this._data.icon.trim().includes(":")),a=""===String(this._data.latitude),i=""===String(this._data.longitude),o=""===String(this._data.radius),s=!(t||e||a||i||o);return r.qy` <ha-dialog .open="${this._open}" header-title="${this._params.entry?this.hass.localize("ui.common.edit_item",{name:this._params.entry.name}):this.hass.localize("ui.panel.config.zone.detail.new_zone")}" prevent-scrim-close ="${this._dialogClosed}"> <ha-form autofocus .hass="${this.hass}" .schema="${this._schema(this._data.icon)}" .data="${this._formData(this._data)}" .error="${this._error}" .computeLabel="${this._computeLabel}" class="${this._data.passive?"passive":""}" -changed="${this._valueChanged}"></ha-form> <ha-dialog-footer slot="footer"> ${this._params.entry?r.qy` <ha-button slot="secondaryAction" variant="danger" appearance="plain" ="${this._deleteEntry}" .disabled="${this._submitting}"> ${this.hass.localize("ui.panel.config.zone.detail.delete")} </ha-button> `:r.qy` <ha-button slot="secondaryAction" appearance="plain" ="${this.closeDialog}"> ${this.hass.localize("ui.common.cancel")} </ha-button> `} <ha-button slot="primaryAction" ="${this._updateEntry}" .disabled="${!s||this._submitting}"> ${this._params.entry?this.hass.localize("ui.common.save"):this.hass.localize("ui.panel.config.zone.detail.create")} </ha-button> </ha-dialog-footer> </ha-dialog> `}_valueChanged(t){this._error=void 0;const e={...t.detail.value};e.latitude=e.location.latitude,e.longitude=e.location.longitude,e.radius=e.location.radius,delete e.location,e.icon||delete e.icon,this._data=e}async _updateEntry(){this._submitting=!0;try{this._params.entry?await this._params.updateEntry(this._data):await this._params.createEntry(this._data),this.closeDialog()}catch(t){this._error={base:t?t.message:"Unknown error"}}finally{this._submitting=!1}}async _deleteEntry(){this._submitting=!0;try{await this._params.removeEntry()&&this.closeDialog()}finally{this._submitting=!1}}static get styles(){return[g.nA,r.AH`ha-form.passive{--zone-radius-color:var(--secondary-text-color)}`]}constructor(...t){super(...t),this._open=!1,this._submitting=!1,this._schema=(0,l.A)(t=>[{name:"name",required:!0,selector:{text:{}}},{name:"icon",required:!1,selector:{icon:{}}},{name:"location",required:!0,selector:{location:{radius:!0,icon:t}}},{name:"passive_note",type:"constant"},{name:"passive",selector:{boolean:{}}}]),this._formData=(0,l.A)(t=>({...t,location:{latitude:t.latitude,longitude:t.longitude,radius:t.radius}})),this._computeLabel=t=>this.hass.localize(`ui.panel.config.zone.detail.${t.name}`)}}(0,o.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,o.Cg)([(0,s.wk)()],m.prototype,"_error",void 0),(0,o.Cg)([(0,s.wk)()],m.prototype,"_data",void 0),(0,o.Cg)([(0,s.wk)()],m.prototype,"_params",void 0),(0,o.Cg)([(0,s.wk)()],m.prototype,"_open",void 0),(0,o.Cg)([(0,s.wk)()],m.prototype,"_submitting",void 0),m=(0,o.Cg)([(0,s.EM)("dialog-zone-detail")],m),i()}catch(t){i(t)}})},22348(t,e,a){a.d(e,{V:()=>o});var i=a(37177);const o=t=>!!t&&i.n},37177(t,e,a){a.d(e,{n:()=>i});const i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}};