UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

2 lines 11.8 kB
/*! For license information please see 32496.33847833132d1819.js.LICENSE.txt */ export const __rspack_esm_id=32496;export const __rspack_esm_ids=[32496];export const __webpack_modules__={35370(t,e,n){var i=n(26198);t.exports=function(t,e,n){for(var o=0,r=arguments.length>2?n:i(e),s=new t(r);r>o;)s[o]=e[o++];return s}},29344(t,e,n){n.a(t,async function(t,i){try{n.d(e,{A:()=>C});var o=n(5124),r=n(22441),s=n(6412),a=n(63672),l=n(34514),c=n(40991),h=n(92070),d=n(41268),u=n(9395),p=n(62676),f=n(15477),b=n(31896),m=n(17060),v=n(19978),g=t([m]);m=(g.then?(await g)():g)[0];var w=Object.defineProperty,k=Object.getOwnPropertyDescriptor,y=(t,e,n,i)=>{for(var o,r=i>1?void 0:i?k(e,n):e,s=t.length-1;s>=0;s--)(o=t[s])&&(r=(i?o(e,n,r):o(r))||r);return i&&r&&w(e,n,r),r};let C=class extends p.q{static get validators(){return[...super.validators,(0,d.i)()]}get value(){return this._value??"on"}set value(t){this._value=t}handleSizeChange(){(0,c.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,s.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" @click="${this.handleClick}" @keydown="${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,s.H)({"has-slotted":e})}" aria-hidden="${e?"false":"true"}">${this.hint}</slot> `}constructor(){super(...arguments),this.hasSlotController=new h.X(this,"hint"),this.localize=new m.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}};C.shadowRootOptions={...p.q.shadowRootOptions,delegatesFocus:!0},C.css=[f.A,b.A,v.A],y([(0,r.P)('input[type="checkbox"]')],C.prototype,"input",2),y([(0,r.MZ)()],C.prototype,"title",2),y([(0,r.MZ)({reflect:!0})],C.prototype,"name",2),y([(0,r.MZ)({reflect:!0})],C.prototype,"value",1),y([(0,r.MZ)({reflect:!0})],C.prototype,"size",2),y([(0,u.w)("size")],C.prototype,"handleSizeChange",1),y([(0,r.MZ)({type:Boolean})],C.prototype,"disabled",2),y([(0,r.MZ)({type:Boolean,attribute:!1})],C.prototype,"checked",1),y([(0,r.MZ)({type:Boolean,attribute:"checked",reflect:!0})],C.prototype,"defaultChecked",2),y([(0,r.MZ)({type:Boolean,reflect:!0})],C.prototype,"required",2),y([(0,r.MZ)({attribute:"hint"})],C.prototype,"hint",2),y([(0,r.MZ)({attribute:"with-hint",type:Boolean})],C.prototype,"withHint",2),y([(0,u.w)(["checked","defaultChecked"])],C.prototype,"handleStateChange",1),y([(0,u.w)("disabled",{waitUntilFirstUpdate:!0})],C.prototype,"handleDisabledChange",1),C=y([(0,r.EM)("wa-switch")],C),C.disableWarning?.("change-in-update"),i()}catch(t){i(t)}})},19978(t,e,n){n.d(e,{A:()=>i});var i=n(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)}@media (forced-colors:active){:checked+.switch .thumb,:checked:enabled+.switch:hover .thumb{background-color:ButtonText}}`},95010(t,e,n){n.d(e,{q:()=>i,N:()=>o});n(16573),n(78100),n(77936),n(37467),n(44732),n(79577),n(16632),n(34226),n(9486),n(20456);function i(t,e,n){const i=t=>Object.is(t,-0)?0:t;return i(t<e?e:t>n?n:t)}function o(t=""){return`${t}${((t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&n[t]];return e})()}`}},4444(t,e,n){n.d(e,{JG:()=>o,Rt:()=>s,I7:()=>r});n(17642),n(58004),n(33853),n(45876),n(32475),n(15024),n(31698);const i=new Set;function o(t){if(i.add(t),!document.documentElement.classList.contains("wa-scroll-lock")){const t=function(){const t=document.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}()+function(){const t=Number(getComputedStyle(document.body).paddingRight.replace(/px/,""));return isNaN(t)||!t?0:t}();let e=getComputedStyle(document.documentElement).scrollbarGutter;e&&"auto"!==e||(e="stable"),t<2&&(e=""),document.documentElement.style.setProperty("--wa-scroll-lock-gutter",e),document.documentElement.classList.add("wa-scroll-lock"),document.documentElement.style.setProperty("--wa-scroll-lock-size",`${t}px`)}}function r(t){i.delete(t),0===i.size&&(document.documentElement.classList.remove("wa-scroll-lock"),document.documentElement.style.removeProperty("--wa-scroll-lock-size"))}function s(t,e,n="vertical",i="smooth"){const o=function(t,e){return{top:Math.round(t.getBoundingClientRect().top-e.getBoundingClientRect().top),left:Math.round(t.getBoundingClientRect().left-e.getBoundingClientRect().left)}}(t,e),r=o.top+e.scrollTop,s=o.left+e.scrollLeft,a=e.scrollLeft,l=e.scrollLeft+e.offsetWidth,c=e.scrollTop,h=e.scrollTop+e.offsetHeight;"horizontal"!==n&&"both"!==n||(s<a?e.scrollTo({left:s,behavior:i}):s+t.clientWidth>l&&e.scrollTo({left:s-e.offsetWidth+t.clientWidth,behavior:i})),"vertical"!==n&&"both"!==n||(r<c?e.scrollTo({top:r,behavior:i}):r+t.clientHeight>h&&e.scrollTo({top:r-e.offsetHeight+t.clientHeight,behavior:i}))}},99731(t,e,n){n.d(e,{Y:()=>c});var i=n(62826),o=n(22441),r=(n(18111),n(22489),n(20116),n(5124)),s=n(99591);class a extends r.WF{get chips(){return this.childElements.filter(t=>t instanceof s.v)}render(){return r.qy`<slot @slotchange="${this.updateTabIndices}"></slot>`}handleKeyDown(t){const e="ArrowLeft"===t.key,n="ArrowRight"===t.key,i="Home"===t.key,o="End"===t.key;if(!(e||n||i||o))return;const{chips:r}=this;if(r.length<2)return;if(t.preventDefault(),i||o){return r[i?0:r.length-1].focus({trailing:o}),void this.updateTabIndices()}const s="rtl"===getComputedStyle(this).direction?e:n,a=r.find(t=>t.matches(":focus-within"));if(!a){return(s?r[0]:r[r.length-1]).focus({trailing:!s}),void this.updateTabIndices()}const l=r.indexOf(a);let c=s?l+1:l-1;for(;c!==l;){c>=r.length?c=0:c<0&&(c=r.length-1);const t=r[c];if(!t.disabled||t.alwaysFocusable){t.focus({trailing:!s}),this.updateTabIndices();break}s?c++:c--}}updateTabIndices(){const{chips:t}=this;let e;for(const n of t){const t=n.alwaysFocusable||!n.disabled;n.matches(":focus-within")&&t?e=n:(t&&!e&&(e=n),n.tabIndex=-1)}e&&(e.tabIndex=0)}constructor(){super(),this.internals=this.attachInternals(),r.S$||(this.addEventListener("focusin",this.updateTabIndices.bind(this)),this.addEventListener("update-focus",this.updateTabIndices.bind(this)),this.addEventListener("keydown",this.handleKeyDown.bind(this)),this.internals.role="toolbar")}}(0,i.Cg)([(0,o.KN)()],a.prototype,"childElements",void 0);const l=r.AH`:host{display:flex;flex-wrap:wrap;gap:8px}`;let c=class extends a{};c.styles=[l],c=(0,i.Cg)([(0,o.EM)("md-chip-set")],c)},27525(t,e,n){function i(t,e=p){const n=a(t,e);return n&&(n.tabIndex=0,n.focus()),n}function o(t,e=p){const n=l(t,e);return n&&(n.tabIndex=0,n.focus()),n}function r(t,e=p){const n=s(t,e);return n&&(n.item.tabIndex=-1),n}function s(t,e=p){for(let n=0;n<t.length;n++){const i=t[n];if(0===i.tabIndex&&e(i))return{item:i,index:n}}return null}function a(t,e=p){for(const n of t)if(e(n))return n;return null}function l(t,e=p){for(let n=t.length-1;n>=0;n--){const i=t[n];if(e(i))return i}return null}function c(t,e,n=p,o=!0){if(e){const i=function(t,e,n=p,i=!0){for(let o=1;o<t.length;o++){const r=(o+e)%t.length;if(r<e&&!i)return null;const s=t[r];if(n(s))return s}return t[e]?t[e]:null}(t,e.index,n,o);return i&&(i.tabIndex=0,i.focus()),i}return i(t,n)}function h(t,e,n=p,i=!0){if(e){const o=function(t,e,n=p,i=!0){for(let o=1;o<t.length;o++){const r=(e-o+t.length)%t.length;if(r>e&&!i)return null;const s=t[r];if(n(s))return s}return t[e]?t[e]:null}(t,e.index,n,i);return o&&(o.tabIndex=0,o.focus()),o}return o(t,n)}function d(){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}n.d(e,{A6:()=>s,Ex:()=>l,RN:()=>d,RZ:()=>o,c7:()=>a,cG:()=>u,u9:()=>h,ub:()=>r,wm:()=>c,zT:()=>i})}};