iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 12 kB
JavaScript
/*! For license information please see 83113.3a4305fd6c04f54e.js.LICENSE.txt */
export const __rspack_esm_id=83113;export const __rspack_esm_ids=[83113];export const __webpack_modules__={34271(e,t,a){a.d(t,{A:()=>o});a(18111),a(7588),a(61701);function o(e){if(!e||"object"!=typeof e)return e;if("[object Date]"==Object.prototype.toString.call(e))return new Date(e.getTime());if(Array.isArray(e))return e.map(o);var t={};return Object.keys(e).forEach(function(a){t[a]=o(e[a])}),t}},93900(e,t,a){a.a(e,async function(e,t){try{var o=a(5124),i=a(22441),n=a(6412),s=a(63672),r=a(17051),l=a(42462),c=a(28438),d=a(98779),h=a(27259),p=a(25877),u=a(31247),g=a(4444),f=a(92070),w=a(9395),b=a(717),y=a(17060),m=a(88496),v=a(91470),k=e([m,y]);[m,y]=k.then?(await k)():k;var E=Object.defineProperty,x=Object.getOwnPropertyDescriptor,C=(e,t,a,o)=>{for(var i,n=o>1?void 0:o?x(t,a):t,s=e.length-1;s>=0;s--)(i=e[s])&&(n=(o?i(t,a,n):i(n))||n);return o&&n&&E(t,a,n),n};let D=class extends b.A{firstUpdated(){this.open&&(this.addOpenListeners(),this.dialog.showModal(),(0,g.JG)(this))}disconnectedCallback(){super.disconnectedCallback(),(0,g.I7)(this),this.removeOpenListeners()}async requestClose(e){const t=new c.L({source:e});if(this.dispatchEvent(t),t.defaultPrevented)return this.open=!0,void(0,h.Ud)(this.dialog,"pulse");this.removeOpenListeners(),await(0,h.Ud)(this.dialog,"hide"),this.open=!1,this.dialog.close(),(0,g.I7)(this);const a=this.originalTrigger;"function"==typeof a?.focus&&setTimeout(()=>a.focus()),this.dispatchEvent(new r.Z)}addOpenListeners(){document.addEventListener("keydown",this.handleDocumentKeyDown),(0,p.AZ)(this)}removeOpenListeners(){document.removeEventListener("keydown",this.handleDocumentKeyDown),(0,p.Fw)(this)}handleDialogCancel(e){e.preventDefault(),!this.dialog.classList.contains("hide")&&e.target===this.dialog&&(0,p.a0)(this)&&this.requestClose(this.dialog)}handleDialogClick(e){const t=e.target.closest('[data-dialog="close"]');t&&(e.stopPropagation(),this.requestClose(t))}async handleDialogPointerDown(e){e.target===this.dialog&&(this.lightDismiss?this.requestClose(this.dialog):await(0,h.Ud)(this.dialog,"pulse"))}handleOpenChange(){this.open&&!this.dialog.open?this.show():!this.open&&this.dialog.open&&(this.open=!0,this.requestClose(this.dialog))}async show(){const e=new d.k;this.dispatchEvent(e),e.defaultPrevented?this.open=!1:(this.addOpenListeners(),this.originalTrigger=document.activeElement,this.open=!0,this.dialog.showModal(),(0,g.JG)(this),requestAnimationFrame(()=>{const e=this.querySelector("[autofocus]");e&&"function"==typeof e.focus?e.focus():this.dialog.focus()}),await(0,h.Ud)(this.dialog,"show"),this.dispatchEvent(new l.q))}render(){const e=!this.withoutHeader,t=this.hasUpdated?this.hasSlotController.test("footer"):this.withFooter;return o.qy` <dialog aria-labelledby="${this.ariaLabelledby??"title"}" aria-describedby="${(0,s.J)(this.ariaDescribedby)}" part="dialog" class="${(0,n.H)({dialog:!0,open:this.open})}" ="${this.handleDialogCancel}" ="${this.handleDialogClick}" ="${this.handleDialogPointerDown}"> ${e?o.qy` <header part="header" class="header"> <h2 part="title" class="title" id="title"> <slot name="label"> ${this.label.length>0?this.label:String.fromCharCode(8203)} </slot> </h2> <div part="header-actions" class="header-actions"> <slot name="header-actions"></slot> <wa-button part="close-button" exportparts="base:close-button__base" class="close" appearance="plain" ="${e=>this.requestClose(e.target)}"> <wa-icon name="xmark" label="${this.localize.term("close")}" library="system" variant="solid"></wa-icon> </wa-button> </div> </header> `:""} <div part="body" class="body"><slot></slot></div> ${t?o.qy` <footer part="footer" class="footer"> <slot name="footer"></slot> </footer> `:""} </dialog> `}constructor(){super(...arguments),this.localize=new y.c(this),this.hasSlotController=new f.X(this,"footer","header-actions","label"),this.open=!1,this.label="",this.withoutHeader=!1,this.lightDismiss=!1,this.withFooter=!1,this.handleDocumentKeyDown=e=>{"Escape"===e.key&&this.open&&(0,p.a0)(this)&&(e.preventDefault(),e.stopPropagation(),this.requestClose(this.dialog))}}};D.css=v.A,C([(0,i.P)(".dialog")],D.prototype,"dialog",2),C([(0,i.MZ)({type:Boolean,reflect:!0})],D.prototype,"open",2),C([(0,i.MZ)({reflect:!0})],D.prototype,"label",2),C([(0,i.MZ)({attribute:"without-header",type:Boolean,reflect:!0})],D.prototype,"withoutHeader",2),C([(0,i.MZ)({attribute:"light-dismiss",type:Boolean})],D.prototype,"lightDismiss",2),C([(0,i.MZ)({attribute:"aria-labelledby"})],D.prototype,"ariaLabelledby",2),C([(0,i.MZ)({attribute:"aria-describedby"})],D.prototype,"ariaDescribedby",2),C([(0,i.MZ)({attribute:"with-footer",type:Boolean})],D.prototype,"withFooter",2),C([(0,w.w)("open",{waitUntilFirstUpdate:!0})],D.prototype,"handleOpenChange",1),D=C([(0,i.EM)("wa-dialog")],D),o.S$||(document.addEventListener("click",e=>{const t=e.target.closest("[data-dialog]");if(t instanceof Element){const[e,a]=(0,u.v)(t.getAttribute("data-dialog")||"");if("open"===e&&a?.length){const e=t.getRootNode().getElementById(a);"wa-dialog"===e?.localName?e.open=!0:console.warn(`A dialog with an ID of "${a}" could not be found in this document.`)}}}),document.addEventListener("pointerdown",()=>{})),t()}catch(e){t(e)}})},91470(e,t,a){a.d(t,{A:()=>o});var o=a(5124).AH`:host{--width:31rem;--spacing:var(--wa-space-l);--backdrop-filter:none;--show-duration:200ms;--hide-duration:200ms;display:none}:host([open]){display:block}.dialog{display:flex;flex-direction:column;top:0;right:0;bottom:0;left:0;width:var(--width);max-width:calc(100% - var(--wa-space-2xl));max-height:calc(100% - var(--wa-space-2xl));color:inherit;background-color:var(--wa-color-surface-raised);border-radius:var(--wa-panel-border-radius);border:none;box-shadow:var(--wa-shadow-l);padding:0;margin:auto}.dialog.show{animation:show-dialog var(--show-duration) ease}.dialog.show::backdrop{animation:show-backdrop var(--show-duration,200ms) ease}.dialog.hide{animation:show-dialog var(--hide-duration) ease reverse}.dialog.hide::backdrop{animation:show-backdrop var(--hide-duration,200ms) ease reverse}.dialog.pulse{animation:pulse 250ms ease}.dialog:focus{outline:0} screen and (max-width:420px){.dialog{max-height:80vh}}.open{display:flex;opacity:1}.header{flex:0 0 auto;display:flex;flex-wrap:nowrap;padding-inline-start:var(--spacing);padding-block-end:0;padding-inline-end:calc(var(--spacing) - var(--wa-form-control-padding-block));padding-block-start:calc(var(--spacing) - var(--wa-form-control-padding-block))}.title{align-self:center;flex:1 1 auto;font-family:inherit;font-size:var(--wa-font-size-l);font-weight:var(--wa-font-weight-heading);line-height:var(--wa-line-height-condensed);margin:0}.header-actions{align-self:start;display:flex;flex-shrink:0;flex-wrap:wrap;justify-content:end;gap:var(--wa-space-2xs);padding-inline-start:var(--spacing)}.header-actions ::slotted(wa-button),.header-actions wa-button{flex:0 0 auto;display:flex;align-items:center}.body{flex:1 1 auto;display:block;padding:var(--spacing);overflow:auto;-webkit-overflow-scrolling:touch}.body:focus{outline:0}.body:focus-visible{outline:var(--wa-focus-ring);outline-offset:var(--wa-focus-ring-offset)}.footer{flex:0 0 auto;display:flex;flex-wrap:wrap;gap:var(--wa-space-xs);justify-content:end;padding:var(--spacing);padding-block-start:0}.footer ::slotted(wa-button:not(:first-of-type)){margin-inline-start:var(--wa-spacing-xs)}.dialog::backdrop{background-color:var(--wa-color-overlay-modal,rgb(0 0 0 / .25));-webkit-backdrop-filter:var(--backdrop-filter);backdrop-filter:var(--backdrop-filter)} pulse{0%{scale:1}50%{scale:1.02}100%{scale:1}} show-dialog{from{opacity:0;scale:0.8}to{opacity:1;scale:1}} show-backdrop{from{opacity:0}to{opacity:1}} (forced-colors:active){.dialog{border:solid 1px #fff}}`},2209(e,t,a){a.d(t,{LV:()=>p});a(18111),a(61701),a(18237),a(45367),a(92731),a(88454),a(29452);const o=Symbol("Comlink.proxy"),i=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),s=Symbol("Comlink.finalizer"),r=Symbol("Comlink.thrown"),l=e=>"object"==typeof e&&null!==e||"function"==typeof e,c=new Map([["proxy",{canHandle:e=>l(e)&&e[o],serialize(e){const{port1:t,port2:a}=new MessageChannel;return d(e,t),[a,[a]]},deserialize:e=>(e.start(),p(e))}],["throw",{canHandle:e=>l(e)&&r in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function d(e,t=globalThis,a=["*"]){t.addEventListener("message",function i(n){if(!n||!n.data)return;if(!function(e,t){for(const a of e){if(t===a||"*"===a)return!0;if(a instanceof RegExp&&a.test(t))return!0}return!1}(a,n.origin))return void console.warn(`Invalid origin '${n.origin}' for comlink proxy`);const{id:l,type:c,path:p}=Object.assign({path:[]},n.data),u=(n.data.argumentList||[]).map(k);let g;try{const t=p.slice(0,-1).reduce((e,t)=>e[t],e),a=p.reduce((e,t)=>e[t],e);switch(c){case"GET":g=a;break;case"SET":t[p.slice(-1)[0]]=k(n.data.value),g=!0;break;case"APPLY":g=a.apply(t,u);break;case"CONSTRUCT":g=function(e){return Object.assign(e,{[o]:!0})}(new a(...u));break;case"ENDPOINT":{const{port1:t,port2:a}=new MessageChannel;d(e,a),g=function(e,t){return m.set(e,t),e}(t,[t])}break;case"RELEASE":g=void 0;break;default:return}}catch(e){g={value:e,[r]:0}}Promise.resolve(g).catch(e=>({value:e,[r]:0})).then(a=>{const[o,n]=v(a);t.postMessage(Object.assign(Object.assign({},o),{id:l}),n),"RELEASE"===c&&(t.removeEventListener("message",i),h(t),s in e&&"function"==typeof e[s]&&e[s]())}).catch(e=>{const[a,o]=v({value:new TypeError("Unserializable return value"),[r]:0});t.postMessage(Object.assign(Object.assign({},a),{id:l}),o)})}),t.start&&t.start()}function h(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function p(e,t){const a=new Map;return e.addEventListener("message",function(e){const{data:t}=e;if(!t||!t.id)return;const o=a.get(t.id);if(o)try{o(t)}finally{a.delete(t.id)}}),b(e,a,[],t)}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return E(e,new Map,{type:"RELEASE"}).then(()=>{h(e)})}const f=new WeakMap,w="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(f.get(e)||0)-1;f.set(e,t),0===t&&g(e)});function b(e,t,a=[],o=function(){}){let s=!1;const r=new Proxy(o,{get(o,i){if(u(s),i===n)return()=>{!function(e){w&&w.unregister(e)}(r),g(e),t.clear(),s=!0};if("then"===i){if(0===a.length)return{then:()=>r};const o=E(e,t,{type:"GET",path:a.map(e=>e.toString())}).then(k);return o.then.bind(o)}return b(e,t,[...a,i])},set(o,i,n){u(s);const[r,l]=v(n);return E(e,t,{type:"SET",path:[...a,i].map(e=>e.toString()),value:r},l).then(k)},apply(o,n,r){u(s);const l=a[a.length-1];if(l===i)return E(e,t,{type:"ENDPOINT"}).then(k);if("bind"===l)return b(e,t,a.slice(0,-1));const[c,d]=y(r);return E(e,t,{type:"APPLY",path:a.map(e=>e.toString()),argumentList:c},d).then(k)},construct(o,i){u(s);const[n,r]=y(i);return E(e,t,{type:"CONSTRUCT",path:a.map(e=>e.toString()),argumentList:n},r).then(k)}});return function(e,t){const a=(f.get(t)||0)+1;f.set(t,a),w&&w.register(e,t,e)}(r,e),r}function y(e){const t=e.map(v);return[t.map(e=>e[0]),(a=t.map(e=>e[1]),Array.prototype.concat.apply([],a))];var a}const m=new WeakMap;function v(e){for(const[t,a]of c)if(a.canHandle(e)){const[o,i]=a.serialize(e);return[{type:"HANDLER",name:t,value:o},i]}return[{type:"RAW",value:e},m.get(e)||[]]}function k(e){switch(e.type){case"HANDLER":return c.get(e.name).deserialize(e.value);case"RAW":return e.value}}function E(e,t,a,o){return new Promise(i=>{const n=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(n,i),e.start&&e.start(),e.postMessage(Object.assign({id:n},a),o)})}}};