iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
13 lines • 48.8 kB
JavaScript
export const __rspack_esm_id=79971;export const __rspack_esm_ids=[79971];export const __webpack_modules__={36356(e,t,i){i.d(t,{q:()=>s});class s{get enabled(){return this._enabled}set enabled(e){e!==this._enabled&&(this._enabled=e,this._enabled?this._attach():this._detach(),this._host.requestUpdate())}hostUpdated(){this.enabled&&!this._scrollContainer&&this._attach()}hostDisconnected(){this._detach()}_attach(){this._scrollContainer=this._host.renderRoot?.querySelector(this._selector),this._scrollContainer&&this._scrollContainer.addEventListener("mousedown",this._mouseDown)}_detach(){window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._scrollContainer&&(this._scrollContainer.removeEventListener("mousedown",this._mouseDown),this._scrollContainer=void 0),this.scrolled=!1,this.scrolling=!1,this.mouseIsDown=!1,this.scrollStartX=0,this.scrollLeft=0}constructor(e,{selector:t,enabled:i}){this.mouseIsDown=!1,this.scrolled=!1,this.scrolling=!1,this.scrollStartX=0,this.scrollLeft=0,this._enabled=!0,this._mouseDown=e=>{const t=this._scrollContainer;t&&(this.scrollStartX=e.pageX-t.offsetLeft,this.scrollLeft=t.scrollLeft,this.mouseIsDown=!0,this.scrolled=!1,window.addEventListener("mousemove",this._mouseMove),window.addEventListener("mouseup",this._mouseUp,{once:!0}))},this._mouseUp=()=>{this.mouseIsDown=!1,this.scrolling=!1,this._host.requestUpdate(),window.removeEventListener("mousemove",this._mouseMove)},this._mouseMove=e=>{if(!this.mouseIsDown)return;const t=this._scrollContainer;if(!t)return;const i=e.pageX-t.offsetLeft-this.scrollStartX;this.scrolled||(this.scrolled=Math.abs(i)>1,this.scrolling=this.scrolled,this._host.requestUpdate()),t.scrollLeft=this.scrollLeft-i},this._selector=t,this._host=e,this.enabled=i??!0,e.addController(this)}}},63130(e,t,i){i.d(t,{l:()=>a});var s=i(50248);const a=async(e,t)=>{if(navigator.clipboard)try{return void await navigator.clipboard.writeText(e)}catch{}const i=t||(0,s.n)()?.getRootNode()||document.body,a=document.createElement("textarea");a.value=e,a.setAttribute("readonly",""),a.style.position="fixed",a.style.top="0",a.style.left="0",a.style.opacity="0",i.appendChild(a),a.select(),document.execCommand("copy"),i.removeChild(a)}},599(e,t,i){i.a(e,async function(e,t){try{var s=i(62826),a=i(5124),r=i(22441),o=i(65063),n=i(89300),d=i(1087),l=e([n]);n=(l.then?(await l)():l)[0];class c extends a.WF{render(){return a.qy` <ha-progress-button .progress="${this.progress}" .disabled="${this.disabled}" .appearance="${this.appearance}" ="${this._buttonTapped}" tabindex="0"> <slot></slot></ha-progress-button> `}async _callService(){this.progress=!0;const e={domain:this.domain,service:this.service,data:this.data,target:this.target,success:!1},t=this.shadowRoot.querySelector("ha-progress-button");try{await this.hass.callService(this.domain,this.service,this.data,this.target),this.progress=!1,t.actionSuccess(),e.success=!0}catch(i){return this.progress=!1,t.actionError(),void(e.success=!1)}finally{(0,d.r)(this,"hass-service-called",e)}}_buttonTapped(){this.confirmation?(0,o.dk)(this,{text:this.confirmation,confirm:()=>this._callService()}):this._callService()}constructor(...e){super(...e),this.disabled=!1,this.progress=!1,this.data={},this.appearance="plain"}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean})],c.prototype,"disabled",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean})],c.prototype,"progress",void 0),(0,s.Cg)([(0,r.MZ)()],c.prototype,"domain",void 0),(0,s.Cg)([(0,r.MZ)()],c.prototype,"service",void 0),(0,s.Cg)([(0,r.MZ)({type:Object})],c.prototype,"target",void 0),(0,s.Cg)([(0,r.MZ)({type:Object})],c.prototype,"data",void 0),(0,s.Cg)([(0,r.MZ)()],c.prototype,"confirmation",void 0),(0,s.Cg)([(0,r.MZ)()],c.prototype,"appearance",void 0),c=(0,s.Cg)([(0,r.EM)("ha-call-service-button")],c),t()}catch(e){t(e)}})},89300(e,t,i){i.a(e,async function(e,t){try{var s=i(62826),a=i(5124),r=i(22441),o=i(6412),n=i(18350),d=i(65829),l=(i(67094),e([n,d]));[n,d]=l.then?(await l)():l;const c="M2.2,16.06L3.88,12L2.2,7.94L6.26,6.26L7.94,2.2L12,3.88L16.06,2.2L17.74,6.26L21.8,7.94L20.12,12L21.8,16.06L17.74,17.74L16.06,21.8L12,20.12L7.94,21.8L6.26,17.74L2.2,16.06M13,17V15H11V17H13M13,13V7H11V13H13Z",h="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z";class p extends a.WF{render(){const e=this.progress||this._result?"accent":this.appearance;return a.qy` <ha-button .appearance="${e}" .disabled="${this.disabled}" .loading="${this.progress}" .variant="${"success"===this._result?"success":"error"===this._result?"danger":this.variant}" class="${(0,o.H)({result:!!this._result,success:"success"===this._result,error:"error"===this._result})}"> ${this.iconPath?a.qy`<ha-svg-icon .path="${this.iconPath}" slot="start"></ha-svg-icon>`:a.s6} <slot>${this.label}</slot> </ha-button> ${this._result?a.qy` <div class="progress"> ${"success"===this._result?a.qy`<ha-svg-icon .path="${h}"></ha-svg-icon>`:"error"===this._result?a.qy`<ha-svg-icon .path="${c}"></ha-svg-icon>`:a.s6} </div> `:a.s6} `}actionSuccess(){this._setResult("success")}actionError(){this._setResult("error")}_setResult(e){this._result=e,setTimeout(()=>{this._result=void 0},2e3)}constructor(...e){super(...e),this.disabled=!1,this.progress=!1,this.appearance="accent",this.variant="brand"}}p.styles=a.AH`:host{outline:0;display:inline-block;position:relative}:host([progress]){pointer-events:none}.progress{bottom:0;display:flex;justify-content:center;align-items:center;position:absolute;top:0;width:100%}ha-button{width:100%}ha-button.result::part(caret),ha-button.result::part(end),ha-button.result::part(label),ha-button.result::part(spinner),ha-button.result::part(start){visibility:hidden}:host([appearance=brand]) ha-svg-icon{color:var(--white-color)}`,(0,s.Cg)([(0,r.MZ)()],p.prototype,"label",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],p.prototype,"progress",void 0),(0,s.Cg)([(0,r.MZ)()],p.prototype,"appearance",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"iconPath",void 0),(0,s.Cg)([(0,r.MZ)()],p.prototype,"variant",void 0),(0,s.Cg)([(0,r.wk)()],p.prototype,"_result",void 0),p=(0,s.Cg)([(0,r.EM)("ha-progress-button")],p),t()}catch(e){t(e)}})},75064(e,t,i){var s=i(62826),a=i(5124),r=i(22441),o=i(2846);class n extends o.G{constructor(...e){super(...e),this.borderTop=!1}}n.styles=[...o.J,a.AH`:host{--md-list-item-one-line-container-height:48px;--md-list-item-two-line-container-height:64px}:host([border-top]) md-item{border-top:1px solid var(--divider-color)}[slot=start]{--state-icon-color:var(--secondary-text-color)}[slot=overline]{line-height:1.15rem;font-size:calc(var(--mdc-typography-subtitle1-font-size, 1rem) * .75);font-weight:var(--mdc-typography-subtitle1-font-weight,400);font-family:var(
--mdc-typography-subtitle1-font-family,
var(--mdc-typography-font-family)
);color:var(--mdc-select-label-ink-color,rgba(0,0,0,.6))}[slot=headline]{line-height:var(--ha-line-height-normal);font-size:var(--ha-font-size-m);white-space:nowrap}[slot=supporting-text]{line-height:var(--ha-line-height-normal);font-size:var(--ha-font-size-s);white-space:nowrap}::slotted(img),::slotted(state-badge){width:32px;height:32px}::slotted(.code){font-family:var(--ha-font-family-code);font-size:var(--ha-font-size-xs)}::slotted(.domain){font-size:var(--ha-font-size-s);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal);align-self:flex-end;max-width:30%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}`],(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0,attribute:"border-top"})],n.prototype,"borderTop",void 0),n=(0,s.Cg)([(0,r.EM)("ha-combo-box-item")],n)},3449(e,t,i){var s=i(62826),a=i(5124),r=i(22441);class o extends a.WF{render(){return a.qy`<slot></slot>`}constructor(...e){super(...e),this.disabled=!1}}o.styles=a.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,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],o.prototype,"disabled",void 0),o=(0,s.Cg)([(0,r.EM)("ha-input-helper-text")],o)},2846(e,t,i){i.d(t,{G:()=>l,J:()=>d});var s=i(62826),a=i(58168),r=i(82553),o=i(5124),n=i(22441);i(54276);const d=[r.R,o.AH`:host{--ha-icon-display:block;--md-sys-color-primary:var(--primary-text-color);--md-sys-color-secondary:var(--secondary-text-color);--md-sys-color-surface:var(--card-background-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--secondary-text-color)}md-item{overflow:var(--md-item-overflow,hidden);align-items:var(--md-item-align-items,center);gap:var(--ha-md-list-item-gap,16px)}`];class l extends a.n{renderRipple(){return"text"===this.type?o.s6:o.qy`<ha-ripple part="ripple" for="item" ?disabled="${this.disabled&&"link"!==this.type}"></ha-ripple>`}}l.styles=d,l=(0,s.Cg)([(0,n.EM)("ha-md-list-item")],l)},88285(e,t,i){i.a(e,async function(e,t){try{var s=i(62826),a=i(35211),r=i(5124),o=i(22441),n=i(63672),d=i(1087),l=i(22792),c=i(17894),h=(i(75064),i(47680),i(26300)),p=e([h]);h=(p.then?(await p)():p)[0];const u="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",g="M7,10L12,15L17,10H7Z";class v extends((0,c.c)(r.WF)){async focus(){await this.updateComplete,await(this.item?.focus())}render(){const e=!!this.value,t=!(!this.value||this.required||this.disabled||this.hideClearIcon),i=this.placeholder??this.label,s=this.label&&e?r.qy`<span slot="overline">${this.label}${this.required?" *":""}</span>`:r.s6,a=e?this.valueRenderer?this.valueRenderer(this.value??""):r.qy`<span slot="headline">${this.value}</span>`:i?r.qy`<span slot="headline" class="placeholder"> ${i}${this.required?" *":""} </span>`:r.s6;return r.qy` <ha-combo-box-item aria-label="${(0,n.J)(this.label||this.placeholder)}" .disabled="${this.disabled}" type="button" compact="compact"> ${this.image?r.qy`<img alt="${this.label??""}" slot="start" .src="${this.image}" crossorigin="anonymous" referrerpolicy="no-referrer">`:this.icon?r.qy`<ha-icon slot="start" .icon="${this.icon}"></ha-icon>`:r.qy`<slot name="start"></slot>`} ${s}${a} ${this.unknown?r.qy`<div slot="supporting-text" class="unknown"> ${this.unknownItemText||this._i18n?.localize("ui.components.combo-box.unknown_item")} </div>`:r.s6} ${t?r.qy` <ha-icon-button class="clear" slot="end" ="${this._clear}" .path="${u}"></ha-icon-button> `:r.s6} <ha-svg-icon class="arrow" slot="end" .path="${g}"></ha-svg-icon> </ha-combo-box-item> `}_clear(e){e.stopPropagation(),(0,d.r)(this,"clear")}static get styles(){return[r.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,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],v.prototype,"invalid",void 0),(0,s.Cg)([(0,o.P)("ha-combo-box-item",!0)],v.prototype,"item",void 0),(0,s.Cg)([(0,o.wk)(),(0,a.Fg)({context:l.D5,subscribe:!0})],v.prototype,"_i18n",void 0),v=(0,s.Cg)([(0,o.EM)("ha-picker-field")],v),t()}catch(e){t(e)}})},606(e,t,i){i.a(e,async function(e,t){try{i(74423),i(18111),i(61701);var s=i(62826),a=i(5124),r=i(22441),o=i(63672),n=i(22786),d=i(1087),l=i(29823),c=(i(70947),i(3449),i(88285)),h=(i(67094),e([l,c]));[l,c]=h.then?(await h)():h;class p extends a.WF{render(){return this.disabled?a.qy`${this._renderField()}${this._renderHelper()}`:a.qy` <ha-dropdown placement="bottom" -select="${this._handleSelect}" -show="${this._handleShow}" -hide="${this._handleHide}"> ${this._renderField()} ${this.options?this.options.map(e=>{const t=["string","number"].includes(typeof e);return a.qy` <ha-dropdown-item .value="${t?e:e.value}" .disabled="${!t&&(e.disabled??!1)}" .selected="${this.value===(t?e:e.value)}"> ${e.iconPath?a.qy`<ha-svg-icon slot="icon" .path="${e.iconPath}"></ha-svg-icon>`:a.s6} <div class="content"> ${t?e:e.label||e.value} ${e.secondary?a.qy`<div class="secondary">${e.secondary}</div>`:a.s6} </div> </ha-dropdown-item> `}):a.qy`<slot></slot>`} </ha-dropdown> ${this._renderHelper()} `}_renderField(){const e=this._getValueLabel(this.options,this.value);return a.qy` <ha-picker-field slot="trigger" type="button" class="${this._opened?"opened":""}" compact="compact" aria-label="${(0,o.J)(this.label)}" ="${this._clearValue}" .label="${this.label}" .value="${e}" .required="${this.required}" .disabled="${this.disabled}" .hideClearIcon="${!this.clearable||this.required||this.disabled||!String(this.value)}"> </ha-picker-field> `}_renderHelper(){return this.helper?a.qy`<ha-input-helper-text .disabled="${this.disabled}">${this.helper}</ha-input-helper-text>`:a.s6}_handleSelect(e){e.stopPropagation();const t=e.detail.item.value;t!==this.value&&(0,d.r)(this,"selected",{value:t})}_clearValue(){!this.disabled&&this.value&&(0,d.r)(this,"selected",{value:void 0})}_handleShow(){this.style.setProperty("--select-menu-width",`${this._triggerField.offsetWidth}px`),this._opened=!0}_handleHide(){this._opened=!1}constructor(...e){super(...e),this.clearable=!1,this.required=!1,this.disabled=!1,this._opened=!1,this._getValueLabel=(0,n.A)((e,t)=>{const i=void 0!==t?String(t):void 0;if(!e||!i)return i;for(const t of e){const e=["string","number"].includes(typeof t);if(e&&t===i||!e&&String(t.value)===i)return e?t:t.label||t.value}return i})}}p.styles=a.AH`:host{position:relative}ha-picker-field.opened{--mdc-text-field-idle-line-color:var(--primary-color)}ha-dropdown-item .content{display:flex;gap:var(--ha-space-1);flex-direction:column}ha-dropdown-item .secondary{font-size:var(--ha-font-size-s);color:var(--ha-color-text-secondary)}ha-dropdown::part(menu){min-width:var(--select-menu-width)}ha-input-helper-text{display:block;margin:var(--ha-space-2) 0 0}`,(0,s.Cg)([(0,r.MZ)({type:Boolean})],p.prototype,"clearable",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"options",void 0),(0,s.Cg)([(0,r.MZ)()],p.prototype,"label",void 0),(0,s.Cg)([(0,r.MZ)()],p.prototype,"helper",void 0),(0,s.Cg)([(0,r.MZ)()],p.prototype,"value",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean})],p.prototype,"required",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean})],p.prototype,"disabled",void 0),(0,s.Cg)([(0,r.wk)()],p.prototype,"_opened",void 0),(0,s.Cg)([(0,r.P)("ha-picker-field")],p.prototype,"_triggerField",void 0),p=(0,s.Cg)([(0,r.EM)("ha-select")],p),t()}catch(e){t(e)}})},62647(e,t,i){var s=i(62826),a=i(9866),r=i(5124),o=i(22441);class n extends a.A{static get styles(){return[a.A.styles,r.AH`:host{font-size:var(--ha-font-size-m);--wa-color-brand-on-quiet:var(
--ha-tab-active-text-color,
var(--primary-color)
);--wa-color-neutral-on-quiet:var(--wa-color-brand-on-quiet);opacity:.8;color:inherit;--wa-space-l:16px}:host([active]:not([disabled])){opacity:1} (hover:hover){:host(:hover:not([disabled]):not([active])) .tab{color:var(--wa-color-brand-on-quiet)}}`]}}n=(0,s.Cg)([(0,o.EM)("ha-tab-group-tab")],n)},66289(e,t,i){i.a(e,async function(e,t){try{var s=i(62826),a=i(42814),r=i(5124),o=i(22441),n=i(36356),d=e([a]);a=(d.then?(await d)():d)[0];class l extends a.A{connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._handleKeyDown,!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeyDown,!0)}handleClick(e){this._dragScrollController.scrolled||super.handleClick(e)}static get styles(){return[a.A.styles,r.AH`:host{--track-width:2px;--track-color:var(--ha-tab-track-color, var(--divider-color));--indicator-color:var(
--ha-tab-indicator-color,
var(--primary-color)
);--wa-color-neutral-on-quiet:var(--indicator-color)}.tab-group-top ::slotted(ha-tab-group-tab[active]){border-block-end:solid var(--track-width) var(--indicator-color);margin-block-end:calc(-1 * var(--track-width))}.tab-group-start ::slotted(ha-tab-group-tab[active]){border-inline-end:solid var(--track-width) var(--indicator-color);margin-inline-end:calc(-1 * var(--track-width))}.tab-group-end ::slotted(ha-tab-group-tab[active]){border-inline-start:solid var(--track-width) var(--indicator-color);margin-inline-start:calc(-1 * var(--track-width))}.scroll-button::part(base):hover{background-color:transparent}`]}constructor(...e){super(...e),this._dragScrollController=new n.q(this,{selector:".nav"}),this.tabTag="ha-tab-group-tab",this.tabOnly=!0,this._handleKeyDown=e=>{(e.altKey||e.metaKey)&&e.stopPropagation()}}}(0,s.Cg)([(0,o.MZ)({attribute:"tab-tag"})],l.prototype,"tabTag",void 0),(0,s.Cg)([(0,o.MZ)({attribute:"tab-only",type:Boolean})],l.prototype,"tabOnly",void 0),l=(0,s.Cg)([(0,o.EM)("ha-tab-group")],l),t()}catch(e){t(e)}})},17894(e,t,i){i.d(t,{c:()=>r});var s=i(62826),a=i(22441);const r=e=>{class t extends e{constructor(...e){super(...e),this.disabled=!1,this.required=!1,this.unknown=!1,this.hideClearIcon=!1}}return(0,s.Cg)([(0,a.MZ)({type:Boolean})],t.prototype,"disabled",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean})],t.prototype,"required",void 0),(0,s.Cg)([(0,a.MZ)()],t.prototype,"icon",void 0),(0,s.Cg)([(0,a.MZ)()],t.prototype,"image",void 0),(0,s.Cg)([(0,a.MZ)()],t.prototype,"label",void 0),(0,s.Cg)([(0,a.MZ)()],t.prototype,"placeholder",void 0),(0,s.Cg)([(0,a.MZ)()],t.prototype,"helper",void 0),(0,s.Cg)([(0,a.MZ)()],t.prototype,"value",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],t.prototype,"unknown",void 0),(0,s.Cg)([(0,a.MZ)({attribute:"unknown-item-text"})],t.prototype,"unknownItemText",void 0),(0,s.Cg)([(0,a.MZ)({attribute:"hide-clear-icon",type:Boolean})],t.prototype,"hideClearIcon",void 0),(0,s.Cg)([(0,a.MZ)({attribute:!1})],t.prototype,"valueRenderer",void 0),t}},39367(e,t,i){i.a(e,async function(e,s){try{i.r(t);i(74423),i(44114),i(18111),i(61701);var a=i(62826),r=i(5124),o=i(22441),n=i(74985),d=i(22786),l=i(1087),c=i(15717),h=(i(76538),i(66289)),p=(i(62647),i(72554)),u=i(84621),g=i(14503),v=i(31580),b=i(8333),m=i(18722),_=i(86251),y=i(17401),C=i(46580),f=i(7118),w=i(18344),x=e([c,h,p,b,m,_,y,C,f,w]);[c,h,p,b,m,_,y,C,f,w]=x.then?(await x)():x;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 k extends r.WF{async showDialog(e){this._device=e.device,this._device?(this._currTab=e.tab||"clusters",this.large=!1,this._open=!0):this.closeDialog()}closeDialog(){this._open=!1}_dialogClosed(){this._device=void 0,(0,l.r)(this,"dialog-closed",{dialog:this.localName})}firstUpdated(e){super.firstUpdated(e),this.addEventListener("close-dialog",()=>this.closeDialog())}willUpdate(e){if(super.willUpdate(e),this._device&&e.has("_device")){const e=this._getTabs(this._device);e.includes(this._currTab)||(this._currTab=e[0]),this._fetchData()}}render(){if(!this._device)return r.s6;const e=this._getTabs(this._device);return r.qy` <ha-dialog .open="${this._open}" prevent-scrim-close ="${this._dialogClosed}"> <ha-dialog-header show-border slot="header"> <ha-icon-button slot="navigationIcon" .label="${this.hass.localize("ui.common.close")}" .path="${$}" ="${this.closeDialog}"></ha-icon-button> <span slot="title" .title="${this.hass.localize("ui.dialogs.zha_manage_device.heading")}" ="${this._enlarge}"> ${this.hass.localize("ui.dialogs.zha_manage_device.heading")} </span> <ha-tab-group -tab-show="${this._handleTabChanged}"> ${e.map(e=>r.qy` <ha-tab-group-tab slot="nav" .panel="${e}" .active="${this._currTab===e}"> ${this.hass.localize(`ui.dialogs.zha_manage_device.tabs.${e}`)} </ha-tab-group-tab> `)} </ha-tab-group> </ha-dialog-header> <div class="content" tabindex="-1" autofocus> ${(0,n.P)("clusters"===this._currTab?r.qy` <zha-manage-clusters .hass="${this.hass}" .device="${this._device}"></zha-manage-clusters> `:"bindings"===this._currTab?r.qy` ${this._bindableDevices.length>0?r.qy` <zha-device-binding-control .hass="${this.hass}" .device="${this._device}" .bindableDevices="${this._bindableDevices}"></zha-device-binding-control> `:r.s6} ${this._device&&this._groups.length>0?r.qy` <zha-group-binding-control .hass="${this.hass}" .device="${this._device}" .groups="${this._groups}"></zha-group-binding-control> `:r.s6} `:"signature"===this._currTab?r.qy` <zha-device-zigbee-info .hass="${this.hass}" .device="${this._device}"></zha-device-zigbee-info> `:r.qy` <zha-device-neighbors .hass="${this.hass}" .device="${this._device}" .narrow="${!this.large}"></zha-device-neighbors> `)} </div> </ha-dialog> `}async _fetchData(){this._device&&this.hass&&(this._bindableDevices=this._device&&"Coordinator"!==this._device.device_type?(await(0,u.PA)(this.hass,this._device.ieee)).sort(v.J8):[],this._groups=(await(0,u.pl)(this.hass)).sort(v.iV))}_enlarge(){this.large=!this.large}_handleTabChanged(e){const t=e.detail.name;t!==this._currTab&&(this._currTab=t)}static get styles(){return[g.nA,g.kO,r.AH`ha-dialog{--dialog-content-padding:0}.content{outline:0;display:flex;flex-direction:column;gap:var(--ha-space-2)}ha-tab-group-tab{flex:1}ha-tab-group-tab::part(base){width:100%;justify-content:center}`]}constructor(...e){super(...e),this.large=!1,this._currTab="clusters",this._bindableDevices=[],this._groups=[],this._open=!1,this._getTabs=(0,d.A)(e=>{const t=["clusters","bindings","signature"];return!e||"Router"!==e.device_type&&"Coordinator"!==e.device_type||t.push("neighbors"),t})}}(0,a.Cg)([(0,o.MZ)({attribute:!1})],k.prototype,"hass",void 0),(0,a.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],k.prototype,"large",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_currTab",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_device",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_bindableDevices",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_groups",void 0),(0,a.Cg)([(0,o.wk)()],k.prototype,"_open",void 0),k=(0,a.Cg)([(0,o.EM)("dialog-zha-manage-zigbee-device")],k),s()}catch(e){s(e)}})},31580(e,t,i){i.d(t,{J8:()=>a,Rr:()=>o,b9:()=>s,iV:()=>r});const s=e=>{let t=e;return"string"==typeof e&&(t=parseInt(e,16)),"0x"+t.toString(16).padStart(4,"0")},a=(e,t)=>{const i=e.user_given_name?e.user_given_name:e.name,s=t.user_given_name?t.user_given_name:t.name;return i.localeCompare(s)},r=(e,t)=>{const i=e.name,s=t.name;return i.localeCompare(s)},o=e=>`${e.name} (Endpoint id: ${e.endpoint_id}, Id: ${s(e.id)}, Type: ${e.type})`},8333(e,t,i){i.a(e,async function(e,t){try{i(18111),i(61701);var s=i(62826),a=i(5124),r=i(22441),o=i(599),n=i(89300),d=(i(76776),i(606)),l=i(91485),c=i(88360),h=i(84621),p=i(14503),u=i(31580),g=e([o,n,d,l]);[o,n,d,l]=g.then?(await g)():g;class v extends a.WF{updated(e){e.has("selectedCluster")&&(this._attributes=void 0,this._selectedAttributeId=void 0,this._attributeValue="",this._fetchAttributesForCluster()),super.updated(e)}render(){return this.device&&this.selectedCluster&&this._attributes?a.qy` <ha-card class="content"> <div class="attribute-picker"> <ha-select .label="${this.hass.localize("ui.panel.config.zha.cluster_attributes.attributes_of_cluster")}" class="menu" .value="${this._selectedAttributeId}" ="${this._selectedAttributeChanged}" .options="${this._attributes.map(e=>({value:e.id,label:`${e.name} (id: ${(0,u.b9)(e.id)})`}))}"> </ha-select> </div> ${void 0!==this._selectedAttributeId?this._renderAttributeInteractions():a.s6} </ha-card> `:a.s6}_renderAttributeInteractions(){return a.qy` <div class="input-text"> <ha-input .label="${this.hass.localize("ui.panel.config.zha.common.value")}" .value="${this._attributeValue}" ="${this._onAttributeValueChanged}" .placeholder="${this.hass.localize("ui.panel.config.zha.common.value")}"></ha-input> </div> <div class="input-text"> <ha-input .label="${this.hass.localize("ui.panel.config.zha.common.manufacturer_code_override")}" type="number" .value="${this._manufacturerCodeOverride}" ="${this._onManufacturerCodeOverrideChanged}" .placeholder="${this.hass.localize("ui.panel.config.zha.common.value")}"></ha-input> </div> <div class="card-actions"> <ha-call-service-button .hass="${this.hass}" domain="zha" service="set_zigbee_cluster_attribute" .data="${this._setAttributeServiceData}"> ${this.hass.localize("ui.panel.config.zha.cluster_attributes.write_zigbee_attribute")} </ha-call-service-button> <ha-progress-button ="${this._onGetZigbeeAttributeClick}" .progress="${this._readingAttribute}" .disabled="${this._readingAttribute}"> ${this.hass.localize("ui.panel.config.zha.cluster_attributes.read_zigbee_attribute")} </ha-progress-button> </div> `}async _fetchAttributesForCluster(){this.device&&this.selectedCluster&&this.hass&&(this._attributes=await(0,h.ZU)(this.hass,this.device.ieee,this.selectedCluster.endpoint_id,this.selectedCluster.id,this.selectedCluster.type),this._attributes.sort((e,t)=>e.name.localeCompare(t.name)),this._attributes.length>0&&(this._selectedAttributeId=this._attributes[0].id))}_computeReadAttributeServiceData(){if(this.selectedCluster&&this.device)return{ieee:this.device.ieee,endpoint_id:this.selectedCluster.endpoint_id,cluster_id:this.selectedCluster.id,cluster_type:this.selectedCluster.type,attribute:this._selectedAttributeId,manufacturer:this._manufacturerCodeOverride?parseInt(this._manufacturerCodeOverride,10):void 0}}_computeSetAttributeServiceData(){if(this.selectedCluster&&this.device)return{ieee:this.device.ieee,endpoint_id:this.selectedCluster.endpoint_id,cluster_id:this.selectedCluster.id,cluster_type:this.selectedCluster.type,attribute:this._selectedAttributeId,value:this._attributeValue,manufacturer:this._manufacturerCodeOverride?parseInt(this._manufacturerCodeOverride,10):void 0}}_onAttributeValueChanged(e){this._attributeValue=e.target.value,this._setAttributeServiceData=this._computeSetAttributeServiceData()}_onManufacturerCodeOverrideChanged(e){this._manufacturerCodeOverride=e.target.value,this._setAttributeServiceData=this._computeSetAttributeServiceData()}async _onGetZigbeeAttributeClick(e){const t=e.currentTarget,i=this._computeReadAttributeServiceData();if(i&&this.hass){this._readingAttribute=!0;try{this._attributeValue=await(0,h.i_)(this.hass,i),(0,c.j)(this,"success"),t.actionSuccess()}catch(e){(0,c.j)(this,"failure"),t.actionError()}finally{this._readingAttribute=!1}}}_selectedAttributeChanged(e){this._selectedAttributeId=Number(e.detail.value),this._attributeValue=""}static get styles(){return[p.RF,a.AH`ha-card{border:none}ha-select{margin-top:16px}.menu,ha-input{width:100%}.card-actions.warning ha-call-service-button{color:var(--error-color)}.attribute-picker{align-items:center;padding-left:28px;padding-right:28px;padding-inline-start:28px;padding-inline-end:28px;padding-bottom:10px}.input-text{padding-left:28px;padding-right:28px;padding-inline-start:28px;padding-inline-end:28px;padding-bottom:10px}.header{flex-grow:1}.card-actions{display:flex;margin-top:var(--ha-space-2);justify-content:flex-end;gap:var(--ha-space-3)}`]}constructor(...e){super(...e),this._attributeValue="",this._readingAttribute=!1}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"device",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],v.prototype,"selectedCluster",void 0),(0,s.Cg)([(0,r.wk)()],v.prototype,"_attributes",void 0),(0,s.Cg)([(0,r.wk)()],v.prototype,"_selectedAttributeId",void 0),(0,s.Cg)([(0,r.wk)()],v.prototype,"_attributeValue",void 0),(0,s.Cg)([(0,r.wk)()],v.prototype,"_manufacturerCodeOverride",void 0),(0,s.Cg)([(0,r.wk)()],v.prototype,"_readingAttribute",void 0),(0,s.Cg)([(0,r.wk)()],v.prototype,"_setAttributeServiceData",void 0),v=(0,s.Cg)([(0,r.EM)("zha-cluster-attributes")],v),t()}catch(e){t(e)}})},18722(e,t,i){i.a(e,async function(e,t){try{i(74423),i(18111),i(81148),i(20116),i(61701);var s=i(62826),a=i(5124),r=i(22441),o=i(599),n=(i(76776),i(52763)),d=i(606),l=i(91485),c=i(84621),h=i(14503),p=i(31580),u=e([o,n,d,l]);[o,n,d,l]=u.then?(await u)():u;class g extends a.WF{updated(e){e.has("selectedCluster")&&(this._commands=void 0,this._selectedCommandId=void 0,this._fetchCommandsForCluster()),super.updated(e)}render(){return this.device&&this.selectedCluster&&this._commands?a.qy` <ha-card class="content"> <div class="command-picker"> <ha-select .label="${this.hass.localize("ui.panel.config.zha.cluster_commands.commands_of_cluster")}" class="menu" .value="${String(this._selectedCommandId)}" ="${this._selectedCommandChanged}" .options="${this._commands.map(e=>({value:String(e.id),label:`${e.name} (id: ${(0,p.b9)(e.id)})`}))}"> </ha-select> </div> ${void 0!==this._selectedCommandId?a.qy` <div class="input-text"> <ha-input .label="${this.hass.localize("ui.panel.config.zha.common.manufacturer_code_override")}" type="number" .value="${this._manufacturerCodeOverride}" ="${this._onManufacturerCodeOverrideChanged}" .placeholder="${this.hass.localize("ui.panel.config.zha.common.value")}"></ha-input> </div> <div class="command-form"> <ha-form .hass="${this.hass}" .schema="${this._commands.find(e=>e.id===this._selectedCommandId).schema}" -changed="${this._commandDataChanged}" .data="${this._commandData}"></ha-form> </div> <div class="card-actions"> <ha-call-service-button .hass="${this.hass}" domain="zha" service="issue_zigbee_cluster_command" .data="${this._issueClusterCommandServiceData}" .disabled="${!this._canIssueCommand}" appearance="accent"> ${this.hass.localize("ui.panel.config.zha.cluster_commands.issue_zigbee_command")} </ha-call-service-button> </div> `:""} </ha-card> `:a.s6}async _fetchCommandsForCluster(){this.device&&this.selectedCluster&&this.hass&&(this._commands=await(0,c.oM)(this.hass,this.device.ieee,this.selectedCluster.endpoint_id,this.selectedCluster.id,this.selectedCluster.type),this._commands.sort((e,t)=>e.name.localeCompare(t.name)),this._commands.length>0&&(this._selectedCommandId=this._commands[0].id))}_computeIssueClusterCommandServiceData(){if(!this.device||!this.selectedCluster||!this._commands)return;const e=this._commands.find(e=>e.id===this._selectedCommandId);return this._canIssueCommand=this._commandData&&e.schema.every(e=>!e.required||!["",void 0].includes(this._commandData[e.name])),{ieee:this.device.ieee,endpoint_id:this.selectedCluster.endpoint_id,cluster_id:this.selectedCluster.id,cluster_type:this.selectedCluster.type,command:this._selectedCommandId,command_type:e.type,params:this._commandData}}async _commandDataChanged(e){this._commandData=e.detail.value,this._issueClusterCommandServiceData=this._computeIssueClusterCommandServiceData()}_onManufacturerCodeOverrideChanged(e){this._manufacturerCodeOverride=Number(e.target.value),this._issueClusterCommandServiceData=this._computeIssueClusterCommandServiceData()}_selectedCommandChanged(e){this._selectedCommandId=Number(e.detail.value),this._issueClusterCommandServiceData=this._computeIssueClusterCommandServiceData()}static get styles(){return[h.RF,a.AH`ha-card{border:none}ha-select{margin-top:16px}.menu,ha-input{width:100%}.card-actions.warning ha-call-service-button{color:var(--error-color)}.command-picker{align-items:center;padding-left:28px;padding-right:28px;padding-inline-start:28px;padding-inline-end:28px;padding-bottom:10px}.input-text{padding-left:28px;padding-right:28px;padding-inline-start:28px;padding-inline-end:28px;padding-bottom:10px}.command-form{padding-left:28px;padding-right:28px;padding-inline-start:28px;padding-inline-end:28px;padding-bottom:10px}.header{flex-grow:1}.toggle-help-icon{float:right;top:-6px;right:0;inset-inline-end:0;inset-inline-start:initial;padding-right:0px;padding-inline-end:0px;padding-inline-start:initial;color:var(--primary-color)}.card-actions{display:flex;justify-content:flex-end}`]}constructor(...e){super(...e),this.isWide=!1,this._canIssueCommand=!1,this._commandData={}}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:"is-wide",type:Boolean})],g.prototype,"isWide",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"device",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"selectedCluster",void 0),(0,s.Cg)([(0,r.wk)()],g.prototype,"_commands",void 0),(0,s.Cg)([(0,r.wk)()],g.prototype,"_selectedCommandId",void 0),(0,s.Cg)([(0,r.wk)()],g.prototype,"_manufacturerCodeOverride",void 0),(0,s.Cg)([(0,r.wk)()],g.prototype,"_issueClusterCommandServiceData",void 0),(0,s.Cg)([(0,r.wk)()],g.prototype,"_canIssueCommand",void 0),(0,s.Cg)([(0,r.wk)()],g.prototype,"_commandData",void 0),g=(0,s.Cg)([(0,r.EM)("zha-cluster-commands")],g),t()}catch(e){t(e)}})},12598(e,t,i){i.a(e,async function(e,t){try{i(18111),i(61701);var s=i(62826),a=i(5124),r=i(22441),o=i(22786),n=i(48091),d=i(31580),l=e([n]);n=(l.then?(await l)():l)[0];class c extends a.WF{clearSelection(){this._dataTable.clearSelection()}render(){return a.qy` <ha-data-table .columns="${this._columns(this.narrow)}" .data="${this._clusters(this.clusters)}" .id="${"cluster_id"}" selectable auto-height .searchLabel="${this.hass.localize("ui.components.data-table.search")}" .noDataText="${this.hass.localize("ui.components.data-table.no-data")}"></ha-data-table> `}constructor(...e){super(...e),this.narrow=!1,this.clusters=[],this._clusters=(0,o.A)(e=>{let t=e;return t=t.map(e=>({...e,cluster_id:e.endpoint_id+"-"+e.id})),t}),this._columns=(0,o.A)(e=>e?{name:{title:"Name",sortable:!0,direction:"asc",flex:2}}:{name:{title:"Name",sortable:!0,direction:"asc",flex:2},id:{title:"ID",template:e=>a.qy` ${(0,d.b9)(e.id)} `,sortable:!0},endpoint_id:{title:"Endpoint ID",sortable:!0}})}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean})],c.prototype,"narrow",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],c.prototype,"clusters",void 0),(0,s.Cg)([(0,r.P)("ha-data-table",!0)],c.prototype,"_dataTable",void 0),c=(0,s.Cg)([(0,r.EM)("zha-clusters-data-table")],c),t()}catch(e){t(e)}})},86251(e,t,i){i.a(e,async function(e,t){try{i(18111),i(61701);var s=i(62826),a=i(5124),r=i(22441),o=i(89300),n=(i(76776),i(606)),d=i(84621),l=i(14503),c=e([o,n]);[o,n]=c.then?(await c)():c;class h extends a.WF{updated(e){e.has("device")&&(this._bindTargetIndex=-1),super.updated(e)}render(){return a.qy` <ha-card class="content"> <div class="command-picker"> <ha-select label="${this.hass.localize("ui.panel.config.zha.device_binding.picker_label")}" class="menu" .value="${String(this._bindTargetIndex)}" ="${this._bindTargetIndexChanged}" .options="${this.bindableDevices.map((e,t)=>({value:String(t),label:e.user_given_name?e.user_given_name:e.name}))}"> </ha-select> </div> <div class="card-actions"> <ha-progress-button ="${this._onUnbindDevicesClick}" .disabled="${!(this._deviceToBind&&this.device)||this._bindingOperationInProgress}" variant="danger" appearance="plain"> ${this.hass.localize("ui.panel.config.zha.device_binding.unbind")} </ha-progress-button> <ha-progress-button ="${this._onBindDevicesClick}" .disabled="${!(this._deviceToBind&&this.device)||this._bindingOperationInProgress}"> ${this.hass.localize("ui.panel.config.zha.device_binding.bind")} </ha-progress-button> </div> </ha-card> `}_bindTargetIndexChanged(e){this._bindTargetIndex=Number(e.detail.value),this._deviceToBind=-1===this._bindTargetIndex?void 0:this.bindableDevices[this._bindTargetIndex]}async _onBindDevicesClick(e){const t=e.currentTarget;if(this.hass&&this._deviceToBind&&this.device){this._bindingOperationInProgress=!0,t.progress=!0;try{await(0,d.Lj)(this.hass,this.device.ieee,this._deviceToBind.ieee),t.actionSuccess()}catch(e){t.actionError()}finally{this._bindingOperationInProgress=!1,t.progress=!1}}}async _onUnbindDevicesClick(e){const t=e.currentTarget;if(this.hass&&this._deviceToBind&&this.device){this._bindingOperationInProgress=!0,t.progress=!0;try{await(0,d.Ky)(this.hass,this.device.ieee,this._deviceToBind.ieee),t.actionSuccess()}catch(e){t.actionError()}finally{this._bindingOperationInProgress=!1,t.progress=!1}}}static get styles(){return[l.RF,a.AH`.menu{width:100%}.content{padding:var(--ha-space-4) 0 0;border:none;outline:0}.command-picker{align-items:center;padding-left:28px;padding-right:28px;padding-inline-start:28px;padding-inline-end:28px;padding-bottom:10px}.header{flex-grow:1}.card-actions{display:flex;margin-top:var(--ha-space-2);justify-content:flex-end;gap:var(--ha-space-3)}`]}constructor(...e){super(...e),this._bindTargetIndex=-1,this.bindableDevices=[],this._bindingOperationInProgress=!1}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],h.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],h.prototype,"device",void 0),(0,s.Cg)([(0,r.wk)()],h.prototype,"_bindTargetIndex",void 0),(0,s.Cg)([(0,r.wk)()],h.prototype,"bindableDevices",void 0),(0,s.Cg)([(0,r.wk)()],h.prototype,"_deviceToBind",void 0),(0,s.Cg)([(0,r.wk)()],h.prototype,"_bindingOperationInProgress",void 0),h=(0,s.Cg)([(0,r.EM)("zha-device-binding-control")],h),t()}catch(e){t(e)}})},17401(e,t,i){i.a(e,async function(e,t){try{i(44114),i(18111),i(7588),i(61701),i(45367),i(92731);var s=i(62826),a=i(5124),r=i(22441),o=i(22786),n=i(48091),d=i(65829),l=i(15717),c=i(84621),h=e([n,d,l]);[n,d,l]=h.then?(await h)():h;class p extends a.WF{updated(e){super.updated(e),this.hass&&e.has("device")&&this._fetchData()}render(){return this.device?a.qy` ${this._devices?a.qy`<ha-data-table .columns="${this._columns(this.narrow)}" .data="${this._deviceNeighbors(this.device,this._devices)}" auto-height .searchLabel="${this.hass.localize("ui.components.data-table.search")}" .noDataText="${this.hass.localize("ui.components.data-table.no-data")}"></ha-data-table>`:a.qy`<ha-spinner size="large"></ha-spinner>`} `:a.s6}async _fetchData(){if(this.device&&this.hass){const e=await(0,c.Uc)(this.hass);this._devices=new Map(e.map(e=>[e.ieee,e]))}}constructor(...e){super(...e),this.narrow=!1,this._deviceNeighbors=(0,o.A)((e,t)=>{const i=[];return e&&t&&e.neighbors.forEach(e=>{const s=t.get(e.ieee);s&&i.push({name:s.user_given_name||s.name,id:s.device_reg_id,lqi:parseInt(e.lqi),depth:parseInt(e.depth),relationship:e.relationship})}),i}),this._columns=(0,o.A)(e=>e?{name:{title:this.hass.localize("ui.panel.config.zha.neighbors.name"),sortable:!0,filterable:!0,direction:"asc",flex:2},lqi:{title:this.hass.localize("ui.panel.config.zha.neighbors.lqi"),sortable:!0,filterable:!0,type:"numeric"}}:{name:{title:this.hass.localize("ui.panel.config.zha.neighbors.name"),sortable:!0,filterable:!0,direction:"asc",flex:2},lqi:{title:this.hass.localize("ui.panel.config.zha.neighbors.lqi"),sortable:!0,filterable:!0,type:"numeric"},relationship:{title:this.hass.localize("ui.panel.config.zha.neighbors.relationship"),sortable:!0,filterable:!0},depth:{title:this.hass.localize("ui.panel.config.zha.neighbors.depth"),sortable:!0,filterable:!0,type:"numeric"}})}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean})],p.prototype,"narrow",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"device",void 0),(0,s.Cg)([(0,r.wk)()],p.prototype,"_devices",void 0),p=(0,s.Cg)([(0,r.EM)("zha-device-neighbors")],p),t()}catch(e){t(e)}})},46580(e,t,i){i.a(e,async function(e,t){try{i(33110);var s=i(62826),a=i(5124),r=i(22441),o=i(15717),n=e([o]);o=(n.then?(await n)():n)[0];class d extends a.WF{updated(e){e.has("device")&&this.hass&&this.device&&(this._signature=JSON.stringify({...this.device.signature,manufacturer:this.device.manufacturer,model:this.device.model,class:this.device.quirk_class},null,2)),super.updated(e)}render(){return this._signature?a.qy` <ha-code-editor mode="yaml" read-only .value="${this._signature}" dir="ltr"> </ha-code-editor> `:a.s6}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],d.prototype,"device",void 0),(0,s.Cg)([(0,r.wk)()],d.prototype,"_signature",void 0),d=(0,s.Cg)([(0,r.EM)("zha-device-zigbee-info")],d),t()}catch(e){t(e)}})},7118(e,t,i){i.a(e,async function(e,t){try{i(44114),i(18111),i(22489),i(20116),i(61701);var s=i(62826),a=i(5124),r=i(22441),o=i(89300),n=(i(76776),i(606)),d=i(84621),l=i(14503),c=i(12598),h=e([o,n,c]);[o,n,c]=h.then?(await h)():h;class p extends a.WF{updated(e){e.has("device")&&(this._bindTargetIndex=-1,this._selectedClusters=[],this._clustersToBind=[],this._fetchClustersForZhaNode()),super.updated(e)}render(){return a.qy` <ha-card class="content"> <div class="command-picker"> <ha-select .label="${this.hass.localize("ui.panel.config.zha.group_binding.group_picker_label")}" class="menu" .value="${String(this._bindTargetIndex)}" ="${this._bindTargetIndexChanged}" .options="${this.groups.map((e,t)=>({value:String(t),label:e.name}))}"> </ha-select> </div> <div class="command-picker"> <zha-clusters-data-table .hass="${this.hass}" .clusters="${this._clusters}" -changed="${this._handleClusterSelectionChanged}" class="menu"></zha-clusters-data-table> </div> <div class="card-actions"> <ha-progress-button ="${this._onUnbindGroupClick}" .disabled="${!this._canBind||this._bindingOperationInProgress}" variant="danger" appearance="plain"> ${this.hass.localize("ui.panel.config.zha.group_binding.unbind_button_label")} </ha-progress-button> <ha-progress-button ="${this._onBindGroupClick}" .disabled="${!this._canBind||this._bindingOperationInProgress}"> ${this.hass.localize("ui.panel.config.zha.group_binding.bind_button_label")} </ha-progress-button> </div> </ha-card> `}_bindTargetIndexChanged(e){this._bindTargetIndex=Number(e.detail.value),this._groupToBind=-1===this._bindTargetIndex?void 0:this.groups[this._bindTargetIndex]}async _onBindGroupClick(e){const t=e.currentTarget;if(this.hass&&this._canBind){this._bindingOperationInProgress=!0,t.progress=!0;try{await(0,d.kH)(this.hass,this.device.ieee,this._groupToBind.group_id,this._clustersToBind),this._zhaClustersDataTable.clearSelection(),t.actionSuccess()}catch(e){t.actionError()}finally{this._bindingOperationInProgress=!1,t.progress=!1}}}async _onUnbindGroupClick(e){const t=e.currentTarget;if(this.hass&&this._canBind){this._bindingOperationInProgress=!0,t.progress=!0;try{await(0,d.ks)(this.hass,this.device.ieee,this._groupToBind.group_id,this._clustersToBind),this._zhaClustersDataTable.clearSelection(),t.actionSuccess()}catch(e){t.actionError()}finally{this._bindingOperationInProgress=!1,t.progress=!1}}}_handleClusterSelectionChanged(e){this._selectedClusters=e.detail.value,this._clustersToBind=[];for(const e of this._selectedClusters){const t=this._clusters.find(t=>e===t.endpoint_id+"-"+t.id);this._clustersToBind.push(t)}}async _fetchClustersForZhaNode(){this.hass&&(this._clusters=await(0,d.cm)(this.hass,this.device.ieee),this._clusters=this._clusters.filter(e=>"out"===e.type.toLowerCase()).sort((e,t)=>e.name.localeCompare(t.name)))}get _canBind(){return Boolean(this._groupToBind&&this._clustersToBind&&this._clustersToBind?.length>0&&this.device)}static get styles(){return[l.RF,a.AH`.menu{width:100%}.content{padding-top:var(--ha-space-2)}.command-picker{align-items:center;padding-left:28px;padding-right:28px;padding-inline-start:28px;padding-inline-end:28px;padding-bottom:10px}.input-text{padding-left:28px;padding-right:28px;padding-inline-start:28px;padding-inline-end:28px;padding-bottom:10px}.sectionHeader{flex-grow:1}.card-actions{display:flex;justify-content:flex-end;gap:var(--ha-space-1)}`]}constructor(...e){super(...e),this._bindTargetIndex=-1,this.groups=[],this._selectedClusters=[],this._clusters=[],this._bindingOperationInProgress=!1}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],p.prototype,"device",void 0),(0,s.Cg)([(0,r.wk)()],p.prototype,"_bindTargetIndex",void 0),(0,s.Cg)([(0,r.wk)()],p.prototype,"groups",void 0),(0,s.Cg)([(0,r.wk)()],p.prototype,"_selectedClusters",void 0),(0,s.Cg)([(0,r.wk)()],p.prototype,"_clusters",void 0),(0,s.Cg)([(0,r.wk)()],p.prototype,"_bindingOperationInProgress",void 0),(0,s.Cg)([(0,r.P)("zha-clusters-data-table",!0)],p.prototype,"_zhaClustersDataTable",void 0),p=(0,s.Cg)([(0,r.EM)("zha-group-binding-control")],p),t()}catch(e){t(e)}})},18344(e,t,i){i.a(e,async function(e,t){try{i(74423),i(18111),i(61701);var s=i(62826),a=i(5124),r=i(22441),o=i(74985),n=(i(76776),i(606)),d=i(66289),l=(i(62647),i(84621)),c=i(14503),h=i(31580),p=i(8333),u=i(18722),g=e([n,d,p,u]);[n,d,p,u]=g.then?(await g)():g;const v=["attributes","commands"];class b extends a.WF{willUpdate(e){super.willUpdate(e),this.device&&(v.includes(this._currTab)||(this._currTab=v[0]))}updated(e){e.has("device")&&(this._clusters=[],this._selectedClusterIndex=-1,this._clustersLoaded=!1,this._fetchClustersForZhaDevice()),super.updated(e)}render(){return this.device&&this._clustersLoaded?a.qy` <ha-card class="content"> <div class="node-picker"> <ha-select .label="${this.hass.localize("ui.panel.config.zha.common.clusters")}" class="menu" .value="${String(this._selectedClusterIndex)}" ="${this._selectedClusterChanged}" .options="${this._clusters.map((e,t)=>({value:String(t),label:(0,h.Rr)(e)}))}"> </ha-select> </div> ${this._selectedCluster?a.qy` <ha-tab-group -tab-show="${this._handleTabChanged}"> ${v.map(e=>a.qy` <ha-tab-group-tab slot="nav" .panel="${e}" .active="${this._currTab===e}">${this.hass.localize(`ui.panel.config.zha.clusters.tabs.${e}`)}</ha-tab-group-tab> `)} </ha-tab-group> <div class="content" tabindex="-1" dialogInitialFocus> ${(0,o.P)("attributes"===this._currTab?a.qy` <zha-cluster-attributes .hass="${this.hass}" .device="${this.device}" .selectedCluster="${this._selectedCluster}"></zha-cluster-attributes> `:a.qy` <zha-cluster-commands .hass="${this.hass}" .device="${this.device}" .selectedCluster="${this._selectedCluster}"></zha-cluster-commands> `)} </div> `:""} </ha-card> `:a.s6}async _fetchClustersForZhaDevice(){this.hass&&(this._clusters=await(0,l.cm)(this.hass,this.device.ieee),this._clusters.sort((e,t)=>e.name.localeCompare(t.name)),this._clusters.length>0&&(this._selectedClusterIndex=0,this._selectedCluster=this._clusters[0]),this._clustersLoaded=!0)}_handleTabChanged(e){const t=e.detail.name;t!==this._currTab&&(this._currTab=t)}_selectedClusterChanged(e){this._selectedClusterIndex=Number(e.detail.value),this._selectedCluster=this._clusters[this._selectedClusterIndex]}static get styles(){return[c.RF,a.AH`.content{padding:var(--ha-space-4) 0 0;border:none;outline:0}ha-select{margin-top:16px}.menu{width:100%}.header{flex-grow:1}.node-picker{align-items:center;margin:0 var(--ha-space-5);padding-bottom:10px}ha-tab-group{margin:0 var(--ha-space-5)}ha-tab-group-tab{flex:1}ha-tab-group-tab::part(base){width:100%;justify-content:center}`]}constructor(...e){super(...e),this.isWide=!1,this._selectedClusterIndex=-1,this._clusters=[],this._currTab="attributes",this._clustersLoaded=!1}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:"is-wide",type:Boolean})],b.prototype,"isWide",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"device",void 0),(0,s.Cg)([(0,r.wk)()],b.prototype,"_selectedClusterIndex",void 0),(0,s.Cg)([(0,r.wk)()],b.prototype,"_clusters",void 0),(0,s.Cg)([(0,r.wk)()],b.prototype,"_selectedCluster",void 0),(0,s.Cg)([(0,r.wk)()],b.prototype,"_currTab",void 0),(0,s.Cg)([(0,r.wk)()],b.prototype,"_clustersLoaded",void 0),b=(0,s.Cg)([(0,r.EM)("zha-manage-clusters")],b),t()}catch(e){t(e)}})}};