@combeenation/custom-code-sdk 0.0.1-alpha5 → 0.0.1-alpha6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs.js +1 -1
- package/dist/bundle.es.js +1 -1
- package/dist/index.d.ts +110 -8
- package/package.json +1 -1
package/dist/bundle.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var j_=Object.defineProperty;var cg=t=>{throw TypeError(t)};var L_=(t,e,n)=>e in t?j_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ar=(t,e,n)=>L_(t,typeof e!="symbol"?e+"":e,n),ug=(t,e,n)=>e.has(t)||cg("Cannot "+n);var xe=(t,e,n)=>(ug(t,e,"read from private field"),n?n.call(t):e.get(t)),wt=(t,e,n)=>e.has(t)?cg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),cr=(t,e,n,r)=>(ug(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("zod"),wm="0.0.1-alpha5";var Sl,gr;class W_{constructor(e){ar(this,"id");wt(this,Sl,"v1");wt(this,gr);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Sl));if(cr(this,gr,n==null?void 0:n.getButtonSdkBridge(this.id)),!xe(this,gr))throw new Error(`Cannot access API for Button "${this.id}".`)}onRendered(e){var n;return((n=xe(this,gr))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}onClick(e){var n;return((n=xe(this,gr))==null?void 0:n.addOnClickCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,gr))==null?void 0:n.setVisible(e))}setText(e){var n;(n=xe(this,gr))==null||n.setText(e)}}Sl=new WeakMap,gr=new WeakMap;var Il,Bi;class V_{constructor(e){ar(this,"id");wt(this,Il,"v1");wt(this,Bi);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Il));if(cr(this,Bi,n==null?void 0:n.getCheckboxSdkBridge(this.id)),!xe(this,Bi))throw new Error(`Cannot access API for Checkbox "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Bi))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Bi))==null?void 0:n.setVisible(e))}}Il=new WeakMap,Bi=new WeakMap;var kl,Ki;class q_{constructor(e){ar(this,"id");wt(this,kl,"v1");wt(this,Ki);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,kl));if(cr(this,Ki,n==null?void 0:n.getCollapsibleSdkBridge(this.id)),!xe(this,Ki))throw new Error(`Cannot access API for Collapsible "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Ki))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Ki))==null?void 0:n.setVisible(e))}}kl=new WeakMap,Ki=new WeakMap;var Tl,vr;class H_{constructor(e){ar(this,"id");wt(this,Tl,"v1");wt(this,vr);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Tl));if(cr(this,vr,n==null?void 0:n.getCustomCtrlSdkBridge(this.id)),!xe(this,vr))throw new Error(`Cannot access API for Custom Control "${this.id}".`)}set renderFn(e){var n;(n=xe(this,vr))==null||n.setRenderFn(e)}async render(e){var n;typeof e=="function"&&(this.renderFn=e),await((n=xe(this,vr))==null?void 0:n.render())}getElement(){var n;return(n=xe(this,vr))==null?void 0:n.getElement()}async setVisible(e){var n;await((n=xe(this,vr))==null?void 0:n.setVisible(e))}}Tl=new WeakMap,vr=new WeakMap;var El,Xi;class B_{constructor(e){ar(this,"id");wt(this,El,"v1");wt(this,Xi);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,El));if(cr(this,Xi,n==null?void 0:n.getDataviewSdkBridge(this.id)),!xe(this,Xi))throw new Error(`Cannot access API for Dataview "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Xi))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Xi))==null?void 0:n.setVisible(e))}}El=new WeakMap,Xi=new WeakMap;var xl,Gi;class K_{constructor(e){ar(this,"id");wt(this,xl,"v1");wt(this,Gi);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,xl));if(cr(this,Gi,n==null?void 0:n.getInputSdkBridge(this.id)),!xe(this,Gi))throw new Error(`Cannot access API for Input "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Gi))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Gi))==null?void 0:n.setVisible(e))}}xl=new WeakMap,Gi=new WeakMap;var Pl,Ji;class X_{constructor(e){ar(this,"id");wt(this,Pl,"v1");wt(this,Ji);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Pl));if(cr(this,Ji,n==null?void 0:n.getPanelSdkBridge(this.id)),!xe(this,Ji))throw new Error(`Cannot access API for Panel "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Ji))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Ji))==null?void 0:n.setVisible(e))}}Pl=new WeakMap,Ji=new WeakMap;var Dl,ei;class G_{constructor(e){ar(this,"id");wt(this,Dl,"v1");wt(this,ei);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Dl));if(cr(this,ei,n==null?void 0:n.getTextSdkBridge(this.id)),!xe(this,ei))throw new Error(`Cannot access API for Text "${this.id}".`)}onRendered(e){var n;return((n=xe(this,ei))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,ei))==null?void 0:n.setVisible(e))}setText(e){var n;(n=xe(this,ei))==null||n.setText(e)}}Dl=new WeakMap,ei=new WeakMap;const Tu=[];function Sm(t,e){if(Tu.length>=1)throw new Error("Only 1 `ConfiguratorClient` can be created at a time.");Tu.push({client:t,internals:e})}function lg(){const t=Tu[0];if(!t)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return t.client}function Yc(){const t=Tu[0];if(!t)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return t.internals}function J_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nf={exports:{}},fg;function Q_(){return fg||(fg=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function o(c,u,l,f,m){if(typeof l!="function")throw new TypeError("The listener must be a function");var d=new i(l,f||c,m),h=n?n+u:u;return c._events[h]?c._events[h].fn?c._events[h]=[c._events[h],d]:c._events[h].push(d):(c._events[h]=d,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,f;if(this._eventsCount===0)return u;for(f in l=this._events)e.call(l,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=n?n+u:u,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,d=f.length,h=new Array(d);m<d;m++)h[m]=f[m].fn;return h},a.prototype.listenerCount=function(u){var l=n?n+u:u,f=this._events[l];return f?f.fn?1:f.length:0},a.prototype.emit=function(u,l,f,m,d,h){var g=n?n+u:u;if(!this._events[g])return!1;var p=this._events[g],v=arguments.length,_,P;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),v){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,l),!0;case 3:return p.fn.call(p.context,l,f),!0;case 4:return p.fn.call(p.context,l,f,m),!0;case 5:return p.fn.call(p.context,l,f,m,d),!0;case 6:return p.fn.call(p.context,l,f,m,d,h),!0}for(P=1,_=new Array(v-1);P<v;P++)_[P-1]=arguments[P];p.fn.apply(p.context,_)}else{var x=p.length,R;for(P=0;P<x;P++)switch(p[P].once&&this.removeListener(u,p[P].fn,void 0,!0),v){case 1:p[P].fn.call(p[P].context);break;case 2:p[P].fn.call(p[P].context,l);break;case 3:p[P].fn.call(p[P].context,l,f);break;case 4:p[P].fn.call(p[P].context,l,f,m);break;default:if(!_)for(R=1,_=new Array(v-1);R<v;R++)_[R-1]=arguments[R];p[P].fn.apply(p[P].context,_)}}return!0},a.prototype.on=function(u,l,f){return o(this,u,l,f,!1)},a.prototype.once=function(u,l,f){return o(this,u,l,f,!0)},a.prototype.removeListener=function(u,l,f,m){var d=n?n+u:u;if(!this._events[d])return this;if(!l)return s(this,d),this;var h=this._events[d];if(h.fn)h.fn===l&&(!m||h.once)&&(!f||h.context===f)&&s(this,d);else{for(var g=0,p=[],v=h.length;g<v;g++)(h[g].fn!==l||m&&!h[g].once||f&&h[g].context!==f)&&p.push(h[g]);p.length?this._events[d]=p.length===1?p[0]:p:s(this,d)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=n?n+u:u,this._events[l]&&s(this,l)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a})(nf)),nf.exports}var Z_=Q_();const Rl=J_(Z_);class Qi extends Error{constructor(e,n){const r=new.target.prototype;super(`${e}: Status code '${n}'`),this.statusCode=n,this.__proto__=r}}class cp extends Error{constructor(e="A timeout occurred."){const n=new.target.prototype;super(e),this.__proto__=n}}class Pn extends Error{constructor(e="An abort occurred."){const n=new.target.prototype;super(e),this.__proto__=n}}class Y_ extends Error{constructor(e,n){const r=new.target.prototype;super(e),this.transport=n,this.errorType="UnsupportedTransportError",this.__proto__=r}}class e0 extends Error{constructor(e,n){const r=new.target.prototype;super(e),this.transport=n,this.errorType="DisabledTransportError",this.__proto__=r}}class t0 extends Error{constructor(e,n){const r=new.target.prototype;super(e),this.transport=n,this.errorType="FailedToStartTransportError",this.__proto__=r}}class dg extends Error{constructor(e){const n=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=n}}class n0 extends Error{constructor(e,n){const r=new.target.prototype;super(e),this.innerErrors=n,this.__proto__=r}}class Im{constructor(e,n,r){this.statusCode=e,this.statusText=n,this.content=r}}class Al{get(e,n){return this.send({...n,method:"GET",url:e})}post(e,n){return this.send({...n,method:"POST",url:e})}delete(e,n){return this.send({...n,method:"DELETE",url:e})}getCookieString(e){return""}}var N;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Information=2]="Information",t[t.Warning=3]="Warning",t[t.Error=4]="Error",t[t.Critical=5]="Critical",t[t.None=6]="None"})(N||(N={}));class Va{constructor(){}log(e,n){}}Va.instance=new Va;const r0="10.0.0";class ht{static isRequired(e,n){if(e==null)throw new Error(`The '${n}' argument is required.`)}static isNotEmpty(e,n){if(!e||e.match(/^\s*$/))throw new Error(`The '${n}' argument should not be empty.`)}static isIn(e,n,r){if(!(e in n))throw new Error(`Unknown ${r} value: ${e}.`)}}class rt{static get isBrowser(){return!rt.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!rt.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!rt.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function qa(t,e){let n="";return uo(t)?(n=`Binary data of length ${t.byteLength}`,e&&(n+=`. Content: '${i0(t)}'`)):typeof t=="string"&&(n=`String data of length ${t.length}`,e&&(n+=`. Content: '${t}'`)),n}function i0(t){const e=new Uint8Array(t);let n="";return e.forEach(r=>{const i=r<16?"0":"";n+=`0x${i}${r.toString(16)} `}),n.substring(0,n.length-1)}function uo(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}async function km(t,e,n,r,i,o){const s={},[a,c]=Ms();s[a]=c,t.log(N.Trace,`(${e} transport) sending data. ${qa(i,o.logMessageContent)}.`);const u=uo(i)?"arraybuffer":"text",l=await n.post(r,{content:i,headers:{...s,...o.headers},responseType:u,timeout:o.timeout,withCredentials:o.withCredentials});t.log(N.Trace,`(${e} transport) request complete. Response status: ${l.statusCode}.`)}function o0(t){return t===void 0?new Eu(N.Information):t===null?Va.instance:t.log!==void 0?t:new Eu(t)}class s0{constructor(e,n){this._subject=e,this._observer=n}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(n=>{})}}class Eu{constructor(e){this._minLevel=e,this.out=console}log(e,n){if(e>=this._minLevel){const r=`[${new Date().toISOString()}] ${N[e]}: ${n}`;switch(e){case N.Critical:case N.Error:this.out.error(r);break;case N.Warning:this.out.warn(r);break;case N.Information:this.out.info(r);break;default:this.out.log(r);break}}}}function Ms(){let t="X-SignalR-User-Agent";return rt.isNode&&(t="User-Agent"),[t,a0(r0,c0(),l0(),u0())]}function a0(t,e,n,r){let i="Microsoft SignalR/";const o=t.split(".");return i+=`${o[0]}.${o[1]}`,i+=` (${t}; `,e&&e!==""?i+=`${e}; `:i+="Unknown OS; ",i+=`${n}`,r?i+=`; ${r}`:i+="; Unknown Runtime Version",i+=")",i}function c0(){if(rt.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function u0(){if(rt.isNode)return process.versions.node}function l0(){return rt.isNode?"NodeJS":"Browser"}function rf(t){return t.stack?t.stack:t.message?t.message:`${t}`}function f0(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class d0 extends Al{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||rt.isNode){const n=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(n("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=n("node-fetch"):this._fetchType=fetch,this._fetchType=n("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(f0());if(typeof AbortController>"u"){const n=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=n("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new Pn;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const n=new this._abortControllerType;let r;e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),r=new Pn});let i=null;if(e.timeout){const c=e.timeout;i=setTimeout(()=>{n.abort(),this._logger.log(N.Warning,"Timeout from HTTP request."),r=new cp},c)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},uo(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:n.signal})}catch(c){throw r||(this._logger.log(N.Warning,`Error from HTTP request. ${c}.`),c)}finally{i&&clearTimeout(i),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const c=await hg(o,"text");throw new Qi(c||o.statusText,o.status)}const a=await hg(o,e.responseType);return new Im(o.status,o.statusText,a)}getCookieString(e){let n="";return rt.isNode&&this._jar&&this._jar.getCookies(e,(r,i)=>n=i.join("; ")),n}}function hg(t,e){let n;switch(e){case"arraybuffer":n=t.arrayBuffer();break;case"text":n=t.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:n=t.text();break}return n}class h0 extends Al{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Pn):e.method?e.url?new Promise((n,r)=>{const i=new XMLHttpRequest;i.open(e.method,e.url,!0),i.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,i.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(uo(e.content)?i.setRequestHeader("Content-Type","application/octet-stream"):i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach(s=>{i.setRequestHeader(s,o[s])}),e.responseType&&(i.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{i.abort(),r(new Pn)}),e.timeout&&(i.timeout=e.timeout),i.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),i.status>=200&&i.status<300?n(new Im(i.status,i.statusText,i.response||i.responseText)):r(new Qi(i.response||i.responseText||i.statusText,i.status))},i.onerror=()=>{this._logger.log(N.Warning,`Error from HTTP request. ${i.status}: ${i.statusText}.`),r(new Qi(i.statusText,i.status))},i.ontimeout=()=>{this._logger.log(N.Warning,"Timeout from HTTP request."),r(new cp)},i.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class p0 extends Al{constructor(e){if(super(),typeof fetch<"u"||rt.isNode)this._httpClient=new d0(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new h0(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Pn):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class rn{static write(e){return`${e}${rn.RecordSeparator}`}static parse(e){if(e[e.length-1]!==rn.RecordSeparator)throw new Error("Message is incomplete.");const n=e.split(rn.RecordSeparator);return n.pop(),n}}rn.RecordSeparatorCode=30;rn.RecordSeparator=String.fromCharCode(rn.RecordSeparatorCode);class g0{writeHandshakeRequest(e){return rn.write(JSON.stringify(e))}parseHandshakeResponse(e){let n,r;if(uo(e)){const a=new Uint8Array(e),c=a.indexOf(rn.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const u=c+1;n=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),r=a.byteLength>u?a.slice(u).buffer:null}else{const a=e,c=a.indexOf(rn.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const u=c+1;n=a.substring(0,u),r=a.length>u?a.substring(u):null}const i=rn.parse(n),o=JSON.parse(i[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[r,o]}}var Se;(function(t){t[t.Invocation=1]="Invocation",t[t.StreamItem=2]="StreamItem",t[t.Completion=3]="Completion",t[t.StreamInvocation=4]="StreamInvocation",t[t.CancelInvocation=5]="CancelInvocation",t[t.Ping=6]="Ping",t[t.Close=7]="Close",t[t.Ack=8]="Ack",t[t.Sequence=9]="Sequence"})(Se||(Se={}));class v0{constructor(){this.observers=[]}next(e){for(const n of this.observers)n.next(e)}error(e){for(const n of this.observers)n.error&&n.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new s0(this,e)}}class m0{constructor(e,n,r){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=n,this._bufferSize=r}async _send(e){const n=this._protocol.writeMessage(e);let r=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let i=()=>{},o=()=>{};uo(n)?this._bufferedByteCount+=n.byteLength:this._bufferedByteCount+=n.length,this._bufferedByteCount>=this._bufferSize&&(r=new Promise((s,a)=>{i=s,o=a})),this._messages.push(new y0(n,this._totalMessageCount,i,o))}try{this._reconnectInProgress||await this._connection.send(n)}catch{this._disconnected()}await r}_ack(e){let n=-1;for(let r=0;r<this._messages.length;r++){const i=this._messages[r];if(i._id<=e.sequenceId)n=r,uo(i._message)?this._bufferedByteCount-=i._message.byteLength:this._bufferedByteCount-=i._message.length,i._resolver();else if(this._bufferedByteCount<this._bufferSize)i._resolver();else break}n!==-1&&(this._messages=this._messages.slice(n+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==Se.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const n=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,n<=this._latestReceivedSequenceId?(n===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=n,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:Se.Sequence,sequenceId:e}));const n=this._messages;for(const r of n)await this._connection.send(r._message);this._reconnectInProgress=!1}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(const n of this._messages)n._rejector(e)}_isInvocationMessage(e){switch(e.type){case Se.Invocation:case Se.StreamItem:case Se.Completion:case Se.StreamInvocation:case Se.CancelInvocation:return!0;case Se.Close:case Se.Sequence:case Se.Ping:case Se.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:Se.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class y0{constructor(e,n,r,i){this._message=e,this._id=n,this._resolver=r,this._rejector=i}}const b0=30*1e3,_0=15*1e3,C0=1e5;var Ge;(function(t){t.Disconnected="Disconnected",t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Reconnecting="Reconnecting"})(Ge||(Ge={}));class up{static create(e,n,r,i,o,s,a){return new up(e,n,r,i,o,s,a)}constructor(e,n,r,i,o,s,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(N.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},ht.isRequired(e,"connection"),ht.isRequired(n,"logger"),ht.isRequired(r,"protocol"),this.serverTimeoutInMilliseconds=o??b0,this.keepAliveIntervalInMilliseconds=s??_0,this._statefulReconnectBufferSize=a??C0,this._logger=n,this._protocol=r,this.connection=e,this._reconnectPolicy=i,this._handshakeProtocol=new g0,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=Ge.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Se.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==Ge.Disconnected&&this._connectionState!==Ge.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==Ge.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Ge.Connecting,this._logger.log(N.Debug,"Starting HubConnection.");try{await this._startInternal(),rt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Ge.Connected,this._connectionStarted=!0,this._logger.log(N.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Ge.Disconnected,this._logger.log(N.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise((n,r)=>{this._handshakeResolver=n,this._handshakeRejecter=r});await this.connection.start(this._protocol.transferFormat);try{let n=this._protocol.version;this.connection.features.reconnect||(n=1);const r={protocol:this._protocol.name,version:n};if(this._logger.log(N.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(r)),this._logger.log(N.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new m0(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(n){throw this._logger.log(N.Debug,`Hub handshake failed with error '${n}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(n),n}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch{}}_stopInternal(e){if(this._connectionState===Ge.Disconnected)return this._logger.log(N.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Ge.Disconnecting)return this._logger.log(N.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const n=this._connectionState;return this._connectionState=Ge.Disconnecting,this._logger.log(N.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(N.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(n===Ge.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new Pn("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...n){const[r,i]=this._replaceStreamingParams(n),o=this._createStreamInvocation(e,n,i);let s;const a=new v0;return a.cancelCallback=()=>{const c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],s.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,u)=>{if(u){a.error(u);return}else c&&(c.type===Se.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},s=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(r,s),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...n){const[r,i]=this._replaceStreamingParams(n),o=this._sendWithProtocol(this._createInvocation(e,n,!0,i));return this._launchStreams(r,o),o}invoke(e,...n){const[r,i]=this._replaceStreamingParams(n),o=this._createInvocation(e,n,!1,i);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(l,f)=>{if(f){c(f);return}else l&&(l.type===Se.Completion?l.error?c(new Error(l.error)):a(l.result):c(new Error(`Unexpected message type: ${l.type}`)))};const u=this._sendWithProtocol(o).catch(l=>{c(l),delete this._callbacks[o.invocationId]});this._launchStreams(r,u)})}on(e,n){!e||!n||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(n)===-1&&this._methods[e].push(n))}off(e,n){if(!e)return;e=e.toLowerCase();const r=this._methods[e];if(r)if(n){const i=r.indexOf(n);i!==-1&&(r.splice(i,1),r.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const n=this._protocol.parseMessages(e,this._logger);for(const r of n)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(r)))switch(r.type){case Se.Invocation:this._invokeClientMethod(r).catch(i=>{this._logger.log(N.Error,`Invoke client method threw error: ${rf(i)}`)});break;case Se.StreamItem:case Se.Completion:{const i=this._callbacks[r.invocationId];if(i){r.type===Se.Completion&&delete this._callbacks[r.invocationId];try{i(r)}catch(o){this._logger.log(N.Error,`Stream callback threw error: ${rf(o)}`)}}break}case Se.Ping:break;case Se.Close:{this._logger.log(N.Information,"Close message received from server.");const i=r.error?new Error("Server returned an error on close: "+r.error):void 0;r.allowReconnect===!0?this.connection.stop(i):this._stopPromise=this._stopInternal(i);break}case Se.Ack:this._messageBuffer&&this._messageBuffer._ack(r);break;case Se.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(r);break;default:this._logger.log(N.Warning,`Invalid message type: ${r.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let n,r;try{[r,n]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(i){const o="Error parsing handshake response: "+i;this._logger.log(N.Error,o);const s=new Error(o);throw this._handshakeRejecter(s),s}if(n.error){const i="Server returned handshake error: "+n.error;this._logger.log(N.Error,i);const o=new Error(i);throw this._handshakeRejecter(o),o}else this._logger.log(N.Debug,"Server handshake complete.");return this._handshakeResolver(),r}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let e=this._nextKeepAlive-new Date().getTime();if(e<0){this._connectionState===Ge.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(e<0&&(e=0),this._pingServerHandle=setTimeout(async()=>{this._connectionState===Ge.Connected&&await this._trySendPingMessage()},e))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const n=e.target.toLowerCase(),r=this._methods[n];if(!r){this._logger.log(N.Warning,`No client method with the name '${n}' found.`),e.invocationId&&(this._logger.log(N.Warning,`No result given for '${n}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const i=r.slice(),o=!!e.invocationId;let s,a,c;for(const u of i)try{const l=s;s=await u.apply(this,e.arguments),o&&s&&l&&(this._logger.log(N.Error,`Multiple results provided for '${n}'. Sending error to server.`),c=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(l){a=l,this._logger.log(N.Error,`A callback for the method '${n}' threw error '${l}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(e.invocationId,`${a}`,null):s!==void 0?c=this._createCompletionMessage(e.invocationId,null,s):(this._logger.log(N.Warning,`No result given for '${n}' method and invocation ID '${e.invocationId}'.`),c=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):s&&this._logger.log(N.Error,`Result given for '${n}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(N.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new Pn("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===Ge.Disconnecting?this._completeClose(e):this._connectionState===Ge.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Ge.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Ge.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),rt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(n=>n.apply(this,[e]))}catch(n){this._logger.log(N.Error,`An onclose callback called with error '${e}' threw error '${n}'.`)}}}async _reconnect(e){const n=Date.now();let r=0,i=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(r,0,i);if(o===null){this._logger.log(N.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=Ge.Reconnecting,e?this._logger.log(N.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(N.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(s=>s.apply(this,[e]))}catch(s){this._logger.log(N.Error,`An onreconnecting callback called with error '${e}' threw error '${s}'.`)}if(this._connectionState!==Ge.Reconnecting){this._logger.log(N.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(N.Information,`Reconnect attempt number ${r+1} will start in ${o} ms.`),await new Promise(s=>{this._reconnectDelayHandle=setTimeout(s,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==Ge.Reconnecting){this._logger.log(N.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=Ge.Connected,this._logger.log(N.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(s=>s.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(N.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(s){if(this._logger.log(N.Information,`Reconnect attempt failed because of error '${s}'.`),this._connectionState!==Ge.Reconnecting){this._logger.log(N.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===Ge.Disconnecting&&this._completeClose();return}r++,i=s instanceof Error?s:new Error(s.toString()),o=this._getNextRetryDelay(r,Date.now()-n,i)}}this._logger.log(N.Information,`Reconnect retries have been exhausted after ${Date.now()-n} ms and ${r} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,n,r){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:n,previousRetryCount:e,retryReason:r})}catch(i){return this._logger.log(N.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${n}) threw error '${i}'.`),null}}_cancelCallbacksWithError(e){const n=this._callbacks;this._callbacks={},Object.keys(n).forEach(r=>{const i=n[r];try{i(null,e)}catch(o){this._logger.log(N.Error,`Stream 'error' callback called with '${e}' threw error: ${rf(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,n,r,i){if(r)return i.length!==0?{target:e,arguments:n,streamIds:i,type:Se.Invocation}:{target:e,arguments:n,type:Se.Invocation};{const o=this._invocationId;return this._invocationId++,i.length!==0?{target:e,arguments:n,invocationId:o.toString(),streamIds:i,type:Se.Invocation}:{target:e,arguments:n,invocationId:o.toString(),type:Se.Invocation}}}_launchStreams(e,n){if(e.length!==0){n||(n=Promise.resolve());for(const r in e)e[r].subscribe({complete:()=>{n=n.then(()=>this._sendWithProtocol(this._createCompletionMessage(r)))},error:i=>{let o;i instanceof Error?o=i.message:i&&i.toString?o=i.toString():o="Unknown error",n=n.then(()=>this._sendWithProtocol(this._createCompletionMessage(r,o)))},next:i=>{n=n.then(()=>this._sendWithProtocol(this._createStreamItemMessage(r,i)))}})}}_replaceStreamingParams(e){const n=[],r=[];for(let i=0;i<e.length;i++){const o=e[i];if(this._isObservable(o)){const s=this._invocationId;this._invocationId++,n[s]=o,r.push(s.toString()),e.splice(i,1)}}return[n,r]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,n,r){const i=this._invocationId;return this._invocationId++,r.length!==0?{target:e,arguments:n,invocationId:i.toString(),streamIds:r,type:Se.StreamInvocation}:{target:e,arguments:n,invocationId:i.toString(),type:Se.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:Se.CancelInvocation}}_createStreamItemMessage(e,n){return{invocationId:e,item:n,type:Se.StreamItem}}_createCompletionMessage(e,n,r){return n?{error:n,invocationId:e,type:Se.Completion}:{invocationId:e,result:r,type:Se.Completion}}_createCloseMessage(){return{type:Se.Close}}async _trySendPingMessage(){try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}}const w0=[0,2e3,1e4,3e4,null];class pg{constructor(e){this._retryDelays=e!==void 0?[...e,null]:w0}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Zi{}Zi.Authorization="Authorization";Zi.Cookie="Cookie";class S0 extends Al{constructor(e,n){super(),this._innerClient=e,this._accessTokenFactory=n}async send(e){let n=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(n=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const r=await this._innerClient.send(e);return n&&r.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):r}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[Zi.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Zi.Authorization]&&delete e.headers[Zi.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var lt;(function(t){t[t.None=0]="None",t[t.WebSockets=1]="WebSockets",t[t.ServerSentEvents=2]="ServerSentEvents",t[t.LongPolling=4]="LongPolling"})(lt||(lt={}));var Rt;(function(t){t[t.Text=1]="Text",t[t.Binary=2]="Binary"})(Rt||(Rt={}));let I0=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class gg{get pollAborted(){return this._pollAbort.aborted}constructor(e,n,r){this._httpClient=e,this._logger=n,this._pollAbort=new I0,this._options=r,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,n){if(ht.isRequired(e,"url"),ht.isRequired(n,"transferFormat"),ht.isIn(n,Rt,"transferFormat"),this._url=e,this._logger.log(N.Trace,"(LongPolling transport) Connecting."),n===Rt.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[r,i]=Ms(),o={[r]:i,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};n===Rt.Binary&&(s.responseType="arraybuffer");const a=`${e}&_=${Date.now()}`;this._logger.log(N.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,s);c.statusCode!==200?(this._logger.log(N.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new Qi(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _poll(e,n){try{for(;this._running;)try{const r=`${e}&_=${Date.now()}`;this._logger.log(N.Trace,`(LongPolling transport) polling: ${r}.`);const i=await this._httpClient.get(r,n);i.statusCode===204?(this._logger.log(N.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):i.statusCode!==200?(this._logger.log(N.Error,`(LongPolling transport) Unexpected response code: ${i.statusCode}.`),this._closeError=new Qi(i.statusText||"",i.statusCode),this._running=!1):i.content?(this._logger.log(N.Trace,`(LongPolling transport) data received. ${qa(i.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(i.content)):this._logger.log(N.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(r){this._running?r instanceof cp?this._logger.log(N.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=r,this._running=!1):this._logger.log(N.Trace,`(LongPolling transport) Poll errored after shutdown: ${r.message}`)}}finally{this._logger.log(N.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?km(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(N.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(N.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[n,r]=Ms();e[n]=r;const i={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let o;try{await this._httpClient.delete(this._url,i)}catch(s){o=s}o?o instanceof Qi&&(o.statusCode===404?this._logger.log(N.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(N.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(N.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(N.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(N.Trace,e),this.onclose(this._closeError)}}}class k0{constructor(e,n,r,i){this._httpClient=e,this._accessToken=n,this._logger=r,this._options=i,this.onreceive=null,this.onclose=null}async connect(e,n){return ht.isRequired(e,"url"),ht.isRequired(n,"transferFormat"),ht.isIn(n,Rt,"transferFormat"),this._logger.log(N.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((r,i)=>{let o=!1;if(n!==Rt.Text){i(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let s;if(rt.isBrowser||rt.isWebWorker)s=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(e),c={};c.Cookie=a;const[u,l]=Ms();c[u]=l,s=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{s.onmessage=a=>{if(this.onreceive)try{this._logger.log(N.Trace,`(SSE transport) data received. ${qa(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},s.onerror=a=>{o?this._close():i(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},s.onopen=()=>{this._logger.log(N.Information,`SSE connected to ${this._url}`),this._eventSource=s,o=!0,r()}}catch(a){i(a);return}})}async send(e){return this._eventSource?km(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class T0{constructor(e,n,r,i,o,s){this._logger=r,this._accessTokenFactory=n,this._logMessageContent=i,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=s}async connect(e,n){ht.isRequired(e,"url"),ht.isRequired(n,"transferFormat"),ht.isIn(n,Rt,"transferFormat"),this._logger.log(N.Trace,"(WebSockets transport) Connecting.");let r;return this._accessTokenFactory&&(r=await this._accessTokenFactory()),new Promise((i,o)=>{e=e.replace(/^http/,"ws");let s;const a=this._httpClient.getCookieString(e);let c=!1;if(rt.isNode||rt.isReactNative){const u={},[l,f]=Ms();u[l]=f,r&&(u[Zi.Authorization]=`Bearer ${r}`),a&&(u[Zi.Cookie]=a),s=new this._webSocketConstructor(e,void 0,{headers:{...u,...this._headers}})}else r&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(r)}`);s||(s=new this._webSocketConstructor(e)),n===Rt.Binary&&(s.binaryType="arraybuffer"),s.onopen=u=>{this._logger.log(N.Information,`WebSocket connected to ${e}.`),this._webSocket=s,c=!0,i()},s.onerror=u=>{let l=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?l=u.error:l="There was an error with the transport",this._logger.log(N.Information,`(WebSockets transport) ${l}.`)},s.onmessage=u=>{if(this._logger.log(N.Trace,`(WebSockets transport) data received. ${qa(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(l){this._close(l);return}},s.onclose=u=>{if(c)this._close(u);else{let l=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?l=u.error:l="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(l))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(N.Trace,`(WebSockets transport) sending data. ${qa(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(N.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const vg=100;class E0{constructor(e,n={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,ht.isRequired(e,"url"),this._logger=o0(n.logger),this.baseUrl=this._resolveUrl(e),n=n||{},n.logMessageContent=n.logMessageContent===void 0?!1:n.logMessageContent,typeof n.withCredentials=="boolean"||n.withCredentials===void 0)n.withCredentials=n.withCredentials===void 0?!0:n.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");n.timeout=n.timeout===void 0?100*1e3:n.timeout;let r=null,i=null;if(rt.isNode&&typeof require<"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;r=o("ws"),i=o("eventsource")}!rt.isNode&&typeof WebSocket<"u"&&!n.WebSocket?n.WebSocket=WebSocket:rt.isNode&&!n.WebSocket&&r&&(n.WebSocket=r),!rt.isNode&&typeof EventSource<"u"&&!n.EventSource?n.EventSource=EventSource:rt.isNode&&!n.EventSource&&typeof i<"u"&&(n.EventSource=i),this._httpClient=new S0(n.httpClient||new p0(this._logger),n.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=n,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Rt.Binary,ht.isIn(e,Rt,"transferFormat"),this._logger.log(N.Debug,`Starting connection with transfer format '${Rt[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,this._connectionState==="Disconnecting"){const n="Failed to start the HttpConnection before stop() was called.";return this._logger.log(N.Error,n),await this._stopPromise,Promise.reject(new Pn(n))}else if(this._connectionState!=="Connected"){const n="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(N.Error,n),Promise.reject(new Pn(n))}this._connectionStarted=!0}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new lp(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(N.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(N.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(n=>{this._stopPromiseResolver=n}),await this._stopInternal(e),await this._stopPromise}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(n){this._logger.log(N.Error,`HttpConnection.transport.stop() threw error '${n}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(N.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let n=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===lt.WebSockets)this.transport=this._constructTransport(lt.WebSockets),await this._startTransport(n,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let r=null,i=0;do{if(r=await this._getNegotiationResponse(n),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Pn("The connection was stopped during negotiation.");if(r.error)throw new Error(r.error);if(r.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(r.url&&(n=r.url),r.accessToken){const o=r.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}i++}while(r.url&&i<vg);if(i===vg&&r.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(n,this._options.transport,r,e)}this.transport instanceof gg&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(N.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(r){return this._logger.log(N.Error,"Failed to start the connection: "+r),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(r)}}async _getNegotiationResponse(e){const n={},[r,i]=Ms();n[r]=i;const o=this._resolveNegotiateUrl(e);this._logger.log(N.Debug,`Sending negotiation request: ${o}.`);try{const s=await this._httpClient.post(o,{content:"",headers:{...n,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(s.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${s.statusCode}'`));const a=JSON.parse(s.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new dg("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(s){let a="Failed to complete negotiation with the server: "+s;return s instanceof Qi&&s.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(N.Error,a),Promise.reject(new dg(a))}}_createConnectUrl(e,n){return n?e+(e.indexOf("?")===-1?"?":"&")+`id=${n}`:e}async _createTransport(e,n,r,i){let o=this._createConnectUrl(e,r.connectionToken);if(this._isITransport(n)){this._logger.log(N.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=n,await this._startTransport(o,i),this.connectionId=r.connectionId;return}const s=[],a=r.availableTransports||[];let c=r;for(const u of a){const l=this._resolveTransportOrError(u,n,i,(c==null?void 0:c.useStatefulReconnect)===!0);if(l instanceof Error)s.push(`${u.transport} failed:`),s.push(l);else if(this._isITransport(l)){if(this.transport=l,!c){try{c=await this._getNegotiationResponse(e)}catch(f){return Promise.reject(f)}o=this._createConnectUrl(e,c.connectionToken)}try{await this._startTransport(o,i),this.connectionId=c.connectionId;return}catch(f){if(this._logger.log(N.Error,`Failed to start the transport '${u.transport}': ${f}`),c=void 0,s.push(new t0(`${u.transport} failed: ${f}`,lt[u.transport])),this._connectionState!=="Connecting"){const m="Failed to select transport before stop() was called.";return this._logger.log(N.Debug,m),Promise.reject(new Pn(m))}}}}return s.length>0?Promise.reject(new n0(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case lt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new T0(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case lt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new k0(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case lt.LongPolling:return new gg(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,n){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async r=>{let i=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,n),await this.features.resend()}catch{i=!0}else{this._stopConnection(r);return}i&&this._stopConnection(r)}:this.transport.onclose=r=>this._stopConnection(r),this.transport.connect(e,n)}_resolveTransportOrError(e,n,r,i){const o=lt[e.transport];if(o==null)return this._logger.log(N.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(x0(n,o))if(e.transferFormats.map(a=>Rt[a]).indexOf(r)>=0){if(o===lt.WebSockets&&!this._options.WebSocket||o===lt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(N.Debug,`Skipping transport '${lt[o]}' because it is not supported in your environment.'`),new Y_(`'${lt[o]}' is not supported in your environment.`,o);this._logger.log(N.Debug,`Selecting transport '${lt[o]}'.`);try{return this.features.reconnect=o===lt.WebSockets?i:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(N.Debug,`Skipping transport '${lt[o]}' because it does not support the requested transfer format '${Rt[r]}'.`),new Error(`'${lt[o]}' does not support ${Rt[r]}.`);else return this._logger.log(N.Debug,`Skipping transport '${lt[o]}' because it was disabled by the client.`),new e0(`'${lt[o]}' is disabled by the client.`,o)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(N.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(N.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(N.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(N.Error,`Connection disconnected with error '${e}'.`):this._logger.log(N.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(n=>{this._logger.log(N.Error,`TransportSendQueue.stop() threw error '${n}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(n){this._logger.log(N.Error,`HttpConnection.onclose(${e}) threw error '${n}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!rt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const n=window.document.createElement("a");return n.href=e,this._logger.log(N.Information,`Normalizing '${e}' to '${n.href}'.`),n.href}_resolveNegotiateUrl(e){const n=new URL(e);n.pathname.endsWith("/")?n.pathname+="negotiate":n.pathname+="/negotiate";const r=new URLSearchParams(n.searchParams);return r.has("negotiateVersion")||r.append("negotiateVersion",this._negotiateVersion.toString()),r.has("useStatefulReconnect")?r.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&r.append("useStatefulReconnect","true"),n.search=r.toString(),n.toString()}}function x0(t,e){return!t||(e&t)!==0}class lp{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new kc,this._transportResult=new kc,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new kc),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new kc;const e=this._transportResult;this._transportResult=void 0;const n=typeof this._buffer[0]=="string"?this._buffer.join(""):lp._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(n),e.resolve()}catch(r){e.reject(r)}}}static _concatBuffers(e){const n=e.map(o=>o.byteLength).reduce((o,s)=>o+s),r=new Uint8Array(n);let i=0;for(const o of e)r.set(new Uint8Array(o),i),i+=o.byteLength;return r.buffer}}class kc{constructor(){this.promise=new Promise((e,n)=>[this._resolver,this._rejecter]=[e,n])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const P0="json";class D0{constructor(){this.name=P0,this.version=2,this.transferFormat=Rt.Text}parseMessages(e,n){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];n===null&&(n=Va.instance);const r=rn.parse(e),i=[];for(const o of r){const s=JSON.parse(o);if(typeof s.type!="number")throw new Error("Invalid payload.");switch(s.type){case Se.Invocation:this._isInvocationMessage(s);break;case Se.StreamItem:this._isStreamItemMessage(s);break;case Se.Completion:this._isCompletionMessage(s);break;case Se.Ping:break;case Se.Close:break;case Se.Ack:this._isAckMessage(s);break;case Se.Sequence:this._isSequenceMessage(s);break;default:n.log(N.Information,"Unknown message type '"+s.type+"' ignored.");continue}i.push(s)}return i}writeMessage(e){return rn.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,n){if(typeof e!="string"||e==="")throw new Error(n)}}const R0={trace:N.Trace,debug:N.Debug,info:N.Information,information:N.Information,warn:N.Warning,warning:N.Warning,error:N.Error,critical:N.Critical,none:N.None};function A0(t){const e=R0[t.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${t}`)}class M0{configureLogging(e){if(ht.isRequired(e,"logging"),z0(e))this.logger=e;else if(typeof e=="string"){const n=A0(e);this.logger=new Eu(n)}else this.logger=new Eu(e);return this}withUrl(e,n){return ht.isRequired(e,"url"),ht.isNotEmpty(e,"url"),this.url=e,typeof n=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...n}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:n},this}withHubProtocol(e){return ht.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new pg(e):this.reconnectPolicy=e:this.reconnectPolicy=new pg,this}withServerTimeout(e){return ht.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return ht.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e==null?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const n=new E0(this.url,e);return up.create(n,this.logger||Va.instance,this.protocol||new D0,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function z0(t){return t.log!==void 0}const mg=t=>{if(typeof t=="object"&&t!==null){if(typeof Object.getPrototypeOf=="function"){const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}return Object.prototype.toString.call(t)==="[object Object]"}return!1},Vn=(...t)=>t.reduce((e,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(n).forEach(r=>{["__proto__","constructor","prototype"].includes(r)||(Array.isArray(e[r])&&Array.isArray(n[r])?e[r]=Vn.options.mergeArrays?Vn.options.uniqueArrayItems?Array.from(new Set(e[r].concat(n[r]))):[...e[r],...n[r]]:n[r]:mg(e[r])&&mg(n[r])?e[r]=Vn(e[r],n[r]):e[r]=n[r]===void 0?Vn.options.allowUndefinedOverrides?n[r]:e[r]:n[r])}),e},{}),Ad={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};Vn.options=Ad;Vn.withOptions=(t,...e)=>{Vn.options=Object.assign(Object.assign({},Ad),t);const n=Vn(...e);return Vn.options=Ad,n};var U0=Object.defineProperty,Tm=t=>{throw TypeError(t)},N0=(t,e,n)=>e in t?U0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,lo=(t,e,n)=>N0(t,typeof e!="symbol"?e+"":e,n),fp=(t,e,n)=>e.has(t)||Tm("Cannot "+n),w=(t,e,n)=>(fp(t,e,"read from private field"),n?n.call(t):e.get(t)),le=(t,e,n)=>e.has(t)?Tm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Me=(t,e,n,r)=>(fp(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),on=(t,e,n)=>(fp(t,e,"access private method"),n),$0=(t,e,n,r)=>({set _(i){Me(t,e,i,n)},get _(){return w(t,e,r)}});const O0="0.0.2-alpha6",vs={Text:"Text",Number:"Number",Logic:"Logic"},sn={ValueComponent:"ValueComponent",TableComponent:"TableComponent",RecordComponent:"RecordComponent",ResourceComponent:"ResourceComponent",GraphicComponent:"GraphicComponent",CheckoutComponent:"CheckoutComponent"},F0=t=>Object.values(sn).includes(t),j0=[sn.GraphicComponent,sn.CheckoutComponent,sn.ResourceComponent,sn.RecordComponent],gn={ValueEditor:"ValueEditor",TableEditor:"TableEditor",Fiber:"Fiber",FiberEditor:"FiberEditor",CfgrField:"CfgrField"},L0=k.z.enum([gn.ValueEditor,gn.TableEditor,gn.Fiber,gn.FiberEditor,gn.CfgrField]),Tc={Fiber:"fiber",CfgrField:"cfgrField"},ur={CtrlFibers:"CtrlFibers"};function eu(t){try{return[null,t()]}catch(e){if(e instanceof Error)return[e,null];throw e}}async function ms(t){try{return[null,await t]}catch(e){if(e instanceof Error)return[e,null];throw e}}function Ml(t){return eu(()=>JSON.parse(t))}const Mr=t=>typeof t=="string",W0=t=>t===void 0||t==null||t===""||It(t)&&t.length===0,It=t=>Array.isArray(t),_r=t=>Object.prototype.toString.call(t)==="[object Object]",Md=async t=>new Promise(e=>setTimeout(e,t)),Em=k.z.string(),V0=k.z.enum([vs.Text,vs.Number,vs.Logic]),q0=t=>V0.safeParse(t).success,xm=k.z.string(),H0=t=>xm.safeParse(t).success,B0=k.z.custom(t=>Mr(t)&&t.toLowerCase()===t),Ls=t=>(t==null?void 0:t.toLowerCase())??"",Pm=k.z.string(),K0=k.z.custom(t=>Mr(t)?new RegExp(`^${sn.ValueComponent}<.*>$`).test(t):!1),X0=k.z.custom(t=>Mr(t)?new RegExp(`^${sn.RecordComponent}<.*>$`).test(t):!1),G0=k.z.custom(t=>Mr(t)?new RegExp(`^${sn.ResourceComponent}<.*>$`).test(t):!1),J0=k.z.custom(t=>Mr(t)?new RegExp(`^${sn.TableComponent}<.*>$`).test(t):!1),Dm=k.z.union([K0,J0,X0,G0,k.z.literal(sn.GraphicComponent),k.z.literal(sn.CheckoutComponent)]),yg=k.z.union([k.z.string(),k.z.number(),k.z.boolean()]),Rm=k.z.union([yg,k.z.array(yg),k.z.object({}),k.z.unknown()]),dp=k.z.object({$typ:k.z.literal("Error"),Id:k.z.string(),Message:k.z.string(),route:k.z.unknown().optional()}),bg=t=>dp.safeParse(t).success,Am=dp.or(Rm),zd=new Map;function Q0(t){const e=Ls(t.name);zd.has(e)||zd.set(e,t)}function Mm(t){const e=Ls(t);return zd.get(e)}class hp{constructor(e,n){lo(this,"name"),lo(this,"zodType"),this.name=e,this.zodType=n,Q0(this)}async getValue(){return await lg().getCmpValue(this.name)}async setInput(e){const n=Ls(this.name);await Yc().setCmpInput(n,e,this.zodType)}onValueChanged(e,n=!1,r){lg().onCmpValueChanged(this.name,e,r,n)}}const Z0=k.z.number().transform(t=>t*1e3).pipe(k.z.coerce.date());function zm(t){return t._def.typeName===k.z.ZodFirstPartyTypeKind.ZodArray}function Um(t){return t._def.typeName===k.z.ZodFirstPartyTypeKind.ZodObject}function Y0(t){const[,e]=Ml(t.description??"{}");return e?e.elementity:!1}const Nm={green:"#36D792",yellow:"#D19A66",red:"red"};function $m(t,e){return t&&e?`[${t}.${e}]`:t?`[${t}]`:e?`[${e}]`:""}function Je(t,e,n="",r,i="green"){const o=$m(t,e),s=Nm[i]??"inherit";console.log(`%c${o}%c ${n}`,`color: ${s}`,"color: inherit",r)}function et(t,e,n="",r,i="green"){const o=$m(t,e),s=Nm[i]??"inherit";console.error(`%c${o}%c ${n}`,`color: ${s}`,"color: inherit",r)}const eC=t=>_r(t)&&Object.values(t).every(e=>_r(e)&&"$key"in e&&"$idx"in e&&"definition"in e),Om=[{open:"List<",openReplace:"[",closeReplace:"]"},{open:"Table<",openReplace:"[",closeReplace:"]"},{open:`${sn.ValueComponent}<`,openReplace:`"${sn.ValueComponent}<`,closeReplace:'>"',preventInnerParsing:!0,allowInnerParsingOnRootLevel:!0},{open:"RecordComponent<",openReplace:'"RecordComponent<',closeReplace:'>"',preventInnerParsing:!0,allowInnerParsingOnRootLevel:!0},{open:"TableComponent<",openReplace:'"TableComponent<',closeReplace:'>"',preventInnerParsing:!0,allowInnerParsingOnRootLevel:!0},{open:"ResourceComponent<",openReplace:'"ResourceComponent<',closeReplace:'>"',preventInnerParsing:!0},{open:"ComposedVisual<",openReplace:'"ComposedVisual<',closeReplace:'>"',preventInnerParsing:!0},{open:"DynamicVisual<",openReplace:'"DynamicVisual<',closeReplace:'>"',preventInnerParsing:!0},{open:"Map<",openReplace:'"Map<',closeReplace:'>"',preventInnerParsing:!0},{open:"DataSource<",openReplace:'"DataSource<',closeReplace:'>"',preventInnerParsing:!0},{open:"Resource<",openReplace:"{",closeReplace:"}"},{open:"Record<{",openReplace:"{",closeReplace:""}];function tC(t){let e=1;for(let n=0;n<t.length;n++)if(t[n]==="<"?e++:t[n]===">"&&e--,e===0)return n;return-1}function Fm(t){const e=[",","}",">"],n=/=|,|<|{|}|]/,r="!!TYPEPLACEHOLDER!!";if(t.indexOf("=")===-1)return'"'+t+'"';let i="",o=!1,s=0,a=t||"";for(;a.length>0;){const c=Om.find(u=>a.indexOf(u.open)===0);if(e.includes(a[0]))i+=a[0],a=a.slice(1);else if(c){a=a.slice(c.open.length);const u=tC(a),l=c.preventInnerParsing?a.substring(0,u):Fm(a.substring(0,u)),f=c.openReplace+l+c.closeReplace;i=i.length>0?i.replace(r,f):f,a=a.slice(u+1),o=!1}else if(o){const u=a.search(n);u>0?(i=i.replace(r,'"'+a.substring(0,u)+'"')+a[u],a=a.slice(u+1)):(et("HiveUtils","_parseHiveTypeToJsonStr","Fallback: Full remaining string appended. Possible parsing issue!",{errorName:"Hive type to JSON - parsing issue",jsonObj:{typeDefinition:t}}),i+=a,a=""),o=!1}else{const u=a.indexOf("="),l=a.substring(0,u).trim();i+=`"${l}":{ "$key": "${l}", "$idx": ${s}, "definition": ${r} }`,s++,a=a.slice(u+1),o=!0}}return i}function Ud(t,e,n,r=n){if(!_r(t)&&!It(t))return t;const i=zm(e);if(It(t)&&i)return[Ud(t[0],e.element,n,r)];if(It(t)||i)return et("HiveUtils","_recursiveHiveSchemaMapping","Type mismatch because either the schema or the type expects an array!",{cmpName:n,propertyPath:r,hive:t,zod:JSON.stringify(e)}),t;if(!Um(e))return et("HiveUtils","_recursiveHiveSchemaMapping","Generated schema doesn't match the retrieved component type!",{cmpName:n,propertyPath:r,hive:t,zod:JSON.stringify(e)}),t;const o=Object.keys(e.shape).reduce((a,c)=>(a[c.toLowerCase()]=c,a),{}),s={};return Object.values(t).forEach(function(a){const c=a.$key.toLowerCase(),u=o[c];if(u){const l=e.shape[u];s[u]=a,s[u].$key=u,delete o[c];const f=r+"."+u,m=Ud(a.definition,l,u,f);s[u].definition=m}else s[a.$key]=a}),s}function _g(t){const e=t.match(/^(\w+)<.+>/),n=e&&2>=e.length?e[1]:t;if(!F0(n))throw et("HiveUtils","getBaseHiveType","Unknown base type found!",{type:t,baseType:n}),new Error(`Unknown base component type found: ${JSON.stringify({type:t,baseType:n})}`);return n}function jm(t,e){const n=(t||"").match(new RegExp("<(.+)>"));return n&&2>=n.length?n[1]:""}function nC(t){const e=t.indexOf("=")>-1,n=e&&Om.find(i=>t.indexOf(i.open)===0),r=n&&n.preventInnerParsing&&!n.allowInnerParsingOnRootLevel;return e&&!r}function rC(t,e,n){const r=jm(t)||t;let i=Lm(r);if(t.startsWith("TableComponent<")&&(i=[i]),!i){et("HiveUtils","parseAndMapSchema","Schema parsing not successful",{jsonObj:{type:r,fullType:t}});return}return i=Ud(i,e,n),i}function tu(t,e,n){const r=It(e),i=r&&It(t)&&(_r(e[0])||It(e[0]));if(W0(t)||r&&!i)return t;if(i)return t.map(s=>tu(s,e[0]));const o={};return Object.values(e.$key!==void 0?e.definition:e).forEach(function(s){const a=s.definition,c=t&&t[s.$idx];let u;It(a)&&_r(a[0])?(u=c==null?void 0:c.map(l=>tu(l,a[0])),JSON.stringify(a)):!It(a)&&_r(a)?(u=tu(c,a),JSON.stringify(a)):u=c,o[s.$key]=u}),o}function Lm(t){const e=t.replace(/Resource<\w+>/g,"Text"),n=Fm(e),[r,i]=Ml(n);return r&&et("HiveUtils","parseHiveTypeToSchema","Schema parsing resulted in an invalid JSON",{jsonObj:{typeDefinition:t,parsed:n},exc:r}),r?void 0:i}const iC={[vs.Text]:k.z.string(),[vs.Number]:k.z.number(),[vs.Logic]:k.z.boolean()};function oC(t){const e=Lm(t),n=r=>{const i=It(r),o=i?r[0]:r,s=eC(o)?k.z.object(Object.values(o).reduce((a,c)=>(a[c.$key]=n(c.definition),a),{})):iC[o];return s?i?k.z.array(s):s:(et("HiveUtils","parseHiveTypeToZodSchema","Unknown simple Hive type",{typeDefinition:t,schema:JSON.stringify(r)}),k.z.unknown())};return e?n(e):(et("HiveUtils","parseHiveTypeToZodSchema","Schema is undefined",{typeDefinition:t}),k.z.unknown())}class Nd extends Error{constructor(e){super(e),this.name="ConversionError"}}function sC(t,e,n){const r=n.safeParse(e);if(!r.success)throw new Nd(r.error.message);const i=function(o,s){if(Y0(o))return s;const a=Um(o),c=zm(o);if(a&&_r(s)){const u=o.shape;return Object.keys(u).reduce(function(l,f){const m=i(u[f],s[f]);return l.push(m),l},[])}else return c&&It(s)?s.map(function(u){return i(o.element,u)}):s};return i(n,e)}function Wm(t){return It(t)?Wm(t[0]):_r(t)}const Cg=Symbol("UnknownCmpType");function aC(t,e){if(t==null)return;const{success:n,error:r}=e.safeParse(t);if(!n)throw et("CmpUtils","_assertCmpValueValid","Parser error:",r),new Error("Value received for component doesn't match its zod schema")}function cC(t,e,n){return rC(t,e,n)}function uC(t,e,n,r){const i=nC(e),o=i?cC(e,n,r):void 0;return i&&o?tu(t,o):t}function lC(t,e,n){const r=Mm(t);if(!r)throw new Error("Component does not exist in the component definitions.");const i=r instanceof hp?uC(n,e,r.zodType,t):Cg;if(i===Cg)throw new Error("Component has unknown type.");return i&&aC(i,r.zodType),i}var Vr,Ko;class fC{constructor(){le(this,Vr,new Map),le(this,Ko,new Map)}updateCmp(e,n,r){const i=w(this,Vr).get(e)??{value:n,freshProperties:new Set};i.value=n,i.freshProperties.add("Value"),r&&w(this,Ko).set(e,{property:"Value",lazy:!1,isInitialSubscription:!0}),w(this,Vr).set(e,i)}markCmpPropertiesAsStale(e,n){const r=w(this,Vr).get(e);r&&n.forEach(i=>r.freshProperties.delete(i))}markAllCmpPropertiesAsStale(){for(const e of w(this,Vr).values())e.freshProperties.clear()}async subscribeToCmpUpdates(e,n,r=!1){Je("CmpsStore","subscribeToCmpUpdates","",{cmpName:e,property:n,lazy:r});const i=w(this,Ko).get(e);(!i||i.lazy===!0&&r===!1)&&(w(this,Ko).set(e,{property:n,lazy:r,isInitialSubscription:!1}),await Yc().subscribeToCmpUpdates(e,n,r))}async resubscribeToCmpUpdates(){const e=Yc(),n=Array.from(w(this,Ko)).filter(([,r])=>!r.isInitialSubscription).map(([r,{property:i,lazy:o}])=>e.subscribeToCmpUpdates(r,i,o));await Promise.all(n)}async getCmpValue(e){Je("CmpsStore","getCmpValue","",{name:e});const n=w(this,Vr).get(e);if(n!=null&&n.freshProperties.has("Value"))return n.value;const r=Ls(e);await Yc().fetchCmpPropertyValue([{name:r,property:"Value"}]);const i=w(this,Vr).get(e);return structuredClone(i==null?void 0:i.value)}}Vr=new WeakMap,Ko=new WeakMap;function wg(t){return t instanceof hp}function dC(t){const e=t.split("-");return{companyName:e[0],distributorName:e.length>1?e[1]:""}}function Vm(t){const{pathname:e}=new URL(t),n=new RegExp("^/(cfgr|preview|staging)/","i"),r=new RegExp("/$"),i=e.replace(n,"").replace(r,"").split("/");if(i.length<2)return;let o,s,a,c,u,l;const f=e.toLowerCase(),m=f.startsWith("/preview/"),d=f.startsWith("/staging/");m||d?(l=i[2],a=i[3],o=i[4]==="copy"?"copy":"edit",c=i[5],s=m?"preview":"staging",u=!1):f.startsWith("/cfgr/")&&(a=i[2]==="copy"?void 0:i[2],c=void 0,i[3]==="edit"?(o="edit",c=i[4]):o="copy",s="cfgr",u=i[i.length-1]!=="copy"||i[i.length-1]==="copy"&&a===void 0);const h=dC(i[0]);return{tenant:i[0],companyName:h.companyName,planName:i[1],planVersion:l||void 0,cfgnId:a||void 0,startAction:o,authToken:c||void 0,cfgrMode:s,isPresetCopy:u}}function Sg(t){const e=new RegExp("^/|/$","g"),n=new URL(t).pathname.replace(e,"").split("/"),r=["cfgr","preview","staging"];return n.length>=2&&r.includes(n[0].toLowerCase())}var qm=(t=>(t[t.NotActivated=0]="NotActivated",t[t.Activated=1]="Activated",t[t.Deactivated=2]="Deactivated",t[t.MarkedForDeletion=3]="MarkedForDeletion",t))(qm||{});const hC=k.z.object({mailNotifications:k.z.object({quoteAssignment:k.z.boolean(),insightsAssignment:k.z.boolean()})});k.z.object({id:k.z.string(),firstname:k.z.string(),lastname:k.z.string(),email:k.z.string(),isCbnAdmin:k.z.boolean().optional(),isSuperAdmin:k.z.boolean().optional(),state:k.z.nativeEnum(qm),avatarUrl:k.z.string().nullable().optional(),settings:hC});const Ig={local:void 0,session:void 0};function kg(t=!1){var e;(e=pC(t).storage)==null||e.clear()}function pC(t=!1){const e="CbnStorageTestKey",n="CbnStorageTestValue",r=t?"session":"local",i=Ig[r];if(i!==void 0)return i;const o={storage:t?window.sessionStorage:window.localStorage,writeable:!1,readable:!1};if(o.storage){try{o.storage.setItem(e,n),o.writeable=!0}catch{}try{const s=o.storage.getItem(e);o.readable=o.writeable?s===n:!0}catch{}o.writeable&&o.storage.removeItem(e)}return Ig[r]=o,o}const gC="/login",vC="redirectTo";function mC(t){kg(),kg(!0);const e=encodeURIComponent(window.location.pathname+window.location.search);window.location.href=`${gC}?${vC}=${e}`}var Hm="function",Bm="object",pp="undefined",Kn="prototype",gp=Object,yC=gp[Kn];/*! https://github.com/nevware21/ts-utils v0.12.6 */function Gt(t,e){return t||e}function ot(t,e){return t[e]}var Ut=void 0,mt=null,vp="",zl="function",dc="object",Cr="prototype",xu="__proto__",Fi="undefined",Pu="constructor",mp="Symbol",ys="length",Du="name",Tt="call",hc="toString",yp="getOwnPropertyDescriptor",jt=Gt(Object),bp=ot(jt,Cr),Km=Gt(String),bo=ot(Km,Cr),pc=Gt(Math),Xm=Gt(Array),Ul=ot(Xm,Cr),xr=ot(Ul,"slice"),Tg="_polyfill",Eg="__nw21$polytype__";function it(t,e){try{return{v:t.apply(this,e)}}catch(n){return{e:n}}}function bC(t,e,n){var r=it(t,n);return r.e?e:r.v}var of;function Nl(t){return function(e){return typeof e===t}}function Gm(t){var e="[object "+t+"]";return function(n){return!!(n&&_C(n)===e)}}function _C(t){return bp[hc].call(t)}function Ye(t){return typeof t===Fi||t===Fi}function CC(t){return t===Ut}function K(t){return t===mt||Ye(t)}function _p(t){return t===mt||t===Ut}function wC(t){return!!t||t!==Ut}function SC(t){return!of&&(of=["string","number","boolean",Fi,"symbol","bigint"]),t!==dc&&of.indexOf(t)!==-1}var de=Nl("string"),pe=Nl(zl);function Xt(t){return!t&&K(t)?!1:!!t&&typeof t===dc}var Ce=ot(Xm,"isArray"),IC=Gm("Date"),gc=Nl("number"),Jm=Nl("boolean"),Cp=Gm("Error");function fi(t){return!!(t&&t.then&&pe(t.then))}function Ru(t){return!(!t||bC(function(){return!(t&&0+t)},!t))}function wp(){}function kC(){return!1}var $t=Gt(Km),TC="[object Error]";function te(t,e){var n=vp,r=bp[hc][Tt](t);r===TC&&(t={stack:$t(t.stack),message:$t(t.message),name:$t(t.name)});try{n=JSON.stringify(t,mt,e?typeof e=="number"?e:4:Ut),n=(n?n.replace(/"(\w+)"\s*:\s{0,1}/g,"$1: "):mt)||$t(t)}catch(i){n=" - "+te(i,e)}return r+": "+n}function Yt(t){throw new Error(t)}function nr(t){throw new TypeError(t)}function $l(t){_p(t)&&nr("Cannot convert undefined or null to object")}function EC(t){de(t)||nr("'"+te(t)+"' is not a string")}function mn(t,e){return!!t&&bp.hasOwnProperty[Tt](t,e)}var xC=Gt(ot(jt,yp),wp),ii=Gt(ot(jt,"hasOwn"),PC);function PC(t,e){return $l(t),mn(t,e)||!!xC(t,e)}function De(t,e,n){if(t&&(Xt(t)||pe(t))){for(var r in t)if(ii(t,r)&&e[Tt](t,r,t[r])===-1)break}}function ee(t,e,n){if(t)for(var r=t[ys]>>>0,i=0;i<r&&!(i in t&&e[Tt](t,t[i],i,t)===-1);i++);}var _o=Ol;function Ol(t,e,n){var r=e?e[t]:mt;return function(i){var o=(i?i[t]:mt)||r;if(o||n){var s=arguments;return(o||n).apply(i,o?xr[Tt](s,1):s)}nr('"'+$t(t)+'" not defined for '+te(i))}}function DC(t){return function(e){return e[t]}}var RC=Gt(ot(jt,yp),wp),Ec={e:"enumerable",c:"configurable",v:"value",w:"writable",g:"get",s:"set"};function Qm(t){var e={};if(e[Ec.c]=!0,e[Ec.e]=!0,t.l){e.get=function(){return t.l.v};var n=RC(t.l,"v");n&&n.set&&(e.set=function(r){t.l.v=r})}return De(t,function(r,i){e[Ec[r]]=CC(i)?e[Ec[r]]:i}),e}var Qn=ot(jt,"defineProperty"),AC=ot(jt,"defineProperties");function MC(t,e,n,r,i,o){var s={e:o,c:i};return n&&(s.g=n),Qn(t,e,Qm(s))}function Ae(t,e,n){return Qn(t,e,Qm(n))}function Zm(t,e,n,r,i){var o={};return De(t,function(s,a){Au(o,s,e?a:s),Au(o,a,s)}),r?r(o):o}function Au(t,e,n,r){Qn(t,e,{value:n,enumerable:!0,writable:!1})}var zC=Gt(ot(jt,"isFrozen"),kC),Ym=ot(jt,"freeze");function UC(t){return t}function NC(t){return $l(t),t[xu]||mt}var $d=ot(jt,"assign"),wr=ot(jt,"keys");function ey(t,e){if((Ce(t)||Xt(t)||pe(t))&&!zC(t)){for(var n=0;n<e.length;n++)if(e[n]===t)return t;e.push(t),De(t,function(r,i){ey(i,e)}),Rn(t)}return t}function Ws(t){return Ym?ey(t,[]):t}var Rn=Gt(Ym,UC),Od=Gt(ot(jt,"getPrototypeOf"),NC);function $C(t){return Zm(t,1,0,Rn)}function OC(t){return Zm(t,0,0,Rn)}function FC(t){var e={};return De(t,function(n,r){Au(e,n,r[1]),Au(e,r[0],r[1])}),Rn(e)}function jC(t){return FC(t)}var ty=OC({asyncIterator:0,hasInstance:1,isConcatSpreadable:2,iterator:3,match:4,matchAll:5,replace:6,search:7,species:8,split:9,toPrimitive:10,toStringTag:11,unscopables:12}),xg="__tsUtils$gblCfg",sf;function ny(){var t;return typeof globalThis!==Fi&&(t=globalThis),!t&&typeof self!==Fi&&(t=self),!t&&typeof window!==Fi&&(t=window),!t&&typeof global!==Fi&&(t=global),t}function Fl(){if(!sf){var t=it(ny).v||{};sf=t[xg]=t[xg]||{}}return sf}var ry=ot(pc,"min"),za=ot(pc,"max"),Pg=_o("slice",bo),Bt=_o("substring",bo),Jr=Ol("substr",bo,LC);function LC(t,e,n){return $l(t),n<0?vp:(e=e||0,e<0&&(e=za(e+t[ys],0)),Ye(n)?Pg(t,e):Pg(t,e,e+n))}function Mu(t,e){return Bt(t,0,e)}function WC(t,e){return t&&(it(function(){t[Tg]=!0,t[Eg]=e}),it(Ae,[t,Tg,{v:!0,w:!1,e:!1}]),it(Ae,[t,Eg,{v:e,w:!1,e:!1}])),t}var Pr=Gt(ot(jt,"create"),VC);function VC(t,e){var n=null;function r(){}if(_p(t))n={};else{var i=typeof t;i!==dc&&i!==zl&&nr("Prototype must be an Object or function: "+te(t)),r[Cr]=t,it(function(){r[xu]=t}),n=new r}return e&&it(AC,[n,e]),n}function An(){return(Date.now||qC)()}function qC(){return new Date().getTime()}function ji(t,e,n){return t.apply(e,n)}var pt;function pi(){pt=Fl()}function iy(t,e){var n={};return!pt&&pi(),n.b=pt.lzy,Qn(n,"v",{configurable:!0,get:function(){var r=ji(t,null,e);return pt.lzy||Qn(n,"v",{value:r}),n.b=pt.lzy,r}}),n}var HC=ot(pc,"random"),BC=iy(function(){for(var t=An().toString(36).slice(2);t.length<16;)t+=HC().toString(36).slice(2);return t=t.substring(0,16),t}),Dg="_urid",KC="$nw21sym",af,XC=0;function GC(){if(!af){var t=Fl();af=t.gblSym=t.gblSym||{k:{},s:{}}}return af}var xc;function Sp(t){var e="_"+XC+++"_"+BC.v,n=mp+"("+t+")";function r(o,s){Ae(i,o,{v:s,e:!1,w:!1})}var i=Pr(null);return r("description",$t(t)),r(hc,function(){return n+KC+e}),r("valueOf",function(){return i}),r("v",n),r("_uid",e),WC(i,"symbol")}function JC(t){var e=GC();if(!ii(e.k,t)){var n=Sp(t),r=wr(e.s).length;n[Dg]=function(){return r+"_"+n[hc]()},e.k[t]=n,e.s[n[Dg]()]=$t(t)}return e.k[t]}function QC(t){!xc&&(xc={});var e,n=ty[t];return n&&(e=xc[n]=xc[n]||Sp(mp+"."+n)),e}function Cn(t){return Qn({toJSON:function(){return t}},"v",{value:t})}var oy="window",Ua;function Vs(t,e){var n;return function(){return!pt&&pi(),(!n||pt.lzy)&&(n=Cn(it(t,e).v)),n.v}}function vn(t){return!pt&&pi(),(!Ua||t===!1||pt.lzy)&&(Ua=Cn(it(ny).v||mt)),Ua.v}function nt(t,e){var n;if(!Ua||e===!1?n=vn(e):n=Ua.v,n&&n[t])return n[t];if(t===oy)try{return window}catch{}return mt}function sy(){return!!kt()}var kt=Vs(nt,["document"]);function jl(){return!!cn()}var cn=Vs(nt,[oy]);function ZC(){return!!rr()}var rr=Vs(nt,["navigator"]);function YC(){return!!ay()}var ay=Vs(nt,["history"]),ew=Vs(function(){return!!it(function(){return process&&(process.versions||{}).node}).v}),cy=Vs(function(){return!!it(function(){return self&&self instanceof WorkerGlobalScope}).v}),zs,cf;function Ll(){return zs=Cn(it(nt,[mp]).v),zs}function tw(t){var e=(pt.lzy?0:zs)||Ll();return e.v?e.v[t]:Ut}function nw(){return!!rw()}function rw(){return!pt&&pi(),((pt.lzy?0:zs)||Ll()).v}function Ip(t,e){var n=ty[t];!pt&&pi();var r=(pt.lzy?0:zs)||Ll();return r.v?r.v[n||t]:QC(t)}function Xs(t,e){!pt&&pi();var n=(pt.lzy?0:zs)||Ll();return n.v?n.v(t):Sp(t)}function kp(t){return!pt&&pi(),cf=(pt.lzy?0:cf)||Cn(it(tw,["for"]).v),(cf.v||JC)(t)}function Fd(t){return!!t&&pe(t.next)}function uy(t){return!_p(t)&&pe(t[Ip(3)])}var Pc;function Tp(t,e,n){if(t&&(Fd(t)||(!Pc&&(Pc=Cn(Ip(3))),t=t[Pc.v]?t[Pc.v]():mt),Fd(t))){var r=Ut,i=Ut;try{for(var o=0;!(i=t.next()).done&&e[Tt](n||t,i.value,o,t)!==-1;)o++}catch(s){r={e:s},t.throw&&(i=mt,t.throw(r))}finally{try{i&&!i.done&&t.return&&t.return(i)}finally{if(r)throw r.e}}}}function cs(t,e){return!Ye(e)&&t&&(Ce(e)?ji(t.push,t,e):Fd(e)||uy(e)?Tp(e,function(n){t.push(n)}):t.push(e)),t}var At=_o("indexOf",Ul),Ha=_o("map",Ul);function Wl(t,e,n){return((t?t.slice:mt)||xr).apply(t,xr[Tt](arguments,1))}var iw=_o("reduce",Ul),uf,ly=Gt(ot(jt,"setPrototypeOf"),ow);function ow(t,e){var n;return!uf&&(uf=Cn((n={},n[xu]=[],n instanceof Array))),uf.v?t[xu]=e:De(e,function(r,i){return t[r]=i}),t}function sw(t,e,n){it(Ae,[e,Du,{v:t,c:!0,e:!1}]),e=ly(e,n);function r(){this[Pu]=e,it(Ae,[this,Du,{v:t,c:!0,e:!1}])}return e[Cr]=n===mt?Pr(n):(r[Cr]=n[Cr],new r),e}function Rg(t,e){e&&(t[Du]=e)}function fy(t,e,n){var r=Error,i=r[Cr][Du],o=Error.captureStackTrace;return sw(t,function(){var s=this,a=arguments;try{it(Rg,[r,t]);var c=ji(r,s,xr[Tt](a))||s;if(c!==s){var u=Od(s);u!==Od(c)&&ly(c,u)}return o&&o(c,s[Pu]),e&&e(c,a),c}finally{it(Rg,[r,i])}},r)}var lf;function aw(t){throw lf||(lf=fy("UnsupportedError")),new lf(t)}function cw(t){return function(e){return $l(e),e&&e.replace&&(e=e.replace(t,vp)),e}}var uw=cw(/^\s+|(?=\s)\s+$/g),Ve=Ol("trim",bo,uw),an=ot(pc,"floor"),ff,df,hf;function Ot(t){if(!t||typeof t!==dc)return!1;hf||(hf=jl()?cn():!0);var e=!1;if(t!==hf){df||(ff=Function[Cr][hc],df=ff[Tt](jt));try{var n=Od(t);e=!n,e||(mn(n,Pu)&&(n=n[Pu]),e=!!(n&&typeof n===zl&&ff[Tt](n)===df))}catch{}}return e}function lw(t){return t.value&&hy(t),!0}var Ag=[pw,hy,vw,gw];function fw(t,e,n,r){var i;return ee(t,function(o){if(o.k===e)return i=o,-1}),i||(i={k:e,v:e},t.push(i),r(i)),i.v}function Ep(t,e,n,r){var i=n.handler,o=n.path?r?n.path.concat(r):n.path:[],s={handler:n.handler,src:n.src,path:o},a=typeof e,c=!1,u=e===mt;u||(e&&a===dc?c=Ot(e):u=SC(a));var l={type:a,isPrim:u,isPlain:c,value:e,result:e,path:o,origin:n.src,copy:function(f,m){return Ep(t,f,m?s:n,m)},copyTo:function(f,m){return dy(t,f,m,s)}};return l.isPrim?i&&i[Tt](n,l)?l.result:e:fw(t,e,o,function(f){Ae(l,"result",{g:function(){return f.v},s:function(h){f.v=h}});for(var m=0,d=i;!(d||(m<Ag.length?Ag[m++]:lw))[Tt](n,l);)d=mt})}function dy(t,e,n,r){if(!K(n))for(var i in n)e[i]=Ep(t,n[i],r,i);return e}function dw(t,e,n){var r={handler:n,src:e,path:[]};return dy([],t,e,r)}function hw(t,e){var n={handler:e,src:t};return Ep([],t,n)}function pw(t){var e=t.value;if(Ce(e)){var n=t.result=[];return n.length=e.length,t.copyTo(n,e),!0}return!1}function gw(t){var e=t.value;return IC(e)?(t.result=new Date(e.getTime()),!0):!1}function vw(t){return t.type===zl}function hy(t){var e=t.value;if(e&&t.isPlain){var n=t.result={};return t.copyTo(n,e),!0}return!1}function py(t,e){return ee(e,function(n){dw(t,n)}),t}function Mg(t,e,n,r,i,o,s){return py(hw(t)||{},xr[Tt](arguments))}function mw(t,e,n,r,i,o,s){return py(t||{},xr[Tt](arguments))}var gy=_o("split",bo);function vy(t,e,n){if(t&&e){var r=gy(e,"."),i=r.pop();ee(r,function(o){K(t[o])&&(t[o]={}),t=t[o]}),t[i]=n}}var yw=DC(ys),pf;function Dr(){return!pt&&pi(),(!pf||pt.lzy)&&(pf=Cn(it(nt,["performance"]).v)),pf.v}var my=ot(pc,"round"),bw=Gt(ot(jt,yp),wp),yy=Ol("endsWith",bo,_w);function _w(t,e,n){EC(t);var r=de(e)?e:$t(e),i=!Ye(n)&&n<t[ys]?n:t[ys];return Bt(t,i-r[ys],i)===r}var at=_o("indexOf",bo),gf="ref",vf="unref",mf="hasRef",Cw="enabled";function ww(t,e,n){var r=!0,i=t?e(mt):mt,o;function s(){return r=!1,i&&i[vf]&&i[vf](),o}function a(){i&&n(i),i=mt}function c(){return i=e(i),r||s(),o}function u(l){!l&&i&&a(),l&&!i&&c()}return o={cancel:a,refresh:c},o[mf]=function(){return i&&i[mf]?i[mf]():r},o[gf]=function(){return r=!0,i&&i[gf]&&i[gf](),o},o[vf]=s,o=Qn(o,Cw,{get:function(){return!!i},set:u}),{h:o,dn:function(){i=mt}}}var Sw,Iw;function kw(t){var e=pe(t)?t:Sw;if(!e){var n=Fl().tmOut||[];Ce(n)&&n.length>0&&pe(n[0])&&(e=n[0])}return e||setTimeout}function Tw(t){var e=pe(t)?t:Iw;if(!e){var n=Fl().tmOut||[];Ce(n)&&n.length>1&&pe(n[1])&&(e=n[1])}return e||clearTimeout}function by(t,e,n){var r=Ce(e),i=r?e.length:0,o=kw(i>0?e[0]:r?Ut:e),s=Tw(i>1?e[1]:Ut),a=n[0];n[0]=function(){c.dn(),ji(a,Ut,xr[Tt](arguments))};var c=ww(t,function(u){if(u){if(u.refresh)return u.refresh(),u;ji(s,Ut,[u])}return ji(o,Ut,n)},function(u){ji(s,Ut,[u])});return c.h}function yn(t,e){return by(!0,Ut,xr[Tt](arguments))}function Ew(t,e){return by(!1,Ut,xr[Tt](arguments))}(vn()||{}).Symbol;(vn()||{}).Reflect;var _y="hasOwnProperty",xw=function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)yC[_y].call(e,i)&&(t[i]=e[i])}return t},Ft=$d||xw,jd=function(t,e){return jd=gp.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)r[_y](i)&&(n[i]=r[i])},jd(t,e)};function ir(t,e){typeof e!==Hm&&e!==null&&nr("Class extends value "+String(e)+" is not a constructor or null"),jd(t,e);function n(){this.constructor=t}t[Kn]=e===null?Pr(e):(n[Kn]=e[Kn],new n)}function zg(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t}var Dc,zu="constructor",Rr="prototype",Uu="function",Nu="_dynInstFuncs",Ld="_isDynProxy",bs="_dynClass",Pw="_dynCls$",Wd="_dynInstChk",Ba=Wd,Cy="_dfOpts",Ug="_unknown_",xp="__proto__",Rc="_dyn"+xp,Ng="__dynProto$Gbl",yf="_dynInstProto",nu="useBaseInst",Vd="setInstFuncs",Pp=Object,Ka=Pp.getPrototypeOf,$g=Pp.getOwnPropertyNames,Og=vn(),qd=Og[Ng]||(Og[Ng]={o:(Dc={},Dc[Vd]=!0,Dc[nu]=!0,Dc),n:1e3});function ru(t){return t&&(t===Pp[Rr]||t===Array[Rr])}function Dp(t){return ru(t)||t===Function[Rr]}function fo(t){var e;if(t){if(Ka)return Ka(t);var n=t[xp]||t[Rr]||(t[zu]?t[zu][Rr]:null);e=t[Rc]||n,mn(t,Rc)||(delete t[yf],e=t[Rc]=t[yf]||t[Rc],t[yf]=n)}return e}function $u(t,e){var n=[];if($g)n=$g(t);else for(var r in t)typeof r=="string"&&mn(t,r)&&n.push(r);if(n&&n.length>0)for(var i=0;i<n.length;i++)e(n[i])}function Rp(t,e,n){return e!==zu&&typeof t[e]===Uu&&(n||mn(t,e))&&e!==xp&&e!==Rr}function Ou(t){nr("DynamicProto: "+t)}function Dw(t){var e=Pr(null);return $u(t,function(n){!e[n]&&Rp(t,n,!1)&&(e[n]=t[n])}),e}function Ap(t,e){for(var n=t.length-1;n>=0;n--)if(t[n]===e)return!0;return!1}function Rw(t,e,n,r){function i(c,u,l){var f=u[l];if(f[Ld]&&r){var m=c[Nu]||{};m[Ba]!==!1&&(f=(m[u[bs]]||{})[l]||f)}return function(){return f.apply(c,arguments)}}var o=Pr(null);$u(n,function(c){o[c]=i(e,n,c)});for(var s=fo(t),a=[];s&&!Dp(s)&&!Ap(a,s);)$u(s,function(c){!o[c]&&Rp(s,c,!Ka)&&(o[c]=i(e,s,c))}),a.push(s),s=fo(s);return o}function Aw(t,e,n,r){var i=null;if(t&&mn(n,bs)){var o=t[Nu]||Pr(null);if(i=(o[n[bs]]||Pr(null))[e],i||Ou("Missing ["+e+"] "+Uu),!i[Wd]&&o[Ba]!==!1){for(var s=!mn(t,e),a=fo(t),c=[];s&&a&&!Dp(a)&&!Ap(c,a);){var u=a[e];if(u){s=u===r;break}c.push(a),a=fo(a)}try{s&&(t[e]=i),i[Wd]=1}catch{o[Ba]=!1}}}return i}function Mw(t,e,n){var r=e[t];return r===n&&(r=fo(e)[t]),typeof r!==Uu&&Ou("["+t+"] is not a "+Uu),r}function zw(t,e,n,r,i){function o(c,u){var l=function(){var f=Aw(this,u,c,l)||Mw(u,c,l);return f.apply(this,arguments)};return l[Ld]=1,l}if(!ru(t)){var s=n[Nu]=n[Nu]||Pr(null);if(!ru(s)){var a=s[e]=s[e]||Pr(null);s[Ba]!==!1&&(s[Ba]=!!i),ru(a)||$u(n,function(c){Rp(n,c,!1)&&n[c]!==r[c]&&(a[c]=n[c],delete n[c],(!mn(t,c)||t[c]&&!t[c][Ld])&&(t[c]=o(t,c)))})}}}function Uw(t,e){if(Ka){for(var n=[],r=fo(e);r&&!Dp(r)&&!Ap(n,r);){if(r===t)return!0;n.push(r),r=fo(r)}return!1}return!0}function bf(t,e){return mn(t,Rr)?t.name||e||Ug:((t||{})[zu]||{}).name||e||Ug}function qe(t,e,n,r){mn(t,Rr)||Ou("theClass is an invalid class definition.");var i=t[Rr];Uw(i,e)||Ou("["+bf(t)+"] not in hierarchy of ["+bf(e)+"]");var o=null;mn(i,bs)?o=i[bs]:(o=Pw+bf(t,"_")+"$"+qd.n,qd.n++,i[bs]=o);var s=qe[Cy],a=!!s[nu];a&&r&&r[nu]!==void 0&&(a=!!r[nu]);var c=Dw(e),u=Rw(i,e,c,a);n(e,u);var l=!!Ka&&!!s[Vd];l&&r&&(l=!!r[Vd]),zw(i,o,e,c,l!==!1)}qe[Cy]=qd.o;var Mp=$C,Nw=jC,Kr=Mp({NONE:0,PENDING:3,INACTIVE:1,ACTIVE:2}),Us="toLowerCase",he="length",Fu="warnToConsole",vc="throwInternal",Yi="watch",ho="apply",Ee="push",Co="splice",ft="logger",Ui="cancel",mc="initialize",Qr="identifier",ju="removeNotificationListener",Lu="addNotificationListener",qn="isInitialized",Ac="getNotifyMgr",Xa="getPlugin",po="name",Nt="processNext",wy="getProcessTelContext",Li="value",us="enabled",Fg="stopPollingInternalLogs",go="unload",Mc="onComplete",Hd="version",Sy="loggingLevelConsole",vo="createNew",pr="teardown",Wu="messageId",eo="message",Sr="diagLog",Vu="_doTeardown",Ga="update",Xn="getNext",Ja="setNextPlugin",Bd="userAgent",mo="split",to="replace",Kd="substring",Iy="indexOf",oi="type",jg="evtName",dr="status",Lg="getAllResponseHeaders",Xd="isChildEvt",Sn="data",_s="getCtx",jn="setCtx",Wg="itemsReceived",zc="headers",Gs="urlString",zo="timeout",Gd="traceFlags",_f="getAttribute",Cf;function $w(t,e){Cf||(Cf=fy("AggregationError",function(r,i){i[he]>1&&(r.errors=i[1])}));var n=t;throw ee(e,function(r,i){n+=`
|
|
1
|
+
"use strict";var j_=Object.defineProperty;var cg=t=>{throw TypeError(t)};var L_=(t,e,n)=>e in t?j_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ar=(t,e,n)=>L_(t,typeof e!="symbol"?e+"":e,n),ug=(t,e,n)=>e.has(t)||cg("Cannot "+n);var xe=(t,e,n)=>(ug(t,e,"read from private field"),n?n.call(t):e.get(t)),wt=(t,e,n)=>e.has(t)?cg("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),cr=(t,e,n,r)=>(ug(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("zod"),wm="0.0.1-alpha6";var Sl,gr;class W_{constructor(e){ar(this,"id");wt(this,Sl,"v1");wt(this,gr);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Sl));if(cr(this,gr,n==null?void 0:n.getButtonSdkBridge(this.id)),!xe(this,gr))throw new Error(`Cannot access API for Button "${this.id}".`)}onRendered(e){var n;return((n=xe(this,gr))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}onClick(e){var n;return((n=xe(this,gr))==null?void 0:n.addOnClickCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,gr))==null?void 0:n.setVisible(e))}setText(e){var n;(n=xe(this,gr))==null||n.setText(e)}}Sl=new WeakMap,gr=new WeakMap;var Il,Bi;class V_{constructor(e){ar(this,"id");wt(this,Il,"v1");wt(this,Bi);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Il));if(cr(this,Bi,n==null?void 0:n.getCheckboxSdkBridge(this.id)),!xe(this,Bi))throw new Error(`Cannot access API for Checkbox "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Bi))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Bi))==null?void 0:n.setVisible(e))}}Il=new WeakMap,Bi=new WeakMap;var kl,Ki;class q_{constructor(e){ar(this,"id");wt(this,kl,"v1");wt(this,Ki);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,kl));if(cr(this,Ki,n==null?void 0:n.getCollapsibleSdkBridge(this.id)),!xe(this,Ki))throw new Error(`Cannot access API for Collapsible "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Ki))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Ki))==null?void 0:n.setVisible(e))}}kl=new WeakMap,Ki=new WeakMap;var Tl,vr;class H_{constructor(e){ar(this,"id");wt(this,Tl,"v1");wt(this,vr);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Tl));if(cr(this,vr,n==null?void 0:n.getCustomCtrlSdkBridge(this.id)),!xe(this,vr))throw new Error(`Cannot access API for Custom Control "${this.id}".`)}set renderFn(e){var n;(n=xe(this,vr))==null||n.setRenderFn(e)}async render(e){var n;typeof e=="function"&&(this.renderFn=e),await((n=xe(this,vr))==null?void 0:n.render())}getElement(){var n;return(n=xe(this,vr))==null?void 0:n.getElement()}async setVisible(e){var n;await((n=xe(this,vr))==null?void 0:n.setVisible(e))}}Tl=new WeakMap,vr=new WeakMap;var El,Xi;class B_{constructor(e){ar(this,"id");wt(this,El,"v1");wt(this,Xi);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,El));if(cr(this,Xi,n==null?void 0:n.getDataviewSdkBridge(this.id)),!xe(this,Xi))throw new Error(`Cannot access API for Dataview "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Xi))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Xi))==null?void 0:n.setVisible(e))}}El=new WeakMap,Xi=new WeakMap;var xl,Gi;class K_{constructor(e){ar(this,"id");wt(this,xl,"v1");wt(this,Gi);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,xl));if(cr(this,Gi,n==null?void 0:n.getInputSdkBridge(this.id)),!xe(this,Gi))throw new Error(`Cannot access API for Input "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Gi))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Gi))==null?void 0:n.setVisible(e))}}xl=new WeakMap,Gi=new WeakMap;var Pl,Ji;class X_{constructor(e){ar(this,"id");wt(this,Pl,"v1");wt(this,Ji);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Pl));if(cr(this,Ji,n==null?void 0:n.getPanelSdkBridge(this.id)),!xe(this,Ji))throw new Error(`Cannot access API for Panel "${this.id}".`)}onRendered(e){var n;return((n=xe(this,Ji))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,Ji))==null?void 0:n.setVisible(e))}}Pl=new WeakMap,Ji=new WeakMap;var Dl,ei;class G_{constructor(e){ar(this,"id");wt(this,Dl,"v1");wt(this,ei);var r,i;this.id=e;const n=(i=(r=window.Cbn)==null?void 0:r.getCustomCodeSdkBridge)==null?void 0:i.call(r,xe(this,Dl));if(cr(this,ei,n==null?void 0:n.getTextSdkBridge(this.id)),!xe(this,ei))throw new Error(`Cannot access API for Text "${this.id}".`)}onRendered(e){var n;return((n=xe(this,ei))==null?void 0:n.addOnRenderedCallback(e))??{unsubscribe:()=>{}}}async setVisible(e){var n;await((n=xe(this,ei))==null?void 0:n.setVisible(e))}setText(e){var n;(n=xe(this,ei))==null||n.setText(e)}}Dl=new WeakMap,ei=new WeakMap;const Tu=[];function Sm(t,e){if(Tu.length>=1)throw new Error("Only 1 `ConfiguratorClient` can be created at a time.");Tu.push({client:t,internals:e})}function lg(){const t=Tu[0];if(!t)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return t.client}function Yc(){const t=Tu[0];if(!t)throw new Error("Operation not possible as no `ConfiguratorClient` has been registered yet.");return t.internals}function J_(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nf={exports:{}},fg;function Q_(){return fg||(fg=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function o(c,u,l,f,m){if(typeof l!="function")throw new TypeError("The listener must be a function");var d=new i(l,f||c,m),h=n?n+u:u;return c._events[h]?c._events[h].fn?c._events[h]=[c._events[h],d]:c._events[h].push(d):(c._events[h]=d,c._eventsCount++),c}function s(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,f;if(this._eventsCount===0)return u;for(f in l=this._events)e.call(l,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=n?n+u:u,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,d=f.length,h=new Array(d);m<d;m++)h[m]=f[m].fn;return h},a.prototype.listenerCount=function(u){var l=n?n+u:u,f=this._events[l];return f?f.fn?1:f.length:0},a.prototype.emit=function(u,l,f,m,d,h){var g=n?n+u:u;if(!this._events[g])return!1;var p=this._events[g],v=arguments.length,_,P;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),v){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,l),!0;case 3:return p.fn.call(p.context,l,f),!0;case 4:return p.fn.call(p.context,l,f,m),!0;case 5:return p.fn.call(p.context,l,f,m,d),!0;case 6:return p.fn.call(p.context,l,f,m,d,h),!0}for(P=1,_=new Array(v-1);P<v;P++)_[P-1]=arguments[P];p.fn.apply(p.context,_)}else{var x=p.length,R;for(P=0;P<x;P++)switch(p[P].once&&this.removeListener(u,p[P].fn,void 0,!0),v){case 1:p[P].fn.call(p[P].context);break;case 2:p[P].fn.call(p[P].context,l);break;case 3:p[P].fn.call(p[P].context,l,f);break;case 4:p[P].fn.call(p[P].context,l,f,m);break;default:if(!_)for(R=1,_=new Array(v-1);R<v;R++)_[R-1]=arguments[R];p[P].fn.apply(p[P].context,_)}}return!0},a.prototype.on=function(u,l,f){return o(this,u,l,f,!1)},a.prototype.once=function(u,l,f){return o(this,u,l,f,!0)},a.prototype.removeListener=function(u,l,f,m){var d=n?n+u:u;if(!this._events[d])return this;if(!l)return s(this,d),this;var h=this._events[d];if(h.fn)h.fn===l&&(!m||h.once)&&(!f||h.context===f)&&s(this,d);else{for(var g=0,p=[],v=h.length;g<v;g++)(h[g].fn!==l||m&&!h[g].once||f&&h[g].context!==f)&&p.push(h[g]);p.length?this._events[d]=p.length===1?p[0]:p:s(this,d)}return this},a.prototype.removeAllListeners=function(u){var l;return u?(l=n?n+u:u,this._events[l]&&s(this,l)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,t.exports=a})(nf)),nf.exports}var Z_=Q_();const Rl=J_(Z_);class Qi extends Error{constructor(e,n){const r=new.target.prototype;super(`${e}: Status code '${n}'`),this.statusCode=n,this.__proto__=r}}class cp extends Error{constructor(e="A timeout occurred."){const n=new.target.prototype;super(e),this.__proto__=n}}class Pn extends Error{constructor(e="An abort occurred."){const n=new.target.prototype;super(e),this.__proto__=n}}class Y_ extends Error{constructor(e,n){const r=new.target.prototype;super(e),this.transport=n,this.errorType="UnsupportedTransportError",this.__proto__=r}}class e0 extends Error{constructor(e,n){const r=new.target.prototype;super(e),this.transport=n,this.errorType="DisabledTransportError",this.__proto__=r}}class t0 extends Error{constructor(e,n){const r=new.target.prototype;super(e),this.transport=n,this.errorType="FailedToStartTransportError",this.__proto__=r}}class dg extends Error{constructor(e){const n=new.target.prototype;super(e),this.errorType="FailedToNegotiateWithServerError",this.__proto__=n}}class n0 extends Error{constructor(e,n){const r=new.target.prototype;super(e),this.innerErrors=n,this.__proto__=r}}class Im{constructor(e,n,r){this.statusCode=e,this.statusText=n,this.content=r}}class Al{get(e,n){return this.send({...n,method:"GET",url:e})}post(e,n){return this.send({...n,method:"POST",url:e})}delete(e,n){return this.send({...n,method:"DELETE",url:e})}getCookieString(e){return""}}var N;(function(t){t[t.Trace=0]="Trace",t[t.Debug=1]="Debug",t[t.Information=2]="Information",t[t.Warning=3]="Warning",t[t.Error=4]="Error",t[t.Critical=5]="Critical",t[t.None=6]="None"})(N||(N={}));class Va{constructor(){}log(e,n){}}Va.instance=new Va;const r0="10.0.0";class ht{static isRequired(e,n){if(e==null)throw new Error(`The '${n}' argument is required.`)}static isNotEmpty(e,n){if(!e||e.match(/^\s*$/))throw new Error(`The '${n}' argument should not be empty.`)}static isIn(e,n,r){if(!(e in n))throw new Error(`Unknown ${r} value: ${e}.`)}}class rt{static get isBrowser(){return!rt.isNode&&typeof window=="object"&&typeof window.document=="object"}static get isWebWorker(){return!rt.isNode&&typeof self=="object"&&"importScripts"in self}static get isReactNative(){return!rt.isNode&&typeof window=="object"&&typeof window.document>"u"}static get isNode(){return typeof process<"u"&&process.release&&process.release.name==="node"}}function qa(t,e){let n="";return uo(t)?(n=`Binary data of length ${t.byteLength}`,e&&(n+=`. Content: '${i0(t)}'`)):typeof t=="string"&&(n=`String data of length ${t.length}`,e&&(n+=`. Content: '${t}'`)),n}function i0(t){const e=new Uint8Array(t);let n="";return e.forEach(r=>{const i=r<16?"0":"";n+=`0x${i}${r.toString(16)} `}),n.substring(0,n.length-1)}function uo(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}async function km(t,e,n,r,i,o){const s={},[a,c]=Ms();s[a]=c,t.log(N.Trace,`(${e} transport) sending data. ${qa(i,o.logMessageContent)}.`);const u=uo(i)?"arraybuffer":"text",l=await n.post(r,{content:i,headers:{...s,...o.headers},responseType:u,timeout:o.timeout,withCredentials:o.withCredentials});t.log(N.Trace,`(${e} transport) request complete. Response status: ${l.statusCode}.`)}function o0(t){return t===void 0?new Eu(N.Information):t===null?Va.instance:t.log!==void 0?t:new Eu(t)}class s0{constructor(e,n){this._subject=e,this._observer=n}dispose(){const e=this._subject.observers.indexOf(this._observer);e>-1&&this._subject.observers.splice(e,1),this._subject.observers.length===0&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(n=>{})}}class Eu{constructor(e){this._minLevel=e,this.out=console}log(e,n){if(e>=this._minLevel){const r=`[${new Date().toISOString()}] ${N[e]}: ${n}`;switch(e){case N.Critical:case N.Error:this.out.error(r);break;case N.Warning:this.out.warn(r);break;case N.Information:this.out.info(r);break;default:this.out.log(r);break}}}}function Ms(){let t="X-SignalR-User-Agent";return rt.isNode&&(t="User-Agent"),[t,a0(r0,c0(),l0(),u0())]}function a0(t,e,n,r){let i="Microsoft SignalR/";const o=t.split(".");return i+=`${o[0]}.${o[1]}`,i+=` (${t}; `,e&&e!==""?i+=`${e}; `:i+="Unknown OS; ",i+=`${n}`,r?i+=`; ${r}`:i+="; Unknown Runtime Version",i+=")",i}function c0(){if(rt.isNode)switch(process.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}else return""}function u0(){if(rt.isNode)return process.versions.node}function l0(){return rt.isNode?"NodeJS":"Browser"}function rf(t){return t.stack?t.stack:t.message?t.message:`${t}`}function f0(){if(typeof globalThis<"u")return globalThis;if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("could not find global")}class d0 extends Al{constructor(e){if(super(),this._logger=e,typeof fetch>"u"||rt.isNode){const n=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._jar=new(n("tough-cookie")).CookieJar,typeof fetch>"u"?this._fetchType=n("node-fetch"):this._fetchType=fetch,this._fetchType=n("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(f0());if(typeof AbortController>"u"){const n=typeof __webpack_require__=="function"?__non_webpack_require__:require;this._abortControllerType=n("abort-controller")}else this._abortControllerType=AbortController}async send(e){if(e.abortSignal&&e.abortSignal.aborted)throw new Pn;if(!e.method)throw new Error("No method defined.");if(!e.url)throw new Error("No url defined.");const n=new this._abortControllerType;let r;e.abortSignal&&(e.abortSignal.onabort=()=>{n.abort(),r=new Pn});let i=null;if(e.timeout){const c=e.timeout;i=setTimeout(()=>{n.abort(),this._logger.log(N.Warning,"Timeout from HTTP request."),r=new cp},c)}e.content===""&&(e.content=void 0),e.content&&(e.headers=e.headers||{},uo(e.content)?e.headers["Content-Type"]="application/octet-stream":e.headers["Content-Type"]="text/plain;charset=UTF-8");let o;try{o=await this._fetchType(e.url,{body:e.content,cache:"no-cache",credentials:e.withCredentials===!0?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...e.headers},method:e.method,mode:"cors",redirect:"follow",signal:n.signal})}catch(c){throw r||(this._logger.log(N.Warning,`Error from HTTP request. ${c}.`),c)}finally{i&&clearTimeout(i),e.abortSignal&&(e.abortSignal.onabort=null)}if(!o.ok){const c=await hg(o,"text");throw new Qi(c||o.statusText,o.status)}const a=await hg(o,e.responseType);return new Im(o.status,o.statusText,a)}getCookieString(e){let n="";return rt.isNode&&this._jar&&this._jar.getCookies(e,(r,i)=>n=i.join("; ")),n}}function hg(t,e){let n;switch(e){case"arraybuffer":n=t.arrayBuffer();break;case"text":n=t.text();break;case"blob":case"document":case"json":throw new Error(`${e} is not supported.`);default:n=t.text();break}return n}class h0 extends Al{constructor(e){super(),this._logger=e}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Pn):e.method?e.url?new Promise((n,r)=>{const i=new XMLHttpRequest;i.open(e.method,e.url,!0),i.withCredentials=e.withCredentials===void 0?!0:e.withCredentials,i.setRequestHeader("X-Requested-With","XMLHttpRequest"),e.content===""&&(e.content=void 0),e.content&&(uo(e.content)?i.setRequestHeader("Content-Type","application/octet-stream"):i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));const o=e.headers;o&&Object.keys(o).forEach(s=>{i.setRequestHeader(s,o[s])}),e.responseType&&(i.responseType=e.responseType),e.abortSignal&&(e.abortSignal.onabort=()=>{i.abort(),r(new Pn)}),e.timeout&&(i.timeout=e.timeout),i.onload=()=>{e.abortSignal&&(e.abortSignal.onabort=null),i.status>=200&&i.status<300?n(new Im(i.status,i.statusText,i.response||i.responseText)):r(new Qi(i.response||i.responseText||i.statusText,i.status))},i.onerror=()=>{this._logger.log(N.Warning,`Error from HTTP request. ${i.status}: ${i.statusText}.`),r(new Qi(i.statusText,i.status))},i.ontimeout=()=>{this._logger.log(N.Warning,"Timeout from HTTP request."),r(new cp)},i.send(e.content)}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}class p0 extends Al{constructor(e){if(super(),typeof fetch<"u"||rt.isNode)this._httpClient=new d0(e);else if(typeof XMLHttpRequest<"u")this._httpClient=new h0(e);else throw new Error("No usable HttpClient found.")}send(e){return e.abortSignal&&e.abortSignal.aborted?Promise.reject(new Pn):e.method?e.url?this._httpClient.send(e):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(e){return this._httpClient.getCookieString(e)}}class rn{static write(e){return`${e}${rn.RecordSeparator}`}static parse(e){if(e[e.length-1]!==rn.RecordSeparator)throw new Error("Message is incomplete.");const n=e.split(rn.RecordSeparator);return n.pop(),n}}rn.RecordSeparatorCode=30;rn.RecordSeparator=String.fromCharCode(rn.RecordSeparatorCode);class g0{writeHandshakeRequest(e){return rn.write(JSON.stringify(e))}parseHandshakeResponse(e){let n,r;if(uo(e)){const a=new Uint8Array(e),c=a.indexOf(rn.RecordSeparatorCode);if(c===-1)throw new Error("Message is incomplete.");const u=c+1;n=String.fromCharCode.apply(null,Array.prototype.slice.call(a.slice(0,u))),r=a.byteLength>u?a.slice(u).buffer:null}else{const a=e,c=a.indexOf(rn.RecordSeparator);if(c===-1)throw new Error("Message is incomplete.");const u=c+1;n=a.substring(0,u),r=a.length>u?a.substring(u):null}const i=rn.parse(n),o=JSON.parse(i[0]);if(o.type)throw new Error("Expected a handshake response from the server.");return[r,o]}}var Se;(function(t){t[t.Invocation=1]="Invocation",t[t.StreamItem=2]="StreamItem",t[t.Completion=3]="Completion",t[t.StreamInvocation=4]="StreamInvocation",t[t.CancelInvocation=5]="CancelInvocation",t[t.Ping=6]="Ping",t[t.Close=7]="Close",t[t.Ack=8]="Ack",t[t.Sequence=9]="Sequence"})(Se||(Se={}));class v0{constructor(){this.observers=[]}next(e){for(const n of this.observers)n.next(e)}error(e){for(const n of this.observers)n.error&&n.error(e)}complete(){for(const e of this.observers)e.complete&&e.complete()}subscribe(e){return this.observers.push(e),new s0(this,e)}}class m0{constructor(e,n,r){this._bufferSize=1e5,this._messages=[],this._totalMessageCount=0,this._waitForSequenceMessage=!1,this._nextReceivingSequenceId=1,this._latestReceivedSequenceId=0,this._bufferedByteCount=0,this._reconnectInProgress=!1,this._protocol=e,this._connection=n,this._bufferSize=r}async _send(e){const n=this._protocol.writeMessage(e);let r=Promise.resolve();if(this._isInvocationMessage(e)){this._totalMessageCount++;let i=()=>{},o=()=>{};uo(n)?this._bufferedByteCount+=n.byteLength:this._bufferedByteCount+=n.length,this._bufferedByteCount>=this._bufferSize&&(r=new Promise((s,a)=>{i=s,o=a})),this._messages.push(new y0(n,this._totalMessageCount,i,o))}try{this._reconnectInProgress||await this._connection.send(n)}catch{this._disconnected()}await r}_ack(e){let n=-1;for(let r=0;r<this._messages.length;r++){const i=this._messages[r];if(i._id<=e.sequenceId)n=r,uo(i._message)?this._bufferedByteCount-=i._message.byteLength:this._bufferedByteCount-=i._message.length,i._resolver();else if(this._bufferedByteCount<this._bufferSize)i._resolver();else break}n!==-1&&(this._messages=this._messages.slice(n+1))}_shouldProcessMessage(e){if(this._waitForSequenceMessage)return e.type!==Se.Sequence?!1:(this._waitForSequenceMessage=!1,!0);if(!this._isInvocationMessage(e))return!0;const n=this._nextReceivingSequenceId;return this._nextReceivingSequenceId++,n<=this._latestReceivedSequenceId?(n===this._latestReceivedSequenceId&&this._ackTimer(),!1):(this._latestReceivedSequenceId=n,this._ackTimer(),!0)}_resetSequence(e){if(e.sequenceId>this._nextReceivingSequenceId){this._connection.stop(new Error("Sequence ID greater than amount of messages we've received."));return}this._nextReceivingSequenceId=e.sequenceId}_disconnected(){this._reconnectInProgress=!0,this._waitForSequenceMessage=!0}async _resend(){const e=this._messages.length!==0?this._messages[0]._id:this._totalMessageCount+1;await this._connection.send(this._protocol.writeMessage({type:Se.Sequence,sequenceId:e}));const n=this._messages;for(const r of n)await this._connection.send(r._message);this._reconnectInProgress=!1}_dispose(e){e??(e=new Error("Unable to reconnect to server."));for(const n of this._messages)n._rejector(e)}_isInvocationMessage(e){switch(e.type){case Se.Invocation:case Se.StreamItem:case Se.Completion:case Se.StreamInvocation:case Se.CancelInvocation:return!0;case Se.Close:case Se.Sequence:case Se.Ping:case Se.Ack:return!1}}_ackTimer(){this._ackTimerHandle===void 0&&(this._ackTimerHandle=setTimeout(async()=>{try{this._reconnectInProgress||await this._connection.send(this._protocol.writeMessage({type:Se.Ack,sequenceId:this._latestReceivedSequenceId}))}catch{}clearTimeout(this._ackTimerHandle),this._ackTimerHandle=void 0},1e3))}}class y0{constructor(e,n,r,i){this._message=e,this._id=n,this._resolver=r,this._rejector=i}}const b0=30*1e3,_0=15*1e3,C0=1e5;var Ge;(function(t){t.Disconnected="Disconnected",t.Connecting="Connecting",t.Connected="Connected",t.Disconnecting="Disconnecting",t.Reconnecting="Reconnecting"})(Ge||(Ge={}));class up{static create(e,n,r,i,o,s,a){return new up(e,n,r,i,o,s,a)}constructor(e,n,r,i,o,s,a){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(N.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://learn.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},ht.isRequired(e,"connection"),ht.isRequired(n,"logger"),ht.isRequired(r,"protocol"),this.serverTimeoutInMilliseconds=o??b0,this.keepAliveIntervalInMilliseconds=s??_0,this._statefulReconnectBufferSize=a??C0,this._logger=n,this._protocol=r,this.connection=e,this._reconnectPolicy=i,this._handshakeProtocol=new g0,this.connection.onreceive=c=>this._processIncomingData(c),this.connection.onclose=c=>this._connectionClosed(c),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=Ge.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:Se.Ping})}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(e){if(this._connectionState!==Ge.Disconnected&&this._connectionState!==Ge.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!e)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=e}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==Ge.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=Ge.Connecting,this._logger.log(N.Debug,"Starting HubConnection.");try{await this._startInternal(),rt.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=Ge.Connected,this._connectionStarted=!0,this._logger.log(N.Debug,"HubConnection connected successfully.")}catch(e){return this._connectionState=Ge.Disconnected,this._logger.log(N.Debug,`HubConnection failed to start successfully because of error '${e}'.`),Promise.reject(e)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const e=new Promise((n,r)=>{this._handshakeResolver=n,this._handshakeRejecter=r});await this.connection.start(this._protocol.transferFormat);try{let n=this._protocol.version;this.connection.features.reconnect||(n=1);const r={protocol:this._protocol.name,version:n};if(this._logger.log(N.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(r)),this._logger.log(N.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await e,this._stopDuringStartError)throw this._stopDuringStartError;(this.connection.features.reconnect||!1)&&(this._messageBuffer=new m0(this._protocol,this.connection,this._statefulReconnectBufferSize),this.connection.features.disconnected=this._messageBuffer._disconnected.bind(this._messageBuffer),this.connection.features.resend=()=>{if(this._messageBuffer)return this._messageBuffer._resend()}),this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(n){throw this._logger.log(N.Debug,`Hub handshake failed with error '${n}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(n),n}}async stop(){const e=this._startPromise;this.connection.features.reconnect=!1,this._stopPromise=this._stopInternal(),await this._stopPromise;try{await e}catch{}}_stopInternal(e){if(this._connectionState===Ge.Disconnected)return this._logger.log(N.Debug,`Call to HubConnection.stop(${e}) ignored because it is already in the disconnected state.`),Promise.resolve();if(this._connectionState===Ge.Disconnecting)return this._logger.log(N.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;const n=this._connectionState;return this._connectionState=Ge.Disconnecting,this._logger.log(N.Debug,"Stopping HubConnection."),this._reconnectDelayHandle?(this._logger.log(N.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(n===Ge.Connected&&this._sendCloseMessage(),this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=e||new Pn("The connection was stopped before the hub handshake could complete."),this.connection.stop(e))}async _sendCloseMessage(){try{await this._sendWithProtocol(this._createCloseMessage())}catch{}}stream(e,...n){const[r,i]=this._replaceStreamingParams(n),o=this._createStreamInvocation(e,n,i);let s;const a=new v0;return a.cancelCallback=()=>{const c=this._createCancelInvocation(o.invocationId);return delete this._callbacks[o.invocationId],s.then(()=>this._sendWithProtocol(c))},this._callbacks[o.invocationId]=(c,u)=>{if(u){a.error(u);return}else c&&(c.type===Se.Completion?c.error?a.error(new Error(c.error)):a.complete():a.next(c.item))},s=this._sendWithProtocol(o).catch(c=>{a.error(c),delete this._callbacks[o.invocationId]}),this._launchStreams(r,s),a}_sendMessage(e){return this._resetKeepAliveInterval(),this.connection.send(e)}_sendWithProtocol(e){return this._messageBuffer?this._messageBuffer._send(e):this._sendMessage(this._protocol.writeMessage(e))}send(e,...n){const[r,i]=this._replaceStreamingParams(n),o=this._sendWithProtocol(this._createInvocation(e,n,!0,i));return this._launchStreams(r,o),o}invoke(e,...n){const[r,i]=this._replaceStreamingParams(n),o=this._createInvocation(e,n,!1,i);return new Promise((a,c)=>{this._callbacks[o.invocationId]=(l,f)=>{if(f){c(f);return}else l&&(l.type===Se.Completion?l.error?c(new Error(l.error)):a(l.result):c(new Error(`Unexpected message type: ${l.type}`)))};const u=this._sendWithProtocol(o).catch(l=>{c(l),delete this._callbacks[o.invocationId]});this._launchStreams(r,u)})}on(e,n){!e||!n||(e=e.toLowerCase(),this._methods[e]||(this._methods[e]=[]),this._methods[e].indexOf(n)===-1&&this._methods[e].push(n))}off(e,n){if(!e)return;e=e.toLowerCase();const r=this._methods[e];if(r)if(n){const i=r.indexOf(n);i!==-1&&(r.splice(i,1),r.length===0&&delete this._methods[e])}else delete this._methods[e]}onclose(e){e&&this._closedCallbacks.push(e)}onreconnecting(e){e&&this._reconnectingCallbacks.push(e)}onreconnected(e){e&&this._reconnectedCallbacks.push(e)}_processIncomingData(e){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(e=this._processHandshakeResponse(e),this._receivedHandshakeResponse=!0),e){const n=this._protocol.parseMessages(e,this._logger);for(const r of n)if(!(this._messageBuffer&&!this._messageBuffer._shouldProcessMessage(r)))switch(r.type){case Se.Invocation:this._invokeClientMethod(r).catch(i=>{this._logger.log(N.Error,`Invoke client method threw error: ${rf(i)}`)});break;case Se.StreamItem:case Se.Completion:{const i=this._callbacks[r.invocationId];if(i){r.type===Se.Completion&&delete this._callbacks[r.invocationId];try{i(r)}catch(o){this._logger.log(N.Error,`Stream callback threw error: ${rf(o)}`)}}break}case Se.Ping:break;case Se.Close:{this._logger.log(N.Information,"Close message received from server.");const i=r.error?new Error("Server returned an error on close: "+r.error):void 0;r.allowReconnect===!0?this.connection.stop(i):this._stopPromise=this._stopInternal(i);break}case Se.Ack:this._messageBuffer&&this._messageBuffer._ack(r);break;case Se.Sequence:this._messageBuffer&&this._messageBuffer._resetSequence(r);break;default:this._logger.log(N.Warning,`Invalid message type: ${r.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(e){let n,r;try{[r,n]=this._handshakeProtocol.parseHandshakeResponse(e)}catch(i){const o="Error parsing handshake response: "+i;this._logger.log(N.Error,o);const s=new Error(o);throw this._handshakeRejecter(s),s}if(n.error){const i="Server returned handshake error: "+n.error;this._logger.log(N.Error,i);const o=new Error(i);throw this._handshakeRejecter(o),o}else this._logger.log(N.Debug,"Server handshake complete.");return this._handshakeResolver(),r}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if(!this.connection.features||!this.connection.features.inherentKeepAlive){this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds);let e=this._nextKeepAlive-new Date().getTime();if(e<0){this._connectionState===Ge.Connected&&this._trySendPingMessage();return}this._pingServerHandle===void 0&&(e<0&&(e=0),this._pingServerHandle=setTimeout(async()=>{this._connectionState===Ge.Connected&&await this._trySendPingMessage()},e))}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(e){const n=e.target.toLowerCase(),r=this._methods[n];if(!r){this._logger.log(N.Warning,`No client method with the name '${n}' found.`),e.invocationId&&(this._logger.log(N.Warning,`No result given for '${n}' method and invocation ID '${e.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)));return}const i=r.slice(),o=!!e.invocationId;let s,a,c;for(const u of i)try{const l=s;s=await u.apply(this,e.arguments),o&&s&&l&&(this._logger.log(N.Error,`Multiple results provided for '${n}'. Sending error to server.`),c=this._createCompletionMessage(e.invocationId,"Client provided multiple results.",null)),a=void 0}catch(l){a=l,this._logger.log(N.Error,`A callback for the method '${n}' threw error '${l}'.`)}c?await this._sendWithProtocol(c):o?(a?c=this._createCompletionMessage(e.invocationId,`${a}`,null):s!==void 0?c=this._createCompletionMessage(e.invocationId,null,s):(this._logger.log(N.Warning,`No result given for '${n}' method and invocation ID '${e.invocationId}'.`),c=this._createCompletionMessage(e.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(c)):s&&this._logger.log(N.Error,`Result given for '${n}' method but server is not expecting a result.`)}_connectionClosed(e){this._logger.log(N.Debug,`HubConnection.connectionClosed(${e}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||e||new Pn("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(e||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===Ge.Disconnecting?this._completeClose(e):this._connectionState===Ge.Connected&&this._reconnectPolicy?this._reconnect(e):this._connectionState===Ge.Connected&&this._completeClose(e)}_completeClose(e){if(this._connectionStarted){this._connectionState=Ge.Disconnected,this._connectionStarted=!1,this._messageBuffer&&(this._messageBuffer._dispose(e??new Error("Connection closed.")),this._messageBuffer=void 0),rt.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(n=>n.apply(this,[e]))}catch(n){this._logger.log(N.Error,`An onclose callback called with error '${e}' threw error '${n}'.`)}}}async _reconnect(e){const n=Date.now();let r=0,i=e!==void 0?e:new Error("Attempting to reconnect due to a unknown error."),o=this._getNextRetryDelay(r,0,i);if(o===null){this._logger.log(N.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(e);return}if(this._connectionState=Ge.Reconnecting,e?this._logger.log(N.Information,`Connection reconnecting because of error '${e}'.`):this._logger.log(N.Information,"Connection reconnecting."),this._reconnectingCallbacks.length!==0){try{this._reconnectingCallbacks.forEach(s=>s.apply(this,[e]))}catch(s){this._logger.log(N.Error,`An onreconnecting callback called with error '${e}' threw error '${s}'.`)}if(this._connectionState!==Ge.Reconnecting){this._logger.log(N.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;o!==null;){if(this._logger.log(N.Information,`Reconnect attempt number ${r+1} will start in ${o} ms.`),await new Promise(s=>{this._reconnectDelayHandle=setTimeout(s,o)}),this._reconnectDelayHandle=void 0,this._connectionState!==Ge.Reconnecting){this._logger.log(N.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=Ge.Connected,this._logger.log(N.Information,"HubConnection reconnected successfully."),this._reconnectedCallbacks.length!==0)try{this._reconnectedCallbacks.forEach(s=>s.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(N.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(s){if(this._logger.log(N.Information,`Reconnect attempt failed because of error '${s}'.`),this._connectionState!==Ge.Reconnecting){this._logger.log(N.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===Ge.Disconnecting&&this._completeClose();return}r++,i=s instanceof Error?s:new Error(s.toString()),o=this._getNextRetryDelay(r,Date.now()-n,i)}}this._logger.log(N.Information,`Reconnect retries have been exhausted after ${Date.now()-n} ms and ${r} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(e,n,r){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:n,previousRetryCount:e,retryReason:r})}catch(i){return this._logger.log(N.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${e}, ${n}) threw error '${i}'.`),null}}_cancelCallbacksWithError(e){const n=this._callbacks;this._callbacks={},Object.keys(n).forEach(r=>{const i=n[r];try{i(null,e)}catch(o){this._logger.log(N.Error,`Stream 'error' callback called with '${e}' threw error: ${rf(o)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(e,n,r,i){if(r)return i.length!==0?{target:e,arguments:n,streamIds:i,type:Se.Invocation}:{target:e,arguments:n,type:Se.Invocation};{const o=this._invocationId;return this._invocationId++,i.length!==0?{target:e,arguments:n,invocationId:o.toString(),streamIds:i,type:Se.Invocation}:{target:e,arguments:n,invocationId:o.toString(),type:Se.Invocation}}}_launchStreams(e,n){if(e.length!==0){n||(n=Promise.resolve());for(const r in e)e[r].subscribe({complete:()=>{n=n.then(()=>this._sendWithProtocol(this._createCompletionMessage(r)))},error:i=>{let o;i instanceof Error?o=i.message:i&&i.toString?o=i.toString():o="Unknown error",n=n.then(()=>this._sendWithProtocol(this._createCompletionMessage(r,o)))},next:i=>{n=n.then(()=>this._sendWithProtocol(this._createStreamItemMessage(r,i)))}})}}_replaceStreamingParams(e){const n=[],r=[];for(let i=0;i<e.length;i++){const o=e[i];if(this._isObservable(o)){const s=this._invocationId;this._invocationId++,n[s]=o,r.push(s.toString()),e.splice(i,1)}}return[n,r]}_isObservable(e){return e&&e.subscribe&&typeof e.subscribe=="function"}_createStreamInvocation(e,n,r){const i=this._invocationId;return this._invocationId++,r.length!==0?{target:e,arguments:n,invocationId:i.toString(),streamIds:r,type:Se.StreamInvocation}:{target:e,arguments:n,invocationId:i.toString(),type:Se.StreamInvocation}}_createCancelInvocation(e){return{invocationId:e,type:Se.CancelInvocation}}_createStreamItemMessage(e,n){return{invocationId:e,item:n,type:Se.StreamItem}}_createCompletionMessage(e,n,r){return n?{error:n,invocationId:e,type:Se.Completion}:{invocationId:e,result:r,type:Se.Completion}}_createCloseMessage(){return{type:Se.Close}}async _trySendPingMessage(){try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}}}const w0=[0,2e3,1e4,3e4,null];class pg{constructor(e){this._retryDelays=e!==void 0?[...e,null]:w0}nextRetryDelayInMilliseconds(e){return this._retryDelays[e.previousRetryCount]}}class Zi{}Zi.Authorization="Authorization";Zi.Cookie="Cookie";class S0 extends Al{constructor(e,n){super(),this._innerClient=e,this._accessTokenFactory=n}async send(e){let n=!0;this._accessTokenFactory&&(!this._accessToken||e.url&&e.url.indexOf("/negotiate?")>0)&&(n=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(e);const r=await this._innerClient.send(e);return n&&r.statusCode===401&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(e),await this._innerClient.send(e)):r}_setAuthorizationHeader(e){e.headers||(e.headers={}),this._accessToken?e.headers[Zi.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&e.headers[Zi.Authorization]&&delete e.headers[Zi.Authorization]}getCookieString(e){return this._innerClient.getCookieString(e)}}var lt;(function(t){t[t.None=0]="None",t[t.WebSockets=1]="WebSockets",t[t.ServerSentEvents=2]="ServerSentEvents",t[t.LongPolling=4]="LongPolling"})(lt||(lt={}));var Rt;(function(t){t[t.Text=1]="Text",t[t.Binary=2]="Binary"})(Rt||(Rt={}));let I0=class{constructor(){this._isAborted=!1,this.onabort=null}abort(){this._isAborted||(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}};class gg{get pollAborted(){return this._pollAbort.aborted}constructor(e,n,r){this._httpClient=e,this._logger=n,this._pollAbort=new I0,this._options=r,this._running=!1,this.onreceive=null,this.onclose=null}async connect(e,n){if(ht.isRequired(e,"url"),ht.isRequired(n,"transferFormat"),ht.isIn(n,Rt,"transferFormat"),this._url=e,this._logger.log(N.Trace,"(LongPolling transport) Connecting."),n===Rt.Binary&&typeof XMLHttpRequest<"u"&&typeof new XMLHttpRequest().responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[r,i]=Ms(),o={[r]:i,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:o,timeout:1e5,withCredentials:this._options.withCredentials};n===Rt.Binary&&(s.responseType="arraybuffer");const a=`${e}&_=${Date.now()}`;this._logger.log(N.Trace,`(LongPolling transport) polling: ${a}.`);const c=await this._httpClient.get(a,s);c.statusCode!==200?(this._logger.log(N.Error,`(LongPolling transport) Unexpected response code: ${c.statusCode}.`),this._closeError=new Qi(c.statusText||"",c.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _poll(e,n){try{for(;this._running;)try{const r=`${e}&_=${Date.now()}`;this._logger.log(N.Trace,`(LongPolling transport) polling: ${r}.`);const i=await this._httpClient.get(r,n);i.statusCode===204?(this._logger.log(N.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):i.statusCode!==200?(this._logger.log(N.Error,`(LongPolling transport) Unexpected response code: ${i.statusCode}.`),this._closeError=new Qi(i.statusText||"",i.statusCode),this._running=!1):i.content?(this._logger.log(N.Trace,`(LongPolling transport) data received. ${qa(i.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(i.content)):this._logger.log(N.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(r){this._running?r instanceof cp?this._logger.log(N.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=r,this._running=!1):this._logger.log(N.Trace,`(LongPolling transport) Poll errored after shutdown: ${r.message}`)}}finally{this._logger.log(N.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(e){return this._running?km(this._logger,"LongPolling",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(N.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(N.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const e={},[n,r]=Ms();e[n]=r;const i={headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};let o;try{await this._httpClient.delete(this._url,i)}catch(s){o=s}o?o instanceof Qi&&(o.statusCode===404?this._logger.log(N.Trace,"(LongPolling transport) A 404 response was returned from sending a DELETE request."):this._logger.log(N.Trace,`(LongPolling transport) Error sending a DELETE request: ${o}`)):this._logger.log(N.Trace,"(LongPolling transport) DELETE request accepted.")}finally{this._logger.log(N.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let e="(LongPolling transport) Firing onclose event.";this._closeError&&(e+=" Error: "+this._closeError),this._logger.log(N.Trace,e),this.onclose(this._closeError)}}}class k0{constructor(e,n,r,i){this._httpClient=e,this._accessToken=n,this._logger=r,this._options=i,this.onreceive=null,this.onclose=null}async connect(e,n){return ht.isRequired(e,"url"),ht.isRequired(n,"transferFormat"),ht.isIn(n,Rt,"transferFormat"),this._logger.log(N.Trace,"(SSE transport) Connecting."),this._url=e,this._accessToken&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((r,i)=>{let o=!1;if(n!==Rt.Text){i(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let s;if(rt.isBrowser||rt.isWebWorker)s=new this._options.EventSource(e,{withCredentials:this._options.withCredentials});else{const a=this._httpClient.getCookieString(e),c={};c.Cookie=a;const[u,l]=Ms();c[u]=l,s=new this._options.EventSource(e,{withCredentials:this._options.withCredentials,headers:{...c,...this._options.headers}})}try{s.onmessage=a=>{if(this.onreceive)try{this._logger.log(N.Trace,`(SSE transport) data received. ${qa(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(c){this._close(c);return}},s.onerror=a=>{o?this._close():i(new Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},s.onopen=()=>{this._logger.log(N.Information,`SSE connected to ${this._url}`),this._eventSource=s,o=!0,r()}}catch(a){i(a);return}})}async send(e){return this._eventSource?km(this._logger,"SSE",this._httpClient,this._url,e,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(e){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(e))}}class T0{constructor(e,n,r,i,o,s){this._logger=r,this._accessTokenFactory=n,this._logMessageContent=i,this._webSocketConstructor=o,this._httpClient=e,this.onreceive=null,this.onclose=null,this._headers=s}async connect(e,n){ht.isRequired(e,"url"),ht.isRequired(n,"transferFormat"),ht.isIn(n,Rt,"transferFormat"),this._logger.log(N.Trace,"(WebSockets transport) Connecting.");let r;return this._accessTokenFactory&&(r=await this._accessTokenFactory()),new Promise((i,o)=>{e=e.replace(/^http/,"ws");let s;const a=this._httpClient.getCookieString(e);let c=!1;if(rt.isNode||rt.isReactNative){const u={},[l,f]=Ms();u[l]=f,r&&(u[Zi.Authorization]=`Bearer ${r}`),a&&(u[Zi.Cookie]=a),s=new this._webSocketConstructor(e,void 0,{headers:{...u,...this._headers}})}else r&&(e+=(e.indexOf("?")<0?"?":"&")+`access_token=${encodeURIComponent(r)}`);s||(s=new this._webSocketConstructor(e)),n===Rt.Binary&&(s.binaryType="arraybuffer"),s.onopen=u=>{this._logger.log(N.Information,`WebSocket connected to ${e}.`),this._webSocket=s,c=!0,i()},s.onerror=u=>{let l=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?l=u.error:l="There was an error with the transport",this._logger.log(N.Information,`(WebSockets transport) ${l}.`)},s.onmessage=u=>{if(this._logger.log(N.Trace,`(WebSockets transport) data received. ${qa(u.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(u.data)}catch(l){this._close(l);return}},s.onclose=u=>{if(c)this._close(u);else{let l=null;typeof ErrorEvent<"u"&&u instanceof ErrorEvent?l=u.error:l="WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.",o(new Error(l))}}})}send(e){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(N.Trace,`(WebSockets transport) sending data. ${qa(e,this._logMessageContent)}.`),this._webSocket.send(e),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(e){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(N.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(e)&&(e.wasClean===!1||e.code!==1e3)?this.onclose(new Error(`WebSocket closed with status code: ${e.code} (${e.reason||"no reason given"}).`)):e instanceof Error?this.onclose(e):this.onclose())}_isCloseEvent(e){return e&&typeof e.wasClean=="boolean"&&typeof e.code=="number"}}const vg=100;class E0{constructor(e,n={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,ht.isRequired(e,"url"),this._logger=o0(n.logger),this.baseUrl=this._resolveUrl(e),n=n||{},n.logMessageContent=n.logMessageContent===void 0?!1:n.logMessageContent,typeof n.withCredentials=="boolean"||n.withCredentials===void 0)n.withCredentials=n.withCredentials===void 0?!0:n.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");n.timeout=n.timeout===void 0?100*1e3:n.timeout;let r=null,i=null;if(rt.isNode&&typeof require<"u"){const o=typeof __webpack_require__=="function"?__non_webpack_require__:require;r=o("ws"),i=o("eventsource")}!rt.isNode&&typeof WebSocket<"u"&&!n.WebSocket?n.WebSocket=WebSocket:rt.isNode&&!n.WebSocket&&r&&(n.WebSocket=r),!rt.isNode&&typeof EventSource<"u"&&!n.EventSource?n.EventSource=EventSource:rt.isNode&&!n.EventSource&&typeof i<"u"&&(n.EventSource=i),this._httpClient=new S0(n.httpClient||new p0(this._logger),n.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=n,this.onreceive=null,this.onclose=null}async start(e){if(e=e||Rt.Binary,ht.isIn(e,Rt,"transferFormat"),this._logger.log(N.Debug,`Starting connection with transfer format '${Rt[e]}'.`),this._connectionState!=="Disconnected")return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(e),await this._startInternalPromise,this._connectionState==="Disconnecting"){const n="Failed to start the HttpConnection before stop() was called.";return this._logger.log(N.Error,n),await this._stopPromise,Promise.reject(new Pn(n))}else if(this._connectionState!=="Connected"){const n="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(N.Error,n),Promise.reject(new Pn(n))}this._connectionStarted=!0}send(e){return this._connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new lp(this.transport)),this._sendQueue.send(e))}async stop(e){if(this._connectionState==="Disconnected")return this._logger.log(N.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnected state.`),Promise.resolve();if(this._connectionState==="Disconnecting")return this._logger.log(N.Debug,`Call to HttpConnection.stop(${e}) ignored because the connection is already in the disconnecting state.`),this._stopPromise;this._connectionState="Disconnecting",this._stopPromise=new Promise(n=>{this._stopPromiseResolver=n}),await this._stopInternal(e),await this._stopPromise}async _stopInternal(e){this._stopError=e;try{await this._startInternalPromise}catch{}if(this.transport){try{await this.transport.stop()}catch(n){this._logger.log(N.Error,`HttpConnection.transport.stop() threw error '${n}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(N.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(e){let n=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===lt.WebSockets)this.transport=this._constructTransport(lt.WebSockets),await this._startTransport(n,e);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let r=null,i=0;do{if(r=await this._getNegotiationResponse(n),this._connectionState==="Disconnecting"||this._connectionState==="Disconnected")throw new Pn("The connection was stopped during negotiation.");if(r.error)throw new Error(r.error);if(r.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");if(r.url&&(n=r.url),r.accessToken){const o=r.accessToken;this._accessTokenFactory=()=>o,this._httpClient._accessToken=o,this._httpClient._accessTokenFactory=void 0}i++}while(r.url&&i<vg);if(i===vg&&r.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(n,this._options.transport,r,e)}this.transport instanceof gg&&(this.features.inherentKeepAlive=!0),this._connectionState==="Connecting"&&(this._logger.log(N.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(r){return this._logger.log(N.Error,"Failed to start the connection: "+r),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(r)}}async _getNegotiationResponse(e){const n={},[r,i]=Ms();n[r]=i;const o=this._resolveNegotiateUrl(e);this._logger.log(N.Debug,`Sending negotiation request: ${o}.`);try{const s=await this._httpClient.post(o,{content:"",headers:{...n,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(s.statusCode!==200)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${s.statusCode}'`));const a=JSON.parse(s.content);return(!a.negotiateVersion||a.negotiateVersion<1)&&(a.connectionToken=a.connectionId),a.useStatefulReconnect&&this._options._useStatefulReconnect!==!0?Promise.reject(new dg("Client didn't negotiate Stateful Reconnect but the server did.")):a}catch(s){let a="Failed to complete negotiation with the server: "+s;return s instanceof Qi&&s.statusCode===404&&(a=a+" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(N.Error,a),Promise.reject(new dg(a))}}_createConnectUrl(e,n){return n?e+(e.indexOf("?")===-1?"?":"&")+`id=${n}`:e}async _createTransport(e,n,r,i){let o=this._createConnectUrl(e,r.connectionToken);if(this._isITransport(n)){this._logger.log(N.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=n,await this._startTransport(o,i),this.connectionId=r.connectionId;return}const s=[],a=r.availableTransports||[];let c=r;for(const u of a){const l=this._resolveTransportOrError(u,n,i,(c==null?void 0:c.useStatefulReconnect)===!0);if(l instanceof Error)s.push(`${u.transport} failed:`),s.push(l);else if(this._isITransport(l)){if(this.transport=l,!c){try{c=await this._getNegotiationResponse(e)}catch(f){return Promise.reject(f)}o=this._createConnectUrl(e,c.connectionToken)}try{await this._startTransport(o,i),this.connectionId=c.connectionId;return}catch(f){if(this._logger.log(N.Error,`Failed to start the transport '${u.transport}': ${f}`),c=void 0,s.push(new t0(`${u.transport} failed: ${f}`,lt[u.transport])),this._connectionState!=="Connecting"){const m="Failed to select transport before stop() was called.";return this._logger.log(N.Debug,m),Promise.reject(new Pn(m))}}}}return s.length>0?Promise.reject(new n0(`Unable to connect to the server with any of the available transports. ${s.join(" ")}`,s)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(e){switch(e){case lt.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new T0(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case lt.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new k0(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case lt.LongPolling:return new gg(this._httpClient,this._logger,this._options);default:throw new Error(`Unknown transport: ${e}.`)}}_startTransport(e,n){return this.transport.onreceive=this.onreceive,this.features.reconnect?this.transport.onclose=async r=>{let i=!1;if(this.features.reconnect)try{this.features.disconnected(),await this.transport.connect(e,n),await this.features.resend()}catch{i=!0}else{this._stopConnection(r);return}i&&this._stopConnection(r)}:this.transport.onclose=r=>this._stopConnection(r),this.transport.connect(e,n)}_resolveTransportOrError(e,n,r,i){const o=lt[e.transport];if(o==null)return this._logger.log(N.Debug,`Skipping transport '${e.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${e.transport}' because it is not supported by this client.`);if(x0(n,o))if(e.transferFormats.map(a=>Rt[a]).indexOf(r)>=0){if(o===lt.WebSockets&&!this._options.WebSocket||o===lt.ServerSentEvents&&!this._options.EventSource)return this._logger.log(N.Debug,`Skipping transport '${lt[o]}' because it is not supported in your environment.'`),new Y_(`'${lt[o]}' is not supported in your environment.`,o);this._logger.log(N.Debug,`Selecting transport '${lt[o]}'.`);try{return this.features.reconnect=o===lt.WebSockets?i:void 0,this._constructTransport(o)}catch(a){return a}}else return this._logger.log(N.Debug,`Skipping transport '${lt[o]}' because it does not support the requested transfer format '${Rt[r]}'.`),new Error(`'${lt[o]}' does not support ${Rt[r]}.`);else return this._logger.log(N.Debug,`Skipping transport '${lt[o]}' because it was disabled by the client.`),new e0(`'${lt[o]}' is disabled by the client.`,o)}_isITransport(e){return e&&typeof e=="object"&&"connect"in e}_stopConnection(e){if(this._logger.log(N.Debug,`HttpConnection.stopConnection(${e}) called while in state ${this._connectionState}.`),this.transport=void 0,e=this._stopError||e,this._stopError=void 0,this._connectionState==="Disconnected"){this._logger.log(N.Debug,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is already in the disconnected state.`);return}if(this._connectionState==="Connecting")throw this._logger.log(N.Warning,`Call to HttpConnection.stopConnection(${e}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${e}) was called while the connection is still in the connecting state.`);if(this._connectionState==="Disconnecting"&&this._stopPromiseResolver(),e?this._logger.log(N.Error,`Connection disconnected with error '${e}'.`):this._logger.log(N.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(n=>{this._logger.log(N.Error,`TransportSendQueue.stop() threw error '${n}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(e)}catch(n){this._logger.log(N.Error,`HttpConnection.onclose(${e}) threw error '${n}'.`)}}}_resolveUrl(e){if(e.lastIndexOf("https://",0)===0||e.lastIndexOf("http://",0)===0)return e;if(!rt.isBrowser)throw new Error(`Cannot resolve '${e}'.`);const n=window.document.createElement("a");return n.href=e,this._logger.log(N.Information,`Normalizing '${e}' to '${n.href}'.`),n.href}_resolveNegotiateUrl(e){const n=new URL(e);n.pathname.endsWith("/")?n.pathname+="negotiate":n.pathname+="/negotiate";const r=new URLSearchParams(n.searchParams);return r.has("negotiateVersion")||r.append("negotiateVersion",this._negotiateVersion.toString()),r.has("useStatefulReconnect")?r.get("useStatefulReconnect")==="true"&&(this._options._useStatefulReconnect=!0):this._options._useStatefulReconnect===!0&&r.append("useStatefulReconnect","true"),n.search=r.toString(),n.toString()}}function x0(t,e){return!t||(e&t)!==0}class lp{constructor(e){this._transport=e,this._buffer=[],this._executing=!0,this._sendBufferedData=new kc,this._transportResult=new kc,this._sendLoopPromise=this._sendLoop()}send(e){return this._bufferData(e),this._transportResult||(this._transportResult=new kc),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(e){if(this._buffer.length&&typeof this._buffer[0]!=typeof e)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof e}`);this._buffer.push(e),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new kc;const e=this._transportResult;this._transportResult=void 0;const n=typeof this._buffer[0]=="string"?this._buffer.join(""):lp._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(n),e.resolve()}catch(r){e.reject(r)}}}static _concatBuffers(e){const n=e.map(o=>o.byteLength).reduce((o,s)=>o+s),r=new Uint8Array(n);let i=0;for(const o of e)r.set(new Uint8Array(o),i),i+=o.byteLength;return r.buffer}}class kc{constructor(){this.promise=new Promise((e,n)=>[this._resolver,this._rejecter]=[e,n])}resolve(){this._resolver()}reject(e){this._rejecter(e)}}const P0="json";class D0{constructor(){this.name=P0,this.version=2,this.transferFormat=Rt.Text}parseMessages(e,n){if(typeof e!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!e)return[];n===null&&(n=Va.instance);const r=rn.parse(e),i=[];for(const o of r){const s=JSON.parse(o);if(typeof s.type!="number")throw new Error("Invalid payload.");switch(s.type){case Se.Invocation:this._isInvocationMessage(s);break;case Se.StreamItem:this._isStreamItemMessage(s);break;case Se.Completion:this._isCompletionMessage(s);break;case Se.Ping:break;case Se.Close:break;case Se.Ack:this._isAckMessage(s);break;case Se.Sequence:this._isSequenceMessage(s);break;default:n.log(N.Information,"Unknown message type '"+s.type+"' ignored.");continue}i.push(s)}return i}writeMessage(e){return rn.write(JSON.stringify(e))}_isInvocationMessage(e){this._assertNotEmptyString(e.target,"Invalid payload for Invocation message."),e.invocationId!==void 0&&this._assertNotEmptyString(e.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(e){if(this._assertNotEmptyString(e.invocationId,"Invalid payload for StreamItem message."),e.item===void 0)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(e){if(e.result&&e.error)throw new Error("Invalid payload for Completion message.");!e.result&&e.error&&this._assertNotEmptyString(e.error,"Invalid payload for Completion message."),this._assertNotEmptyString(e.invocationId,"Invalid payload for Completion message.")}_isAckMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Ack message.")}_isSequenceMessage(e){if(typeof e.sequenceId!="number")throw new Error("Invalid SequenceId for Sequence message.")}_assertNotEmptyString(e,n){if(typeof e!="string"||e==="")throw new Error(n)}}const R0={trace:N.Trace,debug:N.Debug,info:N.Information,information:N.Information,warn:N.Warning,warning:N.Warning,error:N.Error,critical:N.Critical,none:N.None};function A0(t){const e=R0[t.toLowerCase()];if(typeof e<"u")return e;throw new Error(`Unknown log level: ${t}`)}class M0{configureLogging(e){if(ht.isRequired(e,"logging"),z0(e))this.logger=e;else if(typeof e=="string"){const n=A0(e);this.logger=new Eu(n)}else this.logger=new Eu(e);return this}withUrl(e,n){return ht.isRequired(e,"url"),ht.isNotEmpty(e,"url"),this.url=e,typeof n=="object"?this.httpConnectionOptions={...this.httpConnectionOptions,...n}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:n},this}withHubProtocol(e){return ht.isRequired(e,"protocol"),this.protocol=e,this}withAutomaticReconnect(e){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return e?Array.isArray(e)?this.reconnectPolicy=new pg(e):this.reconnectPolicy=e:this.reconnectPolicy=new pg,this}withServerTimeout(e){return ht.isRequired(e,"milliseconds"),this._serverTimeoutInMilliseconds=e,this}withKeepAliveInterval(e){return ht.isRequired(e,"milliseconds"),this._keepAliveIntervalInMilliseconds=e,this}withStatefulReconnect(e){return this.httpConnectionOptions===void 0&&(this.httpConnectionOptions={}),this.httpConnectionOptions._useStatefulReconnect=!0,this._statefulReconnectBufferSize=e==null?void 0:e.bufferSize,this}build(){const e=this.httpConnectionOptions||{};if(e.logger===void 0&&(e.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const n=new E0(this.url,e);return up.create(n,this.logger||Va.instance,this.protocol||new D0,this.reconnectPolicy,this._serverTimeoutInMilliseconds,this._keepAliveIntervalInMilliseconds,this._statefulReconnectBufferSize)}}function z0(t){return t.log!==void 0}const mg=t=>{if(typeof t=="object"&&t!==null){if(typeof Object.getPrototypeOf=="function"){const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}return Object.prototype.toString.call(t)==="[object Object]"}return!1},Vn=(...t)=>t.reduce((e,n)=>{if(Array.isArray(n))throw new TypeError("Arguments provided to ts-deepmerge must be objects, not arrays.");return Object.keys(n).forEach(r=>{["__proto__","constructor","prototype"].includes(r)||(Array.isArray(e[r])&&Array.isArray(n[r])?e[r]=Vn.options.mergeArrays?Vn.options.uniqueArrayItems?Array.from(new Set(e[r].concat(n[r]))):[...e[r],...n[r]]:n[r]:mg(e[r])&&mg(n[r])?e[r]=Vn(e[r],n[r]):e[r]=n[r]===void 0?Vn.options.allowUndefinedOverrides?n[r]:e[r]:n[r])}),e},{}),Ad={allowUndefinedOverrides:!0,mergeArrays:!0,uniqueArrayItems:!0};Vn.options=Ad;Vn.withOptions=(t,...e)=>{Vn.options=Object.assign(Object.assign({},Ad),t);const n=Vn(...e);return Vn.options=Ad,n};var U0=Object.defineProperty,Tm=t=>{throw TypeError(t)},N0=(t,e,n)=>e in t?U0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,lo=(t,e,n)=>N0(t,typeof e!="symbol"?e+"":e,n),fp=(t,e,n)=>e.has(t)||Tm("Cannot "+n),w=(t,e,n)=>(fp(t,e,"read from private field"),n?n.call(t):e.get(t)),le=(t,e,n)=>e.has(t)?Tm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Me=(t,e,n,r)=>(fp(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),on=(t,e,n)=>(fp(t,e,"access private method"),n),$0=(t,e,n,r)=>({set _(i){Me(t,e,i,n)},get _(){return w(t,e,r)}});const O0="0.0.2-alpha6",vs={Text:"Text",Number:"Number",Logic:"Logic"},sn={ValueComponent:"ValueComponent",TableComponent:"TableComponent",RecordComponent:"RecordComponent",ResourceComponent:"ResourceComponent",GraphicComponent:"GraphicComponent",CheckoutComponent:"CheckoutComponent"},F0=t=>Object.values(sn).includes(t),j0=[sn.GraphicComponent,sn.CheckoutComponent,sn.ResourceComponent,sn.RecordComponent],gn={ValueEditor:"ValueEditor",TableEditor:"TableEditor",Fiber:"Fiber",FiberEditor:"FiberEditor",CfgrField:"CfgrField"},L0=k.z.enum([gn.ValueEditor,gn.TableEditor,gn.Fiber,gn.FiberEditor,gn.CfgrField]),Tc={Fiber:"fiber",CfgrField:"cfgrField"},ur={CtrlFibers:"CtrlFibers"};function eu(t){try{return[null,t()]}catch(e){if(e instanceof Error)return[e,null];throw e}}async function ms(t){try{return[null,await t]}catch(e){if(e instanceof Error)return[e,null];throw e}}function Ml(t){return eu(()=>JSON.parse(t))}const Mr=t=>typeof t=="string",W0=t=>t===void 0||t==null||t===""||It(t)&&t.length===0,It=t=>Array.isArray(t),_r=t=>Object.prototype.toString.call(t)==="[object Object]",Md=async t=>new Promise(e=>setTimeout(e,t)),Em=k.z.string(),V0=k.z.enum([vs.Text,vs.Number,vs.Logic]),q0=t=>V0.safeParse(t).success,xm=k.z.string(),H0=t=>xm.safeParse(t).success,B0=k.z.custom(t=>Mr(t)&&t.toLowerCase()===t),Ls=t=>(t==null?void 0:t.toLowerCase())??"",Pm=k.z.string(),K0=k.z.custom(t=>Mr(t)?new RegExp(`^${sn.ValueComponent}<.*>$`).test(t):!1),X0=k.z.custom(t=>Mr(t)?new RegExp(`^${sn.RecordComponent}<.*>$`).test(t):!1),G0=k.z.custom(t=>Mr(t)?new RegExp(`^${sn.ResourceComponent}<.*>$`).test(t):!1),J0=k.z.custom(t=>Mr(t)?new RegExp(`^${sn.TableComponent}<.*>$`).test(t):!1),Dm=k.z.union([K0,J0,X0,G0,k.z.literal(sn.GraphicComponent),k.z.literal(sn.CheckoutComponent)]),yg=k.z.union([k.z.string(),k.z.number(),k.z.boolean()]),Rm=k.z.union([yg,k.z.array(yg),k.z.object({}),k.z.unknown()]),dp=k.z.object({$typ:k.z.literal("Error"),Id:k.z.string(),Message:k.z.string(),route:k.z.unknown().optional()}),bg=t=>dp.safeParse(t).success,Am=dp.or(Rm),zd=new Map;function Q0(t){const e=Ls(t.name);zd.has(e)||zd.set(e,t)}function Mm(t){const e=Ls(t);return zd.get(e)}class hp{constructor(e,n){lo(this,"name"),lo(this,"zodType"),this.name=e,this.zodType=n,Q0(this)}async getValue(){return await lg().getCmpValue(this.name)}async setInput(e){const n=Ls(this.name);await Yc().setCmpInput(n,e,this.zodType)}onValueChanged(e,n=!1,r){lg().onCmpValueChanged(this.name,e,r,n)}}const Z0=k.z.number().transform(t=>t*1e3).pipe(k.z.coerce.date());function zm(t){return t._def.typeName===k.z.ZodFirstPartyTypeKind.ZodArray}function Um(t){return t._def.typeName===k.z.ZodFirstPartyTypeKind.ZodObject}function Y0(t){const[,e]=Ml(t.description??"{}");return e?e.elementity:!1}const Nm={green:"#36D792",yellow:"#D19A66",red:"red"};function $m(t,e){return t&&e?`[${t}.${e}]`:t?`[${t}]`:e?`[${e}]`:""}function Je(t,e,n="",r,i="green"){const o=$m(t,e),s=Nm[i]??"inherit";console.log(`%c${o}%c ${n}`,`color: ${s}`,"color: inherit",r)}function et(t,e,n="",r,i="green"){const o=$m(t,e),s=Nm[i]??"inherit";console.error(`%c${o}%c ${n}`,`color: ${s}`,"color: inherit",r)}const eC=t=>_r(t)&&Object.values(t).every(e=>_r(e)&&"$key"in e&&"$idx"in e&&"definition"in e),Om=[{open:"List<",openReplace:"[",closeReplace:"]"},{open:"Table<",openReplace:"[",closeReplace:"]"},{open:`${sn.ValueComponent}<`,openReplace:`"${sn.ValueComponent}<`,closeReplace:'>"',preventInnerParsing:!0,allowInnerParsingOnRootLevel:!0},{open:"RecordComponent<",openReplace:'"RecordComponent<',closeReplace:'>"',preventInnerParsing:!0,allowInnerParsingOnRootLevel:!0},{open:"TableComponent<",openReplace:'"TableComponent<',closeReplace:'>"',preventInnerParsing:!0,allowInnerParsingOnRootLevel:!0},{open:"ResourceComponent<",openReplace:'"ResourceComponent<',closeReplace:'>"',preventInnerParsing:!0},{open:"ComposedVisual<",openReplace:'"ComposedVisual<',closeReplace:'>"',preventInnerParsing:!0},{open:"DynamicVisual<",openReplace:'"DynamicVisual<',closeReplace:'>"',preventInnerParsing:!0},{open:"Map<",openReplace:'"Map<',closeReplace:'>"',preventInnerParsing:!0},{open:"DataSource<",openReplace:'"DataSource<',closeReplace:'>"',preventInnerParsing:!0},{open:"Resource<",openReplace:"{",closeReplace:"}"},{open:"Record<{",openReplace:"{",closeReplace:""}];function tC(t){let e=1;for(let n=0;n<t.length;n++)if(t[n]==="<"?e++:t[n]===">"&&e--,e===0)return n;return-1}function Fm(t){const e=[",","}",">"],n=/=|,|<|{|}|]/,r="!!TYPEPLACEHOLDER!!";if(t.indexOf("=")===-1)return'"'+t+'"';let i="",o=!1,s=0,a=t||"";for(;a.length>0;){const c=Om.find(u=>a.indexOf(u.open)===0);if(e.includes(a[0]))i+=a[0],a=a.slice(1);else if(c){a=a.slice(c.open.length);const u=tC(a),l=c.preventInnerParsing?a.substring(0,u):Fm(a.substring(0,u)),f=c.openReplace+l+c.closeReplace;i=i.length>0?i.replace(r,f):f,a=a.slice(u+1),o=!1}else if(o){const u=a.search(n);u>0?(i=i.replace(r,'"'+a.substring(0,u)+'"')+a[u],a=a.slice(u+1)):(et("HiveUtils","_parseHiveTypeToJsonStr","Fallback: Full remaining string appended. Possible parsing issue!",{errorName:"Hive type to JSON - parsing issue",jsonObj:{typeDefinition:t}}),i+=a,a=""),o=!1}else{const u=a.indexOf("="),l=a.substring(0,u).trim();i+=`"${l}":{ "$key": "${l}", "$idx": ${s}, "definition": ${r} }`,s++,a=a.slice(u+1),o=!0}}return i}function Ud(t,e,n,r=n){if(!_r(t)&&!It(t))return t;const i=zm(e);if(It(t)&&i)return[Ud(t[0],e.element,n,r)];if(It(t)||i)return et("HiveUtils","_recursiveHiveSchemaMapping","Type mismatch because either the schema or the type expects an array!",{cmpName:n,propertyPath:r,hive:t,zod:JSON.stringify(e)}),t;if(!Um(e))return et("HiveUtils","_recursiveHiveSchemaMapping","Generated schema doesn't match the retrieved component type!",{cmpName:n,propertyPath:r,hive:t,zod:JSON.stringify(e)}),t;const o=Object.keys(e.shape).reduce((a,c)=>(a[c.toLowerCase()]=c,a),{}),s={};return Object.values(t).forEach(function(a){const c=a.$key.toLowerCase(),u=o[c];if(u){const l=e.shape[u];s[u]=a,s[u].$key=u,delete o[c];const f=r+"."+u,m=Ud(a.definition,l,u,f);s[u].definition=m}else s[a.$key]=a}),s}function _g(t){const e=t.match(/^(\w+)<.+>/),n=e&&2>=e.length?e[1]:t;if(!F0(n))throw et("HiveUtils","getBaseHiveType","Unknown base type found!",{type:t,baseType:n}),new Error(`Unknown base component type found: ${JSON.stringify({type:t,baseType:n})}`);return n}function jm(t,e){const n=(t||"").match(new RegExp("<(.+)>"));return n&&2>=n.length?n[1]:""}function nC(t){const e=t.indexOf("=")>-1,n=e&&Om.find(i=>t.indexOf(i.open)===0),r=n&&n.preventInnerParsing&&!n.allowInnerParsingOnRootLevel;return e&&!r}function rC(t,e,n){const r=jm(t)||t;let i=Lm(r);if(t.startsWith("TableComponent<")&&(i=[i]),!i){et("HiveUtils","parseAndMapSchema","Schema parsing not successful",{jsonObj:{type:r,fullType:t}});return}return i=Ud(i,e,n),i}function tu(t,e,n){const r=It(e),i=r&&It(t)&&(_r(e[0])||It(e[0]));if(W0(t)||r&&!i)return t;if(i)return t.map(s=>tu(s,e[0]));const o={};return Object.values(e.$key!==void 0?e.definition:e).forEach(function(s){const a=s.definition,c=t&&t[s.$idx];let u;It(a)&&_r(a[0])?(u=c==null?void 0:c.map(l=>tu(l,a[0])),JSON.stringify(a)):!It(a)&&_r(a)?(u=tu(c,a),JSON.stringify(a)):u=c,o[s.$key]=u}),o}function Lm(t){const e=t.replace(/Resource<\w+>/g,"Text"),n=Fm(e),[r,i]=Ml(n);return r&&et("HiveUtils","parseHiveTypeToSchema","Schema parsing resulted in an invalid JSON",{jsonObj:{typeDefinition:t,parsed:n},exc:r}),r?void 0:i}const iC={[vs.Text]:k.z.string(),[vs.Number]:k.z.number(),[vs.Logic]:k.z.boolean()};function oC(t){const e=Lm(t),n=r=>{const i=It(r),o=i?r[0]:r,s=eC(o)?k.z.object(Object.values(o).reduce((a,c)=>(a[c.$key]=n(c.definition),a),{})):iC[o];return s?i?k.z.array(s):s:(et("HiveUtils","parseHiveTypeToZodSchema","Unknown simple Hive type",{typeDefinition:t,schema:JSON.stringify(r)}),k.z.unknown())};return e?n(e):(et("HiveUtils","parseHiveTypeToZodSchema","Schema is undefined",{typeDefinition:t}),k.z.unknown())}class Nd extends Error{constructor(e){super(e),this.name="ConversionError"}}function sC(t,e,n){const r=n.safeParse(e);if(!r.success)throw new Nd(r.error.message);const i=function(o,s){if(Y0(o))return s;const a=Um(o),c=zm(o);if(a&&_r(s)){const u=o.shape;return Object.keys(u).reduce(function(l,f){const m=i(u[f],s[f]);return l.push(m),l},[])}else return c&&It(s)?s.map(function(u){return i(o.element,u)}):s};return i(n,e)}function Wm(t){return It(t)?Wm(t[0]):_r(t)}const Cg=Symbol("UnknownCmpType");function aC(t,e){if(t==null)return;const{success:n,error:r}=e.safeParse(t);if(!n)throw et("CmpUtils","_assertCmpValueValid","Parser error:",r),new Error("Value received for component doesn't match its zod schema")}function cC(t,e,n){return rC(t,e,n)}function uC(t,e,n,r){const i=nC(e),o=i?cC(e,n,r):void 0;return i&&o?tu(t,o):t}function lC(t,e,n){const r=Mm(t);if(!r)throw new Error("Component does not exist in the component definitions.");const i=r instanceof hp?uC(n,e,r.zodType,t):Cg;if(i===Cg)throw new Error("Component has unknown type.");return i&&aC(i,r.zodType),i}var Vr,Ko;class fC{constructor(){le(this,Vr,new Map),le(this,Ko,new Map)}updateCmp(e,n,r){const i=w(this,Vr).get(e)??{value:n,freshProperties:new Set};i.value=n,i.freshProperties.add("Value"),r&&w(this,Ko).set(e,{property:"Value",lazy:!1,isInitialSubscription:!0}),w(this,Vr).set(e,i)}markCmpPropertiesAsStale(e,n){const r=w(this,Vr).get(e);r&&n.forEach(i=>r.freshProperties.delete(i))}markAllCmpPropertiesAsStale(){for(const e of w(this,Vr).values())e.freshProperties.clear()}async subscribeToCmpUpdates(e,n,r=!1){Je("CmpsStore","subscribeToCmpUpdates","",{cmpName:e,property:n,lazy:r});const i=w(this,Ko).get(e);(!i||i.lazy===!0&&r===!1)&&(w(this,Ko).set(e,{property:n,lazy:r,isInitialSubscription:!1}),await Yc().subscribeToCmpUpdates(e,n,r))}async resubscribeToCmpUpdates(){const e=Yc(),n=Array.from(w(this,Ko)).filter(([,r])=>!r.isInitialSubscription).map(([r,{property:i,lazy:o}])=>e.subscribeToCmpUpdates(r,i,o));await Promise.all(n)}async getCmpValue(e){Je("CmpsStore","getCmpValue","",{name:e});const n=w(this,Vr).get(e);if(n!=null&&n.freshProperties.has("Value"))return n.value;const r=Ls(e);await Yc().fetchCmpPropertyValue([{name:r,property:"Value"}]);const i=w(this,Vr).get(e);return structuredClone(i==null?void 0:i.value)}}Vr=new WeakMap,Ko=new WeakMap;function wg(t){return t instanceof hp}function dC(t){const e=t.split("-");return{companyName:e[0],distributorName:e.length>1?e[1]:""}}function Vm(t){const{pathname:e}=new URL(t),n=new RegExp("^/(cfgr|preview|staging)/","i"),r=new RegExp("/$"),i=e.replace(n,"").replace(r,"").split("/");if(i.length<2)return;let o,s,a,c,u,l;const f=e.toLowerCase(),m=f.startsWith("/preview/"),d=f.startsWith("/staging/");m||d?(l=i[2],a=i[3],o=i[4]==="copy"?"copy":"edit",c=i[5],s=m?"preview":"staging",u=!1):f.startsWith("/cfgr/")&&(a=i[2]==="copy"?void 0:i[2],c=void 0,i[3]==="edit"?(o="edit",c=i[4]):o="copy",s="cfgr",u=i[i.length-1]!=="copy"||i[i.length-1]==="copy"&&a===void 0);const h=dC(i[0]);return{tenant:i[0],companyName:h.companyName,planName:i[1],planVersion:l||void 0,cfgnId:a||void 0,startAction:o,authToken:c||void 0,cfgrMode:s,isPresetCopy:u}}function Sg(t){const e=new RegExp("^/|/$","g"),n=new URL(t).pathname.replace(e,"").split("/"),r=["cfgr","preview","staging"];return n.length>=2&&r.includes(n[0].toLowerCase())}var qm=(t=>(t[t.NotActivated=0]="NotActivated",t[t.Activated=1]="Activated",t[t.Deactivated=2]="Deactivated",t[t.MarkedForDeletion=3]="MarkedForDeletion",t))(qm||{});const hC=k.z.object({mailNotifications:k.z.object({quoteAssignment:k.z.boolean(),insightsAssignment:k.z.boolean()})});k.z.object({id:k.z.string(),firstname:k.z.string(),lastname:k.z.string(),email:k.z.string(),isCbnAdmin:k.z.boolean().optional(),isSuperAdmin:k.z.boolean().optional(),state:k.z.nativeEnum(qm),avatarUrl:k.z.string().nullable().optional(),settings:hC});const Ig={local:void 0,session:void 0};function kg(t=!1){var e;(e=pC(t).storage)==null||e.clear()}function pC(t=!1){const e="CbnStorageTestKey",n="CbnStorageTestValue",r=t?"session":"local",i=Ig[r];if(i!==void 0)return i;const o={storage:t?window.sessionStorage:window.localStorage,writeable:!1,readable:!1};if(o.storage){try{o.storage.setItem(e,n),o.writeable=!0}catch{}try{const s=o.storage.getItem(e);o.readable=o.writeable?s===n:!0}catch{}o.writeable&&o.storage.removeItem(e)}return Ig[r]=o,o}const gC="/login",vC="redirectTo";function mC(t){kg(),kg(!0);const e=encodeURIComponent(window.location.pathname+window.location.search);window.location.href=`${gC}?${vC}=${e}`}var Hm="function",Bm="object",pp="undefined",Kn="prototype",gp=Object,yC=gp[Kn];/*! https://github.com/nevware21/ts-utils v0.12.6 */function Gt(t,e){return t||e}function ot(t,e){return t[e]}var Ut=void 0,mt=null,vp="",zl="function",dc="object",Cr="prototype",xu="__proto__",Fi="undefined",Pu="constructor",mp="Symbol",ys="length",Du="name",Tt="call",hc="toString",yp="getOwnPropertyDescriptor",jt=Gt(Object),bp=ot(jt,Cr),Km=Gt(String),bo=ot(Km,Cr),pc=Gt(Math),Xm=Gt(Array),Ul=ot(Xm,Cr),xr=ot(Ul,"slice"),Tg="_polyfill",Eg="__nw21$polytype__";function it(t,e){try{return{v:t.apply(this,e)}}catch(n){return{e:n}}}function bC(t,e,n){var r=it(t,n);return r.e?e:r.v}var of;function Nl(t){return function(e){return typeof e===t}}function Gm(t){var e="[object "+t+"]";return function(n){return!!(n&&_C(n)===e)}}function _C(t){return bp[hc].call(t)}function Ye(t){return typeof t===Fi||t===Fi}function CC(t){return t===Ut}function K(t){return t===mt||Ye(t)}function _p(t){return t===mt||t===Ut}function wC(t){return!!t||t!==Ut}function SC(t){return!of&&(of=["string","number","boolean",Fi,"symbol","bigint"]),t!==dc&&of.indexOf(t)!==-1}var de=Nl("string"),pe=Nl(zl);function Xt(t){return!t&&K(t)?!1:!!t&&typeof t===dc}var Ce=ot(Xm,"isArray"),IC=Gm("Date"),gc=Nl("number"),Jm=Nl("boolean"),Cp=Gm("Error");function fi(t){return!!(t&&t.then&&pe(t.then))}function Ru(t){return!(!t||bC(function(){return!(t&&0+t)},!t))}function wp(){}function kC(){return!1}var $t=Gt(Km),TC="[object Error]";function te(t,e){var n=vp,r=bp[hc][Tt](t);r===TC&&(t={stack:$t(t.stack),message:$t(t.message),name:$t(t.name)});try{n=JSON.stringify(t,mt,e?typeof e=="number"?e:4:Ut),n=(n?n.replace(/"(\w+)"\s*:\s{0,1}/g,"$1: "):mt)||$t(t)}catch(i){n=" - "+te(i,e)}return r+": "+n}function Yt(t){throw new Error(t)}function nr(t){throw new TypeError(t)}function $l(t){_p(t)&&nr("Cannot convert undefined or null to object")}function EC(t){de(t)||nr("'"+te(t)+"' is not a string")}function mn(t,e){return!!t&&bp.hasOwnProperty[Tt](t,e)}var xC=Gt(ot(jt,yp),wp),ii=Gt(ot(jt,"hasOwn"),PC);function PC(t,e){return $l(t),mn(t,e)||!!xC(t,e)}function De(t,e,n){if(t&&(Xt(t)||pe(t))){for(var r in t)if(ii(t,r)&&e[Tt](t,r,t[r])===-1)break}}function ee(t,e,n){if(t)for(var r=t[ys]>>>0,i=0;i<r&&!(i in t&&e[Tt](t,t[i],i,t)===-1);i++);}var _o=Ol;function Ol(t,e,n){var r=e?e[t]:mt;return function(i){var o=(i?i[t]:mt)||r;if(o||n){var s=arguments;return(o||n).apply(i,o?xr[Tt](s,1):s)}nr('"'+$t(t)+'" not defined for '+te(i))}}function DC(t){return function(e){return e[t]}}var RC=Gt(ot(jt,yp),wp),Ec={e:"enumerable",c:"configurable",v:"value",w:"writable",g:"get",s:"set"};function Qm(t){var e={};if(e[Ec.c]=!0,e[Ec.e]=!0,t.l){e.get=function(){return t.l.v};var n=RC(t.l,"v");n&&n.set&&(e.set=function(r){t.l.v=r})}return De(t,function(r,i){e[Ec[r]]=CC(i)?e[Ec[r]]:i}),e}var Qn=ot(jt,"defineProperty"),AC=ot(jt,"defineProperties");function MC(t,e,n,r,i,o){var s={e:o,c:i};return n&&(s.g=n),Qn(t,e,Qm(s))}function Ae(t,e,n){return Qn(t,e,Qm(n))}function Zm(t,e,n,r,i){var o={};return De(t,function(s,a){Au(o,s,e?a:s),Au(o,a,s)}),r?r(o):o}function Au(t,e,n,r){Qn(t,e,{value:n,enumerable:!0,writable:!1})}var zC=Gt(ot(jt,"isFrozen"),kC),Ym=ot(jt,"freeze");function UC(t){return t}function NC(t){return $l(t),t[xu]||mt}var $d=ot(jt,"assign"),wr=ot(jt,"keys");function ey(t,e){if((Ce(t)||Xt(t)||pe(t))&&!zC(t)){for(var n=0;n<e.length;n++)if(e[n]===t)return t;e.push(t),De(t,function(r,i){ey(i,e)}),Rn(t)}return t}function Ws(t){return Ym?ey(t,[]):t}var Rn=Gt(Ym,UC),Od=Gt(ot(jt,"getPrototypeOf"),NC);function $C(t){return Zm(t,1,0,Rn)}function OC(t){return Zm(t,0,0,Rn)}function FC(t){var e={};return De(t,function(n,r){Au(e,n,r[1]),Au(e,r[0],r[1])}),Rn(e)}function jC(t){return FC(t)}var ty=OC({asyncIterator:0,hasInstance:1,isConcatSpreadable:2,iterator:3,match:4,matchAll:5,replace:6,search:7,species:8,split:9,toPrimitive:10,toStringTag:11,unscopables:12}),xg="__tsUtils$gblCfg",sf;function ny(){var t;return typeof globalThis!==Fi&&(t=globalThis),!t&&typeof self!==Fi&&(t=self),!t&&typeof window!==Fi&&(t=window),!t&&typeof global!==Fi&&(t=global),t}function Fl(){if(!sf){var t=it(ny).v||{};sf=t[xg]=t[xg]||{}}return sf}var ry=ot(pc,"min"),za=ot(pc,"max"),Pg=_o("slice",bo),Bt=_o("substring",bo),Jr=Ol("substr",bo,LC);function LC(t,e,n){return $l(t),n<0?vp:(e=e||0,e<0&&(e=za(e+t[ys],0)),Ye(n)?Pg(t,e):Pg(t,e,e+n))}function Mu(t,e){return Bt(t,0,e)}function WC(t,e){return t&&(it(function(){t[Tg]=!0,t[Eg]=e}),it(Ae,[t,Tg,{v:!0,w:!1,e:!1}]),it(Ae,[t,Eg,{v:e,w:!1,e:!1}])),t}var Pr=Gt(ot(jt,"create"),VC);function VC(t,e){var n=null;function r(){}if(_p(t))n={};else{var i=typeof t;i!==dc&&i!==zl&&nr("Prototype must be an Object or function: "+te(t)),r[Cr]=t,it(function(){r[xu]=t}),n=new r}return e&&it(AC,[n,e]),n}function An(){return(Date.now||qC)()}function qC(){return new Date().getTime()}function ji(t,e,n){return t.apply(e,n)}var pt;function pi(){pt=Fl()}function iy(t,e){var n={};return!pt&&pi(),n.b=pt.lzy,Qn(n,"v",{configurable:!0,get:function(){var r=ji(t,null,e);return pt.lzy||Qn(n,"v",{value:r}),n.b=pt.lzy,r}}),n}var HC=ot(pc,"random"),BC=iy(function(){for(var t=An().toString(36).slice(2);t.length<16;)t+=HC().toString(36).slice(2);return t=t.substring(0,16),t}),Dg="_urid",KC="$nw21sym",af,XC=0;function GC(){if(!af){var t=Fl();af=t.gblSym=t.gblSym||{k:{},s:{}}}return af}var xc;function Sp(t){var e="_"+XC+++"_"+BC.v,n=mp+"("+t+")";function r(o,s){Ae(i,o,{v:s,e:!1,w:!1})}var i=Pr(null);return r("description",$t(t)),r(hc,function(){return n+KC+e}),r("valueOf",function(){return i}),r("v",n),r("_uid",e),WC(i,"symbol")}function JC(t){var e=GC();if(!ii(e.k,t)){var n=Sp(t),r=wr(e.s).length;n[Dg]=function(){return r+"_"+n[hc]()},e.k[t]=n,e.s[n[Dg]()]=$t(t)}return e.k[t]}function QC(t){!xc&&(xc={});var e,n=ty[t];return n&&(e=xc[n]=xc[n]||Sp(mp+"."+n)),e}function Cn(t){return Qn({toJSON:function(){return t}},"v",{value:t})}var oy="window",Ua;function Vs(t,e){var n;return function(){return!pt&&pi(),(!n||pt.lzy)&&(n=Cn(it(t,e).v)),n.v}}function vn(t){return!pt&&pi(),(!Ua||t===!1||pt.lzy)&&(Ua=Cn(it(ny).v||mt)),Ua.v}function nt(t,e){var n;if(!Ua||e===!1?n=vn(e):n=Ua.v,n&&n[t])return n[t];if(t===oy)try{return window}catch{}return mt}function sy(){return!!kt()}var kt=Vs(nt,["document"]);function jl(){return!!cn()}var cn=Vs(nt,[oy]);function ZC(){return!!rr()}var rr=Vs(nt,["navigator"]);function YC(){return!!ay()}var ay=Vs(nt,["history"]),ew=Vs(function(){return!!it(function(){return process&&(process.versions||{}).node}).v}),cy=Vs(function(){return!!it(function(){return self&&self instanceof WorkerGlobalScope}).v}),zs,cf;function Ll(){return zs=Cn(it(nt,[mp]).v),zs}function tw(t){var e=(pt.lzy?0:zs)||Ll();return e.v?e.v[t]:Ut}function nw(){return!!rw()}function rw(){return!pt&&pi(),((pt.lzy?0:zs)||Ll()).v}function Ip(t,e){var n=ty[t];!pt&&pi();var r=(pt.lzy?0:zs)||Ll();return r.v?r.v[n||t]:QC(t)}function Xs(t,e){!pt&&pi();var n=(pt.lzy?0:zs)||Ll();return n.v?n.v(t):Sp(t)}function kp(t){return!pt&&pi(),cf=(pt.lzy?0:cf)||Cn(it(tw,["for"]).v),(cf.v||JC)(t)}function Fd(t){return!!t&&pe(t.next)}function uy(t){return!_p(t)&&pe(t[Ip(3)])}var Pc;function Tp(t,e,n){if(t&&(Fd(t)||(!Pc&&(Pc=Cn(Ip(3))),t=t[Pc.v]?t[Pc.v]():mt),Fd(t))){var r=Ut,i=Ut;try{for(var o=0;!(i=t.next()).done&&e[Tt](n||t,i.value,o,t)!==-1;)o++}catch(s){r={e:s},t.throw&&(i=mt,t.throw(r))}finally{try{i&&!i.done&&t.return&&t.return(i)}finally{if(r)throw r.e}}}}function cs(t,e){return!Ye(e)&&t&&(Ce(e)?ji(t.push,t,e):Fd(e)||uy(e)?Tp(e,function(n){t.push(n)}):t.push(e)),t}var At=_o("indexOf",Ul),Ha=_o("map",Ul);function Wl(t,e,n){return((t?t.slice:mt)||xr).apply(t,xr[Tt](arguments,1))}var iw=_o("reduce",Ul),uf,ly=Gt(ot(jt,"setPrototypeOf"),ow);function ow(t,e){var n;return!uf&&(uf=Cn((n={},n[xu]=[],n instanceof Array))),uf.v?t[xu]=e:De(e,function(r,i){return t[r]=i}),t}function sw(t,e,n){it(Ae,[e,Du,{v:t,c:!0,e:!1}]),e=ly(e,n);function r(){this[Pu]=e,it(Ae,[this,Du,{v:t,c:!0,e:!1}])}return e[Cr]=n===mt?Pr(n):(r[Cr]=n[Cr],new r),e}function Rg(t,e){e&&(t[Du]=e)}function fy(t,e,n){var r=Error,i=r[Cr][Du],o=Error.captureStackTrace;return sw(t,function(){var s=this,a=arguments;try{it(Rg,[r,t]);var c=ji(r,s,xr[Tt](a))||s;if(c!==s){var u=Od(s);u!==Od(c)&&ly(c,u)}return o&&o(c,s[Pu]),e&&e(c,a),c}finally{it(Rg,[r,i])}},r)}var lf;function aw(t){throw lf||(lf=fy("UnsupportedError")),new lf(t)}function cw(t){return function(e){return $l(e),e&&e.replace&&(e=e.replace(t,vp)),e}}var uw=cw(/^\s+|(?=\s)\s+$/g),Ve=Ol("trim",bo,uw),an=ot(pc,"floor"),ff,df,hf;function Ot(t){if(!t||typeof t!==dc)return!1;hf||(hf=jl()?cn():!0);var e=!1;if(t!==hf){df||(ff=Function[Cr][hc],df=ff[Tt](jt));try{var n=Od(t);e=!n,e||(mn(n,Pu)&&(n=n[Pu]),e=!!(n&&typeof n===zl&&ff[Tt](n)===df))}catch{}}return e}function lw(t){return t.value&&hy(t),!0}var Ag=[pw,hy,vw,gw];function fw(t,e,n,r){var i;return ee(t,function(o){if(o.k===e)return i=o,-1}),i||(i={k:e,v:e},t.push(i),r(i)),i.v}function Ep(t,e,n,r){var i=n.handler,o=n.path?r?n.path.concat(r):n.path:[],s={handler:n.handler,src:n.src,path:o},a=typeof e,c=!1,u=e===mt;u||(e&&a===dc?c=Ot(e):u=SC(a));var l={type:a,isPrim:u,isPlain:c,value:e,result:e,path:o,origin:n.src,copy:function(f,m){return Ep(t,f,m?s:n,m)},copyTo:function(f,m){return dy(t,f,m,s)}};return l.isPrim?i&&i[Tt](n,l)?l.result:e:fw(t,e,o,function(f){Ae(l,"result",{g:function(){return f.v},s:function(h){f.v=h}});for(var m=0,d=i;!(d||(m<Ag.length?Ag[m++]:lw))[Tt](n,l);)d=mt})}function dy(t,e,n,r){if(!K(n))for(var i in n)e[i]=Ep(t,n[i],r,i);return e}function dw(t,e,n){var r={handler:n,src:e,path:[]};return dy([],t,e,r)}function hw(t,e){var n={handler:e,src:t};return Ep([],t,n)}function pw(t){var e=t.value;if(Ce(e)){var n=t.result=[];return n.length=e.length,t.copyTo(n,e),!0}return!1}function gw(t){var e=t.value;return IC(e)?(t.result=new Date(e.getTime()),!0):!1}function vw(t){return t.type===zl}function hy(t){var e=t.value;if(e&&t.isPlain){var n=t.result={};return t.copyTo(n,e),!0}return!1}function py(t,e){return ee(e,function(n){dw(t,n)}),t}function Mg(t,e,n,r,i,o,s){return py(hw(t)||{},xr[Tt](arguments))}function mw(t,e,n,r,i,o,s){return py(t||{},xr[Tt](arguments))}var gy=_o("split",bo);function vy(t,e,n){if(t&&e){var r=gy(e,"."),i=r.pop();ee(r,function(o){K(t[o])&&(t[o]={}),t=t[o]}),t[i]=n}}var yw=DC(ys),pf;function Dr(){return!pt&&pi(),(!pf||pt.lzy)&&(pf=Cn(it(nt,["performance"]).v)),pf.v}var my=ot(pc,"round"),bw=Gt(ot(jt,yp),wp),yy=Ol("endsWith",bo,_w);function _w(t,e,n){EC(t);var r=de(e)?e:$t(e),i=!Ye(n)&&n<t[ys]?n:t[ys];return Bt(t,i-r[ys],i)===r}var at=_o("indexOf",bo),gf="ref",vf="unref",mf="hasRef",Cw="enabled";function ww(t,e,n){var r=!0,i=t?e(mt):mt,o;function s(){return r=!1,i&&i[vf]&&i[vf](),o}function a(){i&&n(i),i=mt}function c(){return i=e(i),r||s(),o}function u(l){!l&&i&&a(),l&&!i&&c()}return o={cancel:a,refresh:c},o[mf]=function(){return i&&i[mf]?i[mf]():r},o[gf]=function(){return r=!0,i&&i[gf]&&i[gf](),o},o[vf]=s,o=Qn(o,Cw,{get:function(){return!!i},set:u}),{h:o,dn:function(){i=mt}}}var Sw,Iw;function kw(t){var e=pe(t)?t:Sw;if(!e){var n=Fl().tmOut||[];Ce(n)&&n.length>0&&pe(n[0])&&(e=n[0])}return e||setTimeout}function Tw(t){var e=pe(t)?t:Iw;if(!e){var n=Fl().tmOut||[];Ce(n)&&n.length>1&&pe(n[1])&&(e=n[1])}return e||clearTimeout}function by(t,e,n){var r=Ce(e),i=r?e.length:0,o=kw(i>0?e[0]:r?Ut:e),s=Tw(i>1?e[1]:Ut),a=n[0];n[0]=function(){c.dn(),ji(a,Ut,xr[Tt](arguments))};var c=ww(t,function(u){if(u){if(u.refresh)return u.refresh(),u;ji(s,Ut,[u])}return ji(o,Ut,n)},function(u){ji(s,Ut,[u])});return c.h}function yn(t,e){return by(!0,Ut,xr[Tt](arguments))}function Ew(t,e){return by(!1,Ut,xr[Tt](arguments))}(vn()||{}).Symbol;(vn()||{}).Reflect;var _y="hasOwnProperty",xw=function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)yC[_y].call(e,i)&&(t[i]=e[i])}return t},Ft=$d||xw,jd=function(t,e){return jd=gp.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)r[_y](i)&&(n[i]=r[i])},jd(t,e)};function ir(t,e){typeof e!==Hm&&e!==null&&nr("Class extends value "+String(e)+" is not a constructor or null"),jd(t,e);function n(){this.constructor=t}t[Kn]=e===null?Pr(e):(n[Kn]=e[Kn],new n)}function zg(t,e){for(var n=0,r=e.length,i=t.length;n<r;n++,i++)t[i]=e[n];return t}var Dc,zu="constructor",Rr="prototype",Uu="function",Nu="_dynInstFuncs",Ld="_isDynProxy",bs="_dynClass",Pw="_dynCls$",Wd="_dynInstChk",Ba=Wd,Cy="_dfOpts",Ug="_unknown_",xp="__proto__",Rc="_dyn"+xp,Ng="__dynProto$Gbl",yf="_dynInstProto",nu="useBaseInst",Vd="setInstFuncs",Pp=Object,Ka=Pp.getPrototypeOf,$g=Pp.getOwnPropertyNames,Og=vn(),qd=Og[Ng]||(Og[Ng]={o:(Dc={},Dc[Vd]=!0,Dc[nu]=!0,Dc),n:1e3});function ru(t){return t&&(t===Pp[Rr]||t===Array[Rr])}function Dp(t){return ru(t)||t===Function[Rr]}function fo(t){var e;if(t){if(Ka)return Ka(t);var n=t[xp]||t[Rr]||(t[zu]?t[zu][Rr]:null);e=t[Rc]||n,mn(t,Rc)||(delete t[yf],e=t[Rc]=t[yf]||t[Rc],t[yf]=n)}return e}function $u(t,e){var n=[];if($g)n=$g(t);else for(var r in t)typeof r=="string"&&mn(t,r)&&n.push(r);if(n&&n.length>0)for(var i=0;i<n.length;i++)e(n[i])}function Rp(t,e,n){return e!==zu&&typeof t[e]===Uu&&(n||mn(t,e))&&e!==xp&&e!==Rr}function Ou(t){nr("DynamicProto: "+t)}function Dw(t){var e=Pr(null);return $u(t,function(n){!e[n]&&Rp(t,n,!1)&&(e[n]=t[n])}),e}function Ap(t,e){for(var n=t.length-1;n>=0;n--)if(t[n]===e)return!0;return!1}function Rw(t,e,n,r){function i(c,u,l){var f=u[l];if(f[Ld]&&r){var m=c[Nu]||{};m[Ba]!==!1&&(f=(m[u[bs]]||{})[l]||f)}return function(){return f.apply(c,arguments)}}var o=Pr(null);$u(n,function(c){o[c]=i(e,n,c)});for(var s=fo(t),a=[];s&&!Dp(s)&&!Ap(a,s);)$u(s,function(c){!o[c]&&Rp(s,c,!Ka)&&(o[c]=i(e,s,c))}),a.push(s),s=fo(s);return o}function Aw(t,e,n,r){var i=null;if(t&&mn(n,bs)){var o=t[Nu]||Pr(null);if(i=(o[n[bs]]||Pr(null))[e],i||Ou("Missing ["+e+"] "+Uu),!i[Wd]&&o[Ba]!==!1){for(var s=!mn(t,e),a=fo(t),c=[];s&&a&&!Dp(a)&&!Ap(c,a);){var u=a[e];if(u){s=u===r;break}c.push(a),a=fo(a)}try{s&&(t[e]=i),i[Wd]=1}catch{o[Ba]=!1}}}return i}function Mw(t,e,n){var r=e[t];return r===n&&(r=fo(e)[t]),typeof r!==Uu&&Ou("["+t+"] is not a "+Uu),r}function zw(t,e,n,r,i){function o(c,u){var l=function(){var f=Aw(this,u,c,l)||Mw(u,c,l);return f.apply(this,arguments)};return l[Ld]=1,l}if(!ru(t)){var s=n[Nu]=n[Nu]||Pr(null);if(!ru(s)){var a=s[e]=s[e]||Pr(null);s[Ba]!==!1&&(s[Ba]=!!i),ru(a)||$u(n,function(c){Rp(n,c,!1)&&n[c]!==r[c]&&(a[c]=n[c],delete n[c],(!mn(t,c)||t[c]&&!t[c][Ld])&&(t[c]=o(t,c)))})}}}function Uw(t,e){if(Ka){for(var n=[],r=fo(e);r&&!Dp(r)&&!Ap(n,r);){if(r===t)return!0;n.push(r),r=fo(r)}return!1}return!0}function bf(t,e){return mn(t,Rr)?t.name||e||Ug:((t||{})[zu]||{}).name||e||Ug}function qe(t,e,n,r){mn(t,Rr)||Ou("theClass is an invalid class definition.");var i=t[Rr];Uw(i,e)||Ou("["+bf(t)+"] not in hierarchy of ["+bf(e)+"]");var o=null;mn(i,bs)?o=i[bs]:(o=Pw+bf(t,"_")+"$"+qd.n,qd.n++,i[bs]=o);var s=qe[Cy],a=!!s[nu];a&&r&&r[nu]!==void 0&&(a=!!r[nu]);var c=Dw(e),u=Rw(i,e,c,a);n(e,u);var l=!!Ka&&!!s[Vd];l&&r&&(l=!!r[Vd]),zw(i,o,e,c,l!==!1)}qe[Cy]=qd.o;var Mp=$C,Nw=jC,Kr=Mp({NONE:0,PENDING:3,INACTIVE:1,ACTIVE:2}),Us="toLowerCase",he="length",Fu="warnToConsole",vc="throwInternal",Yi="watch",ho="apply",Ee="push",Co="splice",ft="logger",Ui="cancel",mc="initialize",Qr="identifier",ju="removeNotificationListener",Lu="addNotificationListener",qn="isInitialized",Ac="getNotifyMgr",Xa="getPlugin",po="name",Nt="processNext",wy="getProcessTelContext",Li="value",us="enabled",Fg="stopPollingInternalLogs",go="unload",Mc="onComplete",Hd="version",Sy="loggingLevelConsole",vo="createNew",pr="teardown",Wu="messageId",eo="message",Sr="diagLog",Vu="_doTeardown",Ga="update",Xn="getNext",Ja="setNextPlugin",Bd="userAgent",mo="split",to="replace",Kd="substring",Iy="indexOf",oi="type",jg="evtName",dr="status",Lg="getAllResponseHeaders",Xd="isChildEvt",Sn="data",_s="getCtx",jn="setCtx",Wg="itemsReceived",zc="headers",Gs="urlString",zo="timeout",Gd="traceFlags",_f="getAttribute",Cf;function $w(t,e){Cf||(Cf=fy("AggregationError",function(r,i){i[he]>1&&(r.errors=i[1])}));var n=t;throw ee(e,function(r,i){n+=`
|
|
2
2
|
`.concat(i," > ").concat(te(r))}),new Cf(n,e||[])}/*!
|
|
3
3
|
* NevWare21 Solutions LLC - ts-async, 0.5.5
|
|
4
4
|
* https://github.com/nevware21/ts-async
|
package/dist/bundle.es.js
CHANGED
|
@@ -6,7 +6,7 @@ var L_ = (t, e, n) => e in t ? j_(t, e, { enumerable: !0, configurable: !0, writ
|
|
|
6
6
|
var ar = (t, e, n) => L_(t, typeof e != "symbol" ? e + "" : e, n), cg = (t, e, n) => e.has(t) || ag("Cannot " + n);
|
|
7
7
|
var xe = (t, e, n) => (cg(t, e, "read from private field"), n ? n.call(t) : e.get(t)), wt = (t, e, n) => e.has(t) ? ag("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), cr = (t, e, n, r) => (cg(t, e, "write to private field"), r ? r.call(t, n) : e.set(t, n), n);
|
|
8
8
|
import { z as k } from "zod";
|
|
9
|
-
const W_ = "0.0.1-
|
|
9
|
+
const W_ = "0.0.1-alpha6";
|
|
10
10
|
var Sl, gr;
|
|
11
11
|
class kE {
|
|
12
12
|
constructor(e) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { CheckoutProductCustomFields } from './types/checkout';
|
|
2
|
-
import { DiyShopCheckoutJson } from './types/checkout';
|
|
3
|
-
import { ShopifyCheckoutJson } from './types/checkout';
|
|
4
|
-
import { Shopware6CheckoutJson } from './types/checkout';
|
|
5
1
|
import { z } from 'zod';
|
|
6
2
|
|
|
7
3
|
export declare class Button {
|
|
@@ -35,7 +31,28 @@ export declare class Checkbox {
|
|
|
35
31
|
setVisible(visible: boolean): Promise<void>;
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
export
|
|
34
|
+
export declare type CheckoutProductCustomFields = {
|
|
35
|
+
/**
|
|
36
|
+
* Unique identifier
|
|
37
|
+
*/
|
|
38
|
+
id: string;
|
|
39
|
+
/**
|
|
40
|
+
* Label which the user will also see in the cart (if it is visible)
|
|
41
|
+
*/
|
|
42
|
+
label: string;
|
|
43
|
+
/**
|
|
44
|
+
* Value of the custom field
|
|
45
|
+
*/
|
|
46
|
+
value: string;
|
|
47
|
+
/**
|
|
48
|
+
* Position in the cart
|
|
49
|
+
*/
|
|
50
|
+
position: number;
|
|
51
|
+
/**
|
|
52
|
+
* If it should be visible in the cart
|
|
53
|
+
*/
|
|
54
|
+
isVisible: boolean;
|
|
55
|
+
};
|
|
39
56
|
|
|
40
57
|
declare const client: CfgrClientApi_v1 | undefined;
|
|
41
58
|
|
|
@@ -120,7 +137,7 @@ export declare class Dataview {
|
|
|
120
137
|
setVisible(visible: boolean): Promise<void>;
|
|
121
138
|
}
|
|
122
139
|
|
|
123
|
-
export
|
|
140
|
+
export declare type DiyShopCheckoutJson = Shopware6CheckoutJson;
|
|
124
141
|
|
|
125
142
|
export declare const finishConfiguration: CfgrClient['finishConfiguration'];
|
|
126
143
|
|
|
@@ -163,9 +180,94 @@ export declare class Panel {
|
|
|
163
180
|
setVisible(visible: boolean): Promise<void>;
|
|
164
181
|
}
|
|
165
182
|
|
|
166
|
-
export
|
|
183
|
+
export declare type ShopifyCheckoutJson = {
|
|
184
|
+
products: {
|
|
185
|
+
main: {
|
|
186
|
+
/**
|
|
187
|
+
* SKU id from your shop system
|
|
188
|
+
*/
|
|
189
|
+
productId: string;
|
|
190
|
+
quantity: number;
|
|
191
|
+
/**
|
|
192
|
+
* Gross price of the configured product WITHOUT accessories
|
|
193
|
+
*/
|
|
194
|
+
price: number;
|
|
195
|
+
/**
|
|
196
|
+
* Url to the image which will be used in the cart
|
|
197
|
+
*/
|
|
198
|
+
imageUrl?: string;
|
|
199
|
+
/**
|
|
200
|
+
* New title of the product
|
|
201
|
+
*/
|
|
202
|
+
title?: string;
|
|
203
|
+
/**
|
|
204
|
+
* New description of your product
|
|
205
|
+
*/
|
|
206
|
+
productText?: string;
|
|
207
|
+
customFields?: CheckoutProductCustomFields[];
|
|
208
|
+
/**
|
|
209
|
+
* Weight of the main product
|
|
210
|
+
*/
|
|
211
|
+
weight?: number;
|
|
212
|
+
/**
|
|
213
|
+
* Supported weight unit values: `KG`, `G`, `OZ`, `LB`.
|
|
214
|
+
*/
|
|
215
|
+
weightUnit?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Category id of the new product. A list of all ids can be found here:\
|
|
218
|
+
* {@link https://help.shopify.com/txt/product_taxonomy/en.txt}
|
|
219
|
+
*/
|
|
220
|
+
categoryId?: number;
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Additional predefined Shopify products which will be added to the cart (no custom price/image/title)
|
|
224
|
+
*/
|
|
225
|
+
accessories?: {
|
|
226
|
+
productId: string;
|
|
227
|
+
quantity: number;
|
|
228
|
+
}[];
|
|
229
|
+
}[];
|
|
230
|
+
};
|
|
167
231
|
|
|
168
|
-
export
|
|
232
|
+
export declare type Shopware6CheckoutJson = {
|
|
233
|
+
products: {
|
|
234
|
+
main: {
|
|
235
|
+
/**
|
|
236
|
+
* SKU id from your shop system
|
|
237
|
+
*/
|
|
238
|
+
productId: string;
|
|
239
|
+
quantity: number;
|
|
240
|
+
/**
|
|
241
|
+
* Gross price of the configured product WITHOUT accessories
|
|
242
|
+
*/
|
|
243
|
+
price: number;
|
|
244
|
+
/**
|
|
245
|
+
* Url to the image which will be used in the cart
|
|
246
|
+
*/
|
|
247
|
+
imageUrl?: string;
|
|
248
|
+
/**
|
|
249
|
+
* New title of the product
|
|
250
|
+
*/
|
|
251
|
+
title?: string;
|
|
252
|
+
/**
|
|
253
|
+
* New description of your product
|
|
254
|
+
*/
|
|
255
|
+
productText?: string;
|
|
256
|
+
customFields?: CheckoutProductCustomFields[];
|
|
257
|
+
};
|
|
258
|
+
/**
|
|
259
|
+
* Additional predefined Shopware products which will be added to the cart (no custom price/image/title)
|
|
260
|
+
*/
|
|
261
|
+
accessories?: {
|
|
262
|
+
productId: string;
|
|
263
|
+
quantity: number;
|
|
264
|
+
/**
|
|
265
|
+
* If false the product will be linked to the main product and can't be deleted from cart
|
|
266
|
+
*/
|
|
267
|
+
isSingleCartItem: boolean;
|
|
268
|
+
}[];
|
|
269
|
+
}[];
|
|
270
|
+
};
|
|
169
271
|
|
|
170
272
|
declare class Text_2 {
|
|
171
273
|
#private;
|