iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
7 lines • 57.5 kB
JavaScript
export const __rspack_esm_id=90790;export const __rspack_esm_ids=[90790];export const __webpack_modules__={78011(e,t,a){a.d(t,{x:()=>o});const i=/^(\w+)\.(\w+)$/,o=e=>i.test(e)},99611(e,t,a){a.a(e,async function(e,t){try{a(18111),a(13579),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);var i=a(62826),o=a(1126),s=a(35211),r=a(5124),n=a(22441),l=a(1087),d=a(60353),h=a(22792),c=a(59992),p=a(14503),v=a(22348),u=e([o]);o=(u.then?(await u)():u)[0];const g=300,m=new Set(["ha-control-slider","ha-slider","ha-control-switch","ha-control-circular-slider","ha-hs-color-picker","ha-map","ha-more-info-control-select-container","ha-filter-chip"]),b=new Set(["volume-slider-container","forecast"]);class y extends((0,c.V)(r.WF)){get scrollableElement(){return this._bodyElement}connectedCallback(){super.connectedCallback(),this.addEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.addEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0})}updated(e){super.updated(e),e.has("open")&&(this._drawerOpen=this.open)}render(){return r.qy` <wa-drawer id="drawer" placement="bottom" .open="${this._drawerOpen}" .lightDismiss="${!this.preventScrimClose}" .ariaLabelledby="${this.ariaLabelledBy}" .ariaDescribedby="${this.ariaDescribedBy}" @keydown="${this._handleKeyDown}" @wa-show="${this._handleShow}" @wa-after-show="${this._handleAfterShow}" @wa-hide="${this._handleHide}" @wa-after-hide="${this._handleAfterHide}" @click="${this._handleCloseAction}" without-header @touchstart="${this._handleTouchStart}"> <div class="handle-wrapper" aria-hidden="true"> <div class="handle"></div> </div> <slot name="header"></slot> <div class="content-wrapper"> <div id="body" class="body ha-scrollbar"> <slot></slot> </div> ${this.renderScrollableFades()} </div> <slot name="footer"></slot> </wa-drawer> `}_startResizing(e){document.addEventListener("touchmove",this._handleTouchMove,{passive:!1}),document.addEventListener("touchend",this._handleTouchEnd),document.addEventListener("touchcancel",this._handleTouchEnd),this._gestureRecognizer.start(e)}_animateSnapBack(){this.style.setProperty("--dialog-transition",`transform ${g}ms ease-out`),this.style.removeProperty("--dialog-transform"),setTimeout(()=>{this.style.removeProperty("--dialog-transition")},g)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("slider-interaction-start",this._handleSliderInteractionStart,{capture:!0}),this.removeEventListener("slider-interaction-stop",this._handleSliderInteractionStop,{capture:!0}),this._unregisterResizeHandlers(),this._isDragging=!1}static get styles(){return[...super.styles,p.dp,r.AH`wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:${g}ms;--hide-duration:${g}ms}wa-drawer::part(dialog){max-height:min(var(--ha-bottom-sheet-max-height,90vh),calc(100vh - max(var(--safe-area-inset-top),48px)));max-height:min(var(--ha-bottom-sheet-max-height,90dvh),calc(100dvh - max(var(--safe-area-inset-top),48px)));align-items:center;transform:var(--dialog-transform);transition:var(--dialog-transition)}@media (prefers-reduced-motion:reduce){wa-drawer{--wa-color-surface-raised:transparent;--spacing:0;--size:var(--ha-bottom-sheet-height, auto);--show-duration:1ms;--hide-duration:1ms}wa-drawer::part(dialog){transition:1ms}}wa-drawer::part(dialog)::backdrop{-webkit-backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));backdrop-filter:var(--ha-bottom-sheet-scrim-backdrop-filter,var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none)));background-color:var(--ha-bottom-sheet-scrim-color,var(--mdc-dialog-scrim-color,none))}wa-drawer::part(body){max-width:var(--ha-bottom-sheet-max-width);width:100%;position:relative;border-top-left-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));border-top-right-radius:var(--ha-bottom-sheet-border-radius,var(--ha-dialog-border-radius,var(--ha-border-radius-2xl)));background-color:var(--ha-bottom-sheet-surface-background,var(--ha-dialog-surface-background,var(--card-background-color,var(--ha-color-surface-default))));-webkit-backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));backdrop-filter:var(--ha-bottom-sheet-surface-backdrop-filter,var(--ha-dialog-surface-backdrop-filter,none));padding:var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left))}:host([flexcontent]) wa-drawer::part(body){display:flex;flex-direction:column}:host([prevent-scrim-close]) .handle-wrapper{display:none}.handle-wrapper{position:absolute;top:0;inset-inline-start:0;width:100%;padding-bottom:2px;display:flex;justify-content:center;align-items:center;pointer-events:none;z-index:1}.handle-wrapper .handle{height:16px;width:200px;display:flex;justify-content:center;align-items:center}.handle-wrapper .handle::after{content:"";border-radius:var(--ha-border-radius-md);height:4px;background:var(--ha-bottom-sheet-handle-color,var(--divider-color));width:40px}.content-wrapper{position:relative;flex:1;display:flex;flex-direction:column;min-height:0}.body{padding:var(--ha-bottom-sheet-content-padding,0);box-sizing:border-box}:host([flexcontent]) .body{flex:1;max-width:100%;display:flex;flex-direction:column;padding:var(--ha-bottom-sheet-content-padding,var(--ha-bottom-sheet-padding,0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)));box-sizing:border-box}slot[name=footer]{display:block;padding:0}::slotted([slot=footer]){display:flex;padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4) var(--ha-space-4);gap:var(--ha-space-3);justify-content:flex-end;align-items:center;width:100%;box-sizing:border-box}:host([flexcontent]) slot[name=footer]{flex-shrink:0}`]}constructor(...e){super(...e),this.open=!1,this.flexContent=!1,this.preventScrimClose=!1,this._drawerOpen=!1,this._sliderInteractionActive=!1,this._gestureRecognizer=new d.u,this._isDragging=!1,this._escapePressed=!1,this._handleShow=async()=>{this._drawerOpen=!0,this.open=!0,(0,l.r)(this,"opened"),await this.updateComplete,requestAnimationFrame(()=>{const e=this._autofocusElement;this._hassConfig?.auth.external&&(0,v.V)(this._hassConfig.auth.external)?e&&(e.id||(e.id="ha-bottom-sheet-autofocus"),this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:e.id}})):e?.focus()})},this._handleAfterShow=()=>{(0,l.r)(this,"after-show")},this._handleSliderInteractionStart=()=>{this._sliderInteractionActive=!0},this._handleSliderInteractionStop=()=>{this._sliderInteractionActive=!1},this._handleAfterHide=e=>{if(this._sliderInteractionActive)return this._drawerOpen=!0,void(this.open=!0);e.eventPhase===Event.AT_TARGET&&(this.open=!1,this._drawerOpen=!1,(0,l.r)(this,"closed"))},this._handleHide=e=>{if(e.eventPhase!==Event.AT_TARGET)return;const t=e.detail.source===e.target.drawer;if(this._sliderInteractionActive)return e.preventDefault(),this._drawerOpen=!0,this.open=!0,void(this._escapePressed=!1);this.preventScrimClose&&this._escapePressed&&t&&e.preventDefault(),this._escapePressed=!1},this._handleKeyDown=e=>{"Escape"===e.key&&(this._escapePressed=!0,this.preventScrimClose&&e.preventDefault(),e.stopPropagation(),e.currentTarget.open=!1)},this._handleCloseAction=e=>{e.composedPath().some(e=>e instanceof HTMLElement&&("close"===e.getAttribute("data-dialog")||"close"===e.getAttribute("data-drawer")))&&(this._drawerOpen=!1)},this._handleTouchStart=e=>{if(this.preventScrimClose)return;const t=e.composedPath();for(const e of t){if(e===this._drawer)break;if(e instanceof HTMLElement&&(e.scrollTop>0||m.has(e.localName)||Array.from(e.classList).some(e=>b.has(e))))return}e.stopPropagation(),this._startResizing(e.touches[0].clientY)},this._handleTouchMove=e=>{const t=e.touches[0].clientY,a=this._gestureRecognizer.move(t);a<0&&(e.preventDefault(),this._isDragging=!0,requestAnimationFrame(()=>{this._isDragging&&this.style.setProperty("--dialog-transform",`translateY(${-1*a}px)`)}))},this._handleTouchEnd=()=>{this._unregisterResizeHandlers(),this._isDragging=!1;const e=this._gestureRecognizer.end();if(e.isSwipe)return void(e.isDownwardSwipe?this._drawerOpen=!1:this._animateSnapBack());const t=this._drawer.shadowRoot?.querySelector('[part="body"]'),a=t?.offsetHeight||0;a>0&&e.delta<0&&Math.abs(e.delta)>.5*a?this._drawerOpen=!1:this._animateSnapBack()},this._unregisterResizeHandlers=()=>{document.removeEventListener("touchmove",this._handleTouchMove),document.removeEventListener("touchend",this._handleTouchEnd),document.removeEventListener("touchcancel",this._handleTouchEnd)}}}(0,i.Cg)([(0,n.MZ)({attribute:"aria-labelledby"})],y.prototype,"ariaLabelledBy",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"aria-describedby"})],y.prototype,"ariaDescribedBy",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],y.prototype,"open",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"flexcontent"})],y.prototype,"flexContent",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0,attribute:"prevent-scrim-close"})],y.prototype,"preventScrimClose",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_drawerOpen",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_sliderInteractionActive",void 0),(0,i.Cg)([(0,n.wk)(),(0,s.Fg)({context:h.WF,subscribe:!0})],y.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,n.P)("#drawer")],y.prototype,"_drawer",void 0),(0,i.Cg)([(0,n.P)("#body")],y.prototype,"_bodyElement",void 0),(0,i.Cg)([(0,n.P)("[autofocus]")],y.prototype,"_autofocusElement",void 0),y=(0,i.Cg)([(0,n.EM)("ha-bottom-sheet")],y),t()}catch(e){t(e)}})},38508(e,t,a){a.a(e,async function(e,t){try{a(18111),a(13579);var i=a(62826),o=a(61366),s=a(35211),r=a(5124),n=a(22441),l=a(63672),d=a(91335),h=a(1087),c=a(22792),p=a(17894),v=a(22348),u=a(99611),g=a(18350),m=(a(75064),a(3449),a(49639)),b=a(88285),y=(a(67094),e([o,u,g,m,b]));[o,u,g,m,b]=y.then?(await y)():y;const _="M3 16H10V14H3M18 14V10H16V14H12V16H16V20H18V16H22V14M14 6H3V8H14M14 10H3V12H14V10Z";class f extends((0,p.c)(r.WF)){willUpdate(e){e.has("value")&&this._setUnknownValue()}setFieldValue(e){this._comboBox?this._comboBox.setFieldValue(e):this._initialFieldValue=e}render(){const e=this.useTopLabel&&this.value?void 0:this.label;return r.qy`<div class="container"> ${this.useTopLabel&&this.label?r.qy`<label ?disabled="${this.disabled}">${this.label}</label>`:r.s6} <div id="picker"> <slot name="field"> ${this.addButtonLabel&&!this.value?r.qy`<ha-button size="small" appearance="filled" @click="${this.open}" .disabled="${this.disabled}"> <ha-svg-icon .path="${_}" slot="start"></ha-svg-icon> ${this.addButtonLabel} </ha-button>`:r.qy`<ha-picker-field type="button" class="${this._opened?"opened":""}" compact="compact" .unknown="${this._unknownValue}" .unknownItemText="${this.unknownItemText}" aria-label="${(0,l.J)(this.label)}" @click="${this.open}" @clear="${this._clear}" .icon="${this.icon}" .image="${this.image}" .label="${e}" .placeholder="${this.placeholder}" .value="${this.value}" .valueRenderer="${this.valueRenderer}" .required="${this.required}" .disabled="${this.disabled}" .invalid="${this.invalid}" .hideClearIcon="${this.hideClearIcon}"> <slot name="start"></slot> </ha-picker-field>`} </slot> </div> ${this._pickerWrapperOpen||this._opened?this._openedNarrow?r.qy` <ha-bottom-sheet flexcontent .open="${this._pickerWrapperOpen}" @wa-after-show="${this._dialogOpened}" @closed="${this._hidePicker}" role="dialog" aria-modal="true" aria-label="${this.label||"Select option"}"> ${this._renderComboBox(!0)} </ha-bottom-sheet> `:r.qy` <wa-popover .open="${this._pickerWrapperOpen}" style="--body-width:${this._popoverWidth}px" without-arrow distance="-4" .placement="${this.popoverPlacement}" .for="${this.popoverAnchor?null:"picker"}" .anchor="${this.popoverAnchor??null}" auto-size="vertical" auto-size-padding="16" @wa-after-show="${this._dialogOpened}" @wa-after-hide="${this._hidePicker}" trap-focus role="dialog" aria-modal="true" aria-label="${this.label||"Select option"}"> ${this._renderComboBox()} </wa-popover> `:r.s6} </div> ${this._renderHelper()}`}_renderComboBox(e=!1){return this._opened?r.qy` <ha-picker-combo-box id="combo-box" .allowCustomValue="${this.allowCustomValue}" .label="${this.searchLabel}" .value="${this._selectedValue??this.value}" @value-changed="${this._valueChanged}" .rowRenderer="${this.rowRenderer}" .notFoundLabel="${this.notFoundLabel}" .emptyLabel="${this.emptyLabel}" .getItems="${this.getItems}" .getAdditionalItems="${this.getAdditionalItems}" .searchFn="${this.searchFn}" .mode="${e?"dialog":"popover"}" .sections="${this.sections}" .sectionTitleFunction="${this.sectionTitleFunction}" .selectedSection="${this.selectedSection}" .searchKeys="${this.searchKeys}" .customValueLabel="${this.customValueLabel}" .noSort="${this.noSort}"></ha-picker-combo-box> `:r.s6}_renderHelper(){const e=this.invalid&&this.errorMessage,t=!e&&this.helper;return e||t?r.qy`<ha-input-helper-text .disabled="${this.disabled}"> ${e?this.errorMessage:this.helper} </ha-input-helper-text>`:r.s6}refreshItems(){this._comboBox?.refreshItems()}_hidePicker(e){e.stopPropagation(),this._newValue&&((0,h.r)(this,"value-changed",{value:this._newValue}),this._newValue=void 0),this._opened=!1,this._pickerWrapperOpen=!1,this._selectedValue=void 0,this._unsubscribeTinyKeys?.(),(0,h.r)(this,"picker-closed")}_valueChanged(e){e.stopPropagation();const t=e.detail.value;t&&(this._pickerWrapperOpen=!1,this._newValue=t)}_clear(e){e.stopPropagation(),this._setValue(void 0)}_setValue(e){this.value=e,(0,h.r)(this,"value-changed",{value:e})}async open(e,t){e?.stopPropagation(),this.disabled||(this._selectedValue=t?.selectedValue,this._openedNarrow=this._narrow,this._popoverWidth=this._containerElement?.offsetWidth||250,this._pickerWrapperOpen=!0,this._unsubscribeTinyKeys=(0,d.Tc)(this,{Escape:this._handleEscClose}))}connectedCallback(){super.connectedCallback(),this._handleResize(),window.addEventListener("resize",this._handleResize)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._handleResize),this._unsubscribeTinyKeys?.()}static get styles(){return[r.AH`.container{position:relative;display:block;max-width:100%}label[disabled]{color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}label{display:block;margin:0 0 8px}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}:host([invalid]) ha-input-helper-text{color:var(--mdc-theme-error,var(--error-color,#b00020))}wa-popover{--wa-space-l:0}wa-popover::part(dialog)::backdrop{background:0 0}wa-popover::part(body){width:var(--ha-generic-picker-width,max(var(--body-width),250px));max-width:var(--ha-generic-picker-max-width,var(--ha-generic-picker-width,max(var(--body-width),250px)));max-height:500px;height:70vh;overflow:hidden}@media (max-height:1000px){wa-popover::part(body){max-height:400px}}ha-bottom-sheet{--ha-bottom-sheet-height:90vh;--ha-bottom-sheet-height:calc(100dvh - var(--ha-space-12));--ha-bottom-sheet-max-height:var(--ha-bottom-sheet-height);--ha-bottom-sheet-max-width:600px;--ha-bottom-sheet-padding:0;--ha-bottom-sheet-surface-background:var(--card-background-color);--ha-bottom-sheet-border-radius:var(--ha-border-radius-2xl);--ha-bottom-sheet-content-padding:0 var(--safe-area-inset-right) var(--safe-area-inset-bottom) var(--safe-area-inset-left)}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}`]}constructor(...e){super(...e),this.popoverPlacement="bottom",this.useTopLabel=!1,this.noSort=!1,this._opened=!1,this._pickerWrapperOpen=!1,this._popoverWidth=0,this._openedNarrow=!1,this._unknownValue=!1,this._narrow=!1,this.invalid=!1,this._setUnknownValue=()=>{const e=this.getItems();!this.allowCustomValue&&void 0!==this.value&&null!==this.value&&""!==this.value&&e?this._unknownValue=!e.some(e=>"string"!=typeof e&&e.id===this.value):this._unknownValue=!1},this._dialogOpened=()=>{this._opened=!0,(0,h.r)(this,"picker-opened"),requestAnimationFrame(()=>{this._initialFieldValue&&(this._comboBox?.setFieldValue(this._initialFieldValue),this._initialFieldValue=void 0),this._hassConfig?.auth.external&&(0,v.V)(this._hassConfig.auth.external)?this._hassConfig.auth.external.fireMessage({type:"focus_element",payload:{element_id:"combo-box"}}):this._comboBox?.focus()})},this._handleResize=()=>{this._narrow=window.matchMedia("(max-width: 870px)").matches||window.matchMedia("(max-height: 500px)").matches,!this._openedNarrow&&this._pickerWrapperOpen&&(this._popoverWidth=this._containerElement?.offsetWidth||250)},this._handleEscClose=e=>{e.stopPropagation()}}}f.shadowRootOptions={...r.WF.shadowRootOptions,delegatesFocus:!0},(0,i.Cg)([(0,n.MZ)({type:Boolean,attribute:"allow-custom-value"})],f.prototype,"allowCustomValue",void 0),(0,i.Cg)([(0,n.MZ)({type:String,attribute:"search-label"})],f.prototype,"searchLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"getItems",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"getAdditionalItems",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"rowRenderer",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"searchFn",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"searchKeys",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"notFoundLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"empty-label"})],f.prototype,"emptyLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"popover-placement"})],f.prototype,"popoverPlacement",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"add-button-label"})],f.prototype,"addButtonLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"sections",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"sectionTitleFunction",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"selected-section"})],f.prototype,"selectedSection",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"popoverAnchor",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,attribute:"use-top-label"})],f.prototype,"useTopLabel",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"custom-value-label"})],f.prototype,"customValueLabel",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,attribute:"no-sort"})],f.prototype,"noSort",void 0),(0,i.Cg)([(0,n.P)(".container")],f.prototype,"_containerElement",void 0),(0,i.Cg)([(0,n.P)("ha-picker-combo-box")],f.prototype,"_comboBox",void 0),(0,i.Cg)([(0,n.wk)(),(0,s.Fg)({context:c.WF,subscribe:!0})],f.prototype,"_hassConfig",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_opened",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_pickerWrapperOpen",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_popoverWidth",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_openedNarrow",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_unknownValue",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_selectedValue",void 0),(0,i.Cg)([(0,n.MZ)({attribute:"error-message"})],f.prototype,"errorMessage",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],f.prototype,"invalid",void 0),f=(0,i.Cg)([(0,n.EM)("ha-generic-picker")],f),t()}catch(e){t(e)}})},3449(e,t,a){var i=a(62826),o=a(5124),s=a(22441);class r extends o.WF{render(){return o.qy`<slot></slot>`}constructor(...e){super(...e),this.disabled=!1}}r.styles=o.AH`:host{display:block;color:var(--mdc-text-field-label-ink-color,rgba(0,0,0,.6));font-size:var(--ha-font-size-s);padding-left:16px;padding-right:16px;padding-inline-start:16px;padding-inline-end:16px;letter-spacing:var(
--mdc-typography-caption-letter-spacing,
.0333333333em
);line-height:normal}:host([disabled]){color:var(--mdc-text-field-disabled-ink-color,rgba(0,0,0,.6))}`,(0,i.Cg)([(0,s.MZ)({type:Boolean,reflect:!0})],r.prototype,"disabled",void 0),r=(0,i.Cg)([(0,s.EM)("ha-input-helper-text")],r)},38377(e,t,a){a(74423),a(18111),a(22489),a(61701),a(18237);var i=a(62826),o=a(5124),s=a(22441),r=a(20889),n=a(30015),l=a.n(n),d=a(1087),h=(a(14603),a(47566),a(98721),a(2209));let c;var p=a(996);const v=e=>o.qy`${e}`,u=new p.G(1e3),g={reType:/(?<input>(\[!(?<type>caution|important|note|tip|warning)\])(?:\s|\\n)?)/i,typeToHaAlert:{caution:"error",important:"info",note:"info",tip:"success",warning:"warning"}};class m extends o.mN{disconnectedCallback(){if(super.disconnectedCallback(),this.cache){const e=this._computeCacheKey();u.set(e,this.innerHTML)}}createRenderRoot(){return this}update(e){super.update(e),void 0!==this.content&&(this._renderPromise=this._render())}async getUpdateComplete(){return await super.getUpdateComplete(),await this._renderPromise,!0}willUpdate(e){if(!this.innerHTML&&this.cache){const e=this._computeCacheKey();u.has(e)&&((0,o.XX)(v((0,r._)(u.get(e))),this.renderRoot),this._resize())}}_computeCacheKey(){return l()({content:this.content,allowSvg:this.allowSvg,allowDataUrl:this.allowDataUrl,breaks:this.breaks})}async _render(){const e=await(async(e,t,i)=>(c||(c=(0,h.LV)(new Worker(new URL(a.p+a.u(55640),a.b)))),c.renderMarkdown(e,t,i)))(String(this.content),{breaks:this.breaks,gfm:!0},{allowSvg:this.allowSvg,allowDataUrl:this.allowDataUrl});(0,o.XX)(v((0,r._)(e.join(""))),this.renderRoot),this._resize();const t=document.createTreeWalker(this,NodeFilter.SHOW_ELEMENT,null);for(;t.nextNode();){const e=t.currentNode;if(e instanceof HTMLAnchorElement&&e.host!==document.location.host)e.target="_blank",e.rel="noreferrer noopener";else if(e instanceof HTMLImageElement)this.lazyImages&&(e.loading="lazy"),e.addEventListener("load",this._resize);else if(e instanceof HTMLQuoteElement){const a=e.firstElementChild?.firstChild?.textContent&&g.reType.exec(e.firstElementChild.firstChild.textContent);if(a){const{type:i}=a.groups,o=document.createElement("ha-alert");o.alertType=g.typeToHaAlert[i.toLowerCase()],o.append(...Array.from(e.childNodes).map(e=>{const t=Array.from(e.childNodes);if(!this.breaks&&t.length){const e=t[0];e.nodeType===Node.TEXT_NODE&&e.textContent===a.input&&e.textContent?.includes("\n")&&(e.textContent=e.textContent.split("\n").slice(1).join("\n"))}return t}).reduce((e,t)=>e.concat(t),[]).filter(e=>e.textContent&&e.textContent!==a.input)),t.parentNode().replaceChild(o,e)}}else e instanceof HTMLElement&&["ha-alert","ha-qr-code","ha-icon","ha-svg-icon"].includes(e.localName)&&a(62003)(`./${e.localName}`)}}constructor(...e){super(...e),this.allowSvg=!1,this.allowDataUrl=!1,this.breaks=!1,this.lazyImages=!1,this.cache=!1,this._renderPromise=Promise.resolve(),this._resize=()=>(0,d.r)(this,"content-resize")}}(0,i.Cg)([(0,s.MZ)()],m.prototype,"content",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"allow-svg",type:Boolean})],m.prototype,"allowSvg",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"allow-data-url",type:Boolean})],m.prototype,"allowDataUrl",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"breaks",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"lazy-images"})],m.prototype,"lazyImages",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"cache",void 0),m=(0,i.Cg)([(0,s.EM)("ha-markdown-element")],m)},3587(e,t,a){var i=a(62826),o=a(5124),s=a(22441);a(38377);class r extends o.WF{async getUpdateComplete(){const e=await super.getUpdateComplete();return await(this._markdownElement?.updateComplete),e}render(){return this.content?o.qy`<ha-markdown-element .content="${this.content}" .allowSvg="${this.allowSvg}" .allowDataUrl="${this.allowDataUrl}" .breaks="${this.breaks}" .lazyImages="${this.lazyImages}" .cache="${this.cache}"></ha-markdown-element>`:o.s6}constructor(...e){super(...e),this.allowSvg=!1,this.allowDataUrl=!1,this.breaks=!1,this.lazyImages=!1,this.cache=!1}}r.styles=o.AH`:host{display:block}ha-markdown-element{-ms-user-select:text;-webkit-user-select:text;-moz-user-select:text}ha-markdown-element>:first-child{margin-top:0}ha-markdown-element>:last-child{margin-bottom:0}ha-alert{display:block;margin:var(--ha-space-1) 0}a{color:var(--markdown-link-color,var(--primary-color))}img{background-color:var(--markdown-image-background-color);border-radius:var(--markdown-image-border-radius);max-width:100%}p:first-child>img:first-child{vertical-align:top}p:first-child>img:last-child{vertical-align:top}ha-markdown-element>:is(ol,ul){padding-inline-start:var(--markdown-list-indent,revert)}li:has(input[type=checkbox]){list-style:none}li:has(input[type=checkbox])>input[type=checkbox]{margin-left:0}svg{background-color:var(--markdown-svg-background-color,none);color:var(--markdown-svg-color,none)}code,pre{background-color:var(--markdown-code-background-color,none);border-radius:var(--ha-border-radius-sm);color:var(--markdown-code-text-color,inherit)}code{font-size:var(--ha-font-size-s);padding:.2em .4em}pre code{padding:0}pre{padding:var(--ha-space-4);overflow:auto;line-height:var(--ha-line-height-condensed);font-family:var(--ha-font-family-code)}h1,h2,h3,h4,h5,h6{line-height:initial}h2{font-size:var(--ha-font-size-xl);font-weight:var(--ha-font-weight-bold)}hr{border-color:var(--divider-color);border-bottom:none;margin:var(--ha-space-4) 0}table[role=presentation]{--markdown-table-border-collapse:separate;--markdown-table-border-width:0;--markdown-table-padding-inline:0;--markdown-table-padding-block:0}table[role=presentation] td,table[role=presentation] th{vertical-align:middle}table[role=presentation] td[valign=top],table[role=presentation] th[valign=top]{vertical-align:top}table[role=presentation] td[valign=middle],table[role=presentation] th[valign=middle]{vertical-align:middle}table[role=presentation] td[valign=bottom],table[role=presentation] th[valign=bottom]{vertical-align:bottom}table[role=presentation] td[valign=baseline],table[role=presentation] th[valign=baseline]{vertical-align:baseline}@supports (border-width:attr(border px,0)){table[role=presentation]{--markdown-table-border-width:attr(border px, 0)}table[role=presentation] td,table[role=presentation] th{vertical-align:attr(valign,middle)}}table[role=presentation][border="0"]{--markdown-table-border-width:0}table[role=presentation][border="1"]{--markdown-table-border-width:1px}table[role=presentation][border="2"]{--markdown-table-border-width:2px}table[role=presentation][border="3"]{--markdown-table-border-width:3px}table{border-collapse:var(--markdown-table-border-collapse,collapse)}div:has(> table){overflow:auto}th{text-align:var(--markdown-table-text-align,start)}td,th{border-width:var(--markdown-table-border-width,1px);border-style:var(--markdown-table-border-style,solid);border-color:var(--markdown-table-border-color,var(--divider-color));padding-inline:var(--markdown-table-padding-inline,0.5em);padding-block:var(--markdown-table-padding-block,0.25em)}blockquote{border-left:4px solid var(--divider-color);margin-inline:0;padding-inline:1em}`,(0,i.Cg)([(0,s.MZ)()],r.prototype,"content",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"allow-svg",type:Boolean})],r.prototype,"allowSvg",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"allow-data-url",type:Boolean})],r.prototype,"allowDataUrl",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],r.prototype,"breaks",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean,attribute:"lazy-images"})],r.prototype,"lazyImages",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],r.prototype,"cache",void 0),(0,i.Cg)([(0,s.P)("ha-markdown-element")],r.prototype,"_markdownElement",void 0),r=(0,i.Cg)([(0,s.EM)("ha-markdown")],r)},88285(e,t,a){a.a(e,async function(e,t){try{var i=a(62826),o=a(35211),s=a(5124),r=a(22441),n=a(63672),l=a(1087),d=a(22792),h=a(17894),c=(a(75064),a(47680),a(26300)),p=e([c]);c=(p.then?(await p)():p)[0];const v="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="M7,10L12,15L17,10H7Z";class g extends((0,h.c)(s.WF)){async focus(){await this.updateComplete,await(this.item?.focus())}render(){const e=!!this.value,t=!(!this.value||this.required||this.disabled||this.hideClearIcon),a=this.placeholder??this.label,i=this.label&&e?s.qy`<span slot="overline">${this.label}${this.required?" *":""}</span>`:s.s6,o=e?this.valueRenderer?this.valueRenderer(this.value??""):s.qy`<span slot="headline">${this.value}</span>`:a?s.qy`<span slot="headline" class="placeholder"> ${a}${this.required?" *":""} </span>`:s.s6;return s.qy` <ha-combo-box-item aria-label="${(0,n.J)(this.label||this.placeholder)}" .disabled="${this.disabled}" type="button" compact="compact"> ${this.image?s.qy`<img alt="${this.label??""}" slot="start" .src="${this.image}" crossorigin="anonymous" referrerpolicy="no-referrer">`:this.icon?s.qy`<ha-icon slot="start" .icon="${this.icon}"></ha-icon>`:s.qy`<slot name="start"></slot>`} ${i}${o} ${this.unknown?s.qy`<div slot="supporting-text" class="unknown"> ${this.unknownItemText||this._i18n?.localize("ui.components.combo-box.unknown_item")} </div>`:s.s6} ${t?s.qy` <ha-icon-button class="clear" slot="end" @click="${this._clear}" .path="${v}"></ha-icon-button> `:s.s6} <ha-svg-icon class="arrow" slot="end" .path="${u}"></ha-svg-icon> </ha-combo-box-item> `}_clear(e){e.stopPropagation(),(0,l.r)(this,"clear")}static get styles(){return[s.AH`ha-combo-box-item[disabled]{background-color:var(--ha-color-form-background-disabled);--md-list-item-disabled-opacity:0.5;opacity:.5;cursor:not-allowed}ha-combo-box-item{position:relative;background-color:var(--ha-color-form-background);border-radius:var(--ha-border-radius-sm);border-end-end-radius:0;border-end-start-radius:0;--md-list-item-one-line-container-height:56px;--md-list-item-two-line-container-height:56px;--md-list-item-top-space:0px;--md-list-item-bottom-space:0px;--md-list-item-leading-space:var(--ha-space-4);--md-list-item-trailing-space:var(--ha-space-2);--ha-md-list-item-gap:var(--ha-space-2);--md-focus-ring-width:0px;--md-focus-ring-duration:0s}ha-combo-box-item:after{display:block;content:"";position:absolute;pointer-events:none;bottom:0;left:0;right:0;height:1px;width:100%;background-color:var(--ha-color-border-neutral-loud);transform:height 180ms ease-in-out,background-color 180ms ease-in-out}ha-combo-box-item:focus:after{height:2px;background-color:var(--mdc-theme-primary)}:host([unknown]) ha-combo-box-item{background-color:var(--ha-color-fill-warning-quiet-resting)}:host([invalid]) ha-combo-box-item:after{height:2px;background-color:var(--mdc-theme-error,var(--error-color,#b00020))}.clear{margin:0 -8px;--ha-icon-button-size:32px;--ha-icon-button-padding-inline:var(--ha-space-1)}.arrow{--mdc-icon-size:20px;width:32px}.placeholder{color:var(--secondary-text-color)}:host([invalid]) .placeholder{color:var(--mdc-theme-error,var(--error-color,#b00020))}.unknown{color:var(--ha-color-on-warning-normal)}`]}constructor(...e){super(...e),this.invalid=!1}}(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],g.prototype,"invalid",void 0),(0,i.Cg)([(0,r.P)("ha-combo-box-item",!0)],g.prototype,"item",void 0),(0,i.Cg)([(0,r.wk)(),(0,o.Fg)({context:d.D5,subscribe:!0})],g.prototype,"_i18n",void 0),g=(0,i.Cg)([(0,r.EM)("ha-picker-field")],g),t()}catch(e){t(e)}})},67431(e,t,a){a.a(e,async function(e,t){try{a(74423),a(44114),a(18111),a(22489),a(20116),a(7588),a(61701),a(13579),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);var i=a(62826),o=a(5124),s=a(22441),r=a(22786),n=a(44537),l=a(1087),d=a(71727),h=a(68246),c=a(82286),p=a(24790),v=a(95350),u=a(95311),g=a(36918),m=(a(9503),a(26300)),b=(a(3587),a(11399),a(99766)),y=a(13563),_=(a(8034),a(10763)),f=e([m,b,y,_]);[m,b,y,_]=f.then?(await f)():f;const w="M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,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,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z",k=(e,t)=>"object"==typeof t?!!Array.isArray(t)&&t.some(t=>e.includes(t)):e.includes(t),x=e=>e.selector&&!e.required&&!("boolean"in e.selector&&e.default);class $ extends o.WF{willUpdate(e){if(this.hasUpdated||(this.hass.loadBackendTranslation("services"),this.hass.loadBackendTranslation("selector")),!e.has("value"))return;const t=e.get("value");t?.action!==this.value?.action&&(this._checkedKeys=new Set);const a=this._getServiceInfo(this.value?.action,this.hass.services);if(this.value?.action?t?.action&&(0,d.m)(this.value.action)===(0,d.m)(t.action)||this._fetchManifest((0,d.m)(this.value?.action)):this._manifest=void 0,a&&"target"in a&&(this.value?.data?.entity_id||this.value?.data?.area_id||this.value?.data?.device_id)){const e={...this.value.target};this.value.data.entity_id&&!this.value.target?.entity_id&&(e.entity_id=this.value.data.entity_id),this.value.data.area_id&&!this.value.target?.area_id&&(e.area_id=this.value.data.area_id),this.value.data.device_id&&!this.value.target?.device_id&&(e.device_id=this.value.data.device_id),this._value={...this.value,target:e,data:{...this.value.data}},delete this._value.data.entity_id,delete this._value.data.device_id,delete this._value.data.area_id}else this._value=this.value;if(t?.action!==this.value?.action){let e=!1;if(this._value&&a){const t=this.value&&!("data"in this.value);this._value.data||(this._value.data={}),a.flatFields.forEach(a=>{a.selector&&a.required&&void 0===a.default&&"boolean"in a.selector&&void 0===this._value.data[a.key]&&(e=!0,this._value.data[a.key]=!1),t&&a.selector&&void 0!==a.default&&void 0===this._value.data[a.key]&&(e=!0,this._value.data[a.key]=a.default)})}e&&(0,l.r)(this,"value-changed",{value:{...this._value}})}if(this._value?.data){const e=this._yamlEditor;e&&e.value!==this._value.data&&e.setValue(this._value.data)}}_filterField(e,t){return null===t||!!t.length&&!!t.some(t=>{const a=this.hass.states[t];return!!a&&(!!e.supported_features?.some(e=>(0,c.$)(a,e))||!(!e.attribute||!Object.entries(e.attribute).some(([e,t])=>e in a.attributes&&k(t,a.attributes[e]))))})}render(){const e=this._getServiceInfo(this._value?.action,this.hass.services),t=e?.fields.length&&!e.hasSelector.length||e&&Object.keys(this._value?.data||{}).some(t=>!e.hasSelector.includes(t)),a=t&&e?.fields.find(e=>"entity_id"===e.key),i=Boolean(!t&&e?.flatFields.some(e=>x(e))),s=this._getTargetedEntities(e?.target,this._value),r=this._value?.action?(0,d.m)(this._value.action):void 0,n=this._value?.action?(0,h.Y)(this._value.action):void 0,l=r&&n?this.hass.services[r]?.[n]?.description_placeholders:void 0,c=n&&this.hass.localize(`component.${r}.services.${n}.description`,l)||e?.description;return o.qy`${this.hidePicker?o.s6:o.qy`<ha-service-picker .hass="${this.hass}" .value="${this._value?.action}" .disabled="${this.disabled}" @value-changed="${this._serviceChanged}" .showServiceId="${this.showServiceId}"></ha-service-picker>`} ${this.hideDescription?o.s6:o.qy` <div class="description"> ${c?o.qy`<p>${c}</p>`:""} ${this._manifest?o.qy` <a href="${this._manifest.is_built_in?(0,g.o)(this.hass,`/integrations/${this._manifest.domain}`):this._manifest.documentation}" title="${this.hass.localize("ui.components.service-control.integration_doc")}" target="_blank" rel="noreferrer"> <ha-icon-button .path="${w}" class="help-icon"></ha-icon-button> </a>`:o.s6} </div> `} ${e&&"target"in e?o.qy`<ha-settings-row .narrow="${this.narrow}"> <span slot="heading">${this.hass.localize("ui.components.service-control.target")}</span> <ha-selector .hass="${this.hass}" .selector="${this._targetSelector(e.target,this._value?.target)}" .disabled="${this.disabled}" @value-changed="${this._targetChanged}" .value="${this._value?.target}"></ha-selector></ha-settings-row>`:a?o.qy`<ha-entity-picker .hass="${this.hass}" .disabled="${this.disabled}" .value="${this._value?.data?.entity_id}" .label="${this.hass.localize(`component.${r}.services.${n}.fields.entity_id.description`,l)||a.description}" @value-changed="${this._entityPicked}" allow-custom-entity></ha-entity-picker>`:""} ${t?o.qy`<ha-yaml-editor .label="${this.hass.localize("ui.components.service-control.action_data")}" .name="${"data"}" .readOnly="${this.disabled}" .defaultValue="${this._value?.data}" @value-changed="${this._dataChanged}"></ha-yaml-editor>`:e?.fields.map(e=>{if(!e.fields)return this._renderField(e,i,r,n,s);const t=Object.entries(e.fields).map(([e,t])=>({key:e,...t}));return t.length&&this._hasFilteredFields(t,s)?o.qy`<ha-expansion-panel left-chevron .expanded="${!e.collapsed}" .header="${this.hass.localize(`component.${r}.services.${n}.sections.${e.key}.name`,l)||e.name||e.key}" .secondary="${this._getSectionDescription(e,r,n)}"> <ha-service-section-icon slot="icons" .hass="${this.hass}" .service="${this._value.action}" .section="${e.key}"></ha-service-section-icon> ${Object.entries(e.fields).map(([e,t])=>this._renderField({key:e,...t},i,r,n,s))} </ha-expansion-panel>`:o.s6})} `}_getSectionDescription(e,t,a){return this.hass.localize(`component.${t}.services.${a}.sections.${e.key}.description`,t&&a?this.hass.services[t][a].description_placeholders:void 0)}_hasFilteredFields(e,t){return e.some(e=>!e.filter||this._filterField(e.filter,t))}_toggleCheckbox(e){const t=e.currentTarget?.parentElement?.querySelector("ha-checkbox");t?.click()}_checkboxChanged(e){const t=e.currentTarget.checked,a=e.currentTarget.key;let i;if(t){this._checkedKeys.add(a);const e=this._getServiceInfo(this._value?.action,this.hass.services)?.flatFields.find(e=>e.key===a);let t=e?.default;null==t&&e?.selector&&"constant"in e.selector&&(t=e.selector.constant?.value),null==t&&e?.selector&&"boolean"in e.selector&&(t=!1),null!=t&&(i={...this._value?.data,[a]:t})}else this._checkedKeys.delete(a),i={...this._value?.data},delete i[a],delete this._stickySelector[a];i&&(0,l.r)(this,"value-changed",{value:{...this._value,data:i}}),this.requestUpdate("_checkedKeys")}_serviceChanged(e){if(e.stopPropagation(),e.detail.value===this._value?.action)return;const t=e.detail.value||"";let a;if(t){const e=this._getServiceInfo(t,this.hass.services),i=this._value?.target;if(i&&e?.target){const t={target:{...e.target}};let o=(0,n.e)(i.entity_id||this._value.data?.entity_id)?.slice()||[],s=(0,n.e)(i.device_id||this._value.data?.device_id)?.slice()||[],r=(0,n.e)(i.area_id||this._value.data?.area_id)?.slice()||[];r.length&&(r=r.filter(e=>(0,u.Qz)(this.hass,this.hass.entities,this.hass.devices,e,t))),s.length&&(s=s.filter(e=>(0,u.DF)(this.hass.states,Object.values(this.hass.entities),this.hass.devices[e],t))),o.length&&(o=o.filter(e=>(0,u.MM)(this.hass.states[e],t))),a={...o.length?{entity_id:o}:{},...s.length?{device_id:s}:{},...r.length?{area_id:r}:{}}}}const i={action:t,target:a};(0,l.r)(this,"value-changed",{value:i})}_entityPicked(e){e.stopPropagation();const t=e.detail.value;if(this._value?.data?.entity_id===t)return;let a;!t&&this._value?.data?(a={...this._value},delete a.data.entity_id):a={...this._value,data:{...this._value?.data,entity_id:e.detail.value}},(0,l.r)(this,"value-changed",{value:a})}_targetChanged(e){if(e.stopPropagation(),!1===e.detail.isValid)return;const t=e.detail.value;if(this._value?.target===t)return;let a;t?a={...this._value,target:e.detail.value}:(a={...this._value},delete a.target),(0,l.r)(this,"value-changed",{value:a})}_serviceDataChanged(e){if(e.stopPropagation(),!1===e.detail.isValid)return;const t=e.currentTarget.key,a=e.detail.value;if(!(this._value?.data?.[t]!==a&&(this._value?.data&&t in this._value.data||""!==a&&void 0!==a)))return;const i={...this._value?.data,[t]:a};(""===a||void 0===a||"object"==typeof a&&!Object.keys(a).length)&&(delete i[t],delete this._stickySelector[t]),(0,l.r)(this,"value-changed",{value:{...this._value,data:i}})}_dataChanged(e){e.stopPropagation(),e.detail.isValid&&(0,l.r)(this,"value-changed",{value:{...this._value,data:e.detail.value}})}async _fetchManifest(e){this._manifest=void 0;try{this._manifest=await(0,v.QC)(this.hass,e)}catch(e){}}constructor(...e){super(...e),this.disabled=!1,this.narrow=!1,this.showServiceId=!1,this.hidePicker=!1,this.hideDescription=!1,this._checkedKeys=new Set,this._stickySelector={},this._getServiceInfo=(0,r.A)((e,t)=>{if(!e||!t)return;const a=(0,d.m)(e),i=(0,h.Y)(e);if(!(a in t))return;if(!(i in t[a]))return;const o=Object.entries(t[a][i].fields).map(([e,t])=>({key:e,...t,selector:t.selector})),s=[],r=[];return o.forEach(e=>{e.fields?Object.entries(e.fields).forEach(([e,t])=>{s.push({...t,key:e}),t.selector&&r.push(e)}):(s.push(e),e.selector&&r.push(e.key))}),{...t[a][i],fields:o,flatFields:s,hasSelector:r}}),this._getTargetedEntities=(0,r.A)((e,t)=>{const a=e?{target:e}:{target:{}};if((0,p.r)(t?.target)||(0,p.r)(t?.data?.entity_id)||(0,p.r)(t?.data?.device_id)||(0,p.r)(t?.data?.area_id)||(0,p.r)(t?.data?.floor_id)||(0,p.r)(t?.data?.label_id))return null;const i=(0,n.e)(t?.target?.entity_id||t?.data?.entity_id)?.slice()||[],o=(0,n.e)(t?.target?.device_id||t?.data?.device_id)?.slice()||[],s=(0,n.e)(t?.target?.area_id||t?.data?.area_id)?.slice()||[],r=(0,n.e)(t?.target?.floor_id||t?.data?.floor_id)?.slice(),l=(0,n.e)(t?.target?.label_id||t?.data?.label_id)?.slice();return l&&l.forEach(e=>{const t=(0,u.m0)(this.hass,e,this.hass.areas,this.hass.devices,this.hass.entities,a);o.push(...t.devices);const r=t.entities.filter(e=>!this.hass.entities[e]?.entity_category&&!this.hass.entities[e]?.hidden);i.push(r),s.push(...t.areas)}),r&&r.forEach(e=>{const t=(0,u.MH)(this.hass,e,this.hass.areas,a);s.push(...t.areas)}),s.length&&s.forEach(e=>{const t=(0,u.bZ)(this.hass,e,this.hass.devices,this.hass.entities,a),s=t.entities.filter(e=>!this.hass.entities[e]?.entity_category&&!this.hass.entities[e]?.hidden);i.push(...s),o.push(...t.devices)}),o.length&&o.forEach(e=>{const t=(0,u._7)(this.hass,e,this.hass.entities,a).entities.filter(e=>!this.hass.entities[e]?.entity_category&&!this.hass.entities[e]?.hidden);i.push(...t)}),i}),this._targetSelector=(0,r.A)((e,t)=>(!t||"object"==typeof t&&!Object.keys(t).length?delete this._stickySelector.target:(0,p.r)(t)&&(this._stickySelector.target="string"==typeof t?{template:null}:{object:null}),this._stickySelector.target??(e?{target:{...e}}:{target:{}}))),this._renderField=(e,t,a,i,s)=>{if(e.filter&&!this._filterField(e.filter,s))return o.s6;const r=this._value?.data&&(0,p.r)(this._value.data[e.key]),n=r&&"string"==typeof this._value.data[e.key]?{template:null}:r&&"object"==typeof this._value.data[e.key]?{object:null}:this._stickySelector[e.key]??e?.selector??{text:null};r&&(this._stickySelector[e.key]=n);const l=x(e),d=a&&i?this.hass.services[a][i].description_placeholders:void 0;return e.selector?o.qy`<ha-settings-row .narrow="${this.narrow}"> ${l?o.qy`<ha-checkbox .key="${e.key}" .checked="${this._checkedKeys.has(e.key)||!!this._value?.data&&void 0!==this._value.data[e.key]}" .disabled="${this.disabled}" @change="${this._checkboxChanged}" slot="prefix"></ha-checkbox>`:t?o.qy`<div slot="prefix" class="checkbox-spacer"></div>`:""} <span slot="heading" class="${l?"clickable":""}" @click="${l?this._toggleCheckbox:void 0}">${this.hass.localize(`component.${a}.services.${i}.fields.${e.key}.name`,d)||e.name||e.key}</span> <span slot="description" class="${l?"clickable":""}" @click="${l?this._toggleCheckbox:void 0}"><ha-markdown breaks allow-svg .content="${this.hass.localize(`component.${a}.services.${i}.fields.${e.key}.description`,d)||e?.description}"></ha-markdown> </span> <ha-selector .context="${this._selectorContext(s)}" .disabled="${this.disabled||l&&!this._checkedKeys.has(e.key)&&(!this._value?.data||void 0===this._value.data[e.key])}" .hass="${this.hass}" .selector="${n}" .key="${e.key}" @value-changed="${this._serviceDataChanged}" .value="${this._value?.data?this._value.data[e.key]:void 0}" .placeholder="${e.default}" .localizeValue="${this._localizeValueCallback}" .required="${e.required}"></ha-selector> </ha-settings-row>`:""},this._selectorContext=(0,r.A)(e=>({filter_entity:e||void 0})),this._localizeValueCallback=e=>this._value?.action?this.hass.localize(`component.${(0,d.m)(this._value.action)}.selector.${e}`):""}}$.styles=o.AH`ha-settings-row{padding:var(--service-control-padding,0 16px)}ha-settings-row[narrow]{padding-bottom:8px}ha-settings-row{--settings-row-content-width:100%;--settings-row-prefix-display:contents;border-top:var(--service-control-items-border-top,1px solid var(--divider-color))}ha-entity-picker,ha-service-picker,ha-yaml-editor{display:block;margin:var(--service-control-padding,0 16px)}ha-yaml-editor{padding:16px 0}p{margin:var(--service-control-padding,0 16px);padding:16px 0}:host([hide-picker]) p{padding-top:0}.checkbox-spacer{width:32px}.clickable{cursor:pointer}.help-icon{color:var(--secondary-text-color)}.description{justify-content:space-between;display:flex;align-items:center;padding-right:2px;padding-inline-end:2px;padding-inline-start:initial}.description p{direction:ltr}ha-expansion-panel{--ha-card-border-radius:var(--ha-border-radius-square);--expansion-panel-summary-padding:0 16px;--expansion-panel-content-padding:0}`,(0,i.Cg)([(0,s.MZ)({attribute:!1})],$.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],$.prototype,"value",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],$.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],$.prototype,"narrow",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"show-service-id",type:Boolean})],$.prototype,"showServiceId",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"hide-picker",type:Boolean,reflect:!0})],$.prototype,"hidePicker",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"hide-description",type:Boolean})],$.prototype,"hideDescription",void 0),(0,i.Cg)([(0,s.wk)()],$.prototype,"_value",void 0),(0,i.Cg)([(0,s.wk)()],$.prototype,"_checkedKeys",void 0),(0,i.Cg)([(0,s.wk)()],$.prototype,"_manifest",void 0),(0,i.Cg)([(0,s.P)("ha-yaml-editor")],$.prototype,"_yamlEditor",void 0),$=(0,i.Cg)([(0,s.EM)("ha-service-control")],$),t()}catch(e){t(e)}})},65329(e,t,a){a.a(e,async function(e,t){try{var i=a(62826),o=a(5124),s=a(22441),r=a(91450),n=a(71727),l=a(85694),d=(a(47680),a(67094),e([l]));l=(d.then?(await d)():d)[0];class h extends o.WF{render(){if(this.icon)return o.qy`<ha-icon .icon="${this.icon}"></ha-icon>`;if(!this.service)return o.s6;if(!this.hass)return this._renderFallback();const e=(0,l.f$)(this.hass.connection,this.hass.config,this.service).then(e=>e?o.qy`<ha-icon .icon="${e}"></ha-icon>`:this._renderFallback());return o.qy`${(0,r.T)(e)}`}_renderFallback(){const e=(0,n.m)(this.service);return o.qy` <ha-svg-icon .path="${l.l[e]||l.Gn}"></ha-svg-icon> `}}(0,i.Cg)([(0,s.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)()],h.prototype,"service",void 0),(0,i.Cg)([(0,s.MZ)()],h.prototype,"icon",void 0),h=(0,i.Cg)([(0,s.EM)("ha-service-icon")],h),t()}catch(e){t(e)}})},99766(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(7588);var i=a(62826),o=a(5124),s=a(22441),r=a(22786),n=a(1087),l=a(78011),d=a(85694),h=a(95350),c=(a(75064),a(38508)),p=a(65329),v=e([c,p,d]);[c,p,d]=v.then?(await v)():v;const u="M12,5A2,2 0 0,1 14,7C14,7.24 13.96,7.47 13.88,7.69C17.95,8.5 21,11.91 21,16H3C3,11.91 6.05,8.5 10.12,7.69C10.04,7.47 10,7.24 10,7A2,2 0 0,1 12,5M22,19H2V17H22V19Z",g=[{name:"search_labels.name",weight:10},{name:"search_labels.description",weight:8},{name:"search_labels.domainName",weight:6},{name:"search_labels.serviceId",weight:3}];class m extends o.WF{async open(){await this.updateComplete,await(this._picker?.open())}firstUpdated(e){super.firstUpdated(e),this.hass.loadBackendTranslation("services"),(0,d.Yd)(this.hass.connection,this.hass.config)}render(){const e=this.placeholder??this.hass.localize("ui.components.service-picker.action");return o.qy` <ha-generic-picker .hass="${this.hass}" .autofocus="${this.autofocus}" .notFoundLabel="${this.hass.localize("ui.components.service-picker.no_match")}" .label="${this.label}" .placeholder="${e}" .value="${this.value}" .getItems="${this._getItems}" .rowRenderer="${this._rowRenderer}" .valueRenderer="${this._valueRenderer(this.hass.localize,this.hass.services)}" .searchKeys="${g}" .unknownItemText="${this.hass.localize("ui.components.service-picker.unknown")}" @value-changed="${this._valueChanged}"> </ha-generic-picker> `}_valueChanged(e){e.stopPropagation();const t=e.detail.value;t?(0,l.x)(t)&&this._setValue(t):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.disabled=!1,this.showServiceId=!1,this._rowRenderer=(e,t)=>o.qy` <ha-combo-box-item type="button" .borderTop="${0!==t}"> <ha-service-icon slot="start" .hass="${this.hass}" .service="${e.id}"></ha-service-icon> <span slot="headline">${e.primary}</span> <span slot="supporting-text">${e.secondary}</span> ${e.service_id&&this.showServiceId?o.qy`<span slot="supporting-text" class="code"> ${e.service_id} </span>`:o.s6} ${e.domain_name?o.qy` <div slot="trailing-supporting-text" class="domain"> ${e.domain_name} </div> `:o.s6} </ha-combo-box-item> `,this._valueRenderer=(0,r.A)((e,t)=>a=>{const i=a,[s,r]=i.split(".");if(!t[s]?.[r])return o.qy` <ha-svg-icon slot="start" .path="${u}"></ha-svg-icon> <span slot="headline">${a}</span> `;const n=this.hass.services[s][r].description_placeholders,l=e(`component.${s}.services.${r}.name`,n)||t[s][r].name||r;return o.qy` <ha-service-icon slot="start" .hass="${this.hass}" .service="${i}"></ha-service-icon> <span slot="headline">${l}</span> ${this.showServiceId?o.qy`<span slot="supporting-text" class="code">${i}</span>`:o.s6} `}),this._getItems=()=>this._services(this.hass.localize,this.hass.services),this._services=(0,r.A)((e,t)=>{if(!t)return[];const a=[];return Object.keys(t).sort().forEach(i=>{const o=Object.keys(t[i]).sort();for(const s of o){const o=`${i}.${s}`,r=(0,h.p$)(e,i),n=this.hass.services[i][s].description_placeholders,l=this.hass.localize(`component.${i}.services.${s}.name`,n)||t[i][s].name||s,d=this.hass.localize(`component.${i}.services.${s}.description`,n)||t[i][s].description||"";a.push({id:o,primary:l,secondary:d,domain_name:r,service_id:o,search_labels:{serviceId:o,domainName:r,name:l,description:d},sorting_label:o})}}),a})}}(0,i.Cg)([(0,s.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"disabled",void 0),(0,i.Cg)([(0,s.MZ)()],m.prototype,"label",void 0),(0,i.Cg)([(0,s.MZ)()],m.prototype,"placeholder",void 0),(0,i.Cg)([(0,s.MZ)()],m.prototype,"value",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"show-service-id",type:Boolean})],m.prototype,"showServiceId",void 0),(0,i.Cg)([(0,s.P)("ha-generic-picker")],m.prototype,"_picker",void 0),m=(0,i.Cg)([(0,s.EM)("ha-service-picker")],m),t()}catch(e){t(e)}})},13563(e,t,a){a.a(e,async function(e,t){try{var i=a(62826),o=a(5124),s=a(22441),r=a(91450),n=(a(47680),a(67094),a(85694)),l=e([n]);n=(l.then?(await l)():l)[0];class d extends o.WF{render(){if(this.icon)return o.qy`<ha-icon .icon="${this.icon}"></ha-icon>`;if(!this.service||!this.section)return o.s6;if(!this.hass)return this._renderFallback();const e=(0,n.Yw)(this.hass.connection,this.hass.config,this.service,this.section).then(e=>e?o.qy`<ha-icon .icon="${e}"></ha-icon>`:this._renderFallback());return o.qy`${(0,r.T)(e)}`}_renderFallback(){return o.s6}}(0,i.Cg)([(0,s.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)()],d.prototype,"service",void 0),(0,i.Cg)([(0,s.MZ)()],d.prototype,"section",void 0),(0,i.Cg)([(0,s.MZ)()],d.prototype,"icon",void 0),d=(0,i.Cg)([(0,s.EM)("ha-service-section-icon")],d),t()}catch(e){t(e)}})},8034(e,t,a){var i=a(62826),o=a(92070),s=a(5124),r=a(22441);class n extends s.WF{render(){const e=this._hasSlotController.test("description");return s.qy` <div class="prefix-wrap"> <slot name="prefix"></slot> <div class="body" part="heading" ?two-line="${!this.threeLine&&e}" ?three-line="${this.threeLine}"> <slot name="heading"></slot> ${e?s.qy`<span class="secondary"><slot name="description"></slot></span>`:s.s6} </div> </div> <div class="content"> <slot></slot> </div> `}constructor(...e){super(...e),this.narrow=!1,this.slim=!1,this.threeLine=!1,this.wrapHeading=!1,this.empty=!1,this._hasSlotController=new o.X(this,"description")}}n.styles=s.AH`:host{display:flex;padding:0 var(--ha-space-4);align-content:normal;align-self:auto;align-items:center}.body{padding-top:var(--settings-row-body-padding-top,var(--ha-space-2));padding-bottom:var(--settings-row-body-padding-bottom,var(--ha-space-2));padding-left:0;padding-inline-start:0;padding-right:var(--ha-space-4);padding-inline-end:var(--ha-space-4);overflow:hidden;display:var(--layout-vertical_-_display,flex);flex-direction:var(--layout-vertical_-_flex-direction,column);justify-content:var(--layout-center-justified_-_justify-content,center);flex:var(--layout-flex_-_flex,1);flex-basis:var(--layout-flex_-_flex-basis,0.000000001px)}.body[three-line]{min-height:88px}:host(:not([wrap-heading])) body>*{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.body>.secondary{display:block;padding-top:var(--ha-space-1);font-family:var(
--mdc-typography-body2-font-family,
var(--mdc-typography-font-family, var(--ha-font-family-body))
);font-size:var(--mdc-typography-body2-font-size, var(--ha-font-size-s));-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-weight:var(--mdc-typography-body2-font-weight,var(--ha-font-weight-normal));line-height:normal;color:var(--secondary-text-color)}.body[two-line]{min-height:calc(72px - 16px);flex:1}.content{display:contents}:host(:not([narrow])) .content{display:var(--settings-row-content-display,flex);justify-content:flex-end;flex:1;min-width:0;padding:var(--settings-row-content-padding-block,var(--ha-space-4)) 0}:host([empty]) .content{display:none}.content ::slotted(*){width:var(--settings-row-content-width)}:host([narrow]){align-items:normal;flex-direction:column;border-top:1px solid var(--divider-color);padding-bottom:var(--ha-space-2)}::slotted(ha-switch){padding:var(--settings-row-switch-padding-block,var(--ha-space-4)) 0}.secondary{white-space:normal}.prefix-wrap{flex:var(--settings-row-prefix-flex,1);display:var(--settings-row-prefix-display)}:host([narrow]) .prefix-wrap{display:flex;align-items:center}:host([slim]),:host([slim]) .content,:host([slim]) ::slotted(ha-switch){padding:0}:host([slim]) .body{min-height:0}`,(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],n.prototype,"narrow",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],n.prototype,"slim",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,attribute:"three-line"})],n.prototype,"threeLine",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,attribute:"wrap-heading",reflect:!0})],n.prototype,"wrapHeading",void 0),(0,i.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],n.prototype,"empty",void 0),n=(0,i.Cg)([(0,r.EM)("ha-settings-row")],n)},17894(e,t,a){a.d(t,{c:()=>s});var i=a(62826),o=a(22441);const s=e=>{class t extends e{constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.unknown=!1,this.hideClearIcon=!1}}return(0,i.Cg)([(0,o.MZ)({type:Boolean})],t.prototype,"disabled",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean})],t.prototype,"required",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"icon",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"image",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"label",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"placeholder",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"helper",void 0),(0,i.Cg)([(0,o.MZ)()],t.prototype,"value",void 0),(0,i.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],t.prototype,"unknown",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"unknown-item-text"})],t.prototype,"unknownItemText",void 0),(0,i.Cg)([(0,o.MZ)({attribute:"hide-clear-icon",type:Boolean})],t.prototype,"hideClearIcon",void 0),(0,i.Cg)([(0,o.MZ)({attribute:!1})],t.prototype,"valueRenderer",void 0),t}},996(e,t,a){a.d(t,{G:()=>i});a(45367),a(92731);class i{get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t),this._expiration&&window.setTimeout(()=>this._cache.delete(e),this._expiration)}has(e){return this._cache.has(e)}constructor(e){this._cache=new Map,this._expiration=e}}},46571(e){function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=46571,e.exports=t},62003(e,t,a){var i={"./ha-icon-prev":["89133",[61982]],"./ha-icon-button-toolbar":["9882",[39763,76775]],"./ha-alert":["38962",[19695]],"./ha-icon-button-toggle":["62501",[77254]],"./ha-svg-icon.ts":["67094",[]],"./ha-alert.ts":["38962",[19695]],"./ha-icon":["47680",[44889]],"./ha-icon-next.ts":["43661",[63902]],"./ha-qr-code.ts":["60543",[51343,62740]],"./ha-icon-overflow-menu.ts":["75248",[39763,34995,85545]],"./ha-icon-button-toggle.ts":["62501",[77254]],"./ha-icon-button-group":["39826",[13647]],"./ha-svg-icon":["67094",[]],"./ha-icon-button-prev":["45100",[99197]],"./ha-icon-button.ts":["26300",[]],"./ha-icon-overflow-menu":["75248",[39763,34995,85545]],"./ha-icon-button-arrow-next":["99028",[54101]],"./ha-icon-button-prev.ts":["45100",[99197]],"./ha-icon-picker":["64138",[39763,32450,46095,7305,92769,3283,26092,71749]],"./ha-icon-button-toolbar.ts":["9882",[39763,76775]],"./ha-icon-button-arrow-prev.ts":["90248",[17041]],"./ha-icon-button-next":["25440",[81049]],"./ha-icon-next":["43661",[63902]],"./ha-icon-picker.ts":["64138",[39763,32450,46095,7305,92769,3283,26092,71749]],"./ha-icon-prev.ts":["89133",[61982]],"./ha-icon-button-arrow-prev":["90248",[17041]],"./ha-icon-button-next.ts":["25440",[81049]],"./ha-icon.ts":["47680",[44889]],"./ha-qr-code":["60543",[51343,62740]],"./ha-icon-button":["26300",[]],"./ha-icon-button-group.ts":["39826",[13647]],"./ha-icon-button-arrow-next.ts":["99028",[54101]]};function o(e){if(!a.o(i,e))return Promise.resolve().then(()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=i[e],o=t[0];return Promise.all(t[1].map(a.e)).then(()=>a(o))}o.keys=()=>Object.keys(i),o.id=62003,e.exports=o}};