iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
17 lines • 18.7 kB
JavaScript
/*! For license information please see 84.72ec61cb136d9830.js.LICENSE.txt */
export const __rspack_esm_id=84;export const __rspack_esm_ids=[84];export const __webpack_modules__={2846(t,e,i){i.d(e,{G:()=>d,J:()=>n});var s=i(62826),a=i(58168),o=i(82553),r=i(5124),l=i(22441);i(54276);const n=[o.R,r.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 d extends a.n{renderRipple(){return"text"===this.type?r.s6:r.qy`<ha-ripple part="ripple" for="item" ?disabled="${this.disabled&&"link"!==this.type}"></ha-ripple>`}}d.styles=n,d=(0,s.Cg)([(0,l.EM)("ha-md-list-item")],d)},17308(t,e,i){var s=i(62826),a=i(49838),o=i(11245),r=i(5124),l=i(22441);class n extends a.B{}n.styles=[o.R,r.AH`:host{--md-sys-color-surface:var(--card-background-color)}`],n=(0,s.Cg)([(0,l.EM)("ha-md-list")],n)},49847(t,e,i){i.d(e,{PM:()=>a,_w:()=>l,aj:()=>o,fO:()=>r,zV:()=>s});const s=async(t,e)=>(await t.callService("matter","get_lock_info",{},{entity_id:e},!0,!0)).response[e],a=async(t,e)=>(await t.callService("matter","get_lock_users",{},{entity_id:e},!0,!0)).response[e],o=(t,e,i)=>t.callService("matter","set_lock_user",i,{entity_id:e}),r=(t,e,i)=>t.callService("matter","clear_lock_user",{user_index:i},{entity_id:e}),l=async(t,e,i)=>(await t.callService("matter","set_lock_credential",i,{entity_id:e},!0,!0)).response[e]},50591(t,e,i){i.a(t,async function(t,s){try{i.r(e);i(74423),i(18111),i(22489),i(61701),i(13579);var a=i(62826),o=i(5124),r=i(22441),l=i(1087),n=i(38962),d=i(18350),c=(i(93444),i(26300)),h=(i(17308),i(2846),i(65829)),p=(i(67094),i(72554)),m=i(49847),g=i(65063),y=i(14503),u=i(3732),v=t([n,d,c,h,p]);[n,d,c,h,p]=v.then?(await v)():v;const f="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",_="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z",x="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class b extends o.WF{async showDialog(t){this._entityId=t.entity_id,this._loading=!0,this._open=!0,await this._fetchData()}async _fetchData(){if(this._entityId)try{if(this._lockInfo=await(0,m.zV)(this.hass,this._entityId),this._lockInfo.supports_user_management){const t=await(0,m.PM)(this.hass,this._entityId);this._users=t.users}}catch(t){(0,g.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.matter.lock.errors.load_failed"),text:t.message})}finally{this._loading=!1}}render(){return this._entityId?o.qy` <ha-dialog .open="${this._open}" header-title="${this.hass.localize("ui.panel.config.matter.lock.dialog_title")}" ="${this._dialogClosed}"> ${this._loading?o.qy`<div class="center"> <ha-spinner></ha-spinner> </div>`:this._lockInfo&&!this._lockInfo.supports_user_management?o.qy`<div class="content"> <ha-alert alert-type="warning"> ${this.hass.localize("ui.panel.config.matter.lock.errors.no_user_management")} </ha-alert> ${this._renderDocsLink()} </div>`:o.qy`<div class="content">${this._renderUsers()}</div>`} </ha-dialog> `:o.s6}_renderDocsLink(){return o.qy`<a class="docs-link" href="https://www.home-assistant.io/integrations/matter/#lock-user-and-credential-management" target="_blank" rel="noopener noreferrer"> ${this.hass.localize("ui.panel.config.matter.lock.errors.learn_more")} </a>`}get _supportsPinCredential(){return this._lockInfo?.supported_credential_types?.includes("pin")??!1}_renderUsers(){const t=this._users.filter(t=>"available"!==t.user_status),e=!this._lockInfo?.supported_credential_types?.length;return o.qy` <div class="users-content"> ${e?o.qy`<ha-alert alert-type="warning"> ${this.hass.localize("ui.panel.config.matter.lock.errors.no_credential_types_supported")} </ha-alert> ${this._renderDocsLink()}`:this._supportsPinCredential?o.s6:o.qy`<ha-alert alert-type="info"> ${this.hass.localize("ui.panel.config.matter.lock.errors.pin_not_supported")} </ha-alert> ${this._renderDocsLink()}`} ${0===t.length?o.qy`<p class="empty"> ${this.hass.localize("ui.panel.config.matter.lock.users.no_users")} </p>`:o.qy` <ha-md-list> ${t.map(t=>o.qy` <ha-md-list-item type="button" .user="${t}" ="${this._handleUserClick}"> <div slot="start" class="icon-background"> <ha-svg-icon .path="${_}"></ha-svg-icon> </div> <div slot="headline"> ${t.user_name||`User ${t.user_index}`} </div> <div slot="supporting-text"> ${this.hass.localize(`ui.panel.config.matter.lock.users.user_type.${t.user_type}`)} ${t.credentials.length>0?` - ${t.credentials.length} ${this.hass.localize("ui.panel.config.matter.lock.users.credentials").toLowerCase()}`:""} </div> <ha-icon-button slot="end" .path="${f}" .user="${t}" ="${this._handleDeleteUserClick}"></ha-icon-button> </ha-md-list-item> `)} </ha-md-list> `} ${this._supportsPinCredential?o.qy`<div class="actions"> <ha-button ="${this._addUser}"> <ha-svg-icon slot="icon" .path="${x}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.matter.lock.users.add")} </ha-button> </div>`:o.s6} </div> `}_handleUserClick(t){if(t.composedPath().some(t=>"HA-ICON-BUTTON"===t.tagName))return;const e=t.currentTarget.user;this._editUser(e)}_handleDeleteUserClick(t){t.preventDefault(),t.stopPropagation();const e=t.currentTarget.user;this._deleteUser(e)}_addUser(){(0,u.h)(this,{entity_id:this._entityId,lockInfo:this._lockInfo,onSaved:()=>this._fetchData()})}_editUser(t){(0,u.h)(this,{entity_id:this._entityId,lockInfo:this._lockInfo,user:t,onSaved:()=>this._fetchData()})}async _deleteUser(t){if(await(0,g.dk)(this,{title:this.hass.localize("ui.panel.config.matter.lock.users.delete"),text:this.hass.localize("ui.panel.config.matter.lock.confirm_delete_user",{name:t.user_name||`User ${t.user_index}`}),destructive:!0})){try{await(0,m.fO)(this.hass,this._entityId,t.user_index)}catch(t){console.debug("Failed to clear lock user:",t)}await this._fetchData()}}closeDialog(){this._open=!1}_dialogClosed(){this._entityId=void 0,this._lockInfo=void 0,this._users=[],this._loading=!0,(0,l.r)(this,"dialog-closed",{dialog:this.localName})}static get styles(){return[y.nA,o.AH`ha-dialog{--dialog-content-padding:0}.center{display:flex;align-items:center;justify-content:center;padding:var(--ha-space-6)}.content{min-height:300px}.content>ha-alert{margin:var(--ha-space-4)}.docs-link{display:block;padding:0 var(--ha-space-4);color:var(--primary-color);font-size:14px}.users-content{padding:var(--ha-space-4) 0}.empty{text-align:center;color:var(--secondary-text-color);padding:var(--ha-space-6)}.actions{padding:var(--ha-space-2) var(--ha-space-6);display:flex;justify-content:flex-end}.icon-background{border-radius:var(--ha-border-radius-circle);background-color:var(--primary-color);color:#fff;display:flex;width:40px;height:40px;align-items:center;justify-content:center}`]}constructor(...t){super(...t),this._users=[],this._loading=!0,this._open=!1}}(0,a.Cg)([(0,r.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,a.Cg)([(0,r.wk)()],b.prototype,"_entityId",void 0),(0,a.Cg)([(0,r.wk)()],b.prototype,"_lockInfo",void 0),(0,a.Cg)([(0,r.wk)()],b.prototype,"_users",void 0),(0,a.Cg)([(0,r.wk)()],b.prototype,"_loading",void 0),(0,a.Cg)([(0,r.wk)()],b.prototype,"_open",void 0),b=(0,a.Cg)([(0,r.EM)("dialog-matter-lock-manage")],b),s()}catch(t){s(t)}})},3732(t,e,i){i.d(e,{h:()=>o});var s=i(1087);const a=()=>Promise.all([i.e(81034),i.e(7241)]).then(i.bind(i,78896)),o=(t,e)=>{(0,s.r)(t,"show-dialog",{dialogTag:"dialog-matter-lock-user-edit",dialogImport:a,dialogParams:e})}},11245(t,e,i){i.d(e,{R:()=>s});const s=i(5124).AH`:host{background:var(--md-list-container-color,var(--md-sys-color-surface,#fef7ff));color:unset;display:flex;flex-direction:column;outline:0;padding:8px 0;position:relative}`},49838(t,e,i){i.d(e,{B:()=>n});i(17642),i(58004),i(33853),i(45876),i(32475),i(15024),i(31698);var s=i(62826),a=i(5124),o=i(22441),r=i(25423);const l=new Set(Object.values(r.U));class n extends a.WF{get items(){return this.listController.items}render(){return a.qy` <slot -items="${this.listController.onDeactivateItems}" -activation="${this.listController.onRequestActivation}" ="${this.listController.onSlotchange}"> </slot> `}activateNextItem(){return this.listController.activateNextItem()}activatePreviousItem(){return this.listController.activatePreviousItem()}constructor(){super(),this.listController=new r.Z({isItem:t=>t.hasAttribute("md-list-item"),getPossibleItems:()=>this.slotItems,isRtl:()=>"rtl"===getComputedStyle(this).direction,deactivateItem:t=>{t.tabIndex=-1},activateItem:t=>{t.tabIndex=0},isNavigableKey:t=>l.has(t),isActivatable:t=>!t.disabled&&"text"!==t.type}),this.internals=this.attachInternals(),a.S$||(this.internals.role="list",this.addEventListener("keydown",this.listController.handleKeydown))}}(0,s.Cg)([(0,o.KN)({flatten:!0})],n.prototype,"slotItems",void 0)},82553(t,e,i){i.d(e,{R:()=>s});const s=i(5124).AH`:host{display:flex;-webkit-tap-highlight-color:transparent;--md-ripple-hover-color:var(--md-list-item-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-hover-opacity:var(--md-list-item-hover-state-layer-opacity, 0.08);--md-ripple-pressed-color:var(--md-list-item-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--md-ripple-pressed-opacity:var(--md-list-item-pressed-state-layer-opacity, 0.12)}:host(:is([type=button]:not([disabled]),[type=link])){cursor:pointer}md-focus-ring{z-index:1;--md-focus-ring-shape:8px}a,button,li{background:0 0;border:none;cursor:inherit;padding:0;margin:0;text-align:unset;text-decoration:none}.list-item{border-radius:inherit;display:flex;flex:1;max-width:inherit;min-width:inherit;outline:0;-webkit-tap-highlight-color:transparent;width:100%}.list-item.interactive{cursor:pointer}.list-item.disabled{opacity:var(--md-list-item-disabled-opacity, .3);pointer-events:none}[slot=container]{pointer-events:none}md-ripple{border-radius:inherit}md-item{border-radius:inherit;flex:1;height:100%;color:var(--md-list-item-label-text-color,var(--md-sys-color-on-surface,#1d1b20));font-family:var(--md-list-item-label-text-font, var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-label-text-size, var(--md-sys-typescale-body-large-size, 1rem));line-height:var(--md-list-item-label-text-line-height, var(--md-sys-typescale-body-large-line-height, 1.5rem));font-weight:var(--md-list-item-label-text-weight,var(--md-sys-typescale-body-large-weight,var(--md-ref-typeface-weight-regular,400)));min-height:var(--md-list-item-one-line-container-height,56px);padding-top:var(--md-list-item-top-space,12px);padding-bottom:var(--md-list-item-bottom-space,12px);padding-inline-start:var(--md-list-item-leading-space,16px);padding-inline-end:var(--md-list-item-trailing-space,16px)}md-item[multiline]{min-height:var(--md-list-item-two-line-container-height,72px)}[slot=supporting-text]{color:var(--md-list-item-supporting-text-color,var(--md-sys-color-on-surface-variant,#49454f));font-family:var(--md-list-item-supporting-text-font, var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-supporting-text-size, var(--md-sys-typescale-body-medium-size, .875rem));line-height:var(--md-list-item-supporting-text-line-height, var(--md-sys-typescale-body-medium-line-height, 1.25rem));font-weight:var(--md-list-item-supporting-text-weight,var(--md-sys-typescale-body-medium-weight,var(--md-ref-typeface-weight-regular,400)))}[slot=trailing-supporting-text]{color:var(--md-list-item-trailing-supporting-text-color,var(--md-sys-color-on-surface-variant,#49454f));font-family:var(--md-list-item-trailing-supporting-text-font, var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto)));font-size:var(--md-list-item-trailing-supporting-text-size, var(--md-sys-typescale-label-small-size, .6875rem));line-height:var(--md-list-item-trailing-supporting-text-line-height, var(--md-sys-typescale-label-small-line-height, 1rem));font-weight:var(--md-list-item-trailing-supporting-text-weight,var(--md-sys-typescale-label-small-weight,var(--md-ref-typeface-weight-medium,500)))}:is([slot=start],[slot=end])::slotted(*){fill:currentColor}[slot=start]{color:var(--md-list-item-leading-icon-color,var(--md-sys-color-on-surface-variant,#49454f))}[slot=end]{color:var(--md-list-item-trailing-icon-color,var(--md-sys-color-on-surface-variant,#49454f))}{.disabled slot{color:GrayText}.list-item.disabled{color:GrayText;opacity:1}}`},58168(t,e,i){i.d(e,{n:()=>y});var s=i(62826),a=(i(75275),i(22441)),o=i(5124);class r extends o.WF{render(){return o.qy` <slot name="container"></slot> <slot class="non-text" name="start"></slot> <div class="text"> <slot name="overline" ="${this.handleTextSlotChange}"></slot> <slot class="default-slot" ="${this.handleTextSlotChange}"></slot> <slot name="headline" ="${this.handleTextSlotChange}"></slot> <slot name="supporting-text" ="${this.handleTextSlotChange}"></slot> </div> <slot class="non-text" name="trailing-supporting-text"></slot> <slot class="non-text" name="end"></slot> `}handleTextSlotChange(){let t=!1,e=0;for(const i of this.textSlots)if(l(i)&&(e+=1),e>1){t=!0;break}this.multiline=t}constructor(){super(...arguments),this.multiline=!1}}function l(t){for(const e of t.assignedNodes({flatten:!0})){const t=e.nodeType===Node.ELEMENT_NODE,i=e.nodeType===Node.TEXT_NODE&&e.textContent?.match(/\S/);if(t||i)return!0}return!1}(0,s.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],r.prototype,"multiline",void 0),(0,s.Cg)([(0,a.YG)(".text slot")],r.prototype,"textSlots",void 0);const n=o.AH`:host{color:var(--md-sys-color-on-surface,#1d1b20);font-family:var(--md-sys-typescale-body-large-font, var(--md-ref-typeface-plain, Roboto));font-size:var(--md-sys-typescale-body-large-size, 1rem);font-weight:var(--md-sys-typescale-body-large-weight,var(--md-ref-typeface-weight-regular,400));line-height:var(--md-sys-typescale-body-large-line-height, 1.5rem);align-items:center;box-sizing:border-box;display:flex;gap:16px;min-height:56px;overflow:hidden;padding:12px 16px;position:relative;text-overflow:ellipsis}:host([multiline]){min-height:72px}[name=overline]{color:var(--md-sys-color-on-surface-variant,#49454f);font-family:var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto));font-size:var(--md-sys-typescale-label-small-size, .6875rem);font-weight:var(--md-sys-typescale-label-small-weight,var(--md-ref-typeface-weight-medium,500));line-height:var(--md-sys-typescale-label-small-line-height, 1rem)}[name=supporting-text]{color:var(--md-sys-color-on-surface-variant,#49454f);font-family:var(--md-sys-typescale-body-medium-font, var(--md-ref-typeface-plain, Roboto));font-size:var(--md-sys-typescale-body-medium-size, .875rem);font-weight:var(--md-sys-typescale-body-medium-weight,var(--md-ref-typeface-weight-regular,400));line-height:var(--md-sys-typescale-body-medium-line-height, 1.25rem)}[name=trailing-supporting-text]{color:var(--md-sys-color-on-surface-variant,#49454f);font-family:var(--md-sys-typescale-label-small-font, var(--md-ref-typeface-plain, Roboto));font-size:var(--md-sys-typescale-label-small-size, .6875rem);font-weight:var(--md-sys-typescale-label-small-weight,var(--md-ref-typeface-weight-medium,500));line-height:var(--md-sys-typescale-label-small-line-height, 1rem)}[name=container]::slotted(*){inset:0;position:absolute}.default-slot{display:inline}.default-slot,.text ::slotted(*){overflow:hidden;text-overflow:ellipsis}.text{display:flex;flex:1;flex-direction:column;overflow:hidden}`;let d=class extends r{};d.styles=[n],d=(0,s.Cg)([(0,a.EM)("md-item")],d);i(71970);var c=i(6412),h=i(7872),p=i(1024),m=i(27525);const g=(0,p.n)(o.WF);class y extends g{get isDisabled(){return this.disabled&&"link"!==this.type}willUpdate(t){this.href&&(this.type="link"),super.willUpdate(t)}render(){return this.renderListItem(o.qy` <md-item> <div slot="container"> ${this.renderRipple()} ${this.renderFocusRing()} </div> <slot name="start" slot="start"></slot> <slot name="end" slot="end"></slot> ${this.renderBody()} </md-item> `)}renderListItem(t){const e="link"===this.type;let i;switch(this.type){case"link":i=h.eu`a`;break;case"button":i=h.eu`button`;break;default:i=h.eu`li`}const s="text"!==this.type,a=e&&this.target?this.target:o.s6;return h.qy`
<${i}
id="item"
tabindex="${this.isDisabled||!s?-1:0}"
?disabled=${this.isDisabled}
role="listitem"
aria-selected=${this.ariaSelected||o.s6}
aria-checked=${this.ariaChecked||o.s6}
aria-expanded=${this.ariaExpanded||o.s6}
aria-haspopup=${this.ariaHasPopup||o.s6}
class="list-item ${(0,c.H)(this.getRenderClasses())}"
href=${this.href||o.s6}
target=${a}
=${this.onFocus}
>${t}</${i}>
`}renderRipple(){return"text"===this.type?o.s6:o.qy` <md-ripple part="ripple" for="item" ?disabled="${this.isDisabled}"></md-ripple>`}renderFocusRing(){return"text"===this.type?o.s6:o.qy` <md-focus-ring -changed="${this.onFocusRingVisibilityChanged}" part="focus-ring" for="item" inward></md-focus-ring>`}onFocusRingVisibilityChanged(t){}getRenderClasses(){return{disabled:this.isDisabled}}renderBody(){return o.qy` <slot></slot> <slot name="overline" slot="overline"></slot> <slot name="headline" slot="headline"></slot> <slot name="supporting-text" slot="supporting-text"></slot> <slot name="trailing-supporting-text" slot="trailing-supporting-text"></slot> `}onFocus(){-1===this.tabIndex&&this.dispatchEvent((0,m.cG)())}focus(){this.listItemRoot?.focus()}click(){this.listItemRoot?this.listItemRoot.click():super.click()}constructor(){super(...arguments),this.disabled=!1,this.type="text",this.isListItem=!0,this.href="",this.target=""}}y.shadowRootOptions={...o.WF.shadowRootOptions,delegatesFocus:!0},(0,s.Cg)([(0,a.MZ)({type:Boolean,reflect:!0})],y.prototype,"disabled",void 0),(0,s.Cg)([(0,a.MZ)({reflect:!0})],y.prototype,"type",void 0),(0,s.Cg)([(0,a.MZ)({type:Boolean,attribute:"md-list-item",reflect:!0})],y.prototype,"isListItem",void 0),(0,s.Cg)([(0,a.MZ)()],y.prototype,"href",void 0),(0,s.Cg)([(0,a.MZ)()],y.prototype,"target",void 0),(0,s.Cg)([(0,a.P)(".list-item")],y.prototype,"listItemRoot",void 0)}};