iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
17 lines • 20.7 kB
JavaScript
/*! For license information please see 67748.babe821d210a8c2e.js.LICENSE.txt */
export const __rspack_esm_id=67748;export const __rspack_esm_ids=[67748];export const __webpack_modules__={12451(t,e,i){i.d(e,{O:()=>r,i:()=>o.is});var s=i(5124),o=i(12130);class r extends s.WF{click(){if(this.mdcRoot)return this.mdcRoot.focus(),void this.mdcRoot.click();super.click()}createFoundation(){void 0!==this.mdcFoundation&&this.mdcFoundation.destroy(),this.mdcFoundationClass&&(this.mdcFoundation=new this.mdcFoundationClass(this.createAdapter()),this.mdcFoundation.init())}firstUpdated(){this.createFoundation()}}},12130(t,e,i){i.d(e,{SE:()=>d,U9:()=>l,hP:()=>s,is:()=>o});i(44114);const s=t=>t.nodeType===Node.ELEMENT_NODE;function o(t){return{addClass:e=>{t.classList.add(e)},removeClass:e=>{t.classList.remove(e)},hasClass:e=>t.classList.contains(e)}}let r=!1;const n=()=>{},a={get passive(){return r=!0,!1}};document.addEventListener("x",n,a),document.removeEventListener("x",n);const l=(t=window.document)=>{let e=t.activeElement;const i=[];if(!e)return i;for(;e&&(i.push(e),e.shadowRoot);)e=e.shadowRoot.activeElement;return i},d=t=>{const e=l();if(!e.length)return!1;const i=e[e.length-1],s=new Event("check-if-focused",{bubbles:!0,composed:!0});let o=[];const r=t=>{o=t.composedPath()};return document.body.addEventListener("check-if-focused",r),i.dispatchEvent(s),document.body.removeEventListener("check-if-focused",r),-1!==o.indexOf(t)}},29344(t,e,i){i.a(t,async function(t,s){try{i.d(e,{A:()=>k});var o=i(5124),r=i(22441),n=i(6412),a=i(63672),l=i(34514),d=i(40991),c=i(92070),h=i(41268),u=i(9395),p=i(62676),m=i(15477),f=i(31896),v=i(17060),g=i(19978),y=t([v]);v=(y.then?(await y)():y)[0];var b=Object.defineProperty,w=Object.getOwnPropertyDescriptor,x=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?w(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&b(e,i,r),r};let k=class extends p.q{static get validators(){return[...super.validators,(0,h.i)()]}get value(){return this._value??"on"}set value(t){this._value=t}handleSizeChange(){(0,d.b)(this.localName,this.size)}get checked(){return this.valueHasChanged?Boolean(this._checked):this._checked??this.defaultChecked}set checked(t){this._checked=Boolean(t),this.valueHasChanged=!0}handleClick(){this.hasInteracted=!0,this.checked=!this.checked,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))})}handleKeyDown(t){const e="rtl"===this.localize.dir();"ArrowLeft"===t.key&&(t.preventDefault(),this.checked=e,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))})),"ArrowRight"===t.key&&(t.preventDefault(),this.checked=!e,this.updateComplete.then(()=>{this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),this.dispatchEvent(new InputEvent("input",{bubbles:!0,composed:!0}))}))}willUpdate(t){super.willUpdate(t),(t.has("value")||t.has("checked")||t.has("defaultChecked"))&&this.handleValueOrCheckedChange()}handleValueOrCheckedChange(){this.setValue(this.checked?this.value:null,this._value),this.updateValidity()}handleStateChange(){this.hasUpdated&&(this.input.checked=this.checked),this.customStates.set("checked",this.checked),this.updateValidity()}handleDisabledChange(){this.updateValidity()}click(){this.input.click()}focus(t){this.input.focus(t)}blur(){this.input.blur()}setValue(t,e){this.checked?this.internals.setFormValue(t??"on",e):this.internals.setFormValue(null,null)}formResetCallback(){this._checked=null,super.formResetCallback(),this.handleValueOrCheckedChange()}render(){const t=this.hasUpdated?this.hasSlotController.test("hint"):this.withHint,e=!!this.hint||!!t;return o.qy` <label part="base" class="${(0,n.H)({checked:this.checked,disabled:this.disabled})}"> <input class="input" type="checkbox" title="${this.title}" name="${(0,a.J)(this.name)}" value="${(0,a.J)(this.value)}" .checked="${(0,l.V)(this.checked)}" .disabled="${this.disabled}" .required="${this.required}" role="switch" aria-checked="${this.checked?"true":"false"}" aria-describedby="hint" ="${this.handleClick}" ="${this.handleKeyDown}"> <span part="control" class="switch"> <span part="thumb" class="thumb"></span> </span> <slot part="label" class="label"></slot> </label> <slot id="hint" name="hint" part="hint" class="${(0,n.H)({"has-slotted":e})}" aria-hidden="${e?"false":"true"}">${this.hint}</slot> `}constructor(){super(...arguments),this.hasSlotController=new c.X(this,"hint"),this.localize=new v.c(this),this.title="",this.name=null,this._value=this.getAttribute("value")??null,this.size="m",this.disabled=!1,this._checked=null,this.defaultChecked=this.hasAttribute("checked"),this.required=!1,this.hint="",this.withHint=!1}};k.shadowRootOptions={...p.q.shadowRootOptions,delegatesFocus:!0},k.css=[m.A,f.A,g.A],x([(0,r.P)('input[type="checkbox"]')],k.prototype,"input",2),x([(0,r.MZ)()],k.prototype,"title",2),x([(0,r.MZ)({reflect:!0})],k.prototype,"name",2),x([(0,r.MZ)({reflect:!0})],k.prototype,"value",1),x([(0,r.MZ)({reflect:!0})],k.prototype,"size",2),x([(0,u.w)("size")],k.prototype,"handleSizeChange",1),x([(0,r.MZ)({type:Boolean})],k.prototype,"disabled",2),x([(0,r.MZ)({type:Boolean,attribute:!1})],k.prototype,"checked",1),x([(0,r.MZ)({type:Boolean,attribute:"checked",reflect:!0})],k.prototype,"defaultChecked",2),x([(0,r.MZ)({type:Boolean,reflect:!0})],k.prototype,"required",2),x([(0,r.MZ)({attribute:"hint"})],k.prototype,"hint",2),x([(0,r.MZ)({attribute:"with-hint",type:Boolean})],k.prototype,"withHint",2),x([(0,u.w)(["checked","defaultChecked"])],k.prototype,"handleStateChange",1),x([(0,u.w)("disabled",{waitUntilFirstUpdate:!0})],k.prototype,"handleDisabledChange",1),k=x([(0,r.EM)("wa-switch")],k),k.disableWarning?.("change-in-update"),s()}catch(t){s(t)}})},19978(t,e,i){i.d(e,{A:()=>s});var s=i(5124).AH`:host{--height:var(--wa-form-control-toggle-size);--width:calc(var(--height) * 1.75);--thumb-size:0.75em;display:inline-flex;line-height:var(--wa-form-control-value-line-height)}label{position:relative;display:flex;align-items:center;font:inherit;color:var(--wa-form-control-value-color);vertical-align:middle;cursor:pointer}.switch{flex:0 0 auto;position:relative;display:flex;align-items:center;justify-content:center;width:var(--width);height:var(--height);background-color:var(--wa-form-control-background-color);border-color:var(--wa-form-control-border-color);border-radius:var(--height);border-style:var(--wa-form-control-border-style);border-width:var(--wa-form-control-border-width);transition-property:translate,background,border-color,box-shadow;transition-duration:var(--wa-transition-normal);transition-timing-function:var(--wa-transition-easing)}.switch .thumb{aspect-ratio:1/1;width:var(--thumb-size);height:var(--thumb-size);background-color:var(--wa-form-control-border-color);border-radius:50%;translate:calc((var(--width) - var(--height))/ -2);transition:inherit}.switch .thumb:dir(rtl){translate:calc((var(--width) - var(--height))/ 2)}.input{position:absolute;opacity:0;padding:0;margin:0;pointer-events:none}label:not(.disabled) .input:focus-visible~.switch .thumb{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}.checked .switch{background-color:var(--wa-form-control-activated-color);border-color:var(--wa-form-control-activated-color)}.checked .switch .thumb{background-color:var(--wa-color-surface-default);translate:calc((var(--width) - var(--height))/ 2)}.checked .switch .thumb:dir(rtl){translate:calc((var(--width) - var(--height))/ -2)}label:has(> :disabled){opacity:.5;cursor:not-allowed}[part~=label]{display:inline-block;line-height:var(--height);margin-inline-start:.5em;user-select:none;-webkit-user-select:none}:host([required]) [part~=label]::after{content:var(--wa-form-control-required-content);color:var(--wa-form-control-required-content-color);margin-inline-start:var(--wa-form-control-required-content-offset)} (forced-colors:active){:checked+.switch .thumb,:checked:enabled+.switch:hover .thumb{background-color:ButtonText}}`},27525(t,e,i){function s(t,e=p){const i=a(t,e);return i&&(i.tabIndex=0,i.focus()),i}function o(t,e=p){const i=l(t,e);return i&&(i.tabIndex=0,i.focus()),i}function r(t,e=p){const i=n(t,e);return i&&(i.item.tabIndex=-1),i}function n(t,e=p){for(let i=0;i<t.length;i++){const s=t[i];if(0===s.tabIndex&&e(s))return{item:s,index:i}}return null}function a(t,e=p){for(const i of t)if(e(i))return i;return null}function l(t,e=p){for(let i=t.length-1;i>=0;i--){const s=t[i];if(e(s))return s}return null}function d(t,e,i=p,o=!0){if(e){const s=function(t,e,i=p,s=!0){for(let o=1;o<t.length;o++){const r=(o+e)%t.length;if(r<e&&!s)return null;const n=t[r];if(i(n))return n}return t[e]?t[e]:null}(t,e.index,i,o);return s&&(s.tabIndex=0,s.focus()),s}return s(t,i)}function c(t,e,i=p,s=!0){if(e){const o=function(t,e,i=p,s=!0){for(let o=1;o<t.length;o++){const r=(e-o+t.length)%t.length;if(r>e&&!s)return null;const n=t[r];if(i(n))return n}return t[e]?t[e]:null}(t,e.index,i,s);return o&&(o.tabIndex=0,o.focus()),o}return o(t,i)}function h(){return new Event("deactivate-items",{bubbles:!0,composed:!0})}function u(){return new Event("request-activation",{bubbles:!0,composed:!0})}function p(t){return!t.disabled}i.d(e,{A6:()=>n,Ex:()=>l,RN:()=>h,RZ:()=>o,c7:()=>a,cG:()=>u,u9:()=>c,ub:()=>r,wm:()=>d,zT:()=>s})},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:()=>f});var s=i(62826),o=(i(75275),i(22441)),r=i(5124);class n extends r.WF{render(){return r.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(a(i)&&(e+=1),e>1){t=!0;break}this.multiline=t}constructor(){super(...arguments),this.multiline=!1}}function a(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,o.MZ)({type:Boolean,reflect:!0})],n.prototype,"multiline",void 0),(0,s.Cg)([(0,o.YG)(".text slot")],n.prototype,"textSlots",void 0);const l=r.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 n{};d.styles=[l],d=(0,s.Cg)([(0,o.EM)("md-item")],d);i(71970);var c=i(6412),h=i(7872),u=i(1024),p=i(27525);const m=(0,u.n)(r.WF);class f extends m{get isDisabled(){return this.disabled&&"link"!==this.type}willUpdate(t){this.href&&(this.type="link"),super.willUpdate(t)}render(){return this.renderListItem(r.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,o=e&&this.target?this.target:r.s6;return h.qy`
<${i}
id="item"
tabindex="${this.isDisabled||!s?-1:0}"
?disabled=${this.isDisabled}
role="listitem"
aria-selected=${this.ariaSelected||r.s6}
aria-checked=${this.ariaChecked||r.s6}
aria-expanded=${this.ariaExpanded||r.s6}
aria-haspopup=${this.ariaHasPopup||r.s6}
class="list-item ${(0,c.H)(this.getRenderClasses())}"
href=${this.href||r.s6}
target=${o}
=${this.onFocus}
>${t}</${i}>
`}renderRipple(){return"text"===this.type?r.s6:r.qy` <md-ripple part="ripple" for="item" ?disabled="${this.isDisabled}"></md-ripple>`}renderFocusRing(){return"text"===this.type?r.s6:r.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 r.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,p.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=""}}f.shadowRootOptions={...r.WF.shadowRootOptions,delegatesFocus:!0},(0,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],f.prototype,"disabled",void 0),(0,s.Cg)([(0,o.MZ)({reflect:!0})],f.prototype,"type",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,attribute:"md-list-item",reflect:!0})],f.prototype,"isListItem",void 0),(0,s.Cg)([(0,o.MZ)()],f.prototype,"href",void 0),(0,s.Cg)([(0,o.MZ)()],f.prototype,"target",void 0),(0,s.Cg)([(0,o.P)(".list-item")],f.prototype,"listItemRoot",void 0)},95192(t,e,i){i.d(e,{IU:()=>d,Jt:()=>a,Yd:()=>s,hZ:()=>l,y$:()=>o});i(44114),i(18111),i(7588),i(61701);function s(t){return new Promise((e,i)=>{t.oncomplete=t.onsuccess=()=>e(t.result),t.onabort=t.onerror=()=>i(t.error)})}function o(t,e){let i;return(o,r)=>(()=>{if(i)return i;const o=indexedDB.open(t);return o.onupgradeneeded=()=>o.result.createObjectStore(e),i=s(o),i.then(t=>{t.onclose=()=>i=void 0},()=>{}),i})().then(t=>r(t.transaction(e,o).objectStore(e)))}let r;function n(){return r||(r=o("keyval-store","keyval")),r}function a(t,e=n()){return e("readonly",e=>s(e.get(t)))}function l(t,e,i=n()){return i("readwrite",i=>(i.put(e,t),s(i.transaction)))}function d(t=n()){return t("readwrite",t=>(t.clear(),s(t.transaction)))}},91450(t,e,i){i.d(e,{T:()=>u});i(18111),i(20116);var s=i(5055),o=i(63937),r=i(37540);class n{disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}constructor(t){this.G=t}}class a{get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}constructor(){this.Y=void 0,this.Z=void 0}}var l=i(42017);const d=t=>!(0,o.sO)(t)&&"function"==typeof t.then,c=1073741823;class h extends r.Kq{render(...t){return t.find(t=>!d(t))??s.c0}update(t,e){const i=this._$Cbt;let o=i.length;this._$Cbt=e;const r=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let t=0;t<e.length&&!(t>this._$Cwt);t++){const s=e[t];if(!d(s))return this._$Cwt=t,s;t<o&&s===i[t]||(this._$Cwt=c,o=0,Promise.resolve(s).then(async t=>{for(;n.get();)await n.get();const e=r.deref();if(void 0!==e){const i=e._$Cbt.indexOf(s);i>-1&&i<e._$Cwt&&(e._$Cwt=i,e.setValue(t))}}))}return s.c0}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}constructor(){super(...arguments),this._$Cwt=c,this._$Cbt=[],this._$CK=new n(this),this._$CX=new a}}const u=(0,l.u$)(h)}};