UNPKG

iobroker.lovelace

Version:

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

7 lines 23.5 kB
/*! For license information please see 69353.8d261f2e6d800146.js.LICENSE.txt */ export const __webpack_ids__=["69353"];export const __webpack_modules__={27323:function(e,t,n){n.d(t,{O:()=>h});var i=n(9065),o=n(1105),a=n(57243),r=n(15093),s=n(35359),l=n(20552),d=n(91928);const c={fromAttribute:e=>null!==e&&(""===e||e),toAttribute:e=>"boolean"==typeof e?e?"":null:e};class h extends o.P{constructor(){super(...arguments),this.rows=2,this.cols=20,this.charCounter=!1}render(){const e=this.charCounter&&-1!==this.maxLength,t=e&&"internal"===this.charCounter,n=e&&!t,i=!!this.helper||!!this.validationMessage||n,o={"mdc-text-field--disabled":this.disabled,"mdc-text-field--no-label":!this.label,"mdc-text-field--filled":!this.outlined,"mdc-text-field--outlined":this.outlined,"mdc-text-field--end-aligned":this.endAligned,"mdc-text-field--with-internal-counter":t};return a.dy` <label class="mdc-text-field mdc-text-field--textarea ${(0,s.$)(o)}"> ${this.renderRipple()} ${this.outlined?this.renderOutline():this.renderLabel()} ${this.renderInput()} ${this.renderCharCounter(t)} ${this.renderLineRipple()} </label> ${this.renderHelperText(i,n)} `}renderInput(){const e=this.label?"label":void 0,t=-1===this.minLength?void 0:this.minLength,n=-1===this.maxLength?void 0:this.maxLength,i=this.autocapitalize?this.autocapitalize:void 0;return a.dy` <textarea aria-labelledby="${(0,l.o)(e)}" class="mdc-text-field__input" .value="${(0,d.a)(this.value)}" rows="${this.rows}" cols="${this.cols}" ?disabled="${this.disabled}" placeholder="${this.placeholder}" ?required="${this.required}" ?readonly="${this.readOnly}" minlength="${(0,l.o)(t)}" maxlength="${(0,l.o)(n)}" name="${(0,l.o)(""===this.name?void 0:this.name)}" inputmode="${(0,l.o)(this.inputMode)}" autocapitalize="${(0,l.o)(i)}" @input="${this.handleInputChange}" @blur="${this.onInputBlur}"> </textarea>`}}(0,i.__decorate)([(0,r.IO)("textarea")],h.prototype,"formElement",void 0),(0,i.__decorate)([(0,r.Cb)({type:Number})],h.prototype,"rows",void 0),(0,i.__decorate)([(0,r.Cb)({type:Number})],h.prototype,"cols",void 0),(0,i.__decorate)([(0,r.Cb)({converter:c})],h.prototype,"charCounter",void 0)},88540:function(e,t,n){n.d(t,{W:()=>i});const i=n(57243).iv`.mdc-text-field{height:100%}.mdc-text-field__input{resize:none}`},95198:function(e,t,n){var i=n(44249),o=n(57243),a=n(15093);(0,i.Z)([(0,a.Mo)("ha-dialog-header")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"method",key:"render",value:function(){return o.dy` <header class="header"> <div class="header-bar"> <section class="header-navigation-icon"> <slot name="navigationIcon"></slot> </section> <section class="header-content"> <div class="header-title"> <slot name="title"></slot> </div> <div class="header-subtitle"> <slot name="subtitle"></slot> </div> </section> <section class="header-action-items"> <slot name="actionItems"></slot> </section> </div> <slot></slot> </header> `}},{kind:"get",static:!0,key:"styles",value:function(){return[o.iv`:host{display:block}:host([show-border]){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.header-bar{display:flex;flex-direction:row;align-items:flex-start;padding:4px;box-sizing:border-box}.header-content{flex:1;padding:10px 4px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.header-title{font-size:22px;line-height:28px;font-weight:400}.header-subtitle{font-size:14px;line-height:20px;color:var(--secondary-text-color)}@media all and (min-width:450px) and (min-height:500px){.header-bar{padding:12px}}.header-navigation-icon{flex:none;min-width:8px;height:100%;display:flex;flex-direction:row}.header-action-items{flex:none;min-width:8px;height:100%;display:flex;flex-direction:row}`]}}]}}),o.oi)},53013:function(e,t,n){var i=n(44249),o=n(72621),a=(n(9359),n(56475),n(70104),n(48136),n(57243)),r=n(15093),s=n(94886),l=n.n(s),d=n(36522),c=(n(75656),n(50100),n(18084),n(75351));let h;const u=new(n(80262).L)(1e3),p={reType:/(?<input>(\[!(?<type>caution|important|note|tip|warning)\])(?:\s|\\n)?)/i,typeToHaAlert:{caution:"error",important:"info",note:"info",tip:"success",warning:"warning"}};(0,i.Z)([(0,r.Mo)("ha-markdown-element")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,r.Cb)()],key:"content",value:void 0},{kind:"field",decorators:[(0,r.Cb)({attribute:"allow-svg",type:Boolean})],key:"allowSvg",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"breaks",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean,attribute:"lazy-images"})],key:"lazyImages",value:()=>!1},{kind:"field",decorators:[(0,r.Cb)({type:Boolean})],key:"cache",value:()=>!1},{kind:"method",key:"disconnectedCallback",value:function(){if((0,o.Z)(i,"disconnectedCallback",this,3)([]),this.cache){const e=this._computeCacheKey();u.set(e,this.innerHTML)}}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"update",value:function(e){(0,o.Z)(i,"update",this,3)([e]),void 0!==this.content&&this._render()}},{kind:"method",key:"willUpdate",value:function(e){if(!this.innerHTML&&this.cache){const e=this._computeCacheKey();u.has(e)&&(this.innerHTML=u.get(e),this._resize())}}},{kind:"method",key:"_computeCacheKey",value:function(){return l()({content:this.content,allowSvg:this.allowSvg,breaks:this.breaks})}},{kind:"method",key:"_render",value:async function(){this.innerHTML=await(async(e,t,i)=>(h||(h=(0,c.Ud)(new Worker(new URL(n.p+n.u("45845"),n.b)))),h.renderMarkdown(e,t,i)))(String(this.content),{breaks:this.breaks,gfm:!0},{allowSvg:this.allowSvg}),this._resize();const e=document.createTreeWalker(this,NodeFilter.SHOW_ELEMENT,null);for(;e.nextNode();){const t=e.currentNode;if(t instanceof HTMLAnchorElement&&t.host!==document.location.host)t.target="_blank",t.rel="noreferrer noopener";else if(t instanceof HTMLImageElement)this.lazyImages&&(t.loading="lazy"),t.addEventListener("load",this._resize);else if(t instanceof HTMLQuoteElement){const n=t.firstElementChild?.firstChild?.textContent&&p.reType.exec(t.firstElementChild.firstChild.textContent);if(n){const{type:i}=n.groups,o=document.createElement("ha-alert");o.alertType=p.typeToHaAlert[i.toLowerCase()],o.append(...Array.from(t.childNodes).map((e=>{const t=Array.from(e.childNodes);if(!this.breaks&&t.length){const e=t[0];e.nodeType===Node.TEXT_NODE&&e.textContent===n.input&&e.textContent?.includes("\n")&&(e.textContent=e.textContent.split("\n").slice(1).join("\n"))}return t})).reduce(((e,t)=>e.concat(t)),[]).filter((e=>e.textContent&&e.textContent!==n.input))),e.parentNode().replaceChild(o,t)}}else t instanceof HTMLElement&&["ha-alert","ha-qr-code","ha-icon","ha-svg-icon"].includes(t.localName)&&n(23265)(`./${t.localName}`)}}},{kind:"field",key:"_resize",value(){return()=>(0,d.B)(this,"content-resize")}}]}}),a.fl)},51784:function(e,t,n){n.d(t,{dJ:()=>u,zB:()=>p});var i=n(44249),o=n(72621),a=n(67840),r=n(88854),s=n(57243),l=n(15093);let d;a.A.addInitializer((async e=>{await e.updateComplete;const t=e;t.dialog.prepend(t.scrim),t.scrim.style.inset=0,t.scrim.style.zIndex=0;const{getOpenAnimation:n,getCloseAnimation:i}=t;t.getOpenAnimation=()=>{const e=n.call(void 0);return e.container=[...e.container??[],...e.dialog??[]],e.dialog=[],e},t.getCloseAnimation=()=>{const e=i.call(void 0);return e.container=[...e.container??[],...e.dialog??[]],e.dialog=[],e}}));(0,i.Z)([(0,l.Mo)("ha-md-dialog")],(function(e,t){class i extends t{constructor(){super(),e(this),this.addEventListener("cancel",this._handleCancel),"function"!=typeof HTMLDialogElement&&(this.addEventListener("open",this._handleOpen),d||(d=n.e("73854").then(n.bind(n,85893)))),void 0===this.animate&&(this.quick=!0),void 0===this.animate&&(this.quick=!0)}}return{F:i,d:[{kind:"field",decorators:[(0,l.Cb)({attribute:"disable-cancel-action",type:Boolean})],key:"disableCancelAction",value:()=>!1},{kind:"field",key:"_polyfillDialogRegistered",value:()=>!1},{kind:"method",key:"_handleOpen",value:async function(e){if(e.preventDefault(),this._polyfillDialogRegistered)return;this._polyfillDialogRegistered=!0,this._loadPolyfillStylesheet("/static/polyfills/dialog-polyfill.css");const t=this.shadowRoot?.querySelector("dialog");(await d).default.registerDialog(t),this.removeEventListener("open",this._handleOpen),this.show()}},{kind:"method",key:"_loadPolyfillStylesheet",value:async function(e){const t=document.createElement("link");return t.rel="stylesheet",t.href=e,new Promise(((n,i)=>{t.onload=()=>n(),t.onerror=()=>i(new Error(`Stylesheet failed to load: ${e}`)),this.shadowRoot?.appendChild(t)}))}},{kind:"method",key:"_handleCancel",value:function(e){if(this.disableCancelAction){e.preventDefault();const t=this.shadowRoot?.querySelector("dialog .container");void 0!==this.animate&&t?.animate([{transform:"rotate(-1deg)","animation-timing-function":"ease-in"},{transform:"rotate(1.5deg)","animation-timing-function":"ease-out"},{transform:"rotate(0deg)","animation-timing-function":"ease-in"}],{duration:200,iterations:2})}}},{kind:"field",static:!0,key:"styles",value(){return[...(0,o.Z)(i,"styles",this),s.iv`:host{--md-dialog-container-color:var(--card-background-color);--md-dialog-headline-color:var(--primary-text-color);--md-dialog-supporting-text-color:var(--primary-text-color);--md-sys-color-scrim:#000000;--md-dialog-headline-weight:400;--md-dialog-headline-size:1.574rem;--md-dialog-supporting-text-size:1rem;--md-dialog-supporting-text-line-height:1.5rem}:host([type=alert]){min-width:320px}@media all and (max-width:450px),all and (max-height:500px){:host(:not([type=alert])){min-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));max-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));min-height:100%;max-height:100%;--md-dialog-container-shape:0}}::slotted(ha-dialog-header[slot=headline]){display:contents}.scroller{overflow:var(--dialog-content-overflow,auto)}slot[name=content]::slotted(*){padding:var(--dialog-content-padding,24px)}.scrim{z-index:10}`]}}]}}),a.A);const c={...r.I,dialog:[[[{transform:"translateY(50px)"},{transform:"translateY(0)"}],{duration:500,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:0},{opacity:1}],{duration:50,easing:"linear",pseudoElement:"::before"}]]},h={...r.G,dialog:[[[{transform:"translateY(0)"},{transform:"translateY(50px)"}],{duration:150,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:"1"},{opacity:"0"}],{delay:100,duration:50,easing:"linear",pseudoElement:"::before"}]]},u=()=>window.matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches?c:r.I,p=()=>window.matchMedia("all and (max-width: 450px), all and (max-height: 500px)").matches?h:r.G},40917:function(e,t,n){var i=n(44249),o=n(72621),a=n(27323),r=n(33990),s=n(88540),l=n(57243),d=n(15093);(0,i.Z)([(0,d.Mo)("ha-textarea")],(function(e,t){class n extends t{constructor(...t){super(...t),e(this)}}return{F:n,d:[{kind:"field",decorators:[(0,d.Cb)({type:Boolean,reflect:!0})],key:"autogrow",value:()=>!1},{kind:"method",key:"updated",value:function(e){(0,o.Z)(n,"updated",this,3)([e]),this.autogrow&&e.has("value")&&(this.mdcRoot.dataset.value=this.value+'=​"')}},{kind:"field",static:!0,key:"styles",value:()=>[r.W,s.W,l.iv`:host([autogrow]) .mdc-text-field{position:relative;min-height:74px;min-width:178px;max-height:200px}:host([autogrow]) .mdc-text-field:after{content:attr(data-value);margin-top:23px;margin-bottom:9px;line-height:1.5rem;min-height:42px;padding:0px 32px 0 16px;letter-spacing:var( --mdc-typography-subtitle1-letter-spacing, .009375em );visibility:hidden;white-space:pre-wrap}:host([autogrow]) .mdc-text-field__input{position:absolute;height:calc(100% - 32px)}:host([autogrow]) .mdc-text-field.mdc-text-field--no-label:after{margin-top:16px;margin-bottom:16px}.mdc-floating-label{inset-inline-start:16px!important;inset-inline-end:initial!important;transform-origin:var(--float-start) top}@media only screen and (min-width:459px){:host([mobile-multiline]) .mdc-text-field__input{white-space:nowrap;max-height:16px}}`]}]}}),a.O)},64028:function(e,t,n){n.a(e,(async function(e,i){try{n.r(t),n.d(t,{DialogSupportPackage:()=>p});var o=n(44249),a=(n(31622),n(87319),n(57243)),r=n(15093),s=n(36522),l=(n(99426),n(59826),n(17170)),d=(n(95198),n(53013),n(51784),n(92824),n(40917),n(94616)),c=n(58014),h=e([l]);l=(h.then?(await h)():h)[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";let p=(0,o.Z)([(0,r.Mo)("dialog-cloud-support-package")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,r.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.SB)()],key:"_open",value:()=>!1},{kind:"field",decorators:[(0,r.SB)()],key:"_supportPackage",value:void 0},{kind:"field",decorators:[(0,r.IO)("ha-md-dialog")],key:"_dialog",value:void 0},{kind:"method",key:"showDialog",value:function(){this._open=!0,this._loadSupportPackage()}},{kind:"method",key:"_dialogClosed",value:function(){this._open=!1,this._supportPackage=void 0,(0,s.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"method",key:"closeDialog",value:function(){return this._dialog?.close(),!0}},{kind:"method",key:"render",value:function(){return this._open?a.dy` <ha-md-dialog open @closed="${this._dialogClosed}"> <ha-dialog-header slot="headline"> <ha-icon-button slot="navigationIcon" .label="${this.hass.localize("ui.common.close")}" .path="${u}" @click="${this.closeDialog}"></ha-icon-button> <span slot="title">Download support package</span> </ha-dialog-header> <div slot="content"> ${this._supportPackage?a.dy`<ha-markdown-element .content="${this._supportPackage}" breaks></ha-markdown-element>`:a.dy` <div class="progress-container"> <ha-spinner></ha-spinner> Generating preview... </div> `} </div> <div class="footer" slot="actions"> <ha-alert> This file may contain personal data about your home. Avoid sharing them with unverified or untrusted parties. </ha-alert> <hr> <div class="actions"> <ha-button @click="${this.closeDialog}">Close</ha-button> <ha-button @click="${this._download}">Download</ha-button> </div> </div> </ha-md-dialog> `:a.Ld}},{kind:"method",key:"_loadSupportPackage",value:async function(){this._supportPackage=await(0,d.AC)(this.hass)}},{kind:"method",key:"_download",value:async function(){(0,c.N)("data:text/plain;charset=utf-8,"+encodeURIComponent(this._supportPackage||""),"support-package.md")}},{kind:"field",static:!0,key:"styles",value:()=>a.iv`ha-md-dialog{min-width:90vw;min-height:90vh}.progress-container{display:flex;flex-direction:column;align-items:center;justify-content:center;height:calc(90vh - 260px);width:100%}@media all and (max-width:450px),all and (max-height:500px){ha-md-dialog{min-width:100vw;min-height:100vh}.progress-container{height:calc(100vh - 260px)}}.footer{flex-direction:column}.actions{display:flex;gap:8px;justify-content:flex-end}hr{border:none;border-top:1px solid var(--divider-color);width:calc(100% + 48px);margin-right:-24px;margin-left:-24px}table,td,th{border:none}table{width:100%;display:table;border-collapse:collapse;border-spacing:0}table tr{border-bottom:none}table>tbody>tr:nth-child(odd){background-color:rgba(var(--rgb-primary-text-color),.04)}table>tbody>tr>td{border-radius:0}table>tbody>tr{-webkit-transition:background-color .25s ease;transition:background-color .25s ease}table>tbody>tr:hover{background-color:rgba(var(--rgb-primary-text-color),.08)}tr{border-bottom:1px solid var(--divider-color)}td,th{padding:15px 5px;display:table-cell;text-align:left;vertical-align:middle;border-radius:2px}details{background-color:var(--secondary-background-color);padding:16px 24px;margin:8px 0;border:1px solid var(--divider-color);border-radius:16px}summary{font-weight:700;cursor:pointer}`}]}}),a.oi);i()}catch(e){i(e)}}))},80262:function(e,t,n){n.d(t,{L:()=>i});class i{constructor(e){this._expiration=void 0,this._cache=new Map,this._expiration=e}get(e){return this._cache.get(e)}set(e,t){this._cache.set(e,t),this._expiration&&window.setTimeout((()=>this._cache.delete(e)),this._expiration)}has(e){return this._cache.has(e)}}},58014:function(e,t,n){n.d(t,{N:()=>o,G:()=>a});var i=n(18117);const o=(e,t="")=>{const n=document.createElement("a");n.target="_blank",n.href=e,n.download=t,n.style.display="none",document.body.appendChild(n),n.dispatchEvent(new MouseEvent("click")),document.body.removeChild(n)},a=e=>!(e=>!!e.auth.external&&i.G)(e)||!!e.auth.external?.config.downloadFileSupported},18117:function(e,t,n){n.d(t,{G:()=>i});const i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},23265:function(e,t,n){var i={"./ha-icon":["65981","97406"],"./ha-icon-button-toggle":["79505","80175"],"./ha-svg-icon":["37583"],"./ha-icon-button-group":["45747","97792"],"./ha-svg-icon.ts":["37583"],"./ha-icon.ts":["65981","97406"],"./ha-icon-overflow-menu":["59959","91552","78456","56898","99287","35252"],"./ha-icon-next":["13928","99172"],"./ha-icon-picker":["21393","46379","66031","24199","27506","97077"],"./ha-qr-code.ts":["50634","53750","70472"],"./ha-icon-button-arrow-prev.ts":["54202","41069"],"./ha-icon-button-arrow-prev":["54202","41069"],"./ha-icon-overflow-menu.ts":["59959","91552","78456","56898","99287","35252"],"./ha-alert":["99426","4809"],"./ha-icon-button-next":["4635","51577"],"./ha-icon-button":["23334"],"./ha-icon-button-next.ts":["4635","51577"],"./ha-icon-picker.ts":["21393","46379","66031","24199","27506","97077"],"./ha-icon-button-group.ts":["45747","97792"],"./ha-icon-button-toggle.ts":["79505","80175"],"./ha-icon-button-arrow-next.ts":["54237","21559"],"./ha-icon-button-prev.ts":["5828","43537"],"./ha-icon-prev":["95499","87557"],"./ha-icon-prev.ts":["95499","87557"],"./ha-icon-button.ts":["23334"],"./ha-alert.ts":["99426","4809"],"./ha-icon-button-prev":["5828","43537"],"./ha-qr-code":["50634","53750","70472"],"./ha-icon-next.ts":["13928","99172"],"./ha-icon-button-arrow-next":["54237","21559"]};function o(e){if(!n.o(i,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=i[e],o=t[0];return Promise.all(t.slice(1).map(n.e)).then((function(){return n(o)}))}o.keys=()=>Object.keys(i),o.id=23265,e.exports=o},1231:function(e,t,n){n.d(t,{B:()=>l});var i=n(9065),o=n(15093),a=n(57243);class r extends a.oi{constructor(){super(...arguments),this.inset=!1,this.insetStart=!1,this.insetEnd=!1}}(0,i.__decorate)([(0,o.Cb)({type:Boolean,reflect:!0})],r.prototype,"inset",void 0),(0,i.__decorate)([(0,o.Cb)({type:Boolean,reflect:!0,attribute:"inset-start"})],r.prototype,"insetStart",void 0),(0,i.__decorate)([(0,o.Cb)({type:Boolean,reflect:!0,attribute:"inset-end"})],r.prototype,"insetEnd",void 0);const s=a.iv`:host{box-sizing:border-box;color:var(--md-divider-color,var(--md-sys-color-outline-variant,#cac4d0));display:flex;height:var(--md-divider-thickness,1px);width:100%}:host([inset-start]),:host([inset]){padding-inline-start:16px}:host([inset-end]),:host([inset]){padding-inline-end:16px}:host::before{background:currentColor;content:"";height:100%;width:100%}@media(forced-colors:active){:host::before{background:CanvasText}}`;let l=class extends r{};l.styles=[s],l=(0,i.__decorate)([(0,o.Mo)("md-divider")],l)},75351:function(e,t,n){n.d(t,{Ud:()=>u});n(9359),n(70104),n(48136);const i=Symbol("Comlink.proxy"),o=Symbol("Comlink.endpoint"),a=Symbol("Comlink.releaseProxy"),r=Symbol("Comlink.finalizer"),s=Symbol("Comlink.thrown"),l=e=>"object"==typeof e&&null!==e||"function"==typeof e,d=new Map([["proxy",{canHandle:e=>l(e)&&e[i],serialize(e){const{port1:t,port2:n}=new MessageChannel;return c(e,t),[n,[n]]},deserialize:e=>(e.start(),u(e))}],["throw",{canHandle:e=>l(e)&&s 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 c(e,t=globalThis,n=["*"]){t.addEventListener("message",(function o(a){if(!a||!a.data)return;if(!function(e,t){for(const n of e){if(t===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}return!1}(n,a.origin))return void console.warn(`Invalid origin '${a.origin}' for comlink proxy`);const{id:l,type:d,path:u}=Object.assign({path:[]},a.data),p=(a.data.argumentList||[]).map(k);let m;try{const t=u.slice(0,-1).reduce(((e,t)=>e[t]),e),n=u.reduce(((e,t)=>e[t]),e);switch(d){case"GET":m=n;break;case"SET":t[u.slice(-1)[0]]=k(a.data.value),m=!0;break;case"APPLY":m=n.apply(t,p);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[i]:!0})}(new n(...p));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;c(e,n),m=function(e,t){return b.set(e,t),e}(t,[t])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[s]:0}}Promise.resolve(m).catch((e=>({value:e,[s]:0}))).then((n=>{const[i,a]=x(n);t.postMessage(Object.assign(Object.assign({},i),{id:l}),a),"RELEASE"===d&&(t.removeEventListener("message",o),h(t),r in e&&"function"==typeof e[r]&&e[r]())})).catch((e=>{const[n,i]=x({value:new TypeError("Unserializable return value"),[s]:0});t.postMessage(Object.assign(Object.assign({},n),{id:l}),i)}))})),t.start&&t.start()}function h(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e,t){const n=new Map;return e.addEventListener("message",(function(e){const{data:t}=e;if(!t||!t.id)return;const i=n.get(t.id);if(i)try{i(t)}finally{n.delete(t.id)}})),v(e,n,[],t)}function p(e){if(e)throw new Error("Proxy has been released and is not useable")}function m(e){return w(e,new Map,{type:"RELEASE"}).then((()=>{h(e)}))}const g=new WeakMap,f="FinalizationRegistry"in globalThis&&new FinalizationRegistry((e=>{const t=(g.get(e)||0)-1;g.set(e,t),0===t&&m(e)}));function v(e,t,n=[],i=function(){}){let r=!1;const s=new Proxy(i,{get(i,o){if(p(r),o===a)return()=>{!function(e){f&&f.unregister(e)}(s),m(e),t.clear(),r=!0};if("then"===o){if(0===n.length)return{then:()=>s};const i=w(e,t,{type:"GET",path:n.map((e=>e.toString()))}).then(k);return i.then.bind(i)}return v(e,t,[...n,o])},set(i,o,a){p(r);const[s,l]=x(a);return w(e,t,{type:"SET",path:[...n,o].map((e=>e.toString())),value:s},l).then(k)},apply(i,a,s){p(r);const l=n[n.length-1];if(l===o)return w(e,t,{type:"ENDPOINT"}).then(k);if("bind"===l)return v(e,t,n.slice(0,-1));const[d,c]=y(s);return w(e,t,{type:"APPLY",path:n.map((e=>e.toString())),argumentList:d},c).then(k)},construct(i,o){p(r);const[a,s]=y(o);return w(e,t,{type:"CONSTRUCT",path:n.map((e=>e.toString())),argumentList:a},s).then(k)}});return function(e,t){const n=(g.get(t)||0)+1;g.set(t,n),f&&f.register(e,t,e)}(s,e),s}function y(e){const t=e.map(x);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const b=new WeakMap;function x(e){for(const[t,n]of d)if(n.canHandle(e)){const[i,o]=n.serialize(e);return[{type:"HANDLER",name:t,value:i},o]}return[{type:"RAW",value:e},b.get(e)||[]]}function k(e){switch(e.type){case"HANDLER":return d.get(e.name).deserialize(e.value);case"RAW":return e.value}}function w(e,t,n,i){return new Promise((o=>{const a=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");t.set(a,o),e.start&&e.start(),e.postMessage(Object.assign({id:a},n),i)}))}}}; //# sourceMappingURL=69353.8d261f2e6d800146.js.map