@factset/frontgate-js-sdk 6.10.1 → 6.10.2

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
4
4
 
5
+ ## [6.10.2] (2025-07-01)
6
+
7
+ ### Bug Fixes
8
+
9
+ - **connection:** only trigger disconenct after beeing authenticated [c58dfa9]
10
+ - **connection:** remove duplicate trigger [15fdd6b]
11
+
5
12
  ## [6.10.1] (2025-05-05)
6
13
 
7
14
  ### Bug Fixes
@@ -147,10 +147,12 @@ export const wsConnection = (conf) => {
147
147
  __classPrivateFieldGet(this, _ws, "f").onclose = (closeEvent) => {
148
148
  unhookOnFrontgateConnectionAuthenticated?.();
149
149
  this.log(LogLevel.DEBUG, 'Disconnected', closeEvent);
150
- void this.hooks.callHook('frontgateConnection:disconnected', closeEvent);
151
150
  if (__classPrivateFieldGet(this, _wsStateInternal, "f") === 'connecting' || __classPrivateFieldGet(this, _wsStateInternal, "f") === 'connected') {
152
151
  reject(JSON.stringify(closeEvent));
153
152
  }
153
+ else {
154
+ void this.hooks.callHook('frontgateConnection:disconnected', closeEvent);
155
+ }
154
156
  clearInterval(__classPrivateFieldGet(this, _keepAliveTimer, "f"));
155
157
  __classPrivateFieldSet(this, _wsStateInternal, 'disconnected', "f");
156
158
  };
@@ -1 +1 @@
1
- {"version":3,"file":"FrontgateWSMixin.js","sourceRoot":"","sources":["../../../../../src/mixins/connection/FrontgateWSMixin.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAOL,0BAA0B,GAC3B,MAAM,KAAK,CAAC;AAEb,OAAO,SAAS,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAGtC,OAAO,EAAC,oBAAoB,EAAE,YAAY,EAAC,MAAM,sBAAsB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,CAAC,iBAAiB,IAAI,GAAG;iBACjD,CAAC;YACJ,CAAC;eAaD;IACJ,CAAC,CAAC;IAEF,OAAO,0BAA0B,CAAC,kBAAkB,EAAE;QACpD,WAAW,EAAE,cAAc;QAC3B,qBAAqB,EAAE,CAAC,YAAY,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- export const PACKAGE_JSON = { version: '6.10.1', package: '@factset/frontgate-js-sdk' };
1
+ export const PACKAGE_JSON = { version: '6.10.2', package: '@factset/frontgate-js-sdk' };
2
2
  //# sourceMappingURL=version.js.map
@@ -153,10 +153,12 @@ const wsConnection = (conf) => {
153
153
  __classPrivateFieldGet(this, _ws, "f").onclose = (closeEvent) => {
154
154
  unhookOnFrontgateConnectionAuthenticated?.();
155
155
  this.log(logger_1.LogLevel.DEBUG, 'Disconnected', closeEvent);
156
- void this.hooks.callHook('frontgateConnection:disconnected', closeEvent);
157
156
  if (__classPrivateFieldGet(this, _wsStateInternal, "f") === 'connecting' || __classPrivateFieldGet(this, _wsStateInternal, "f") === 'connected') {
158
157
  reject(JSON.stringify(closeEvent));
159
158
  }
159
+ else {
160
+ void this.hooks.callHook('frontgateConnection:disconnected', closeEvent);
161
+ }
160
162
  clearInterval(__classPrivateFieldGet(this, _keepAliveTimer, "f"));
161
163
  __classPrivateFieldSet(this, _wsStateInternal, 'disconnected', "f");
162
164
  };
@@ -1 +1 @@
1
- {"version":3,"file":"FrontgateWSMixin.js","sourceRoot":"","sources":["../../../../../src/mixins/connection/FrontgateWSMixin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2BAQa;AAEb,kEAAsC;AAEtC,yCAAsC;AAGtC,yDAAwE;AACxE,2CAA4C;AAC5C,oDAAgD;AA4BzC,MAAM,YAAY,GAAG,CAAC,IAAwC,EAAE,EAAE;IACvE,MAAM,kBAAkB,GAAG,CAGzB,IAAO,EACP,EAAE;;QACF,YAAO,KAAM,SAAQ,IAAI;gBAuBv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,CAAC;gBACD,MAAA,GAAG,CAAC,MAAM,CAAC,0BAA0B,EAAC,cAAc,QAAd,cAAc,GAAK,uBAAA,IAAI,sBAAe,EAAC;gBAC7E,MAAA,GAAG,CAAC,MAAM,CAAC,0BAA0B,EAAC,OAAO,QAAP,OAAO,GAAK,uBAAA,IAAI,eAAQ,EAAC;YACjE,CAAC;+DAEmB,KAAa,EAAE,GAAe;gBAChD,OAAO,IAAI,uBAAa,CAAC;oBACvB,OAAO,EAAE,2BAA2B;oBACpC,OAAO,EAAE,CAAC;oBACV,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM;oBAC1B,MAAM,EAAE,CAAC;oBACT,OAAO,EAAE,KAAK;iBACf,CAAC,CAAC;YACL,CAAC;qEAEsB,IAAuC;gBAC5D,MAAM,kBAAkB,GAAG,IAAI,CAAC,sBAAsB,IAAI,EAAE,CAAC;gBAE7D,MAAM,eAAe,GAAG,IAAI,CAAC,mBAAmB,IAAI,kBAAkB,GAAG,OAAO,CAAC;gBAEjF,OAAO;oBACL,GAAG,IAAI;oBACP,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,YAAY;oBACnD,sBAAsB,EAAE,kBAAkB;oBAC1C,mBAAmB,EAAE,eAAe;oBACpC,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,IAAI;oBACrB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,IAAI,GAAG;iBACjD,CAAC;YACJ,CAAC;eAaD;IACJ,CAAC,CAAC;IAEF,OAAO,IAAA,8BAA0B,EAAC,kBAAkB,EAAE;QACpD,WAAW,EAAE,cAAc;QAC3B,qBAAqB,EAAE,CAAC,YAAY,CAAC;KACtC,CAAC,CAAC;AACL,CAAC,CAAC;AAxWW,QAAA,YAAY,gBAwWvB"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_JSON = void 0;
4
- exports.PACKAGE_JSON = { version: '6.10.1', package: '@factset/frontgate-js-sdk' };
4
+ exports.PACKAGE_JSON = { version: '6.10.2', package: '@factset/frontgate-js-sdk' };
5
5
  //# sourceMappingURL=version.js.map
@@ -1,4 +1,4 @@
1
- (function(d,G){typeof exports=="object"&&typeof module<"u"?G(exports):typeof define=="function"&&define.amd?define(["exports"],G):(d=typeof globalThis<"u"?globalThis:d||self,G(d.fdsg={}))})(this,function(d){"use strict";var Us=d=>{throw TypeError(d)};var lr=(d,G,X)=>G.has(d)||Us("Cannot "+X);var v=(d,G,X)=>(lr(d,G,"read from private field"),X?X.call(d):G.get(d)),O=(d,G,X)=>G.has(d)?Us("Cannot add the same private member more than once"):G instanceof WeakSet?G.add(d):G.set(d,X),R=(d,G,X,it)=>(lr(d,G,"write to private field"),it?it.call(d,X):G.set(d,X),X),q=(d,G,X)=>(lr(d,G,"access private method"),X);var $s=(d,G,X,it)=>({set _(Rt){R(d,G,Rt,X)},get _(){return v(d,G,it)}});var qe,Mt,St,He,Ge,Be,Re,Oe,ae,Vs,Ys,Ks,Qs,Xs;class Rt{constructor(e,t=-1){if(!Number.isInteger(e))throw new TypeError(`idApplication is not an integer number. Given: ${e} (${typeof e})`);if(this.idApplication=e,!Number.isInteger(t))throw new TypeError(`idUser is not an integer number. Given: ${t} (${typeof t})`);this.idUser=t}peerInfoFromMessage(e){if(e.Message==="Foundation::DisconnectionMessage"){const t=e;throw new Error(`Disconnection Message: ${t.details}`)}if(e.Message==="Foundation::AuthenticationByTokenResponse"||e.Message==="Foundation::ConfigurationResponse"){const t=e;return this.serverInfo=this.parseServerInfo(t),{uuid:t.server_info.uuid,description:t.server_info.description,software:t.server_info.software,os:t.server_info.os,maximumIdleInterval:parseInt(t.maximum_idle_interval,10),maximumReceivableMessageSize:t.maximum_receivable_message_size}}throw new Error("Could not extract server_info from unknown message type.")}parseServerInfo(e){const t=e,r=Number(BigInt(t.time_at_server.microseconds))/1e3,s=Math.ceil(Date.now()-r);return{description:t.server_info.description,software:t.server_info.software,os:t.server_info.os,time:new Date(r),offsetInMs:s}}getServerInfo(){return this.serverInfo}}var y=(n=>(n[n.TRACE=10]="TRACE",n[n.DEBUG=20]="DEBUG",n[n.INFO=30]="INFO",n[n.WARN=40]="WARN",n[n.ERROR=50]="ERROR",n[n.FATAL=60]="FATAL",n[n.SILENT=100]="SILENT",n))(y||{});const Ce=class Ce{constructor(e=""){this.defaultLevel=40,this.noop=()=>null,this.name=e,this.setDefaultLevelFromLocalStorage(),Object.assign(Ce.loggers,{[e]:this})}getName(){return this.name}setLevel(e){this.level=e}getLevel(){return typeof this.level=="number"&&isFinite(this.level)&&Math.floor(this.level)===this.level?this.level:this.defaultLevel}shouldLog(e){switch(this.getLevel()){case 100:return!1;case 60:return e==="fatal";case 50:return e==="fatal"||e==="error";case 40:return e==="fatal"||e==="error"||e==="warn";case 30:return e==="fatal"||e==="error"||e==="warn"||e==="info";case 20:return e==="fatal"||e==="error"||e==="warn"||e==="info"||e==="debug";case 10:default:return!0}}setDefaultLevelFromLocalStorage(){let e;try{if(!(typeof localStorage=="object"))return;const r=localStorage.getItem("loglevel");if(!r)return;e=r}catch{return}e&&this.setLevel(Ce.getLogLevel(e))}static getLogLevel(e){const t=e.toLowerCase();switch(t){case"silent":return 100;case"fatal":return 60;case"error":return 50;case"warn":return 40;case"info":return 30;case"debug":return 20;case"trace":return 10;default:throw new Error(`Invalid log level: ${t}`)}}static getLogger(e,t){if(Object.prototype.hasOwnProperty.call(Ce.loggers,e))return Ce.loggers[e];const r=new t(e);return Ce.loggers[e]=r,r}};Ce.loggers={};let Te=Ce;class Zs{static getLogLevel(e){const t=e.toLowerCase();switch(t){case"silent":return y.SILENT;case"fatal":return y.FATAL;case"error":return y.ERROR;case"warn":return y.WARN;case"info":return y.INFO;case"debug":return y.DEBUG;case"trace":return y.TRACE;default:throw new Error(`Invalid log level: ${t}`)}}}class an extends Te{constructor(){super(...arguments),this.trace=this.getLogMethod("trace"),this.debug=this.getLogMethod("debug"),this.info=this.getLogMethod("info"),this.warn=this.getLogMethod("warn"),this.error=this.getLogMethod("error"),this.fatal=this.getLogMethod("fatal")}setLevel(e){this.level=e,this.trace=this.getLogMethod("trace"),this.debug=this.getLogMethod("debug"),this.info=this.getLogMethod("info"),this.warn=this.getLogMethod("warn"),this.error=this.getLogMethod("error"),this.fatal=this.getLogMethod("fatal")}getLogMethod(e){if(this.shouldLog(e)){const t=e==="debug"||e==="fatal"?"log":e,r=this.name?`${this.name}: [${e.toUpperCase()}] `:`-----> [${e.toUpperCase()}] `;return Function.prototype.bind.call(console[t],console,r)}return this.noop}static getLogger(e=""){return super.getLogger(e,an)}}const eo={silent:0,fatal:1,error:2,warn:3,info:4,debug:5,trace:6};class to extends Te{constructor(e,t=""){super(t),this.name=t,this.logger=e,this.trace=Function.prototype.bind.call(e.trace,e),this.debug=Function.prototype.bind.call(e.debug,e),this.info=Function.prototype.bind.call(e.info,e),this.warn=Function.prototype.bind.call(e.warn,e),this.error=Function.prototype.bind.call(e.error,e),this.fatal=Function.prototype.bind.call(e.error,e)}setLevel(e){this.level=e,this.logger&&(this.logger.level=y[e].toLowerCase())}static getLogger(e=""){return Object.prototype.hasOwnProperty.call(Te.loggers,e)?Te.loggers[e]:null}}class at extends Te{constructor(){super(...arguments),this.trace=this.noop,this.debug=this.noop,this.info=this.noop,this.warn=this.noop,this.error=this.noop}static getLogger(e=""){return super.getLogger(e,at)}}var H=Uint8Array,te=Uint16Array,cn=Int32Array,Ot=new H([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pt=new H([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),un=new H([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gr=function(n,e){for(var t=new te(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];for(var s=new cn(t[30]),r=1;r<30;++r)for(var o=t[r];o<t[r+1];++o)s[o]=o-t[r]<<5|r;return{b:t,r:s}},vr=gr(Ot,2),br=vr.b,hn=vr.r;br[28]=258,hn[258]=28;for(var mr=gr(Pt,0),no=mr.b,yr=mr.r,ln=new te(32768),U=0;U<32768;++U){var Ee=(U&43690)>>1|(U&21845)<<1;Ee=(Ee&52428)>>2|(Ee&13107)<<2,Ee=(Ee&61680)>>4|(Ee&3855)<<4,ln[U]=((Ee&65280)>>8|(Ee&255)<<8)>>1}for(var pe=function(n,e,t){for(var r=n.length,s=0,o=new te(e);s<r;++s)n[s]&&++o[n[s]-1];var i=new te(e);for(s=1;s<e;++s)i[s]=i[s-1]+o[s-1]<<1;var a;if(t){a=new te(1<<e);var c=15-e;for(s=0;s<r;++s)if(n[s])for(var h=s<<4|n[s],u=e-n[s],l=i[n[s]-1]++<<u,b=l|(1<<u)-1;l<=b;++l)a[ln[l]>>c]=h}else for(a=new te(r),s=0;s<r;++s)n[s]&&(a[s]=ln[i[n[s]-1]++]>>15-n[s]);return a},Me=new H(288),U=0;U<144;++U)Me[U]=8;for(var U=144;U<256;++U)Me[U]=9;for(var U=256;U<280;++U)Me[U]=7;for(var U=280;U<288;++U)Me[U]=8;for(var ct=new H(32),U=0;U<32;++U)ct[U]=5;var ro=pe(Me,9,0),so=pe(Me,9,1),oo=pe(ct,5,0),io=pe(ct,5,1),fn=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},ce=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},dn=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},pn=function(n){return(n+7)/8|0},Ne=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new H(n.subarray(e,t))},ao=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],W=function(n,e,t){var r=new Error(e||ao[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,W),!t)throw r;return r},co=function(n,e,t,r){var s=n.length,o=0;if(!s||e.f&&!e.l)return t||new H(0);var i=!t,a=i||e.i!=2,c=e.i;i&&(t=new H(s*3));var h=function(At){var kt=t.length;if(At>kt){var ot=new H(Math.max(kt*2,At));ot.set(t),t=ot}},u=e.f||0,l=e.p||0,b=e.b||0,f=e.l,E=e.d,_=e.m,k=e.n,w=s*8;do{if(!f){u=ce(n,l,1);var m=ce(n,l+1,3);if(l+=3,m)if(m==1)f=so,E=io,_=9,k=5;else if(m==2){var A=ce(n,l,31)+257,N=ce(n,l+10,15)+4,g=A+ce(n,l+5,31)+1;l+=14;for(var p=new H(g),I=new H(19),C=0;C<N;++C)I[un[C]]=ce(n,l+C*3,7);l+=N*3;for(var x=fn(I),z=(1<<x)-1,P=pe(I,x,1),C=0;C<g;){var F=P[ce(n,l,z)];l+=F&15;var T=F>>4;if(T<16)p[C++]=T;else{var j=0,L=0;for(T==16?(L=3+ce(n,l,3),l+=2,j=p[C-1]):T==17?(L=3+ce(n,l,7),l+=3):T==18&&(L=11+ce(n,l,127),l+=7);L--;)p[C++]=j}}var V=p.subarray(0,A),$=p.subarray(A);_=fn(V),k=fn($),f=pe(V,_,1),E=pe($,k,1)}else W(1);else{var T=pn(l)+4,S=n[T-4]|n[T-3]<<8,M=T+S;if(M>s){c&&W(0);break}a&&h(b+S),t.set(n.subarray(T,M),b),e.b=b+=S,e.p=l=M*8,e.f=u;continue}if(l>w){c&&W(0);break}}a&&h(b+131072);for(var Je=(1<<_)-1,ee=(1<<k)-1,de=l;;de=l){var j=f[dn(n,l)&Je],Y=j>>4;if(l+=j&15,l>w){c&&W(0);break}if(j||W(2),Y<256)t[b++]=Y;else if(Y==256){de=l,f=null;break}else{var J=Y-254;if(Y>264){var C=Y-257,D=Ot[C];J=ce(n,l,(1<<D)-1)+br[C],l+=D}var ie=E[dn(n,l)&ee],me=ie>>4;ie||W(3),l+=ie&15;var $=no[me];if(me>3){var D=Pt[me];$+=dn(n,l)&(1<<D)-1,l+=D}if(l>w){c&&W(0);break}a&&h(b+131072);var Pe=b+J;if(b<$){var _e=o-$,We=Math.min($,Pe);for(_e+b<0&&W(3);b<We;++b)t[b]=r[_e+b]}for(;b<Pe;++b)t[b]=t[b-$]}}e.l=f,e.p=de,e.b=b,e.f=u,f&&(u=1,e.m=_,e.d=E,e.n=k)}while(!u);return b!=t.length&&i?Ne(t,0,b):t.subarray(0,b)},ye=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8},ut=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8,n[r+2]|=t>>16},gn=function(n,e){for(var t=[],r=0;r<n.length;++r)n[r]&&t.push({s:r,f:n[r]});var s=t.length,o=t.slice();if(!s)return{t:Er,l:0};if(s==1){var i=new H(t[0].s+1);return i[t[0].s]=1,{t:i,l:1}}t.sort(function(M,A){return M.f-A.f}),t.push({s:-1,f:25001});var a=t[0],c=t[1],h=0,u=1,l=2;for(t[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=s-1;)a=t[t[h].f<t[l].f?h++:l++],c=t[h!=u&&t[h].f<t[l].f?h++:l++],t[u++]={s:-1,f:a.f+c.f,l:a,r:c};for(var b=o[0].s,r=1;r<s;++r)o[r].s>b&&(b=o[r].s);var f=new te(b+1),E=vn(t[u-1],f,0);if(E>e){var r=0,_=0,k=E-e,w=1<<k;for(o.sort(function(A,N){return f[N.s]-f[A.s]||A.f-N.f});r<s;++r){var m=o[r].s;if(f[m]>e)_+=w-(1<<E-f[m]),f[m]=e;else break}for(_>>=k;_>0;){var T=o[r].s;f[T]<e?_-=1<<e-f[T]++-1:++r}for(;r>=0&&_;--r){var S=o[r].s;f[S]==e&&(--f[S],++_)}E=e}return{t:new H(f),l:E}},vn=function(n,e,t){return n.s==-1?Math.max(vn(n.l,e,t+1),vn(n.r,e,t+1)):e[n.s]=t},wr=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new te(++e),r=0,s=n[0],o=1,i=function(c){t[r++]=c},a=1;a<=e;++a)if(n[a]==s&&a!=e)++o;else{if(!s&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(s),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(s);o=1,s=n[a]}return{c:t.subarray(0,r),n:e}},ht=function(n,e){for(var t=0,r=0;r<e.length;++r)t+=n[r]*e[r];return t},_r=function(n,e,t){var r=t.length,s=pn(e+2);n[s]=r&255,n[s+1]=r>>8,n[s+2]=n[s]^255,n[s+3]=n[s+1]^255;for(var o=0;o<r;++o)n[s+o+4]=t[o];return(s+4+r)*8},Tr=function(n,e,t,r,s,o,i,a,c,h,u){ye(e,u++,t),++s[256];for(var l=gn(s,15),b=l.t,f=l.l,E=gn(o,15),_=E.t,k=E.l,w=wr(b),m=w.c,T=w.n,S=wr(_),M=S.c,A=S.n,N=new te(19),g=0;g<m.length;++g)++N[m[g]&31];for(var g=0;g<M.length;++g)++N[M[g]&31];for(var p=gn(N,7),I=p.t,C=p.l,x=19;x>4&&!I[un[x-1]];--x);var z=h+5<<3,P=ht(s,Me)+ht(o,ct)+i,F=ht(s,b)+ht(o,_)+i+14+3*x+ht(N,I)+2*N[16]+3*N[17]+7*N[18];if(c>=0&&z<=P&&z<=F)return _r(e,u,n.subarray(c,c+h));var j,L,V,$;if(ye(e,u,1+(F<P)),u+=2,F<P){j=pe(b,f,0),L=b,V=pe(_,k,0),$=_;var Je=pe(I,C,0);ye(e,u,T-257),ye(e,u+5,A-1),ye(e,u+10,x-4),u+=14;for(var g=0;g<x;++g)ye(e,u+3*g,I[un[g]]);u+=3*x;for(var ee=[m,M],de=0;de<2;++de)for(var Y=ee[de],g=0;g<Y.length;++g){var J=Y[g]&31;ye(e,u,Je[J]),u+=I[J],J>15&&(ye(e,u,Y[g]>>5&127),u+=Y[g]>>12)}}else j=ro,L=Me,V=oo,$=ct;for(var g=0;g<a;++g){var D=r[g];if(D>255){var J=D>>18&31;ut(e,u,j[J+257]),u+=L[J+257],J>7&&(ye(e,u,D>>23&31),u+=Ot[J]);var ie=D&31;ut(e,u,V[ie]),u+=$[ie],ie>3&&(ut(e,u,D>>5&8191),u+=Pt[ie])}else ut(e,u,j[D]),u+=L[D]}return ut(e,u,j[256]),u+L[256]},uo=new cn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Er=new H(0),ho=function(n,e,t,r,s,o){var i=o.z||n.length,a=new H(r+i+5*(1+Math.ceil(i/7e3))+s),c=a.subarray(r,a.length-s),h=o.l,u=(o.r||0)&7;if(e){u&&(c[0]=o.r>>3);for(var l=uo[e-1],b=l>>13,f=l&8191,E=(1<<t)-1,_=o.p||new te(32768),k=o.h||new te(E+1),w=Math.ceil(t/3),m=2*w,T=function(hr){return(n[hr]^n[hr+1]<<w^n[hr+2]<<m)&E},S=new cn(25e3),M=new te(288),A=new te(32),N=0,g=0,p=o.i||0,I=0,C=o.w||0,x=0;p+2<i;++p){var z=T(p),P=p&32767,F=k[z];if(_[P]=F,k[z]=P,C<=p){var j=i-p;if((N>7e3||I>24576)&&(j>423||!h)){u=Tr(n,c,0,S,M,A,g,I,x,p-x,u),I=N=g=0,x=p;for(var L=0;L<286;++L)M[L]=0;for(var L=0;L<30;++L)A[L]=0}var V=2,$=0,Je=f,ee=P-F&32767;if(j>2&&z==T(p-ee))for(var de=Math.min(b,j)-1,Y=Math.min(32767,p),J=Math.min(258,j);ee<=Y&&--Je&&P!=F;){if(n[p+V]==n[p+V-ee]){for(var D=0;D<J&&n[p+D]==n[p+D-ee];++D);if(D>V){if(V=D,$=ee,D>de)break;for(var ie=Math.min(ee,D-2),me=0,L=0;L<ie;++L){var Pe=p-ee+L&32767,_e=_[Pe],We=Pe-_e&32767;We>me&&(me=We,F=Pe)}}}P=F,F=_[P],ee+=P-F&32767}if($){S[I++]=268435456|hn[V]<<18|yr[$];var At=hn[V]&31,kt=yr[$]&31;g+=Ot[At]+Pt[kt],++M[257+At],++A[kt],C=p+V,++N}else S[I++]=n[p],++M[n[p]]}}for(p=Math.max(p,C);p<i;++p)S[I++]=n[p],++M[n[p]];u=Tr(n,c,h,S,M,A,g,I,x,p-x,u),h||(o.r=u&7|c[u/8|0]<<3,u-=7,o.h=k,o.p=_,o.i=p,o.w=C)}else{for(var p=o.w||0;p<i+h;p+=65535){var ot=p+65535;ot>=i&&(c[u/8|0]=h,ot=i),u=_r(c,u+1,n.subarray(p,ot))}o.i=i}return Ne(a,0,r+pn(u)+s)},Mr=function(){var n=1,e=0;return{p:function(t){for(var r=n,s=e,o=t.length|0,i=0;i!=o;){for(var a=Math.min(i+2655,o);i<a;++i)s+=r+=t[i];r=(r&65535)+15*(r>>16),s=(s&65535)+15*(s>>16)}n=r,e=s},d:function(){return n%=65521,e%=65521,(n&255)<<24|(n&65280)<<8|(e&255)<<8|e>>8}}},Sr=function(n,e,t,r,s){if(!s&&(s={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),i=new H(o.length+n.length);i.set(o),i.set(n,o.length),n=i,s.w=o.length}return ho(n,e.level==null?6:e.level,e.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+e.mem,t,r,s)},Ir=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},lo=function(n,e){var t=e.level,r=t==0?0:t<6?1:t==9?3:2;if(n[0]=120,n[1]=r<<6|(e.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,e.dictionary){var s=Mr();s.p(e.dictionary),Ir(n,2,s.d())}},fo=function(n,e){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&W(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&W(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2},bn=function(){function n(e,t){if(typeof e=="function"&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new H(98304),this.o.dictionary){var r=this.o.dictionary.subarray(-32768);this.b.set(r,32768-r.length),this.s.i=32768-r.length}}return n.prototype.p=function(e,t){this.ondata(Sr(e,this.o,0,0,this.s),t)},n.prototype.push=function(e,t){this.ondata||W(5),this.s.l&&W(4);var r=e.length+this.s.z;if(r>this.b.length){if(r>2*this.b.length-32768){var s=new H(r&-32768);s.set(this.b.subarray(0,this.s.z)),this.b=s}var o=this.b.length-this.s.z;this.b.set(e.subarray(0,o),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(o),32768),this.s.z=e.length-o+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||W(5),this.s.l&&W(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}(),mn=function(){function n(e,t){typeof e=="function"&&(t=e,e={}),this.ondata=t;var r=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new H(32768),this.p=new H(0),r&&this.o.set(r)}return n.prototype.e=function(e){if(this.ondata||W(5),this.d&&W(4),!this.p.length)this.p=e;else if(e.length){var t=new H(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},n.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,r=co(this.p,this.s,this.o);this.ondata(Ne(r,t,this.s.b),this.d),this.o=Ne(r,this.s.b-32768),this.s.b=this.o.length,this.p=Ne(this.p,this.s.p/8|0),this.s.p&=7},n.prototype.push=function(e,t){this.e(e),this.c(t)},n}(),po=function(){function n(e,t){this.c=Mr(),this.v=1,bn.call(this,e,t)}return n.prototype.push=function(e,t){this.c.p(e),bn.prototype.push.call(this,e,t)},n.prototype.p=function(e,t){var r=Sr(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(lo(r,this.o),this.v=0),t&&Ir(r,r.length-4,this.c.d()),this.ondata(r,t)},n.prototype.flush=function(){bn.prototype.flush.call(this)},n}(),go=function(){function n(e,t){mn.call(this,e,t),this.v=e&&e.dictionary?2:1}return n.prototype.push=function(e,t){if(mn.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(fo(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&W(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),mn.prototype.c.call(this,t)},n}(),Ar=typeof TextEncoder<"u"&&new TextEncoder,yn=typeof TextDecoder<"u"&&new TextDecoder,vo=0;try{yn.decode(Er,{stream:!0}),vo=1}catch{}var bo=function(n){for(var e="",t=0;;){var r=n[t++],s=(r>127)+(r>223)+(r>239);if(t+s>n.length)return{s:e,r:Ne(n,t-1)};s?s==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):s&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}};function mo(n,e){var t;if(Ar)return Ar.encode(n);for(var r=n.length,s=new H(n.length+(n.length>>1)),o=0,i=function(h){s[o++]=h},t=0;t<r;++t){if(o+5>s.length){var a=new H(o+8+(r-t<<1));a.set(s),s=a}var c=n.charCodeAt(t);c<128||e?i(c):c<2048?(i(192|c>>6),i(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|n.charCodeAt(++t)&1023,i(240|c>>18),i(128|c>>12&63),i(128|c>>6&63),i(128|c&63)):(i(224|c>>12),i(128|c>>6&63),i(128|c&63))}return Ne(s,0,o)}function yo(n,e){var t;if(yn)return yn.decode(n);var r=bo(n),s=r.s,t=r.r;return t.length&&W(8),s}const wo=n=>{if(n.length===1)return n[0];const e=new Uint8Array(n.reduce((t,r)=>t+r.length,0));for(let t=0,r=0;t<n.length;++t)e.set(n[t],r),r+=n[t].length;return e};class kr{constructor(){this.reset()}reset(){this.compressor=null,this.decompressor=null}compress(e){this.compressor||(this.compressor=new po({mem:4}));const t=[];return this.compressor.ondata=r=>{t.push(r)},this.compressor.push(mo(e)),this.compressor.flush(),wo(t)}decompress(e){this.decompressor||(this.decompressor=new go);let t;this.decompressor.ondata=r=>{t=r};try{if(this.decompressor.push(e),t===void 0)throw new Error("invalid block type")}catch(r){throw new Error(`Decompression error: ${r.message}, length: ${e.length}, data: [${e.toString()}]`)}return yo(t)}}const we=class we{static isSupportedEncoding(e){return we.SUPPORTED_ENCODINGS.includes(e)}static isPlainJson(e){return we.PLAIN_JSON_ENCODINGS.includes(e)}static isCompressedJson(e){return we.COMPRESSED_ENCODINGS.includes(e)}};we.SUPPORTED_ENCODINGS=["jsjson-v2","jsjsonc-v2"],we.PLAIN_JSON_ENCODINGS=["jsjson-v2"],we.COMPRESSED_ENCODINGS=we.SUPPORTED_ENCODINGS.filter(e=>e.includes("jsonc"));let Se=we;const _o="Mdg2Client",Cr="BST",wn=6e3,Rr=3e3,To=9e3,Or=3,Eo=!1,Mo=9e3,Pr=!1,Nr=512;function So(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _n,jr;function Io(){if(jr)return _n;jr=1;var n=function(m){return e(m)&&!t(m)};function e(w){return!!w&&typeof w=="object"}function t(w){var m=Object.prototype.toString.call(w);return m==="[object RegExp]"||m==="[object Date]"||o(w)}var r=typeof Symbol=="function"&&Symbol.for,s=r?Symbol.for("react.element"):60103;function o(w){return w.$$typeof===s}function i(w){return Array.isArray(w)?[]:{}}function a(w,m){return m.clone!==!1&&m.isMergeableObject(w)?_(i(w),w,m):w}function c(w,m,T){return w.concat(m).map(function(S){return a(S,T)})}function h(w,m){if(!m.customMerge)return _;var T=m.customMerge(w);return typeof T=="function"?T:_}function u(w){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(w).filter(function(m){return Object.propertyIsEnumerable.call(w,m)}):[]}function l(w){return Object.keys(w).concat(u(w))}function b(w,m){try{return m in w}catch{return!1}}function f(w,m){return b(w,m)&&!(Object.hasOwnProperty.call(w,m)&&Object.propertyIsEnumerable.call(w,m))}function E(w,m,T){var S={};return T.isMergeableObject(w)&&l(w).forEach(function(M){S[M]=a(w[M],T)}),l(m).forEach(function(M){f(w,M)||(b(w,M)&&T.isMergeableObject(m[M])?S[M]=h(M,T)(w[M],m[M],T):S[M]=a(m[M],T))}),S}function _(w,m,T){T=T||{},T.arrayMerge=T.arrayMerge||c,T.isMergeableObject=T.isMergeableObject||n,T.cloneUnlessOtherwiseSpecified=a;var S=Array.isArray(m),M=Array.isArray(w),A=S===M;return A?S?T.arrayMerge(w,m,T):E(w,m,T):a(m,T)}_.all=function(m,T){if(!Array.isArray(m))throw new Error("first argument should be an array");return m.reduce(function(S,M){return _(S,M,T)},{})};var k=_;return _n=k,_n}var Ao=Io();const Dr=So(Ao);class ko extends Error{constructor(e="Service Unavailable",t){super(e,{cause:t}),this.name="ServiceUnavailableError",this.code=503}}class Co extends Error{constructor(e="Internal Server Error",t){super(e,{cause:t}),this.name="InternalServerError",this.code=500}}class xr extends Error{constructor(e="Timeout",t){super(e,{cause:t}),this.name="TimeoutError",this.code=408}}class Ro extends Error{constructor(e="Unauthorized",t){super(e,{cause:t}),this.name="UnauthorizedError",this.code=401}}class Oo extends Error{constructor(e="Bad Request",t){super(e,{cause:t}),this.name="BadRequestError",this.code=400}}class Po extends Error{constructor(e,t){super(e,{cause:t}),this.name="ResponseError",this.response=t}}function No(n){return!!n&&typeof n=="object"}function jo(...n){const e=n.filter(No);return Dr.all(e,{arrayMerge:(t,r)=>r})}function Tn(n){return n.replace(/[=]/g,"").replace(/\//g,"_").replace(/\+/g,"-")}function Do(n){return/^[A-Za-z0-9_-]*$/.test(n)}function xo(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4!==0;)e+="=";switch(e.length%4){case 0:break;case 1:e+="===";break;case 2:e+="==";break;case 3:e+="=";break}return e}const En=n=>{var r,s,o,i;let e="Unknown",t=500;if(n.name==="Foundation::PermissionDeniedResponse")t=403,e=`Permission Denied. Job ID: ${n.jobId} failed with status code ${t} `;else if(n.name==="Foundation::ErrorResponse"&&n.reason){const a=n.reason.startsWith("{"),c=a?JSON.parse(n.reason)||{}:n.reason;a&&((r=c.errors)!=null&&r[0].details)?e=c.errors[0].details:typeof c=="string"&&(e=c),t=parseInt(((o=(s=c==null?void 0:c.meta)==null?void 0:s.status)==null?void 0:o.code)??((i=n.msg.reason)==null?void 0:i.value)??500,10)}return new Po(`${e} (${t})`,n)},Fo=async n=>new Promise(e=>{setTimeout(e,n)}),Uo=()=>typeof window>"u",tt=class tt{constructor(){this._timeAtSender=Date.now()}getPtlMessage(){return{Message:tt.NAME,Version:tt.VERSION,time_at_sender:{microseconds:this._timeAtSender*1e3}}}resetTimeAtSender(){this._timeAtSender=Date.now()}get timeAtSender(){return this._timeAtSender}};tt.NAME="PingRequest",tt.VERSION=3;let ze=tt;var Fr=(n=>(n.MAXIMUM_STRING="9223372036854775807",n.MINIMUM_STRING="-9223372036854775807",n))(Fr||{});function Nt(n){return n.toString().slice(0,-3)}const nt=class nt{constructor(e){if(e.Message!==nt.NAME)throw new Error(`Unsupported message=${e.Message}`);if(e.Version!==nt.VERSION)throw new Error(`Unsupported version=${e.Version} for message=${e.Message}`);this._timeReceivedResponse=Date.now(),this._timeAtSender=Number(Nt(e.time_at_sender.microseconds)),this._timeFromRequest=Number(Nt(e.time_from_request.microseconds))}get timeAtPeer(){return this._timeAtSender}get timeOfRequest(){return this._timeFromRequest}get timeOfResponse(){return this._timeReceivedResponse}get latencyTotal(){return this._timeReceivedResponse-this._timeFromRequest}get latencyAtPeer(){return this._timeAtSender-this._timeFromRequest}};nt.NAME="Foundation::PingResponse",nt.VERSION=2;let je=nt;var Ie=(n=>(n[n.DISCONNECTED=0]="DISCONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.AUTHENTICATED=2]="AUTHENTICATED",n[n.RECONNECTING=3]="RECONNECTING",n))(Ie||{}),Ur=(n=>(n[n.production=40]="production",n[n.preproduction=35]="preproduction",n[n.show=30]="show",n[n.testing=20]="testing",n))(Ur||{}),$r=(n=>(n.production="frontgate-eu.factsetdigitalsolutions.com",n.show="frontgate-eu.show.factsetdigitalsolutions.com",n))($r||{});const nn=class nn{constructor(e,t){if(this.reconnectDelays=[1e3,2e3,4e3,8e3,16e3,32e3],this.reconnectCounter=0,this.connectionCounter=0,this.onConnect=null,this.onMessage=null,this.onClose=null,this.onError=null,this.onAuthentication=null,this.onCleanupRequests=null,this.onCleanupSubscriptions=null,this.onClearPendingSubscription=null,this.onReceiveTimeout=null,this.restartSubscriptions=null,this.options={...nn.DEFAULT_OPTIONS,...t},this.auth=e,this.state=0,this.options.logger&&(this.logger=this.options.logger),this.timestampOfLastMessageSent=0,this.jobId=0,this.peerInfo=null,this.compressor=new kr,this.keepAliveIntervalHandle=null,this.hasActiveSession=!1,this.options.loglevel&&this.logger.setLevel(this.options.loglevel),!Se.isSupportedEncoding(this.options.encoding))throw new Error(`Unknown or unsupported encoding: ${this.options.encoding}`);this.messageProcessors={},this.setMessageProcessor("Foundation::LoadNotificationMessage",this.handleLoadNotificationMessage.bind(this)),this.setMessageProcessor("Foundation::KeepAliveMessage",this.handleKeepAliveMessage.bind(this)),this.setMessageProcessor("Foundation::PingResponse",this.handlePingResponseMessage.bind(this)),this.setMessageProcessor("Foundation::DisconnectionMessage",this.handleDisconnectionMessage.bind(this))}setMessageProcessor(e,t){this.messageProcessors[e]=t}removeMessageProcessor(e){this.messageProcessors[e]!==void 0&&(this.messageProcessors[e]=void 0)}async close(){if(!this.isAuthenticated()){this.logger.warn("Cannot close gracefully. Connection not open. Proceeding to handleClose."),await this.handleClose("Unauthenticated connection");return}try{await this.sendDisconnectionMessage()}catch(e){await this.handleClose(e.message)}}setPeerInfo(e){this.peerInfo={...this.peerInfo,...e}}isAuthenticated(){return this.state===2}isConnecting(){return this.state===1}clearPendingConnection(){this.pendingConnection=null}isPendingConnection(){return this.pendingConnection instanceof Promise}handleLoadNotificationMessage(e){return this.peerInfo&&(this.peerInfo.loadStatus=e.load),!1}handleKeepAliveMessage(){return!1}handlePingResponseMessage(e){const t=new je(e);return this.logger.debug(`Time in ms: Request=${t.timeOfRequest} Peer=${t.timeAtPeer} Response=${t.timeOfResponse}`),this.logger.debug(`Latency in ms: Total=${t.latencyTotal} Peer=${t.latencyAtPeer}`),!1}async handleDisconnectionMessage(e){await this.handleClose(`DisconnectionMessage received: '${e.details}`),this.onClose&&this.onClose(e.details)}handleAuthentication(){this.state=2;const e=1e3;this.keepAliveIntervalHandle=setInterval(()=>{this.sendKeepAliveMessage()},e),this.onAuthentication&&this.onAuthentication()}handleReceiveTimeout(){this.messageReceiveTimeout&&clearTimeout(this.messageReceiveTimeout),this.onReceiveTimeout&&this.onReceiveTimeout()}resetReceiveTimeout(){var t;if(!((t=this.peerInfo)!=null&&t.maximumIdleInterval))return;const e=this.peerInfo.maximumIdleInterval/1e3*2;this.messageReceiveTimeout&&clearTimeout(this.messageReceiveTimeout),this.messageReceiveTimeout=setTimeout(()=>{this.handleReceiveTimeout()},e)}handleStandardMessage(e){return this.onMessage&&this.onMessage(e),!0}handleMessage(e){if(!e.Message)return;this.resetReceiveTimeout();const t=this.messageProcessors[e.Message];if(t!==void 0){if(!t(e))return}else this.handleStandardMessage(e);return e}async handleClose(e){if(typeof e=="string")this.logger.warn(`Handling connection close event. Reason: ${e}`);else{const{code:s,reason:o,wasClean:i,type:a}=e;this.logger.warn("Handling connection close event.",{code:s,reason:o,wasClean:i,type:a})}this.onCleanupRequests&&this.onCleanupRequests(),!this.shouldRestartSubscriptions&&this.onCleanupSubscriptions&&this.onCleanupSubscriptions(),this.keepAliveIntervalHandle&&(clearInterval(this.keepAliveIntervalHandle),this.keepAliveIntervalHandle=null),this.state=0,this.compressor.reset(),this.peerInfo=null,this.messageReceiveTimeout&&(clearTimeout(this.messageReceiveTimeout),this.messageReceiveTimeout=null),typeof e=="string"&&e.includes("DisconnectionMessage")&&(this.logger.debug("Disconnect message received. Preventing reconnect. Potential authentication failure."),this.options.shouldReconnectOnConnectionLoss=!1),this.auth.reconnectable&&this.options.shouldReconnectOnConnectionLoss?(this.onMessage=null,await this.reconnect()):(this.onClose&&this.onClose(e),this.onMessage=null,this.onClose=null,this.onError=null)}async reconnect(){for(;!this.isAuthenticated();){this.compressor.reset(),this.peerInfo=null,this.state=3;try{const e=this.reconnectDelays.length-1;let t=this.reconnectDelays[this.reconnectCounter]??this.reconnectDelays[e];t+=Math.floor(Math.random()*50);const r=this.reconnectCounter?`(${this.reconnectCounter} attempts)`:"";this.logger.warn(`Trying to reconnect. Waiting ${t} ms ${r}`),this.reconnectCounter++,await this.open(t),this.shouldRestartSubscriptions&&this.restartSubscriptions&&this.restartSubscriptions()}catch(e){this.logger.error("Failed to reconnect",e)}}this.reconnectCounter=0}handleWsError(e){this.close().then(()=>{this.logger.error("Connection closed due to WebSocket error")}),this.logger.error("WebSocket error: ",e),this.onError&&this.onError(e)}preSubmit(e){if(e.Message){const t=this.returnAndAssignJobIdToMessage(e);return this.logger.trace("PreSubmit",{message:e.Message,jobId:t}),t}throw new TypeError("Expected message type. Must be JSON message object or Array of JSON message objects")}async sendKeepAliveMessage(){const e=Date.now()-this.timestampOfLastMessageSent,t=this.options.maximum_idle_interval/1e3/2;if(!(this.timestampOfLastMessageSent>0&&e>t))return;const s=this.options.enablePingPongKeepalive??Uo()?new ze().getPtlMessage():{Message:"KeepAliveMessage",Version:2};await this.submit(s)}async sendDisconnectionMessage(e="client shutdown",t=64){const r={Message:"Foundation::DisconnectionMessage",Version:3,reason:{value:t},details:e};await this.submit(r),await this.handleClose("Disconnected by User.")}returnAndAssignJobIdToMessage(e){if(typeof e!="object")throw new TypeError(`expected object, not ${typeof e}`);if(typeof e.Message>"u")throw new TypeError("expected object to have a 'Message' member");return!/Request$/.exec(e.Message)||typeof e.header>"u"?null:(e.header.id_job||(this.jobId=this.jobId>=Number.MAX_SAFE_INTEGER?1:this.jobId+1,e.header.id_job=this.jobId),e.header.id_job)}setLogger(e){this.logger=e}};nn.DEFAULT_OPTIONS={payload_content:"foundation",deployment_stage:30,logger:at.getLogger(_o),loglevel:y.WARN,maximum_idle_interval:45e6,host:"frontgate-eu.show.factsetdigitalsolutions.com",port:443,tls:!0,path_prefix:"",encoding:"jsjsonc-v2",split_authentication_token_second_factor:void 0,shouldReconnectOnConnectionLoss:!0,connectionTimeoutInMs:To,sessionHandling:!1};let jt=nn;var ge=null;typeof WebSocket<"u"?ge=WebSocket:typeof MozWebSocket<"u"?ge=MozWebSocket:typeof global<"u"?ge=global.WebSocket||global.MozWebSocket:typeof window<"u"?ge=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(ge=self.WebSocket||self.MozWebSocket);class Ve{constructor(){this.promiseFinally=async(e,t)=>{const r=o=>(t(),o),s=async o=>(t(),Promise.reject(o));return Promise.resolve(e).then(r,s)},this._id=null,this._delay=null}static async wrap(e,t,r=""){return new Ve().wrap(e,t,r)}get id(){return this._id}get delay(){return this._delay}async set(e,t=""){return new Promise((r,s)=>{this.clear();const o=t?()=>{s(new xr(t))}:r;this._id=setTimeout(o,e),this._delay=e})}async wrap(e,t,r=""){const s=this.promiseFinally(e,()=>{this.clear()}),o=this.set(t,r);return Promise.race([s,o])}clear(){this._id&&clearTimeout(this._id)}}class lt extends jt{constructor(e,t){if(typeof ge>"u")throw new Co("WebSocketClient not supported, WebSocket() missing in JavaScript environment");super(e,lt.sanitizeOptions(t)),this.ws=null;const{encoding:r}=this.options;if(!Se.isSupportedEncoding(r))throw new Oo(`Unknown or unsupported encoding: ${r}`);this.onReceiveTimeout=()=>{this.logger.debug("onReceiveTimeout: Closing connection"),super.close().then(()=>{var s;(s=this.ws)==null||s.close()})}}async openConnection(){this.state===Ie.RECONNECTING&&this.auth.onReconnect&&await this.auth.onReconnect(),this.logger.info("Opening new connection",{host:this.options.host});try{await this.openWebSocket()}catch(e){throw this.logger.error("Problem opening connection",e),new ko(e.message,e)}this.logger.info(`Performing ${this.auth.constructor.name}`);try{await this.performAuthentication(),this.logger.debug("WebSocket authenticated")}catch(e){throw this.logger.error("Authentication problem occurred:",e),new Ro(e.message,e)}this.ws&&(this.ws.onclose=this.handleClose.bind(this),this.ws.onerror=this.handleWsError.bind(this))}async performAuthentication(){await new Promise((e,t)=>{this.ws?(this.ws.onclose=()=>{this.state=Ie.DISCONNECTED,t(new Error("Connection closed by server. Check credentials."))},this.ws.onerror=r=>{this.close(),t(new Error(`WebSocket error during authentication: ${r.message}`))},this.auth.authenticate(this).then(e).catch(t)):t(new Error("WebSocket not initialized"))}),this.handleAuthentication()}async open(e){this.onConnect&&(this.logger.trace("onConnect()"),this.onConnect());const t=this.options.connectionTimeoutInMs,r=`Connection timeout after ${t} ms`,s=async o=>o instanceof xr&&!this.pendingConnection?Promise.resolve():Promise.reject(o);if(this.isPendingConnection()&&this.pendingConnection){this.connectionCounter++;const o=Date.now();return this.logger.warn(`Waiting for pending connection (${this.connectionCounter}) with a timeout of ${t} ms`),Ve.wrap(this.pendingConnection,t,r).catch(s).then(()=>{const i=Date.now()-o;this.logger.warn(`Pending connection (${this.connectionCounter}) resolved after ${i} ms`)})}return e?(this.logger.debug(`Opening ${e} ms delayed connection with a timeout of ${t} ms`),this.pendingConnection=Fo(e).then(async()=>Ve.wrap(this.openConnection(),t,r)).catch(s).finally(()=>{this.clearPendingConnection()}),this.pendingConnection):(this.logger.debug(`Opening connection with a timeout of ${t} ms `),this.pendingConnection=Ve.wrap(this.openConnection(),t,r).catch(s).finally(()=>{this.clearPendingConnection()}),this.pendingConnection)}async close(e=!1,t=!1){this.logger.info("Closing connection explicitly"),this.options.shouldReconnectOnConnectionLoss=e,await super.close(),this.ws&&(this.clearPendingConnection(),this.ws.onclose=this.handleClose.bind(this),this.ws.close(),this.state=Ie.DISCONNECTED),t&&!e&&this.options.sessionHandling&&this.hasActiveSession&&(this.logger.info("Session logout"),await this.openWebSocket(!0))}send(e){const t=this.preSubmit(e),r=this.submit(e);return r.idJob=t,r}async submit(e){this.timestampOfLastMessageSent=Date.now();const t=new Promise(r=>{switch(this.logger.debug(`Sending ${e.Message}`,{...e}),this.sendMessage(e),this.resolveOnMessage=r,e.Message){case"Foundation::DisconnectionMessage":case"Foundation::KeepAliveMessage":case"Foundation::PingRequest":r({Message:"This message does not have a response",Version:1});break}});return t.catch(r=>{const s=new Date(this.timestampOfLastMessageSent);this.logger.error(`Failed sending ${e.Message}`,r,{request:e,lastMsgDate:s})}),t}sendMessage(e){var r;let t=JSON.stringify(e);Se.isCompressedJson(this.options.encoding)&&(t=this.compressor.compress(t)),(r=this.ws)==null||r.send(t)}async openWebSocket(e=!1){return this.logger.debug("Open WebSocket"),new Promise((t,r)=>{const{encoding:s,tls:o,host:i,port:a,path_prefix:c,frontgateSplitAuthenticationTokenSecondFactor:h,webSocketClientOptions:u,sessionHandling:l,frontgateAuthenticationToken:b}=this.options,E=`${o?"wss":"ws"}://${i}:${a}${c}/ws`,[_,k]=s.split("-"),m=[`${k?`${k}.`:""}ws-${_}.mdgms.com`];h?(m.push(`mdg2auth-${h}`),this.options.frontgateSplitAuthenticationTokenSecondFactor=null):l&&(e?m.push("mdg2wstoken-0"):this.clientOptions.otpToken?(m.push(`mdg2wstoken-${Tn(this.clientOptions.otpToken)}`),this.clientOptions.otpToken=""):b?typeof window<"u"&&m.push(`mdg2wstoken-${Tn(b)}`):m.push("mdg2wstoken-1")),this.state=Ie.CONNECTING,u?this.ws=new ge(E,m,u):this.ws=new ge(E,m),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{this.logger.info("WebSocket connected",{wsUrl:E,subProtocols:m}),e&&(this.logger.info("User logged out"),this.ws&&this.ws.close()),this.hasActiveSession=!e&&l,t()},this.ws.onclose=T=>{this.state=Ie.DISCONNECTED;const S=T.reason?`: ${T.reason}`:"";r(new Error(`Connection closed while trying to connect${S}`))},this.ws.onerror=this.handleWsError.bind(this),this.ws.onmessage=this.onWebSocketMessage.bind(this)})}onWebSocketMessage(e){if(this.state===Ie.DISCONNECTED){this.logger.warn("onWebSocketMessage while state is disconnected",{data:e.data});return}const t=this.decodeMessage(e.data),r=this.handleMessage(t);this.logger.debug(`Received ${t.Message}`,t),r&&this.resolveOnMessage(r)}decodeMessage(e){const{encoding:t}=this.options;try{if(e instanceof ArrayBuffer&&Se.isCompressedJson(t)){const r=this.compressor.decompress(new Uint8Array(e));return JSON.parse(r)}if(typeof e=="string"&&Se.isPlainJson(t))return JSON.parse(e)}catch(r){this.logger.error("Decoding message failed",r)}return String(e.constructor.name)==="Buffer"?e:(this.logger.error(`Could not decode Message of type "${typeof e}" with encoding "${t}".`),{Message:`Invalid Message Type ${typeof e}`,Version:1})}static sanitizeOptions(e={}){return e.frontgateHost&&(e.host=e.frontgateHost),e.frontgatePathPrefix&&(e.path_prefix=e.frontgatePathPrefix),e.frontgateSplitAuthenticationTokenSecondFactor&&(e.split_authentication_token_second_factor=e.frontgateSplitAuthenticationTokenSecondFactor),e.frontgateWebsocketProtocol&&(e.encoding=e.frontgateWebsocketProtocol),e.deploymentStage&&(e.deployment_stage=e.deploymentStage),e}handleWsError(e){typeof process<"u"&&this.close(this.options.shouldReconnectOnConnectionLoss).then(()=>{this.logger.error("Connection closed due to WebSocket error")}),this.logger.error("WebSocket error: ",e),this.onError&&this.onError(e)}}var Lr=(n=>(n.FRONTGATE_HOST="frontgate-host",n.FRONTGATE_PATH_PREFIX="frontgate-path-prefix",n.FRONTGATE_SPLIT_AUTHENTICATION_TOKEN_SECOND_FACTOR="frontgate-split-authentication-token-second-factor",n.FRONTGATE_AUTHENTICATION_TYPE="frontgate-authentication-type",n.FRONTGATE_AUTHENTICATION_TOKEN="frontgate-authentication-token",n.FRONTGATE_WEBSOCKET_PROTOCOL="frontgate-websocket-protocol",n))(Lr||{});function $o(n){const e=[];if(n)for(let t=0;t<n.length;t++)e.push(n.readInt8(t));return e}function qr(n){const e={},t=Object.keys(n);return["frontgate-host","frontgate-path-prefix","frontgate-split-authentication-token-second-factor","frontgate-authentication-type","frontgate-authentication-token","frontgate-websocket-protocol"].forEach(r=>{t.includes(r)&&(e[r.replace(/-([a-z])/g,s=>s[1].toUpperCase())]=n[r])}),e}function Hr(n){const e={};return n.forEach((t,r)=>{e[r]=t}),e}async function Dt(n,e){const t=await fetch(n,e),r=Hr(t.headers);return{config:qr(r),response:t}}function Gr(n={},e,t){const r=n.frontgateAuthenticationType==="token"?new kn(n.frontgateAuthenticationToken):new Cn;return r.setFetchConfiguration(e,t),new lt(r,n)}function Br({frontgateHost:n,frontgateWebsocketProtocol:e}){localStorage.setItem("mdg2config",JSON.stringify({frontgateHost:n,frontgateWebsocketProtocol:e}))}function Jr(){const n=localStorage.getItem("mdg2config");return n?JSON.parse(n):null}function Wr(n){return n.name==="Foundation::ErrorResponse"}function zr(n){return n.name==="Foundation::PermissionDeniedResponse"}function Vr(n){return n.name==="Foundation::HighLevelResponse"}function Yr(n){return n.Message==="Foundation::HighLevelResponse"}function Kr(n){return n.name==="Foundation::RejectResponse"}function xt(n){return n.name==="Foundation::HighLevelUpdate"}function Qr(n){return n.name==="Foundation::SubscriptionLossMessage"}const Xr={version:"6.10.1",package:"@factset/frontgate-js-sdk"};function Lo(){const n=qo();return{userAgent:n.userAgent,platform:n.platform,version:Xr.version,package:Xr.package,mobile:/Mobi/i.test(n.userAgent)}}function qo(){return typeof navigator<"u"?navigator:typeof process<"u"?{userAgent:`node.js/io.js, ${process.version}`,platform:`${process.platform}_${process.arch}`}:{userAgent:"unknown",platform:"unknown"}}const Ho=n=>{const e=[18,20,9],t=r=>{for(let s=r.length;s>r.length-16;s-=2){let o=parseInt(r.substring(s-2,s),16);o>127&&(o-=256),e.push(o)}};return t(n.traceId),e.push(17),t(n.spanId),e.push(24),e.push(0),e},Go=async(n,e)=>new Promise((t,r)=>{setTimeout(()=>{r(e)},n)}),ue=async(n,e,t)=>Promise.race([Go(n,e),t]),Zr=n=>n+Math.random()*100,he=class he{constructor(){this.headerMembers={dataset:{id_dataset:0},id_job:0,flags_r2:0,resend_counter:0,timeout:wn,authentication_identifiers:{id_application:0,id_user:0},cache_key:{value:[]},previous_response_hash:{value:[]},tracing:{value:{value:[]}}},this.flags=[]}getPtlMessage(){return this.headerMembers}getQuality(){return Object.keys(he.PRICE_QUALITY).find(t=>he.PRICE_QUALITY[t]===this.headerMembers.dataset.id_dataset)}setQuality(e){this.headerMembers.dataset.id_dataset=he.PRICE_QUALITY[e]}setIdApplication(e,t=!1){(this.headerMembers.authentication_identifiers.id_application===0||t)&&(this.headerMembers.authentication_identifiers.id_application=e)}setIdUser(e,t=!1){(this.headerMembers.authentication_identifiers.id_user===0||t)&&(this.headerMembers.authentication_identifiers.id_user=e)}setFlag(e,t=!0){const r=this.flags.indexOf(e);t&&r===-1&&this.flags.push(e),!t&&r>-1&&this.flags.splice(r,1),this.headerMembers.flags_r2=this.getFlagsValue()}getFlagsValue(){return this.flags.reduce((e,t)=>e+he.FLAG_VALUE[t],0)}isFlagValueSet(e){return this.flags.find(t=>t===e)!==void 0}setJobId(e){this.headerMembers.id_job=e}getJobId(){return this.headerMembers.id_job}countResend(){this.headerMembers.resend_counter++}getResendCounter(){return this.headerMembers.resend_counter}setTimeout(e){if(e>0){this.headerMembers.timeout=e;return}throw new Error(`Attempted to set the timeout to "${e}". The timeout must be greater than 0.`)}getTimeout(){return this.headerMembers.timeout}setTracing(e){/^0+$/.test(e.traceId)||(this.headerMembers.tracing.value.value=Ho(e))}static getDataSet(e){return Object.prototype.hasOwnProperty.call(he.PRICE_QUALITY,e)?he.PRICE_QUALITY[e]:he.PRICE_QUALITY.DLY}};he.PRICE_QUALITY={RLT:129,DLY:0,EOD:130},he.FLAG_VALUE={add_subscription:1,no_merge:2,support_caching:4,permission_denied_response:8,internal_client:16,current_state_refresh:32,subscription_use_pull_permissions:64,allow_chunked_response:128};let ft=he;class Ye{constructor(e,t){this.header=new ft,this.coreMembers={Message:e,Version:t},this.members={}}getPtlMessage(){const e={header:this.header.getPtlMessage()};return jo(this.coreMembers,e,this.members)}}class dt{constructor(e,t){this.token=e,this.maximumIdleInterval=t}toJson(){const e=Lo();return{Message:"AuthenticationByTokenRequest",Version:1,token:{value:this.token},software:JSON.stringify(e),os:e.platform,feature_flags_wanted:{value:0},maximum_idle_interval:this.maximumIdleInterval,maximum_receivable_message_size:1048576,flags:0,cache_authentication_salt:{value:[]},cache_authentication_encrypted_secret:{encrypted_secret:[]}}}}const le=class le extends Ye{constructor(e,t,r,s,o=!1){super(le.NAME,le.VERSION),t&&this.header.setIdUser(t),r&&this.header.setIdApplication(r),s&&this.header.setTimeout(s),this.members.flags=o?le.FLAG_SINGLE_USAGE:0,this.members.lifetime_seconds_r2=e??le.LIFETIME_SECONDS_DEFAULT,this.header.setFlag("no_merge")}};le.NAME="AuthenticationTokenRequest",le.VERSION=6,le.LIFETIME_SECONDS_DEFAULT=-1,le.LIFETIME_SECONDS_MAXIMUM=-2,le.FLAG_SINGLE_USAGE=1;let De=le;const rt=class rt extends Ye{constructor(e){super(rt.NAME,rt.VERSION),this.members.id_job_subscription=e}};rt.NAME="CancelSubscriptionRequest",rt.VERSION=6;let Ae=rt;const fe=class fe extends Ye{constructor(e,t,r={},s){super(fe.NAME,fe.VERSION),this.members.accept="application/json",this.members.content_type="application/json",this.members.body={value:[]},this.members.query="",this.members.path=t,this.setMethod(e),Object.keys(r).length>0&&(e==="POST"?this.setBody(r):this.setQuery(r)),s&&this.setOptions(s)}setOptions(e){Object.hasOwnProperty.call(e,"accept")&&(this.members.accept=e.accept),Object.hasOwnProperty.call(e,"content_type")&&(this.members.content_type=e.content_type),Object.hasOwnProperty.call(e,"subscribe")&&e.subscribe&&this.header.setFlag("add_subscription"),Object.hasOwnProperty.call(e,"no_merge")&&e.no_merge&&this.header.setFlag("no_merge"),Object.hasOwnProperty.call(e,"allowChunkedResponse")&&e.allowChunkedResponse&&this.header.setFlag("allow_chunked_response"),Object.hasOwnProperty.call(e,"idApplication")&&e.idApplication&&this.header.setIdApplication(e.idApplication),Object.hasOwnProperty.call(e,"idUser")&&e.idUser&&this.header.setIdUser(e.idUser)}setMethod(e){const t=e==="POST"?fe.METHOD.POST:fe.METHOD.GET;this.members.method={value:t}}setBody(e={}){e instanceof Array?this.members.body={value:e}:this.members.body={value:JSON.stringify(e)}}getData(){return this.members.method.value===fe.METHOD.POST?fe.ptlToJsonData(this.members.body.value):this.members.query}setQuery(e={}){this.members.query=Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}static ptlToJsonData(e){if(typeof e=="string")return JSON.parse(e);if(e instanceof Array&&e.length>0){let t="";return e.forEach(r=>{t+=String.fromCharCode(r)}),JSON.parse(t)}}};fe.NAME="HighLevelRequest",fe.VERSION=3,fe.METHOD={GET:1,POST:2};let ve=fe;const oe=class oe extends Ye{constructor(e,t,r){super(oe.NAME,oe.VERSION),this.members.request={headers:{values:[{key:"accept",value:"application/json"},{key:"content-type",value:"application/json"}]},protocol:{value:oe.PROTOCOL.HTTPS},host:"",port:0,path:t,query:"",body:{value:[]}},this.setQuery(),this.setMethod(e),r&&this.setOptions(r)}setOptions(e){e.no_merge&&this.header.setFlag("no_merge"),e.idApplication&&this.header.setIdApplication(e.idApplication),e.idUser&&this.header.setIdUser(e.idUser),e.protocol&&(this.members.request.protocol=e.protocol.toUpperCase()==="HTTP"?{value:oe.PROTOCOL.HTTP}:{value:oe.PROTOCOL.HTTPS}),e.method&&(this.members.request.method={value:oe.METHOD[e.method]}),e.host&&(this.members.request.host=e.host),e.port&&(this.members.request.port=e.port),e.path&&(this.members.request.path=e.path),e.query&&(this.members.request.query=typeof e.query=="string"?e.query:Object.keys(e.query).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e.query[t])}`).join("&")),e.body&&this.setBody(e.body),e.headers&&this.setHeaders(e.headers)}setHeaders(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t],s=this.members.request.headers.values.findIndex(i=>i.key===t);s!==-1&&this.members.request.headers.values.splice(s,1),this.members.request.headers.values.push({key:t,value:r})}}setQuery(){if(this.members.request.path.includes("?")){const e=this.members.request.path.split("?");this.members.request.path=e[0],this.members.request.query=e[1]}}setMethod(e){this.members.request.method={value:oe.METHOD[e]}}setBody(e={}){return e instanceof Array||typeof e=="string"?this.members.request.body={value:e}:this.members.request.body={value:JSON.stringify(e)},this}getData(){var e;if((e=this.members.request.body)!=null&&e.value)return ve.ptlToJsonData(this.members.request.body.value)}};oe.NAME="HTTPProxyRequest",oe.VERSION=2,oe.PROTOCOL={HTTP:1,HTTPS:2},oe.METHOD={GET:1,POST:2,OPTIONS:3,HEAD:4,PUT:5,DELETE:6,TRACE:7,CONNECT:8};let Ke=oe;class es extends Ye{constructor(e){super(e.Message,e.version?e.version:e.Version),this._extractRequestAttributes(e)}_extractRequestAttributes(e){for(const t of Object.keys(this.coreMembers))delete e[t];this.members=Dr(this.members,e)}}class Mn{static createFromString(e){return Mn.createFromObject(JSON.parse(e))}static createFromObject(e){const{header:t}=e;return t&&(t.id_job&&delete t.id_job,t.resend_counter&&delete t.resend_counter),new es(e)}}class ne{constructor(e){this.raw=e}get msg(){return this.raw}get name(){return this.raw.Message}get jobId(){return this.raw.header.id_job}get serviceId(){return this.raw.header.id_service}isUpdateMessage(){return Object.hasOwnProperty.call(this.raw,"header")&&(Object.hasOwnProperty.call(this.raw.header,"id_service")||Object.hasOwnProperty.call(this.raw.header,"id_job"))&&this.raw.Message.endsWith("Update")}isLossMessage(){return Object.hasOwnProperty.call(this.raw,"header")&&(Object.hasOwnProperty.call(this.raw.header,"id_service")||Object.hasOwnProperty.call(this.raw.header,"id_job"))&&(this.raw.Message.endsWith("LossMessage")||this.raw.Message.endsWith("Loss"))}}class Sn extends ne{constructor(e){if(super(e),!this.raw.token.value.b64)throw new Error("Token not set in AuthenticationTokenResponse");if(!this.raw.expiry.microseconds)throw new Error("Expiry not set in AuthenticationTokenResponse");this.token=this.raw.token.value.b64,this.expiry=parseInt(Nt(this.raw.expiry.microseconds),10)}getToken(){return this.token}getExpiry(){return this.expiry}}class ts extends ne{}class Z extends ne{get reason(){return this.raw.details}get jobId(){return this.raw.id_job}}class In extends ne{constructor(e){super(e);try{this.responseData=JSON.parse(this.raw.body.value)}catch(t){throw new Error(`Could not parse HighLevelResponse: ${t.message}`)}}get data(){return this.responseData.data}get meta(){return this.responseData.meta}get status(){return this.meta.status}get statusCode(){return this.status.code}}class An extends ne{constructor(e){super(e);try{const t=this.raw.response.body.value,r=t.substr(0,1)==="{";this.responseData=r?JSON.parse(t):t}catch(t){throw new Error(`Could not parse HTTPProxyResponse: ${t}`)}this.responseInfo=this.raw.info,this.statusReason=this.raw.response.status_reason,this.statusCode=this.raw.response.status_code.value}get data(){return this.responseData}get meta(){return this.responseData.meta}get status(){return{code:this.statusCode,reason:this.statusReason}}}class ns extends ne{get reason(){return this.raw.details}}class rs extends ne{get reason(){return this.raw.details}get jobId(){return this.raw.id_job}}const Bo=Object.freeze(Object.defineProperty({__proto__:null,AuthenticationTokenResponse:Sn,CancelSubscriptionResponse:ts,ErrorResponse:Z,HTTPProxyResponse:An,HighLevelResponse:In,Mdg2Response:ne,PermissionDeniedResponse:ns,PingResponse:je,RejectResponse:rs},Symbol.toStringTag,{value:"Module"}));class Ft extends ne{constructor(e){if(super(e),typeof this.raw.body.value!="string")throw new Error("Incorrect response type in HighLevelUpdate");try{this.responseData=JSON.parse(this.raw.body.value)}catch(t){throw new Error(`Could not parse HighLevelUpdate: ${t.message}`)}}get data(){return this.responseData}}class Ut extends ne{constructor(e){super(e),this.reason=e.reason}get reasonValue(){return this.reason.value}}const Jo=Object.freeze(Object.defineProperty({__proto__:null,HighLevelUpdate:Ft,SubscriptionLossMessage:Ut},Symbol.toStringTag,{value:"Module"}));class kn extends Rt{constructor(e,t=!0){if(super(-2,-2),t&&(!e||e.length<80))throw new Error("Invalid token passed to TokenAuthentication");this.setToken(e)}setToken(e){this.token=Do(e)?xo(e):e}setFetchConfiguration(e,t){this.fetchConfigurationInput=e,this.fetchConfigurationConfig=t}async authenticate(e){this.connection=e;const t=await this.sendAuthenticationByTokenRequest(),r=this.peerInfoFromMessage(t);this.connection.setPeerInfo(r)}async sendAuthenticationByTokenRequest(){const e={b64:this.token},t=new dt(e,this.connection.options.maximum_idle_interval);return await this.connection.submit(t.toJson())}get reconnectable(){return!!this.fetchConfigurationInput}async onReconnect(){if(this.fetchConfigurationInput){const{config:e}=await Dt(this.fetchConfigurationInput,this.fetchConfigurationConfig);e.frontgateAuthenticationType==="token"&&e.frontgateAuthenticationToken&&this.setToken(e.frontgateAuthenticationToken)}}}class Cn extends kn{constructor(){super("",!1)}getEncodedToken(){return[]}async onReconnect(){if(this.fetchConfigurationInput){const{config:e}=await Dt(this.fetchConfigurationInput,this.fetchConfigurationConfig);e.frontgateSplitAuthenticationTokenSecondFactor&&(this.connection.options.frontgateSplitAuthenticationTokenSecondFactor=e.frontgateSplitAuthenticationTokenSecondFactor)}}}class Rn{constructor(e){const t=Tn(e),r=Math.ceil(t.length/2);this.firstFactor=t.substring(0,r),this.secondFactor=t.substring(r)}getFirstFactor(){return this.firstFactor}getSecondFactor(){return this.secondFactor}}const rn=class rn{constructor(e,t){this.cb=e,this.conn=t,this.isRequestPending=!1,this.request=new ze}start(e){if(this.timeout!==void 0)throw new Error("LatencyTracker already running!");this.conn.setMessageProcessor("Foundation::PingResponse",this.handlePingResponse.bind(this)),this.timeout=setInterval(()=>{if(!this.conn.isAuthenticated()){this.cb(void 0,void 0,void 0,"Skipping ping request, connection not authenticated!");return}if(this.isRequestPending){if(Date.now()-this.request.timeAtSender<rn.MAX_RESPONSE_LATENCY_MS){this.cb(this.request.timeAtSender,void 0,void 0,"Skipping ping request, previous request pending!");return}this.cb(this.request.timeAtSender,void 0,void 0,"Clearing ping request, previous request exceeded timeout!")}this.isRequestPending=!0,this.request.resetTimeAtSender(),this.conn.send(this.request.getPtlMessage())},e),typeof window>"u"&&this.timeout.unref()}stop(){clearInterval(this.timeout),this.timeout=void 0,this.isRequestPending=!1,this.conn.removeMessageProcessor("Foundation::PingResponse")}handlePingResponse(e){const t=new je(e);return this.cb(t.timeOfRequest,t.latencyTotal,t.latencyAtPeer,void 0),this.isRequestPending=!1,!1}};rn.MAX_RESPONSE_LATENCY_MS=60*1e3;let On=rn;const Wo=()=>K(e=>class extends e{async requestAuthenticationToken(t=30,r=0,s=0,o=this.defaultTimeoutInMs){const a={message:new De(t,r,s,o).getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",a);const c=new Promise((u,l)=>{this.hooks.hookOnce(`frontgateConnection:response:${a.callbackId}`,b=>{if(!b.Message.includes("AuthenticationTokenResponse")){l(JSON.stringify(b));return}const f=new Sn(b);u({token:f.getToken(),expiry:f.getExpiry()})})}),h=`Request timeout reached (${o} ms) for ${a.message.Message}`;return ue(o,h,c)}async requestAuthenticationTokenForCookieTokenAuthentication(t=30,r=0,s=0,o=this.defaultTimeoutInMs){const i=await this.requestAuthenticationToken(t,r,s,o);return new Rn(i.token)}},{featureName:"AuthTokenRequest",featureGroups:["Misc"]}),$t=8,ss={...Bo,...Jo},st=class st{static createMessage(e){if(!e)throw new Error(`Could not create message because msg is "${e}"`);if(!e.Message||typeof e.Message!="string")throw new Error(`Could not create message because msg.Message is "${e.Message}"`);const t=e.Message.indexOf(st.msgNameSeparator);if(t===-1)throw new Error(`Could not create message for invalid msg.Message "${e.Message}"`);if(!(e!=null&&e.header))throw new Error("Could not create message because the header is missing in the msg");try{const r=e.Message.substring(t+st.msgNameSeparatorLength);return ss[r]?new ss[r](e):new ne(e)}catch(r){throw new Error(`Could not create message "${e.Message}": ${r.message}`)}}static hasNextChunk(e){var t;return((((t=e.header)==null?void 0:t.flags)??0)&$t)===$t}};st.msgNameSeparator="::",st.msgNameSeparatorLength=2;let Lt=st;const zo=n=>K(t=>{var r,Ls,o;return o=class extends t{constructor(){super(...arguments);O(this,r)}async requestEndpoint(a,c,h,u,l=this.defaultTimeoutInMs){const b=new ve(a,c,h,{...u,allowChunkedResponse:!(n!=null&&n.disableChunkedResponse)});b.header.setTimeout(l),n!=null&&n.allowPermissionDeniedResponse&&b.header.setFlag("permission_denied_response");const f={message:b.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",f);const E=new Promise((k,w)=>{const m=[],T=()=>{this.hooks.hookOnce(`frontgateConnection:response:${f.callbackId}`,S=>{var M,A,N,g;try{if(!S.Message.includes("HighLevelResponse")){w(JSON.stringify(S));return}if(q(this,r,Ls).call(this,S))m.push({body:((N=S.body)==null?void 0:N.value)??"",processingTime:((g=S.header)==null?void 0:g.processingTime)??0}),T();else{m.push({body:((M=S.body)==null?void 0:M.value)??"",processingTime:((A=S.header)==null?void 0:A.processingTime)??0});const p=new In({...S,body:{value:m.map(I=>I.body).join("")},header:{...S.header,processingTime:m.reduce((I,C)=>I+C.processingTime,0)}});k({response:p,data:p.data})}}catch(p){w(p)}})};T()}),_=`Request timeout reached (${l} ms) for ${f.message.Message}`;return ue(l,_,E)}},r=new WeakSet,Ls=function(a){var c;return((((c=a.header)==null?void 0:c.flags)??0)&$t)===$t},o},{featureName:"EndpointRequest",featureGroups:["Misc"]}),os=n=>K(t=>{var r,s,o,i,a,c,h,u,on,b,f,qs,Hs,Ct,fr,Gs,dr,Bs,Js,A;return A=class extends t{constructor(...g){super(...g);O(this,u);O(this,r);O(this,s);O(this,o,"disconnected");O(this,i);O(this,a,0);O(this,c);O(this,h);O(this,b);O(this,f,[]);R(this,c,-2),R(this,h,-1),n&&(this.conf=n),this.hooks.hook("frontgateConnection:setIdApp",p=>{R(this,c,p)}),this.hooks.hook("frontgateConnection:setIdUser",p=>{R(this,h,p)}),this.hooks.hook("frontgateConnection:sendMessage",p=>{if(p.callbackType==="job"){const I=q(this,u,Gs).call(this,p.message);p.callbackId=`${I}`,q(this,u,dr).call(this,p.message)}if(v(this,u,on)==="connected"&&p.callbackType==="response")q(this,u,Ct).call(this,p.message);else if(v(this,u,on)==="authenticated")q(this,u,Ct).call(this,p.message);else{if(v(this,f).length>=v(this,b))throw new Error("Message buffer is full");v(this,f).push(p)}}),this.hooks.hook("frontgateConnection:authenticated",()=>{if(!v(this,s))throw new Error("No connection configuration set");for(this.log(y.DEBUG,"Draining message buffer");v(this,f).length>0;){const p=v(this,f).shift();p&&(q(this,u,dr).call(this,p.message),q(this,u,Ct).call(this,p.message))}R(this,i,setInterval(()=>{this.log(y.DEBUG,"Sending keepalive"),this.hooks.callHook("frontgateConnection:sendMessage",{message:q(this,u,Hs).call(this),callbackType:"response",callbackId:"KeepAliveMessage"})},v(this,s).maximumIdleIntervalInS/2*1e3))}),this.hooks.hook("reconnect:attempt",async()=>{clearInterval(v(this,i)),this.log(y.DEBUG,"Reconnecting"),await this.hooks.callHook("frontgateConnection:reset");try{await this.connect(),await this.hooks.callHook("reconnect:success")}catch(p){this.log(y.ERROR,"Reconnect failed",p),await this.hooks.callHook("reconnect:failed",p)}})}set conf(g){const p=q(this,u,Js).call(this,g);R(this,b,p.messageBufferSize),R(this,s,p)}async connect(){if(!v(this,s))throw new Error("No connection configuration set");if(v(this,u,on)!=="disconnected")throw new Error("Client is already connected or is connecting right now");const{host:g,port:p,tls:I,pathPrefix:C}=v(this,s);R(this,o,"connecting");const z=`${I?"wss":"ws"}://${g}:${p}${C??""}/ws`,P={encoding:"jsjson-v2"};await this.hooks.callHook("frontgateConnection:afterSetEncoding",P);const[F,j]=P.encoding.split("-"),V=[`${j?`${j}.`:""}ws-${F}.mdgms.com`],$={url:z,subProtocols:V};await this.hooks.callHook("frontgateConnection:beforeConnect",$),this.log(y.DEBUG,`Connecting to ${$.url} with subprotocols ${$.subProtocols}`);const Je=new Promise((de,Y)=>{if(!v(this,s))throw new Error("No connection configuration set");v(this,s).wsClientOptions&&typeof window>"u"?R(this,r,new ge($.url,$.subProtocols,v(this,s).wsClientOptions)):R(this,r,new ge($.url,$.subProtocols)),v(this,r).binaryType="arraybuffer";let J;v(this,r).onopen=()=>{R(this,o,"connected"),this.log(y.DEBUG,"Connected"),this.hooks.callHook("frontgateConnection:connected",v(this,s)).catch(Y),J=this.hooks.hookOnce("frontgateConnection:authenticated",()=>{R(this,o,"authenticated"),this.log(y.DEBUG,"Authenticated"),de()})},v(this,r).onclose=D=>{J==null||J(),this.log(y.DEBUG,"Disconnected",D),this.hooks.callHook("frontgateConnection:disconnected",D),(v(this,o)==="connecting"||v(this,o)==="connected")&&Y(JSON.stringify(D)),clearInterval(v(this,i)),R(this,o,"disconnected")},v(this,r).onerror=D=>{J==null||J(),this.log(y.ERROR,"Error:",D),this.hooks.callHook("frontgateConnection:error",D),(v(this,o)==="connecting"||v(this,o)==="connected")&&Y(new Error("Websocket error")),clearInterval(v(this,i)),R(this,o,"disconnected")},v(this,r).onmessage=D=>{const{data:ie}=D;this.log(y.DEBUG,"Received data:",ie);const me={msg:ie};this.hooks.callHook("frontgateConnection:afterReceiveMessage",me).then(()=>{var We;this.log(y.DEBUG,"Received message",me.msg);const Pe=me.msg.toString("utf-8"),_e=JSON.parse(Pe);if(this.hooks.callHook("frontgateConnection:message",_e),_e.Message==="Foundation::DisconnectionMessage"){(We=v(this,r))==null||We.close(),this.hooks.callHook("frontgateConnection:disconnected",_e);return}q(this,u,fr).call(this,_e)})}}),ee=`Timeout reached (${this.defaultTimeoutInMs} ms) for connection to ${z}`;return ue(this.defaultTimeoutInMs,ee,Je)}async disconnect(){return new Promise(g=>{q(this,u,Ct).call(this,q(this,u,qs).call(this)),this.hooks.hookOnce("frontgateConnection:disconnected",()=>{var p;(p=v(this,r))==null||p.close(),g()})})}isConnected(){return v(this,o)==="authenticated"}isDisconnected(){return v(this,o)!=="authenticated"}isReadyToConnect(){return v(this,o)==="disconnected"}},r=new WeakMap,s=new WeakMap,o=new WeakMap,i=new WeakMap,a=new WeakMap,c=new WeakMap,h=new WeakMap,u=new WeakSet,on=function(){return v(this,r)&&v(this,r).readyState<2?v(this,o):"disconnected"},b=new WeakMap,f=new WeakMap,qs=function(){return{Message:"Foundation::DisconnectionMessage",Version:3,reason:{value:64},details:"client shutdown"}},Hs=function(){return{Message:"KeepAliveMessage",Version:2}},Ct=async function(g){var I;await this.hooks.callHook("frontgateConnection:beforeSerializeMessage",g);const p={msg:JSON.stringify(g)};await this.hooks.callHook("frontgateConnection:beforeSendMessage",p),this.log(y.DEBUG,"Sending message:",g),this.log(y.TRACE,"Sending data:",p.msg);try{(I=v(this,r))==null||I.send(p.msg)}catch(C){const x=q(this,u,Bs).call(this,C,g);q(this,u,fr).call(this,x.msg)}},fr=function(g){var p,I;if(typeof((p=g.header)==null?void 0:p.id_job)<"u"){this.hooks.callHook(`frontgateConnection:response:${g.header.id_job}`,g);return}if(typeof((I=g.header)==null?void 0:I.id_service)<"u"&&typeof g.id_notation<"u"){this.hooks.callHook(`frontgateConnection:response:${g.header.id_service}-${g.id_notation}`,g);return}if(typeof g.id_job<"u"){this.hooks.callHook(`frontgateConnection:response:${g.id_job}`,g);return}typeof g.Message=="string"&&this.hooks.callHook(`frontgateConnection:response:${g.Message.replace("Foundation::","")}`,g)},Gs=function(g){R(this,a,v(this,a)+1);const p=v(this,a);return g.header={...g.header,id_job:p},v(this,a)},dr=function(g){var p,I;g.header||(g.header={authentication_identifiers:{id_application:void 0,id_user:void 0}}),g.header.authentication_identifiers||(g.header={...g.header,authentication_identifiers:{id_application:void 0,id_user:void 0}}),(p=g.header.authentication_identifiers).id_application||(p.id_application=v(this,c)),(I=g.header.authentication_identifiers).id_user||(I.id_user=v(this,h))},Bs=function(g,p){var I;return new Z({Message:"Foundation::ErrorResponse",Version:1,id_job:(I=p.header)==null?void 0:I.id_job,reason:8,details:g})},Js=function(g){const p=g.maximumIdleIntervalInS??60,I=g.maximumIdleInterval??p*1e6;return{...g,payloadContent:g.payloadContent??"foundation",maximumIdleIntervalInS:p,maximumIdleInterval:I,tls:g.tls??!0,messageBufferSize:g.messageBufferSize??512}},A},{featureName:"WSConnection",disabledFeatureGroups:["Connection"]}),Vo=(n,e)=>(e&&n.setLevel(e),K(r=>class extends r{constructor(...s){super(...s),this.logger=n}},{featureName:"Logger",featureGroups:["Misc"]})),Yo=()=>K(e=>{var t,r;return r=class extends e{constructor(...o){super(...o);O(this,t);R(this,t,new kr),this.hooks.hook("frontgateConnection:reset",()=>{v(this,t).reset()}),this.hooks.hook("frontgateConnection:afterSetEncoding",i=>{i.encoding="jsjsonc-v2"}),this.hooks.hook("frontgateConnection:beforeSendMessage",i=>{const a=v(this,t).compress(i.msg);i.msg=a}),this.hooks.hook("frontgateConnection:afterReceiveMessage",i=>{const a=v(this,t).decompress(new Uint8Array(i.msg));i.msg=a})}},t=new WeakMap,r},{featureName:"MessageCompressor",featureGroups:["Misc"]}),Ko=()=>K(e=>class extends e{async request(t,r=this.defaultTimeoutInMs){t.header.setTimeout(r);const s={message:t.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",s);const o=new Promise(a=>{this.hooks.hookOnce(`frontgateConnection:response:${s.callbackId}`,c=>{const h=new ne(c);a(h)})}),i=`Request timeout reached (${r} ms) for ${s.message.Message}`;return ue(r,i,o)}},{featureName:"Request",featureGroups:["Misc"]}),Qo=n=>K(t=>{var s,o;const r={...n};return o=class extends t{constructor(){super(...arguments);O(this,s,new Map)}async observeEndpoint(a,c,h,u){const l=`${a}:${c}:${JSON.stringify(h)}:${JSON.stringify(u??{})}`,b=r.timeout??this.defaultTimeoutInMs,f=r.subscriptionResubscribeTimeout??1e3;if(v(this,s).has(l)){const m=v(this,s).get(l);if(m)return m.count++,this.log(y.INFO,`Reusing existing subscription for ${l}`),m.observer}this.log(y.INFO,`Creating new subscription for ${l}`);const E=new ve(a,c,h,{...u,subscribe:!0});E.header.setTimeout(b);const _={message:E.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",_);const k=new Promise((m,T)=>{this.hooks.hookOnce(`frontgateConnection:response:${_.callbackId}`,S=>{if(!S.Message.includes("HighLevelResponse")){this.log(y.ERROR,`Unexpected response: ${S.Message}`),T(new Z(JSON.stringify(S)));return}let M;try{M=JSON.parse(S.body.value)}catch(I){this.log(y.ERROR,`Failed to parse response: ${S.body.value}`),this.log(y.ERROR,I),T(I);return}const A=new is(S.header.id_job,M);let N=this.hooks.hook(`frontgateConnection:response:${_.callbackId}`,I=>{if(!I.Message.includes("HighLevelUpdate")){if(I.Message.includes("SubscriptionLoss")){this.log(y.DEBUG,`Received: ${I.Message}`),setTimeout(()=>{g()},Zr(f)),N();return}this.log(y.ERROR,`Unexpected response: ${S.Message}`),A.pushError(new Z(JSON.stringify(I))),N();return}let C;try{C=new Ft(I)}catch(x){this.log(y.ERROR,`Failed to parse response: ${I.body.value}`),A.pushError(x);return}A.pushPatchData(C.data)});const g=async()=>{N(),this.log(y.INFO,`Resubscribing to ${l} due to reconnect`),await this.hooks.callHook("frontgateConnection:sendMessage",_);const I=new Promise((C,x)=>{this.hooks.hookOnce(`frontgateConnection:response:${_.callbackId}`,z=>{if(!S.Message.includes("HighLevelResponse")){const P=new Z(z);this.log(y.ERROR,`Unexpected response: ${z.Message}`),N(),x(P);return}this.log(y.INFO,`Resubscribed to ${l} with ${z.header.id_job}`),A.idJob=z.header.id_job,N=this.hooks.hook(`frontgateConnection:response:${z.header.id_job}`,P=>{if(!P.Message.includes("HighLevelUpdate")){if(P.Message.includes("SubscriptionLoss")){this.log(y.DEBUG,`Received: ${P.Message}`),setTimeout(()=>{g()},Zr(f));return}this.log(y.ERROR,`Unexpected response: ${P.Message}`);const j=new Z(P);A.pushError(j);return}let F;try{F=new Ft(P)}catch(j){this.log(y.ERROR,`Failed to parse response: ${P.body.value}`),A.pushError(j);return}A.unsubscribe=()=>{const j=v(this,s).get(l);if(j){if(j.count--,j.count>0){this.log(y.INFO,`Not unsubscribing from ${l} as there are still ${j.count} subscribers`);return}v(this,s).delete(l)}this.log(y.INFO,`Unsubscribing from ${l}`);const V={message:new Ae(A.idJob).getPtlMessage(),callbackType:"job",callbackId:""};this.hooks.callHook("frontgateConnection:sendMessage",V),N(),p()},A.pushPatchData(F.data)}),C()})});try{await ue(b,"Request timeout reached",I)}catch(C){A.pushError(new Z({Message:"Reconnect failed",Error:C}))}},p=this.hooks.hook("reconnect:success",g);A.unsubscribe=()=>{const I=v(this,s).get(l);if(I){if(I.count--,I.count>0){this.log(y.INFO,`Not unsubscribing from ${l} as there are still ${I.count} subscribers`);return}v(this,s).delete(l)}this.log(y.INFO,`Unsubscribing from ${l}`);const x={message:new Ae(A.idJob).getPtlMessage(),callbackType:"job",callbackId:""};this.hooks.callHook("frontgateConnection:sendMessage",x),N(),p()},v(this,s).set(l,{observer:A,count:1}),m(A)})}),w=`Request timeout reached (${b} ms) for ${_.message.Message}`;return ue(b,w,k)}},s=new WeakMap,o},{featureName:"EndpointSubscriptions",featureGroups:["Misc"]}),Xo=()=>K(e=>{var t,r,pr,o;return o=class extends e{constructor(){super(...arguments);O(this,r);O(this,t,new Map)}async observe(a,c=this.defaultTimeoutInMs){return q(this,r,pr).call(this,a,"job",void 0,c)}async observeConnectionBased(a,c,h=this.defaultTimeoutInMs){return q(this,r,pr).call(this,a,"connection",c,h)}},t=new WeakMap,r=new WeakSet,pr=async function(a,c,h,u=this.defaultTimeoutInMs){const l=JSON.stringify(a.getPtlMessage());if(v(this,t).has(l)){const k=v(this,t).get(l);if(k)return k.count++,this.log(y.INFO,`Reusing existing subscription for ${l}`),k.observer}this.log(y.INFO,`Creating new subscription for ${l}`);const f={message:a.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",f);const E=new Promise((k,w)=>{this.hooks.hookOnce(`frontgateConnection:response:${f.callbackId}`,m=>{if(m.Message.includes("Error")||m.Message.includes("PermissionDenied")){this.log(y.ERROR,`Unexpected response: ${m.Message}`),w(new Error(`Unexpected response: ${m.Message}`));return}const T=c==="connection"?`${m.header.id_service}-${a.getPtlMessage().id_notation}`:m.header.id_job,S=typeof h>"u"?new Ae(m.header.id_job):new h(m.header.id_service,a.getPtlMessage().id_notation),M=new Nn(m.header.id_job,m);let A=this.hooks.hook(`frontgateConnection:response:${T}`,g=>{if(g.Message.includes("Error")||g.Message.includes("PermissionDenied")){this.log(y.ERROR,`Unexpected response: ${m.Message}`),M.pushError(new Z(JSON.stringify(g)));return}M.pushData(g)});const N=this.hooks.hook("reconnect:success",async()=>{A(),this.log(y.INFO,`Resubscribing to ${l} due to reconnect`),await this.hooks.callHook("frontgateConnection:sendMessage",f);const g=new Promise((p,I)=>{this.hooks.hookOnce(`frontgateConnection:response:${f.callbackId}`,C=>{if(C.Message.includes("Error")||C.Message.includes("PermissionDenied")){const P=new Z(C);this.log(y.ERROR,`Unexpected resp: ${C.Message}`),I(P);return}const x=c==="connection"?`${C.header.id_service}-${a.getPtlMessage().id_notation}`:C.header.id_job,z=typeof h>"u"?new Ae(C.header.id_job):new h(C.header.id_service,a.getPtlMessage().id_notation);M.idJob=C.header.id_job,A=this.hooks.hook(`frontgateConnection:response:${x}`,P=>{if(P.Message.includes("Error")||P.Message.includes("PermissionDenied")){this.log(y.ERROR,`Unexpected response: ${P.Message}`);const F=new Z(P);M.pushError(F);return}M.unsubscribe=()=>{const F=v(this,t).get(l);if(F){if(F.count--,F.count>0){this.log(y.INFO,`Not unsubscribing from ${l} as there are still ${F.count} subscribers`);return}v(this,t).delete(l)}this.log(y.INFO,`Unsubscribing from ${l}`);const j={message:z.getPtlMessage(),callbackType:"job",callbackId:""};this.hooks.callHook("frontgateConnection:sendMessage",j),A(),N()},M.pushData(P)}),p()})});try{await ue(u,"Request timeout reached",g)}catch(p){M.pushError(new Z({Message:"Reconnect failed",Error:p}))}});M.unsubscribe=()=>{const g=v(this,t).get(l);if(g){if(g.count--,g.count>0){this.log(y.INFO,`Not unsubscribing from ${l} as there are still ${g.count} subscribers`);return}v(this,t).delete(l)}this.log(y.INFO,`Unsubscribing from ${l}`);const p={message:S.getPtlMessage(),callbackType:"job",callbackId:""};this.hooks.callHook("frontgateConnection:sendMessage",p),A(),N()},v(this,t).set(l,{observer:M,count:1}),k(M)})}),_=`Request timeout reached (${u} ms) for ${f.message.Message}`;return ue(u,_,E)},o},{featureName:"RawSubscriptions",featureGroups:["Misc"]}),Pn=(n,e)=>{const t=e.split("/").slice(1);let r=n;for(let s=0;s<t.length-1;s++){const o=decodeURIComponent(t[s]);if(!(o in r))throw new Error(`Path not found: ${e}`);r=r[o]}return[r,decodeURIComponent(t[t.length-1])]},Zo=(n,e,t)=>{const[r,s]=Pn(n,e);r[s]=t},ei="-",ti=(n,e,t)=>{const[r,s]=Pn(n,e);Array.isArray(r)?s===ei?r.push(t):r.splice(parseInt(s,10),0,t):r[s]=t},ni=(n,e)=>{const[t,r]=Pn(n,e);Array.isArray(t)?t.splice(parseInt(r,10),1):delete t[r]};function ri(n,e){return e.forEach(t=>{switch(t.op){case"replace":Zo(n,t.path,t.value);break;case"add":ti(n,t.path,t.value);break;case"remove":ni(n,t.path);break;case"move":case"copy":case"test":default:throw new Error(`Unsupported op: ${t.op}`)}}),n}class Nn{constructor(e,t){O(this,qe);O(this,Mt,[]);O(this,St,[]);R(this,qe,t),this.idJob=e}get data(){return v(this,qe)}subscribe({next:e,error:t}){e(v(this,qe)),t&&v(this,St).push(t),v(this,Mt).push(e)}pushData(e){R(this,qe,e),v(this,Mt).forEach(t=>{t(e)})}pushError(e){v(this,St).forEach(t=>{t(e)})}}qe=new WeakMap,Mt=new WeakMap,St=new WeakMap;class is extends Nn{pushPatchData(e){try{const t=ri(this.data,e);super.pushData(t)}catch(t){super.pushError(new Z(t.message))}}}const si=n=>K(t=>class extends t{constructor(...r){super(...r),this.hooks.hook("frontgateConnection:beforeConnect",o=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2),this.log(y.DEBUG,"Adding mdg2auth subprotocol"),o.subProtocols.push(`mdg2auth-${n}`)});const s=async o=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2);const i={maximum_idle_interval:o.maximumIdleInterval},a={b64:""},h=new dt(a,i.maximum_idle_interval).toJson();this.log(y.INFO,"Sending message",h);const u={message:h,callbackType:"response",callbackId:h.Message.replace("Request","Response")};await this.hooks.callHook("frontgateConnection:sendMessage",u),this.hooks.hookOnce(`frontgateConnection:response:${u.callbackId}`,l=>{this.log(y.INFO,"Received response",l),this.hooks.callHook("frontgateConnection:authenticated")})};this.hooks.hookOnce("frontgateConnection:connected",s)}},{featureName:"CookieTokenAuth",featureGroups:["Auth"],disabledFeatureGroups:["Auth"]}),oi=n=>K(t=>{var r,s;return s=class extends t{constructor(...i){super(...i);O(this,r);R(this,r,n??"");const a=async c=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2);const h={maximum_idle_interval:c.maximumIdleInterval},u={b64:v(this,r)},b=new dt(u,h.maximum_idle_interval).toJson();this.log(y.INFO,"Sending message",b);const f={message:b,callbackType:"response",callbackId:b.Message.replace("Request","Response")};await this.hooks.callHook("frontgateConnection:sendMessage",f),this.hooks.hookOnce(`frontgateConnection:response:${f.callbackId}`,E=>{this.log(y.INFO,"Received response",E),this.hooks.callHook("frontgateConnection:authenticated")})};this.hooks.hook("frontgateConnection:connected",a)}set token(i){R(this,r,i)}},r=new WeakMap,s},{featureName:"TokenAuth",featureGroups:["Auth"],disabledFeatureGroups:["Auth"]}),ii=(n,e,t)=>K(s=>{var o,i,a,c,h,Ws,l;return l=class extends os({host:"",pathPrefix:"",port:0,tls:!0,maximumIdleIntervalInS:n.maximumIdleIntervalInS})(s){constructor(...f){super(...f);O(this,h);O(this,o,"");O(this,i,"");O(this,a);O(this,c);R(this,a,e),R(this,c,t),this.hooks.hook("frontgateConnection:beforeConnect",async _=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2),this.log(y.DEBUG,"Fetching connection configuration");const k=await q(this,h,Ws).call(this);if(this.log(y.DEBUG,"Connection configuration received",n),_.url=k.url,k.authtenticationType==="token"&&k.authenticationToken)R(this,o,k.authenticationToken);else if(k.splitAuthenticationTokenSecondFactor)R(this,i,k.splitAuthenticationTokenSecondFactor);else throw new Error("Invalid authentication configuration");this.log(y.DEBUG,"Adding mdg2auth subprotocol"),v(this,i)!==""&&_.subProtocols.push(`mdg2auth-${v(this,i)}`)});const E=async _=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2);const k={maximum_idle_interval:_.maximumIdleInterval},w={b64:v(this,o)},T=new dt(w,k.maximum_idle_interval).toJson();this.log(y.INFO,"Sending message",T);const S={message:T,callbackType:"response",callbackId:T.Message.replace("Request","Response")};await this.hooks.callHook("frontgateConnection:sendMessage",S),this.hooks.hookOnce(`frontgateConnection:response:${S.callbackId}`,M=>{this.log(y.INFO,"Received response",M),this.hooks.callHook("frontgateConnection:authenticated")})};this.hooks.hook("frontgateConnection:connected",E)}},o=new WeakMap,i=new WeakMap,a=new WeakMap,c=new WeakMap,h=new WeakSet,Ws=async function(){const f=await fetch(v(this,a),v(this,c));if(!f.ok)throw new Error(`Failed to fetch connection configuration: ${f.status} ${f.statusText}`);const{headers:E}=f,_=E.get("frontgate-host"),k=E.get("frontgate-path-prefix"),w=E.get("frontgate-split-authentication-token-second-factor"),m=E.get("frontgate-authentication-type"),T=E.get("frontgate-authentication-token"),S=E.get("frontgate-websocket-port")??"443",M=`wss://${_}:${S}${k??""}/ws`;if(m==="token"&&!T)throw new Error("Authentication token is required for token authentication");if(m!=="token"&&!w)throw new Error("Split authentication token second factor is required");return{url:M,authtenticationType:m,authenticationToken:T,splitAuthenticationTokenSecondFactor:w}},l},{featureName:"FetchAuth",featureGroups:["Auth","Connection"],disabledFeatureGroups:["Auth","Connection"]}),ai=(n,e)=>({options:n,submit:async t=>{e.log(y.INFO,"Sending message",t);const r={message:t,callbackType:"response",callbackId:t.Message.replace("Request","Response")};await e.hooks.callHook("frontgateConnection:sendMessage",r);let s;return new Promise((o,i)=>{const a=e.hooks.hookOnce(`frontgateConnection:response:${r.callbackId}`,c=>{clearTimeout(s),e.log(y.INFO,"Received response",c),o(c)});s=setTimeout(()=>{a(),i(new Error("Authentication message timeout"))},3e3)})},setPeerInfo:t=>{e.log(y.INFO,"Peer info:",t)},auth:{}}),ci=()=>K(e=>{var t,r,s,o;return o=class extends e{constructor(...a){super(...a);O(this,t,0);O(this,r,[1e3,2e3,4e3,8e3,16e3,32e3]);O(this,s);const c=h=>{if(h.code!==1e3){v(this,s)&&(this.log(y.WARN,"Aborting previous reconnect attempt"),clearTimeout(v(this,s)),R(this,t,0));let u=v(this,t);v(this,t)>v(this,r).length&&(u=v(this,r).length-1);const l=v(this,r)[u];R(this,s,setTimeout(()=>{this.log(y.INFO,`Reconnecting... Attempt ${v(this,t)}`);const b=this.hooks.hookOnce("reconnect:failed",c);this.hooks.callHook("reconnect:attempt",h).then(b).catch(()=>{this.log(y.ERROR,"Failed to reconnect")}),R(this,s,void 0)},l)),$s(this,t)._++}};this.hooks.hookOnce("frontgateConnection:disconnected",c),this.hooks.hook("reconnect:success",()=>{clearTimeout(v(this,s)),R(this,s,void 0),R(this,t,0),this.log(y.INFO,"Reconnected"),this.hooks.hookOnce("frontgateConnection:disconnected",c)})}},t=new WeakMap,r=new WeakMap,s=new WeakMap,o},{featureName:"Reconnect",featureGroups:["Misc"],disabledFeatures:["TokenAuth","CookieTokenAuth"]});var ui=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},xe="1.9.0",as=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function hi(n){var e=new Set([n]),t=new Set,r=n.match(as);if(!r)return function(){return!1};var s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(s.prerelease!=null)return function(c){return c===n};function o(a){return t.add(a),!1}function i(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(t.has(c))return!1;var h=c.match(as);if(!h)return o(c);var u={major:+h[1],minor:+h[2],patch:+h[3],prerelease:h[4]};return u.prerelease!=null||s.major!==u.major?o(c):s.major===0?s.minor===u.minor&&s.patch<=u.patch?i(c):o(c):s.minor<=u.minor?i(c):o(c)}}var li=hi(xe),fi=xe.split(".")[0],pt=Symbol.for("opentelemetry.js.api."+fi),gt=ui;function vt(n,e,t,r){var s;r===void 0&&(r=!1);var o=gt[pt]=(s=gt[pt])!==null&&s!==void 0?s:{version:xe};if(!r&&o[n]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+n);return t.error(i.stack||i.message),!1}if(o.version!==xe){var i=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+n+" does not match previously registered API v"+xe);return t.error(i.stack||i.message),!1}return o[n]=e,t.debug("@opentelemetry/api: Registered a global for "+n+" v"+xe+"."),!0}function Fe(n){var e,t,r=(e=gt[pt])===null||e===void 0?void 0:e.version;if(!(!r||!li(r)))return(t=gt[pt])===null||t===void 0?void 0:t[n]}function bt(n,e){e.debug("@opentelemetry/api: Unregistering a global for "+n+" v"+xe+".");var t=gt[pt];t&&delete t[n]}var di=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},pi=function(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))},gi=function(){function n(e){this._namespace=e.namespace||"DiagComponentLogger"}return n.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("debug",this._namespace,e)},n.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("error",this._namespace,e)},n.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("info",this._namespace,e)},n.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("warn",this._namespace,e)},n.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("verbose",this._namespace,e)},n}();function mt(n,e,t){var r=Fe("diag");if(r)return t.unshift(e),r[n].apply(r,pi([],di(t),!1))}var re;(function(n){n[n.NONE=0]="NONE",n[n.ERROR=30]="ERROR",n[n.WARN=50]="WARN",n[n.INFO=60]="INFO",n[n.DEBUG=70]="DEBUG",n[n.VERBOSE=80]="VERBOSE",n[n.ALL=9999]="ALL"})(re||(re={}));function vi(n,e){n<re.NONE?n=re.NONE:n>re.ALL&&(n=re.ALL),e=e||{};function t(r,s){var o=e[r];return typeof o=="function"&&n>=s?o.bind(e):function(){}}return{error:t("error",re.ERROR),warn:t("warn",re.WARN),info:t("info",re.INFO),debug:t("debug",re.DEBUG),verbose:t("verbose",re.VERBOSE)}}var bi=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},mi=function(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))},yi="diag",be=function(){function n(){function e(s){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var a=Fe("diag");if(a)return a[s].apply(a,mi([],bi(o),!1))}}var t=this,r=function(s,o){var i,a,c;if(o===void 0&&(o={logLevel:re.INFO}),s===t){var h=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((i=h.stack)!==null&&i!==void 0?i:h.message),!1}typeof o=="number"&&(o={logLevel:o});var u=Fe("diag"),l=vi((a=o.logLevel)!==null&&a!==void 0?a:re.INFO,s);if(u&&!o.suppressOverrideMessage){var b=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";u.warn("Current logger will be overwritten from "+b),l.warn("Current logger will overwrite one already registered from "+b)}return vt("diag",l,t,!0)};t.setLogger=r,t.disable=function(){bt(yi,t)},t.createComponentLogger=function(s){return new gi(s)},t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}return n.instance=function(){return this._instance||(this._instance=new n),this._instance},n}(),wi=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},_i=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ti=function(){function n(e){this._entries=e?new Map(e):new Map}return n.prototype.getEntry=function(e){var t=this._entries.get(e);if(t)return Object.assign({},t)},n.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var t=wi(e,2),r=t[0],s=t[1];return[r,s]})},n.prototype.setEntry=function(e,t){var r=new n(this._entries);return r._entries.set(e,t),r},n.prototype.removeEntry=function(e){var t=new n(this._entries);return t._entries.delete(e),t},n.prototype.removeEntries=function(){for(var e,t,r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];var o=new n(this._entries);try{for(var i=_i(r),a=i.next();!a.done;a=i.next()){var c=a.value;o._entries.delete(c)}}catch(h){e={error:h}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return o},n.prototype.clear=function(){return new n},n}();be.instance();function Ei(n){return n===void 0&&(n={}),new Ti(new Map(Object.entries(n)))}function cs(n){return Symbol.for(n)}var Mi=function(){function n(e){var t=this;t._currentContext=e?new Map(e):new Map,t.getValue=function(r){return t._currentContext.get(r)},t.setValue=function(r,s){var o=new n(t._currentContext);return o._currentContext.set(r,s),o},t.deleteValue=function(r){var s=new n(t._currentContext);return s._currentContext.delete(r),s}}return n}(),Si=new Mi,Ue=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ii=function(){function n(){}return n.prototype.createGauge=function(e,t){return xi},n.prototype.createHistogram=function(e,t){return Fi},n.prototype.createCounter=function(e,t){return Di},n.prototype.createUpDownCounter=function(e,t){return Ui},n.prototype.createObservableGauge=function(e,t){return Li},n.prototype.createObservableCounter=function(e,t){return $i},n.prototype.createObservableUpDownCounter=function(e,t){return qi},n.prototype.addBatchObservableCallback=function(e,t){},n.prototype.removeBatchObservableCallback=function(e){},n}(),qt=function(){function n(){}return n}(),Ai=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.add=function(t,r){},e}(qt),ki=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.add=function(t,r){},e}(qt),Ci=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.record=function(t,r){},e}(qt),Ri=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.record=function(t,r){},e}(qt),jn=function(){function n(){}return n.prototype.addCallback=function(e){},n.prototype.removeCallback=function(e){},n}(),Oi=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(jn),Pi=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(jn),Ni=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(jn),ji=new Ii,Di=new Ai,xi=new Ci,Fi=new Ri,Ui=new ki,$i=new Oi,Li=new Pi,qi=new Ni,Hi={get:function(n,e){if(n!=null)return n[e]},keys:function(n){return n==null?[]:Object.keys(n)}},Gi={set:function(n,e,t){n!=null&&(n[e]=t)}},Bi=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},Ji=function(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))},Wi=function(){function n(){}return n.prototype.active=function(){return Si},n.prototype.with=function(e,t,r){for(var s=[],o=3;o<arguments.length;o++)s[o-3]=arguments[o];return t.call.apply(t,Ji([r],Bi(s),!1))},n.prototype.bind=function(e,t){return t},n.prototype.enable=function(){return this},n.prototype.disable=function(){return this},n}(),zi=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},Vi=function(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))},Dn="context",Yi=new Wi,Ht=function(){function n(){}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setGlobalContextManager=function(e){return vt(Dn,e,be.instance())},n.prototype.active=function(){return this._getContextManager().active()},n.prototype.with=function(e,t,r){for(var s,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(s=this._getContextManager()).with.apply(s,Vi([e,t,r],zi(o),!1))},n.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},n.prototype._getContextManager=function(){return Fe(Dn)||Yi},n.prototype.disable=function(){this._getContextManager().disable(),bt(Dn,be.instance())},n}(),xn;(function(n){n[n.NONE=0]="NONE",n[n.SAMPLED=1]="SAMPLED"})(xn||(xn={}));var us="0000000000000000",hs="00000000000000000000000000000000",Ki={traceId:hs,spanId:us,traceFlags:xn.NONE},yt=function(){function n(e){e===void 0&&(e=Ki),this._spanContext=e}return n.prototype.spanContext=function(){return this._spanContext},n.prototype.setAttribute=function(e,t){return this},n.prototype.setAttributes=function(e){return this},n.prototype.addEvent=function(e,t){return this},n.prototype.addLink=function(e){return this},n.prototype.addLinks=function(e){return this},n.prototype.setStatus=function(e){return this},n.prototype.updateName=function(e){return this},n.prototype.end=function(e){},n.prototype.isRecording=function(){return!1},n.prototype.recordException=function(e,t){},n}(),Fn=cs("OpenTelemetry Context Key SPAN");function Un(n){return n.getValue(Fn)||void 0}function Qi(){return Un(Ht.getInstance().active())}function $n(n,e){return n.setValue(Fn,e)}function Xi(n){return n.deleteValue(Fn)}function Zi(n,e){return $n(n,new yt(e))}function ls(n){var e;return(e=Un(n))===null||e===void 0?void 0:e.spanContext()}var ea=/^([0-9a-f]{32})$/i,ta=/^[0-9a-f]{16}$/i;function na(n){return ea.test(n)&&n!==hs}function ra(n){return ta.test(n)&&n!==us}function fs(n){return na(n.traceId)&&ra(n.spanId)}function sa(n){return new yt(n)}var Ln=Ht.getInstance(),ds=function(){function n(){}return n.prototype.startSpan=function(e,t,r){r===void 0&&(r=Ln.active());var s=!!(t!=null&&t.root);if(s)return new yt;var o=r&&ls(r);return oa(o)&&fs(o)?new yt(o):new yt},n.prototype.startActiveSpan=function(e,t,r,s){var o,i,a;if(!(arguments.length<2)){arguments.length===2?a=t:arguments.length===3?(o=t,a=r):(o=t,i=r,a=s);var c=i??Ln.active(),h=this.startSpan(e,o,c),u=$n(c,h);return Ln.with(u,a,void 0,h)}},n}();function oa(n){return typeof n=="object"&&typeof n.spanId=="string"&&typeof n.traceId=="string"&&typeof n.traceFlags=="number"}var ia=new ds,aa=function(){function n(e,t,r,s){this._provider=e,this.name=t,this.version=r,this.options=s}return n.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},n.prototype.startActiveSpan=function(e,t,r,s){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},n.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):ia},n}(),ca=function(){function n(){}return n.prototype.getTracer=function(e,t,r){return new ds},n}(),ua=new ca,ps=function(){function n(){}return n.prototype.getTracer=function(e,t,r){var s;return(s=this.getDelegateTracer(e,t,r))!==null&&s!==void 0?s:new aa(this,e,t,r)},n.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:ua},n.prototype.setDelegate=function(e){this._delegate=e},n.prototype.getDelegateTracer=function(e,t,r){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getTracer(e,t,r)},n}();Ht.getInstance(),be.instance();var ha=function(){function n(){}return n.prototype.getMeter=function(e,t,r){return ji},n}(),la=new ha,qn="metrics",fa=function(){function n(){}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setGlobalMeterProvider=function(e){return vt(qn,e,be.instance())},n.prototype.getMeterProvider=function(){return Fe(qn)||la},n.prototype.getMeter=function(e,t,r){return this.getMeterProvider().getMeter(e,t,r)},n.prototype.disable=function(){bt(qn,be.instance())},n}();fa.getInstance();var da=function(){function n(){}return n.prototype.inject=function(e,t){},n.prototype.extract=function(e,t){return e},n.prototype.fields=function(){return[]},n}(),Hn=cs("OpenTelemetry Baggage Key");function gs(n){return n.getValue(Hn)||void 0}function pa(){return gs(Ht.getInstance().active())}function ga(n,e){return n.setValue(Hn,e)}function va(n){return n.deleteValue(Hn)}var Gn="propagation",ba=new da,ma=function(){function n(){this.createBaggage=Ei,this.getBaggage=gs,this.getActiveBaggage=pa,this.setBaggage=ga,this.deleteBaggage=va}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setGlobalPropagator=function(e){return vt(Gn,e,be.instance())},n.prototype.inject=function(e,t,r){return r===void 0&&(r=Gi),this._getGlobalPropagator().inject(e,t,r)},n.prototype.extract=function(e,t,r){return r===void 0&&(r=Hi),this._getGlobalPropagator().extract(e,t,r)},n.prototype.fields=function(){return this._getGlobalPropagator().fields()},n.prototype.disable=function(){bt(Gn,be.instance())},n.prototype._getGlobalPropagator=function(){return Fe(Gn)||ba},n}();ma.getInstance();var Bn="trace",ya=function(){function n(){this._proxyTracerProvider=new ps,this.wrapSpanContext=sa,this.isSpanContextValid=fs,this.deleteSpan=Xi,this.getSpan=Un,this.getActiveSpan=Qi,this.getSpanContext=ls,this.setSpan=$n,this.setSpanContext=Zi}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setGlobalTracerProvider=function(e){var t=vt(Bn,this._proxyTracerProvider,be.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},n.prototype.getTracerProvider=function(){return Fe(Bn)||this._proxyTracerProvider},n.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},n.prototype.disable=function(){bt(Bn,be.instance()),this._proxyTracerProvider=new ps},n}(),vs=ya.getInstance();const wa=()=>K(e=>{var t,zs,s;return s=class extends e{constructor(...i){super(...i);O(this,t);this.hooks.hook("frontgateConnection:beforeSerializeMessage",a=>{a.header&&vs.getTracer("frontgate-js-sdk").startActiveSpan("frontgateConnection:sendMessage",c=>{const h=q(this,t,zs).call(this,c.spanContext());h&&(a.header={...a.header,...h}),c.end()})})}},t=new WeakSet,zs=function(i){if(!/^0+$/.test(i.traceId))return{tracing:{value:{value:bs(i)}}}},s},{featureName:"OpenTelemetry",featureGroups:["Misc"]}),bs=n=>{const e=[18,20,9],t=r=>{for(let s=r.length;s>r.length-16;s-=2){let o=parseInt(r.substring(s-2,s),16);o>127&&(o-=256),e.push(o)}};return t(n.traceId),e.push(17),t(n.spanId),e.push(24),e.push(0),e},_a=()=>K(e=>class extends e{async requestProxyEndpoint(t,r,s,o,i=this.defaultTimeoutInMs){const a=new Ke(t,r,o);s&&a.setBody(s),a.header.setTimeout(i);const c={message:a.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",c);const h=new Promise((l,b)=>{this.hooks.hookOnce(`frontgateConnection:response:${c.callbackId}`,f=>{try{if(!f.Message.includes("HTTPProxyResponse")){b(JSON.stringify(f));return}const E=new An(f);l({response:E,data:E.data})}catch(E){b(E)}})}),u=`Request timeout reached (${i} ms) for ${c.message.Message}`;return ue(i,u,h)}},{featureName:"HTTPProxyRequest",featureGroups:["Misc"]}),Ta=()=>K(e=>class extends e{async ping(t=this.defaultTimeoutInMs){const s={message:new ze().getPtlMessage(),callbackType:"response",callbackId:"PingResponse"};await this.hooks.callHook("frontgateConnection:sendMessage",s);const o=new Promise(a=>{this.hooks.hookOnce(`frontgateConnection:response:${s.callbackId}`,c=>{const h=new je(c);a(h)})}),i=`Request timeout reached (${t} ms) for ${s.message.Message}`;return ue(t,i,o)}},{featureName:"Pingable",featureGroups:["Misc"]}),K=(n,e)=>{const t=n;return t.featureName=e.featureName,t.featureGroups=e.featureGroups,t.disabledFeatures=e.disabledFeatures,t.disabledFeatureGroups=e.disabledFeatureGroups,t};var Jn=function(n,e){return Jn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])},Jn(n,e)};function Qe(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Jn(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Ea(n,e,t,r){function s(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{h(r.next(u))}catch(l){i(l)}}function c(u){try{h(r.throw(u))}catch(l){i(l)}}function h(u){u.done?o(u.value):s(u.value).then(a,c)}h((r=r.apply(n,e||[])).next())})}function ms(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(h){return function(u){return c([h,u])}}function c(h){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,h[0]&&(t=0)),t;)try{if(r=1,s&&(o=h[0]&2?s.return:h[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,h[1])).done)return o;switch(s=0,o&&(h=[h[0]&2,o.value]),h[0]){case 0:case 1:o=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,s=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!o||h[1]>o[0]&&h[1]<o[3])){t.label=h[1];break}if(h[0]===6&&t.label<o[1]){t.label=o[1],o=h;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(h);break}o[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(n,t)}catch(u){h=[6,u],s=0}finally{r=o=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Xe(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gt(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o}function Bt(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))}function Ze(n){return this instanceof Ze?(this.v=n,this):new Ze(n)}function Ma(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),s[Symbol.asyncIterator]=function(){return this},s;function i(f){return function(E){return Promise.resolve(E).then(f,l)}}function a(f,E){r[f]&&(s[f]=function(_){return new Promise(function(k,w){o.push([f,_,k,w])>1||c(f,_)})},E&&(s[f]=E(s[f])))}function c(f,E){try{h(r[f](E))}catch(_){b(o[0][3],_)}}function h(f){f.value instanceof Ze?Promise.resolve(f.value.v).then(u,l):b(o[0][2],f)}function u(f){c("next",f)}function l(f){c("throw",f)}function b(f,E){f(E),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Sa(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof Xe=="function"?Xe(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(i){return new Promise(function(a,c){i=n[o](i),s(a,c,i.done,i.value)})}}function s(o,i,a,c){Promise.resolve(c).then(function(h){o({value:h,done:a})},i)}}typeof SuppressedError=="function"&&SuppressedError;function Q(n){return typeof n=="function"}function ys(n){var e=function(r){Error.call(r),r.stack=new Error().stack},t=n(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Wn=ys(function(n){return function(t){n(this),this.message=t?t.length+` errors occurred during unsubscription:
1
+ (function(d,G){typeof exports=="object"&&typeof module<"u"?G(exports):typeof define=="function"&&define.amd?define(["exports"],G):(d=typeof globalThis<"u"?globalThis:d||self,G(d.fdsg={}))})(this,function(d){"use strict";var Us=d=>{throw TypeError(d)};var lr=(d,G,X)=>G.has(d)||Us("Cannot "+X);var v=(d,G,X)=>(lr(d,G,"read from private field"),X?X.call(d):G.get(d)),O=(d,G,X)=>G.has(d)?Us("Cannot add the same private member more than once"):G instanceof WeakSet?G.add(d):G.set(d,X),R=(d,G,X,it)=>(lr(d,G,"write to private field"),it?it.call(d,X):G.set(d,X),X),q=(d,G,X)=>(lr(d,G,"access private method"),X);var $s=(d,G,X,it)=>({set _(Rt){R(d,G,Rt,X)},get _(){return v(d,G,it)}});var qe,Mt,St,He,Ge,Be,Re,Oe,ae,Vs,Ys,Ks,Qs,Xs;class Rt{constructor(e,t=-1){if(!Number.isInteger(e))throw new TypeError(`idApplication is not an integer number. Given: ${e} (${typeof e})`);if(this.idApplication=e,!Number.isInteger(t))throw new TypeError(`idUser is not an integer number. Given: ${t} (${typeof t})`);this.idUser=t}peerInfoFromMessage(e){if(e.Message==="Foundation::DisconnectionMessage"){const t=e;throw new Error(`Disconnection Message: ${t.details}`)}if(e.Message==="Foundation::AuthenticationByTokenResponse"||e.Message==="Foundation::ConfigurationResponse"){const t=e;return this.serverInfo=this.parseServerInfo(t),{uuid:t.server_info.uuid,description:t.server_info.description,software:t.server_info.software,os:t.server_info.os,maximumIdleInterval:parseInt(t.maximum_idle_interval,10),maximumReceivableMessageSize:t.maximum_receivable_message_size}}throw new Error("Could not extract server_info from unknown message type.")}parseServerInfo(e){const t=e,r=Number(BigInt(t.time_at_server.microseconds))/1e3,s=Math.ceil(Date.now()-r);return{description:t.server_info.description,software:t.server_info.software,os:t.server_info.os,time:new Date(r),offsetInMs:s}}getServerInfo(){return this.serverInfo}}var y=(n=>(n[n.TRACE=10]="TRACE",n[n.DEBUG=20]="DEBUG",n[n.INFO=30]="INFO",n[n.WARN=40]="WARN",n[n.ERROR=50]="ERROR",n[n.FATAL=60]="FATAL",n[n.SILENT=100]="SILENT",n))(y||{});const Ce=class Ce{constructor(e=""){this.defaultLevel=40,this.noop=()=>null,this.name=e,this.setDefaultLevelFromLocalStorage(),Object.assign(Ce.loggers,{[e]:this})}getName(){return this.name}setLevel(e){this.level=e}getLevel(){return typeof this.level=="number"&&isFinite(this.level)&&Math.floor(this.level)===this.level?this.level:this.defaultLevel}shouldLog(e){switch(this.getLevel()){case 100:return!1;case 60:return e==="fatal";case 50:return e==="fatal"||e==="error";case 40:return e==="fatal"||e==="error"||e==="warn";case 30:return e==="fatal"||e==="error"||e==="warn"||e==="info";case 20:return e==="fatal"||e==="error"||e==="warn"||e==="info"||e==="debug";case 10:default:return!0}}setDefaultLevelFromLocalStorage(){let e;try{if(!(typeof localStorage=="object"))return;const r=localStorage.getItem("loglevel");if(!r)return;e=r}catch{return}e&&this.setLevel(Ce.getLogLevel(e))}static getLogLevel(e){const t=e.toLowerCase();switch(t){case"silent":return 100;case"fatal":return 60;case"error":return 50;case"warn":return 40;case"info":return 30;case"debug":return 20;case"trace":return 10;default:throw new Error(`Invalid log level: ${t}`)}}static getLogger(e,t){if(Object.prototype.hasOwnProperty.call(Ce.loggers,e))return Ce.loggers[e];const r=new t(e);return Ce.loggers[e]=r,r}};Ce.loggers={};let Te=Ce;class Zs{static getLogLevel(e){const t=e.toLowerCase();switch(t){case"silent":return y.SILENT;case"fatal":return y.FATAL;case"error":return y.ERROR;case"warn":return y.WARN;case"info":return y.INFO;case"debug":return y.DEBUG;case"trace":return y.TRACE;default:throw new Error(`Invalid log level: ${t}`)}}}class an extends Te{constructor(){super(...arguments),this.trace=this.getLogMethod("trace"),this.debug=this.getLogMethod("debug"),this.info=this.getLogMethod("info"),this.warn=this.getLogMethod("warn"),this.error=this.getLogMethod("error"),this.fatal=this.getLogMethod("fatal")}setLevel(e){this.level=e,this.trace=this.getLogMethod("trace"),this.debug=this.getLogMethod("debug"),this.info=this.getLogMethod("info"),this.warn=this.getLogMethod("warn"),this.error=this.getLogMethod("error"),this.fatal=this.getLogMethod("fatal")}getLogMethod(e){if(this.shouldLog(e)){const t=e==="debug"||e==="fatal"?"log":e,r=this.name?`${this.name}: [${e.toUpperCase()}] `:`-----> [${e.toUpperCase()}] `;return Function.prototype.bind.call(console[t],console,r)}return this.noop}static getLogger(e=""){return super.getLogger(e,an)}}const eo={silent:0,fatal:1,error:2,warn:3,info:4,debug:5,trace:6};class to extends Te{constructor(e,t=""){super(t),this.name=t,this.logger=e,this.trace=Function.prototype.bind.call(e.trace,e),this.debug=Function.prototype.bind.call(e.debug,e),this.info=Function.prototype.bind.call(e.info,e),this.warn=Function.prototype.bind.call(e.warn,e),this.error=Function.prototype.bind.call(e.error,e),this.fatal=Function.prototype.bind.call(e.error,e)}setLevel(e){this.level=e,this.logger&&(this.logger.level=y[e].toLowerCase())}static getLogger(e=""){return Object.prototype.hasOwnProperty.call(Te.loggers,e)?Te.loggers[e]:null}}class at extends Te{constructor(){super(...arguments),this.trace=this.noop,this.debug=this.noop,this.info=this.noop,this.warn=this.noop,this.error=this.noop}static getLogger(e=""){return super.getLogger(e,at)}}var H=Uint8Array,te=Uint16Array,cn=Int32Array,Ot=new H([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Pt=new H([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),un=new H([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gr=function(n,e){for(var t=new te(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];for(var s=new cn(t[30]),r=1;r<30;++r)for(var o=t[r];o<t[r+1];++o)s[o]=o-t[r]<<5|r;return{b:t,r:s}},vr=gr(Ot,2),br=vr.b,hn=vr.r;br[28]=258,hn[258]=28;for(var mr=gr(Pt,0),no=mr.b,yr=mr.r,ln=new te(32768),U=0;U<32768;++U){var Ee=(U&43690)>>1|(U&21845)<<1;Ee=(Ee&52428)>>2|(Ee&13107)<<2,Ee=(Ee&61680)>>4|(Ee&3855)<<4,ln[U]=((Ee&65280)>>8|(Ee&255)<<8)>>1}for(var pe=function(n,e,t){for(var r=n.length,s=0,o=new te(e);s<r;++s)n[s]&&++o[n[s]-1];var i=new te(e);for(s=1;s<e;++s)i[s]=i[s-1]+o[s-1]<<1;var a;if(t){a=new te(1<<e);var c=15-e;for(s=0;s<r;++s)if(n[s])for(var h=s<<4|n[s],u=e-n[s],l=i[n[s]-1]++<<u,b=l|(1<<u)-1;l<=b;++l)a[ln[l]>>c]=h}else for(a=new te(r),s=0;s<r;++s)n[s]&&(a[s]=ln[i[n[s]-1]++]>>15-n[s]);return a},Me=new H(288),U=0;U<144;++U)Me[U]=8;for(var U=144;U<256;++U)Me[U]=9;for(var U=256;U<280;++U)Me[U]=7;for(var U=280;U<288;++U)Me[U]=8;for(var ct=new H(32),U=0;U<32;++U)ct[U]=5;var ro=pe(Me,9,0),so=pe(Me,9,1),oo=pe(ct,5,0),io=pe(ct,5,1),fn=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},ce=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},dn=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},pn=function(n){return(n+7)/8|0},Ne=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new H(n.subarray(e,t))},ao=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],W=function(n,e,t){var r=new Error(e||ao[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,W),!t)throw r;return r},co=function(n,e,t,r){var s=n.length,o=0;if(!s||e.f&&!e.l)return t||new H(0);var i=!t,a=i||e.i!=2,c=e.i;i&&(t=new H(s*3));var h=function(At){var kt=t.length;if(At>kt){var ot=new H(Math.max(kt*2,At));ot.set(t),t=ot}},u=e.f||0,l=e.p||0,b=e.b||0,f=e.l,E=e.d,_=e.m,k=e.n,w=s*8;do{if(!f){u=ce(n,l,1);var m=ce(n,l+1,3);if(l+=3,m)if(m==1)f=so,E=io,_=9,k=5;else if(m==2){var A=ce(n,l,31)+257,N=ce(n,l+10,15)+4,g=A+ce(n,l+5,31)+1;l+=14;for(var p=new H(g),I=new H(19),C=0;C<N;++C)I[un[C]]=ce(n,l+C*3,7);l+=N*3;for(var x=fn(I),z=(1<<x)-1,P=pe(I,x,1),C=0;C<g;){var F=P[ce(n,l,z)];l+=F&15;var T=F>>4;if(T<16)p[C++]=T;else{var j=0,L=0;for(T==16?(L=3+ce(n,l,3),l+=2,j=p[C-1]):T==17?(L=3+ce(n,l,7),l+=3):T==18&&(L=11+ce(n,l,127),l+=7);L--;)p[C++]=j}}var V=p.subarray(0,A),$=p.subarray(A);_=fn(V),k=fn($),f=pe(V,_,1),E=pe($,k,1)}else W(1);else{var T=pn(l)+4,S=n[T-4]|n[T-3]<<8,M=T+S;if(M>s){c&&W(0);break}a&&h(b+S),t.set(n.subarray(T,M),b),e.b=b+=S,e.p=l=M*8,e.f=u;continue}if(l>w){c&&W(0);break}}a&&h(b+131072);for(var Je=(1<<_)-1,ee=(1<<k)-1,de=l;;de=l){var j=f[dn(n,l)&Je],Y=j>>4;if(l+=j&15,l>w){c&&W(0);break}if(j||W(2),Y<256)t[b++]=Y;else if(Y==256){de=l,f=null;break}else{var J=Y-254;if(Y>264){var C=Y-257,D=Ot[C];J=ce(n,l,(1<<D)-1)+br[C],l+=D}var ie=E[dn(n,l)&ee],me=ie>>4;ie||W(3),l+=ie&15;var $=no[me];if(me>3){var D=Pt[me];$+=dn(n,l)&(1<<D)-1,l+=D}if(l>w){c&&W(0);break}a&&h(b+131072);var Pe=b+J;if(b<$){var _e=o-$,We=Math.min($,Pe);for(_e+b<0&&W(3);b<We;++b)t[b]=r[_e+b]}for(;b<Pe;++b)t[b]=t[b-$]}}e.l=f,e.p=de,e.b=b,e.f=u,f&&(u=1,e.m=_,e.d=E,e.n=k)}while(!u);return b!=t.length&&i?Ne(t,0,b):t.subarray(0,b)},ye=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8},ut=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8,n[r+2]|=t>>16},gn=function(n,e){for(var t=[],r=0;r<n.length;++r)n[r]&&t.push({s:r,f:n[r]});var s=t.length,o=t.slice();if(!s)return{t:Er,l:0};if(s==1){var i=new H(t[0].s+1);return i[t[0].s]=1,{t:i,l:1}}t.sort(function(M,A){return M.f-A.f}),t.push({s:-1,f:25001});var a=t[0],c=t[1],h=0,u=1,l=2;for(t[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=s-1;)a=t[t[h].f<t[l].f?h++:l++],c=t[h!=u&&t[h].f<t[l].f?h++:l++],t[u++]={s:-1,f:a.f+c.f,l:a,r:c};for(var b=o[0].s,r=1;r<s;++r)o[r].s>b&&(b=o[r].s);var f=new te(b+1),E=vn(t[u-1],f,0);if(E>e){var r=0,_=0,k=E-e,w=1<<k;for(o.sort(function(A,N){return f[N.s]-f[A.s]||A.f-N.f});r<s;++r){var m=o[r].s;if(f[m]>e)_+=w-(1<<E-f[m]),f[m]=e;else break}for(_>>=k;_>0;){var T=o[r].s;f[T]<e?_-=1<<e-f[T]++-1:++r}for(;r>=0&&_;--r){var S=o[r].s;f[S]==e&&(--f[S],++_)}E=e}return{t:new H(f),l:E}},vn=function(n,e,t){return n.s==-1?Math.max(vn(n.l,e,t+1),vn(n.r,e,t+1)):e[n.s]=t},wr=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new te(++e),r=0,s=n[0],o=1,i=function(c){t[r++]=c},a=1;a<=e;++a)if(n[a]==s&&a!=e)++o;else{if(!s&&o>2){for(;o>138;o-=138)i(32754);o>2&&(i(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(i(s),--o;o>6;o-=6)i(8304);o>2&&(i(o-3<<5|8208),o=0)}for(;o--;)i(s);o=1,s=n[a]}return{c:t.subarray(0,r),n:e}},ht=function(n,e){for(var t=0,r=0;r<e.length;++r)t+=n[r]*e[r];return t},_r=function(n,e,t){var r=t.length,s=pn(e+2);n[s]=r&255,n[s+1]=r>>8,n[s+2]=n[s]^255,n[s+3]=n[s+1]^255;for(var o=0;o<r;++o)n[s+o+4]=t[o];return(s+4+r)*8},Tr=function(n,e,t,r,s,o,i,a,c,h,u){ye(e,u++,t),++s[256];for(var l=gn(s,15),b=l.t,f=l.l,E=gn(o,15),_=E.t,k=E.l,w=wr(b),m=w.c,T=w.n,S=wr(_),M=S.c,A=S.n,N=new te(19),g=0;g<m.length;++g)++N[m[g]&31];for(var g=0;g<M.length;++g)++N[M[g]&31];for(var p=gn(N,7),I=p.t,C=p.l,x=19;x>4&&!I[un[x-1]];--x);var z=h+5<<3,P=ht(s,Me)+ht(o,ct)+i,F=ht(s,b)+ht(o,_)+i+14+3*x+ht(N,I)+2*N[16]+3*N[17]+7*N[18];if(c>=0&&z<=P&&z<=F)return _r(e,u,n.subarray(c,c+h));var j,L,V,$;if(ye(e,u,1+(F<P)),u+=2,F<P){j=pe(b,f,0),L=b,V=pe(_,k,0),$=_;var Je=pe(I,C,0);ye(e,u,T-257),ye(e,u+5,A-1),ye(e,u+10,x-4),u+=14;for(var g=0;g<x;++g)ye(e,u+3*g,I[un[g]]);u+=3*x;for(var ee=[m,M],de=0;de<2;++de)for(var Y=ee[de],g=0;g<Y.length;++g){var J=Y[g]&31;ye(e,u,Je[J]),u+=I[J],J>15&&(ye(e,u,Y[g]>>5&127),u+=Y[g]>>12)}}else j=ro,L=Me,V=oo,$=ct;for(var g=0;g<a;++g){var D=r[g];if(D>255){var J=D>>18&31;ut(e,u,j[J+257]),u+=L[J+257],J>7&&(ye(e,u,D>>23&31),u+=Ot[J]);var ie=D&31;ut(e,u,V[ie]),u+=$[ie],ie>3&&(ut(e,u,D>>5&8191),u+=Pt[ie])}else ut(e,u,j[D]),u+=L[D]}return ut(e,u,j[256]),u+L[256]},uo=new cn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Er=new H(0),ho=function(n,e,t,r,s,o){var i=o.z||n.length,a=new H(r+i+5*(1+Math.ceil(i/7e3))+s),c=a.subarray(r,a.length-s),h=o.l,u=(o.r||0)&7;if(e){u&&(c[0]=o.r>>3);for(var l=uo[e-1],b=l>>13,f=l&8191,E=(1<<t)-1,_=o.p||new te(32768),k=o.h||new te(E+1),w=Math.ceil(t/3),m=2*w,T=function(hr){return(n[hr]^n[hr+1]<<w^n[hr+2]<<m)&E},S=new cn(25e3),M=new te(288),A=new te(32),N=0,g=0,p=o.i||0,I=0,C=o.w||0,x=0;p+2<i;++p){var z=T(p),P=p&32767,F=k[z];if(_[P]=F,k[z]=P,C<=p){var j=i-p;if((N>7e3||I>24576)&&(j>423||!h)){u=Tr(n,c,0,S,M,A,g,I,x,p-x,u),I=N=g=0,x=p;for(var L=0;L<286;++L)M[L]=0;for(var L=0;L<30;++L)A[L]=0}var V=2,$=0,Je=f,ee=P-F&32767;if(j>2&&z==T(p-ee))for(var de=Math.min(b,j)-1,Y=Math.min(32767,p),J=Math.min(258,j);ee<=Y&&--Je&&P!=F;){if(n[p+V]==n[p+V-ee]){for(var D=0;D<J&&n[p+D]==n[p+D-ee];++D);if(D>V){if(V=D,$=ee,D>de)break;for(var ie=Math.min(ee,D-2),me=0,L=0;L<ie;++L){var Pe=p-ee+L&32767,_e=_[Pe],We=Pe-_e&32767;We>me&&(me=We,F=Pe)}}}P=F,F=_[P],ee+=P-F&32767}if($){S[I++]=268435456|hn[V]<<18|yr[$];var At=hn[V]&31,kt=yr[$]&31;g+=Ot[At]+Pt[kt],++M[257+At],++A[kt],C=p+V,++N}else S[I++]=n[p],++M[n[p]]}}for(p=Math.max(p,C);p<i;++p)S[I++]=n[p],++M[n[p]];u=Tr(n,c,h,S,M,A,g,I,x,p-x,u),h||(o.r=u&7|c[u/8|0]<<3,u-=7,o.h=k,o.p=_,o.i=p,o.w=C)}else{for(var p=o.w||0;p<i+h;p+=65535){var ot=p+65535;ot>=i&&(c[u/8|0]=h,ot=i),u=_r(c,u+1,n.subarray(p,ot))}o.i=i}return Ne(a,0,r+pn(u)+s)},Mr=function(){var n=1,e=0;return{p:function(t){for(var r=n,s=e,o=t.length|0,i=0;i!=o;){for(var a=Math.min(i+2655,o);i<a;++i)s+=r+=t[i];r=(r&65535)+15*(r>>16),s=(s&65535)+15*(s>>16)}n=r,e=s},d:function(){return n%=65521,e%=65521,(n&255)<<24|(n&65280)<<8|(e&255)<<8|e>>8}}},Sr=function(n,e,t,r,s){if(!s&&(s={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),i=new H(o.length+n.length);i.set(o),i.set(n,o.length),n=i,s.w=o.length}return ho(n,e.level==null?6:e.level,e.mem==null?s.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+e.mem,t,r,s)},Ir=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},lo=function(n,e){var t=e.level,r=t==0?0:t<6?1:t==9?3:2;if(n[0]=120,n[1]=r<<6|(e.dictionary&&32),n[1]|=31-(n[0]<<8|n[1])%31,e.dictionary){var s=Mr();s.p(e.dictionary),Ir(n,2,s.d())}},fo=function(n,e){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&W(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&W(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2},bn=function(){function n(e,t){if(typeof e=="function"&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new H(98304),this.o.dictionary){var r=this.o.dictionary.subarray(-32768);this.b.set(r,32768-r.length),this.s.i=32768-r.length}}return n.prototype.p=function(e,t){this.ondata(Sr(e,this.o,0,0,this.s),t)},n.prototype.push=function(e,t){this.ondata||W(5),this.s.l&&W(4);var r=e.length+this.s.z;if(r>this.b.length){if(r>2*this.b.length-32768){var s=new H(r&-32768);s.set(this.b.subarray(0,this.s.z)),this.b=s}var o=this.b.length-this.s.z;this.b.set(e.subarray(0,o),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(o),32768),this.s.z=e.length-o+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},n.prototype.flush=function(){this.ondata||W(5),this.s.l&&W(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},n}(),mn=function(){function n(e,t){typeof e=="function"&&(t=e,e={}),this.ondata=t;var r=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:r?r.length:0},this.o=new H(32768),this.p=new H(0),r&&this.o.set(r)}return n.prototype.e=function(e){if(this.ondata||W(5),this.d&&W(4),!this.p.length)this.p=e;else if(e.length){var t=new H(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},n.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,r=co(this.p,this.s,this.o);this.ondata(Ne(r,t,this.s.b),this.d),this.o=Ne(r,this.s.b-32768),this.s.b=this.o.length,this.p=Ne(this.p,this.s.p/8|0),this.s.p&=7},n.prototype.push=function(e,t){this.e(e),this.c(t)},n}(),po=function(){function n(e,t){this.c=Mr(),this.v=1,bn.call(this,e,t)}return n.prototype.push=function(e,t){this.c.p(e),bn.prototype.push.call(this,e,t)},n.prototype.p=function(e,t){var r=Sr(e,this.o,this.v&&(this.o.dictionary?6:2),t&&4,this.s);this.v&&(lo(r,this.o),this.v=0),t&&Ir(r,r.length-4,this.c.d()),this.ondata(r,t)},n.prototype.flush=function(){bn.prototype.flush.call(this)},n}(),go=function(){function n(e,t){mn.call(this,e,t),this.v=e&&e.dictionary?2:1}return n.prototype.push=function(e,t){if(mn.prototype.e.call(this,e),this.v){if(this.p.length<6&&!t)return;this.p=this.p.subarray(fo(this.p,this.v-1)),this.v=0}t&&(this.p.length<4&&W(6,"invalid zlib data"),this.p=this.p.subarray(0,-4)),mn.prototype.c.call(this,t)},n}(),Ar=typeof TextEncoder<"u"&&new TextEncoder,yn=typeof TextDecoder<"u"&&new TextDecoder,vo=0;try{yn.decode(Er,{stream:!0}),vo=1}catch{}var bo=function(n){for(var e="",t=0;;){var r=n[t++],s=(r>127)+(r>223)+(r>239);if(t+s>n.length)return{s:e,r:Ne(n,t-1)};s?s==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):s&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}};function mo(n,e){var t;if(Ar)return Ar.encode(n);for(var r=n.length,s=new H(n.length+(n.length>>1)),o=0,i=function(h){s[o++]=h},t=0;t<r;++t){if(o+5>s.length){var a=new H(o+8+(r-t<<1));a.set(s),s=a}var c=n.charCodeAt(t);c<128||e?i(c):c<2048?(i(192|c>>6),i(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|n.charCodeAt(++t)&1023,i(240|c>>18),i(128|c>>12&63),i(128|c>>6&63),i(128|c&63)):(i(224|c>>12),i(128|c>>6&63),i(128|c&63))}return Ne(s,0,o)}function yo(n,e){var t;if(yn)return yn.decode(n);var r=bo(n),s=r.s,t=r.r;return t.length&&W(8),s}const wo=n=>{if(n.length===1)return n[0];const e=new Uint8Array(n.reduce((t,r)=>t+r.length,0));for(let t=0,r=0;t<n.length;++t)e.set(n[t],r),r+=n[t].length;return e};class kr{constructor(){this.reset()}reset(){this.compressor=null,this.decompressor=null}compress(e){this.compressor||(this.compressor=new po({mem:4}));const t=[];return this.compressor.ondata=r=>{t.push(r)},this.compressor.push(mo(e)),this.compressor.flush(),wo(t)}decompress(e){this.decompressor||(this.decompressor=new go);let t;this.decompressor.ondata=r=>{t=r};try{if(this.decompressor.push(e),t===void 0)throw new Error("invalid block type")}catch(r){throw new Error(`Decompression error: ${r.message}, length: ${e.length}, data: [${e.toString()}]`)}return yo(t)}}const we=class we{static isSupportedEncoding(e){return we.SUPPORTED_ENCODINGS.includes(e)}static isPlainJson(e){return we.PLAIN_JSON_ENCODINGS.includes(e)}static isCompressedJson(e){return we.COMPRESSED_ENCODINGS.includes(e)}};we.SUPPORTED_ENCODINGS=["jsjson-v2","jsjsonc-v2"],we.PLAIN_JSON_ENCODINGS=["jsjson-v2"],we.COMPRESSED_ENCODINGS=we.SUPPORTED_ENCODINGS.filter(e=>e.includes("jsonc"));let Se=we;const _o="Mdg2Client",Cr="BST",wn=6e3,Rr=3e3,To=9e3,Or=3,Eo=!1,Mo=9e3,Pr=!1,Nr=512;function So(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var _n,jr;function Io(){if(jr)return _n;jr=1;var n=function(m){return e(m)&&!t(m)};function e(w){return!!w&&typeof w=="object"}function t(w){var m=Object.prototype.toString.call(w);return m==="[object RegExp]"||m==="[object Date]"||o(w)}var r=typeof Symbol=="function"&&Symbol.for,s=r?Symbol.for("react.element"):60103;function o(w){return w.$$typeof===s}function i(w){return Array.isArray(w)?[]:{}}function a(w,m){return m.clone!==!1&&m.isMergeableObject(w)?_(i(w),w,m):w}function c(w,m,T){return w.concat(m).map(function(S){return a(S,T)})}function h(w,m){if(!m.customMerge)return _;var T=m.customMerge(w);return typeof T=="function"?T:_}function u(w){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(w).filter(function(m){return Object.propertyIsEnumerable.call(w,m)}):[]}function l(w){return Object.keys(w).concat(u(w))}function b(w,m){try{return m in w}catch{return!1}}function f(w,m){return b(w,m)&&!(Object.hasOwnProperty.call(w,m)&&Object.propertyIsEnumerable.call(w,m))}function E(w,m,T){var S={};return T.isMergeableObject(w)&&l(w).forEach(function(M){S[M]=a(w[M],T)}),l(m).forEach(function(M){f(w,M)||(b(w,M)&&T.isMergeableObject(m[M])?S[M]=h(M,T)(w[M],m[M],T):S[M]=a(m[M],T))}),S}function _(w,m,T){T=T||{},T.arrayMerge=T.arrayMerge||c,T.isMergeableObject=T.isMergeableObject||n,T.cloneUnlessOtherwiseSpecified=a;var S=Array.isArray(m),M=Array.isArray(w),A=S===M;return A?S?T.arrayMerge(w,m,T):E(w,m,T):a(m,T)}_.all=function(m,T){if(!Array.isArray(m))throw new Error("first argument should be an array");return m.reduce(function(S,M){return _(S,M,T)},{})};var k=_;return _n=k,_n}var Ao=Io();const Dr=So(Ao);class ko extends Error{constructor(e="Service Unavailable",t){super(e,{cause:t}),this.name="ServiceUnavailableError",this.code=503}}class Co extends Error{constructor(e="Internal Server Error",t){super(e,{cause:t}),this.name="InternalServerError",this.code=500}}class xr extends Error{constructor(e="Timeout",t){super(e,{cause:t}),this.name="TimeoutError",this.code=408}}class Ro extends Error{constructor(e="Unauthorized",t){super(e,{cause:t}),this.name="UnauthorizedError",this.code=401}}class Oo extends Error{constructor(e="Bad Request",t){super(e,{cause:t}),this.name="BadRequestError",this.code=400}}class Po extends Error{constructor(e,t){super(e,{cause:t}),this.name="ResponseError",this.response=t}}function No(n){return!!n&&typeof n=="object"}function jo(...n){const e=n.filter(No);return Dr.all(e,{arrayMerge:(t,r)=>r})}function Tn(n){return n.replace(/[=]/g,"").replace(/\//g,"_").replace(/\+/g,"-")}function Do(n){return/^[A-Za-z0-9_-]*$/.test(n)}function xo(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");for(;e.length%4!==0;)e+="=";switch(e.length%4){case 0:break;case 1:e+="===";break;case 2:e+="==";break;case 3:e+="=";break}return e}const En=n=>{var r,s,o,i;let e="Unknown",t=500;if(n.name==="Foundation::PermissionDeniedResponse")t=403,e=`Permission Denied. Job ID: ${n.jobId} failed with status code ${t} `;else if(n.name==="Foundation::ErrorResponse"&&n.reason){const a=n.reason.startsWith("{"),c=a?JSON.parse(n.reason)||{}:n.reason;a&&((r=c.errors)!=null&&r[0].details)?e=c.errors[0].details:typeof c=="string"&&(e=c),t=parseInt(((o=(s=c==null?void 0:c.meta)==null?void 0:s.status)==null?void 0:o.code)??((i=n.msg.reason)==null?void 0:i.value)??500,10)}return new Po(`${e} (${t})`,n)},Fo=async n=>new Promise(e=>{setTimeout(e,n)}),Uo=()=>typeof window>"u",tt=class tt{constructor(){this._timeAtSender=Date.now()}getPtlMessage(){return{Message:tt.NAME,Version:tt.VERSION,time_at_sender:{microseconds:this._timeAtSender*1e3}}}resetTimeAtSender(){this._timeAtSender=Date.now()}get timeAtSender(){return this._timeAtSender}};tt.NAME="PingRequest",tt.VERSION=3;let ze=tt;var Fr=(n=>(n.MAXIMUM_STRING="9223372036854775807",n.MINIMUM_STRING="-9223372036854775807",n))(Fr||{});function Nt(n){return n.toString().slice(0,-3)}const nt=class nt{constructor(e){if(e.Message!==nt.NAME)throw new Error(`Unsupported message=${e.Message}`);if(e.Version!==nt.VERSION)throw new Error(`Unsupported version=${e.Version} for message=${e.Message}`);this._timeReceivedResponse=Date.now(),this._timeAtSender=Number(Nt(e.time_at_sender.microseconds)),this._timeFromRequest=Number(Nt(e.time_from_request.microseconds))}get timeAtPeer(){return this._timeAtSender}get timeOfRequest(){return this._timeFromRequest}get timeOfResponse(){return this._timeReceivedResponse}get latencyTotal(){return this._timeReceivedResponse-this._timeFromRequest}get latencyAtPeer(){return this._timeAtSender-this._timeFromRequest}};nt.NAME="Foundation::PingResponse",nt.VERSION=2;let je=nt;var Ie=(n=>(n[n.DISCONNECTED=0]="DISCONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.AUTHENTICATED=2]="AUTHENTICATED",n[n.RECONNECTING=3]="RECONNECTING",n))(Ie||{}),Ur=(n=>(n[n.production=40]="production",n[n.preproduction=35]="preproduction",n[n.show=30]="show",n[n.testing=20]="testing",n))(Ur||{}),$r=(n=>(n.production="frontgate-eu.factsetdigitalsolutions.com",n.show="frontgate-eu.show.factsetdigitalsolutions.com",n))($r||{});const nn=class nn{constructor(e,t){if(this.reconnectDelays=[1e3,2e3,4e3,8e3,16e3,32e3],this.reconnectCounter=0,this.connectionCounter=0,this.onConnect=null,this.onMessage=null,this.onClose=null,this.onError=null,this.onAuthentication=null,this.onCleanupRequests=null,this.onCleanupSubscriptions=null,this.onClearPendingSubscription=null,this.onReceiveTimeout=null,this.restartSubscriptions=null,this.options={...nn.DEFAULT_OPTIONS,...t},this.auth=e,this.state=0,this.options.logger&&(this.logger=this.options.logger),this.timestampOfLastMessageSent=0,this.jobId=0,this.peerInfo=null,this.compressor=new kr,this.keepAliveIntervalHandle=null,this.hasActiveSession=!1,this.options.loglevel&&this.logger.setLevel(this.options.loglevel),!Se.isSupportedEncoding(this.options.encoding))throw new Error(`Unknown or unsupported encoding: ${this.options.encoding}`);this.messageProcessors={},this.setMessageProcessor("Foundation::LoadNotificationMessage",this.handleLoadNotificationMessage.bind(this)),this.setMessageProcessor("Foundation::KeepAliveMessage",this.handleKeepAliveMessage.bind(this)),this.setMessageProcessor("Foundation::PingResponse",this.handlePingResponseMessage.bind(this)),this.setMessageProcessor("Foundation::DisconnectionMessage",this.handleDisconnectionMessage.bind(this))}setMessageProcessor(e,t){this.messageProcessors[e]=t}removeMessageProcessor(e){this.messageProcessors[e]!==void 0&&(this.messageProcessors[e]=void 0)}async close(){if(!this.isAuthenticated()){this.logger.warn("Cannot close gracefully. Connection not open. Proceeding to handleClose."),await this.handleClose("Unauthenticated connection");return}try{await this.sendDisconnectionMessage()}catch(e){await this.handleClose(e.message)}}setPeerInfo(e){this.peerInfo={...this.peerInfo,...e}}isAuthenticated(){return this.state===2}isConnecting(){return this.state===1}clearPendingConnection(){this.pendingConnection=null}isPendingConnection(){return this.pendingConnection instanceof Promise}handleLoadNotificationMessage(e){return this.peerInfo&&(this.peerInfo.loadStatus=e.load),!1}handleKeepAliveMessage(){return!1}handlePingResponseMessage(e){const t=new je(e);return this.logger.debug(`Time in ms: Request=${t.timeOfRequest} Peer=${t.timeAtPeer} Response=${t.timeOfResponse}`),this.logger.debug(`Latency in ms: Total=${t.latencyTotal} Peer=${t.latencyAtPeer}`),!1}async handleDisconnectionMessage(e){await this.handleClose(`DisconnectionMessage received: '${e.details}`),this.onClose&&this.onClose(e.details)}handleAuthentication(){this.state=2;const e=1e3;this.keepAliveIntervalHandle=setInterval(()=>{this.sendKeepAliveMessage()},e),this.onAuthentication&&this.onAuthentication()}handleReceiveTimeout(){this.messageReceiveTimeout&&clearTimeout(this.messageReceiveTimeout),this.onReceiveTimeout&&this.onReceiveTimeout()}resetReceiveTimeout(){var t;if(!((t=this.peerInfo)!=null&&t.maximumIdleInterval))return;const e=this.peerInfo.maximumIdleInterval/1e3*2;this.messageReceiveTimeout&&clearTimeout(this.messageReceiveTimeout),this.messageReceiveTimeout=setTimeout(()=>{this.handleReceiveTimeout()},e)}handleStandardMessage(e){return this.onMessage&&this.onMessage(e),!0}handleMessage(e){if(!e.Message)return;this.resetReceiveTimeout();const t=this.messageProcessors[e.Message];if(t!==void 0){if(!t(e))return}else this.handleStandardMessage(e);return e}async handleClose(e){if(typeof e=="string")this.logger.warn(`Handling connection close event. Reason: ${e}`);else{const{code:s,reason:o,wasClean:i,type:a}=e;this.logger.warn("Handling connection close event.",{code:s,reason:o,wasClean:i,type:a})}this.onCleanupRequests&&this.onCleanupRequests(),!this.shouldRestartSubscriptions&&this.onCleanupSubscriptions&&this.onCleanupSubscriptions(),this.keepAliveIntervalHandle&&(clearInterval(this.keepAliveIntervalHandle),this.keepAliveIntervalHandle=null),this.state=0,this.compressor.reset(),this.peerInfo=null,this.messageReceiveTimeout&&(clearTimeout(this.messageReceiveTimeout),this.messageReceiveTimeout=null),typeof e=="string"&&e.includes("DisconnectionMessage")&&(this.logger.debug("Disconnect message received. Preventing reconnect. Potential authentication failure."),this.options.shouldReconnectOnConnectionLoss=!1),this.auth.reconnectable&&this.options.shouldReconnectOnConnectionLoss?(this.onMessage=null,await this.reconnect()):(this.onClose&&this.onClose(e),this.onMessage=null,this.onClose=null,this.onError=null)}async reconnect(){for(;!this.isAuthenticated();){this.compressor.reset(),this.peerInfo=null,this.state=3;try{const e=this.reconnectDelays.length-1;let t=this.reconnectDelays[this.reconnectCounter]??this.reconnectDelays[e];t+=Math.floor(Math.random()*50);const r=this.reconnectCounter?`(${this.reconnectCounter} attempts)`:"";this.logger.warn(`Trying to reconnect. Waiting ${t} ms ${r}`),this.reconnectCounter++,await this.open(t),this.shouldRestartSubscriptions&&this.restartSubscriptions&&this.restartSubscriptions()}catch(e){this.logger.error("Failed to reconnect",e)}}this.reconnectCounter=0}handleWsError(e){this.close().then(()=>{this.logger.error("Connection closed due to WebSocket error")}),this.logger.error("WebSocket error: ",e),this.onError&&this.onError(e)}preSubmit(e){if(e.Message){const t=this.returnAndAssignJobIdToMessage(e);return this.logger.trace("PreSubmit",{message:e.Message,jobId:t}),t}throw new TypeError("Expected message type. Must be JSON message object or Array of JSON message objects")}async sendKeepAliveMessage(){const e=Date.now()-this.timestampOfLastMessageSent,t=this.options.maximum_idle_interval/1e3/2;if(!(this.timestampOfLastMessageSent>0&&e>t))return;const s=this.options.enablePingPongKeepalive??Uo()?new ze().getPtlMessage():{Message:"KeepAliveMessage",Version:2};await this.submit(s)}async sendDisconnectionMessage(e="client shutdown",t=64){const r={Message:"Foundation::DisconnectionMessage",Version:3,reason:{value:t},details:e};await this.submit(r),await this.handleClose("Disconnected by User.")}returnAndAssignJobIdToMessage(e){if(typeof e!="object")throw new TypeError(`expected object, not ${typeof e}`);if(typeof e.Message>"u")throw new TypeError("expected object to have a 'Message' member");return!/Request$/.exec(e.Message)||typeof e.header>"u"?null:(e.header.id_job||(this.jobId=this.jobId>=Number.MAX_SAFE_INTEGER?1:this.jobId+1,e.header.id_job=this.jobId),e.header.id_job)}setLogger(e){this.logger=e}};nn.DEFAULT_OPTIONS={payload_content:"foundation",deployment_stage:30,logger:at.getLogger(_o),loglevel:y.WARN,maximum_idle_interval:45e6,host:"frontgate-eu.show.factsetdigitalsolutions.com",port:443,tls:!0,path_prefix:"",encoding:"jsjsonc-v2",split_authentication_token_second_factor:void 0,shouldReconnectOnConnectionLoss:!0,connectionTimeoutInMs:To,sessionHandling:!1};let jt=nn;var ge=null;typeof WebSocket<"u"?ge=WebSocket:typeof MozWebSocket<"u"?ge=MozWebSocket:typeof global<"u"?ge=global.WebSocket||global.MozWebSocket:typeof window<"u"?ge=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(ge=self.WebSocket||self.MozWebSocket);class Ve{constructor(){this.promiseFinally=async(e,t)=>{const r=o=>(t(),o),s=async o=>(t(),Promise.reject(o));return Promise.resolve(e).then(r,s)},this._id=null,this._delay=null}static async wrap(e,t,r=""){return new Ve().wrap(e,t,r)}get id(){return this._id}get delay(){return this._delay}async set(e,t=""){return new Promise((r,s)=>{this.clear();const o=t?()=>{s(new xr(t))}:r;this._id=setTimeout(o,e),this._delay=e})}async wrap(e,t,r=""){const s=this.promiseFinally(e,()=>{this.clear()}),o=this.set(t,r);return Promise.race([s,o])}clear(){this._id&&clearTimeout(this._id)}}class lt extends jt{constructor(e,t){if(typeof ge>"u")throw new Co("WebSocketClient not supported, WebSocket() missing in JavaScript environment");super(e,lt.sanitizeOptions(t)),this.ws=null;const{encoding:r}=this.options;if(!Se.isSupportedEncoding(r))throw new Oo(`Unknown or unsupported encoding: ${r}`);this.onReceiveTimeout=()=>{this.logger.debug("onReceiveTimeout: Closing connection"),super.close().then(()=>{var s;(s=this.ws)==null||s.close()})}}async openConnection(){this.state===Ie.RECONNECTING&&this.auth.onReconnect&&await this.auth.onReconnect(),this.logger.info("Opening new connection",{host:this.options.host});try{await this.openWebSocket()}catch(e){throw this.logger.error("Problem opening connection",e),new ko(e.message,e)}this.logger.info(`Performing ${this.auth.constructor.name}`);try{await this.performAuthentication(),this.logger.debug("WebSocket authenticated")}catch(e){throw this.logger.error("Authentication problem occurred:",e),new Ro(e.message,e)}this.ws&&(this.ws.onclose=this.handleClose.bind(this),this.ws.onerror=this.handleWsError.bind(this))}async performAuthentication(){await new Promise((e,t)=>{this.ws?(this.ws.onclose=()=>{this.state=Ie.DISCONNECTED,t(new Error("Connection closed by server. Check credentials."))},this.ws.onerror=r=>{this.close(),t(new Error(`WebSocket error during authentication: ${r.message}`))},this.auth.authenticate(this).then(e).catch(t)):t(new Error("WebSocket not initialized"))}),this.handleAuthentication()}async open(e){this.onConnect&&(this.logger.trace("onConnect()"),this.onConnect());const t=this.options.connectionTimeoutInMs,r=`Connection timeout after ${t} ms`,s=async o=>o instanceof xr&&!this.pendingConnection?Promise.resolve():Promise.reject(o);if(this.isPendingConnection()&&this.pendingConnection){this.connectionCounter++;const o=Date.now();return this.logger.warn(`Waiting for pending connection (${this.connectionCounter}) with a timeout of ${t} ms`),Ve.wrap(this.pendingConnection,t,r).catch(s).then(()=>{const i=Date.now()-o;this.logger.warn(`Pending connection (${this.connectionCounter}) resolved after ${i} ms`)})}return e?(this.logger.debug(`Opening ${e} ms delayed connection with a timeout of ${t} ms`),this.pendingConnection=Fo(e).then(async()=>Ve.wrap(this.openConnection(),t,r)).catch(s).finally(()=>{this.clearPendingConnection()}),this.pendingConnection):(this.logger.debug(`Opening connection with a timeout of ${t} ms `),this.pendingConnection=Ve.wrap(this.openConnection(),t,r).catch(s).finally(()=>{this.clearPendingConnection()}),this.pendingConnection)}async close(e=!1,t=!1){this.logger.info("Closing connection explicitly"),this.options.shouldReconnectOnConnectionLoss=e,await super.close(),this.ws&&(this.clearPendingConnection(),this.ws.onclose=this.handleClose.bind(this),this.ws.close(),this.state=Ie.DISCONNECTED),t&&!e&&this.options.sessionHandling&&this.hasActiveSession&&(this.logger.info("Session logout"),await this.openWebSocket(!0))}send(e){const t=this.preSubmit(e),r=this.submit(e);return r.idJob=t,r}async submit(e){this.timestampOfLastMessageSent=Date.now();const t=new Promise(r=>{switch(this.logger.debug(`Sending ${e.Message}`,{...e}),this.sendMessage(e),this.resolveOnMessage=r,e.Message){case"Foundation::DisconnectionMessage":case"Foundation::KeepAliveMessage":case"Foundation::PingRequest":r({Message:"This message does not have a response",Version:1});break}});return t.catch(r=>{const s=new Date(this.timestampOfLastMessageSent);this.logger.error(`Failed sending ${e.Message}`,r,{request:e,lastMsgDate:s})}),t}sendMessage(e){var r;let t=JSON.stringify(e);Se.isCompressedJson(this.options.encoding)&&(t=this.compressor.compress(t)),(r=this.ws)==null||r.send(t)}async openWebSocket(e=!1){return this.logger.debug("Open WebSocket"),new Promise((t,r)=>{const{encoding:s,tls:o,host:i,port:a,path_prefix:c,frontgateSplitAuthenticationTokenSecondFactor:h,webSocketClientOptions:u,sessionHandling:l,frontgateAuthenticationToken:b}=this.options,E=`${o?"wss":"ws"}://${i}:${a}${c}/ws`,[_,k]=s.split("-"),m=[`${k?`${k}.`:""}ws-${_}.mdgms.com`];h?(m.push(`mdg2auth-${h}`),this.options.frontgateSplitAuthenticationTokenSecondFactor=null):l&&(e?m.push("mdg2wstoken-0"):this.clientOptions.otpToken?(m.push(`mdg2wstoken-${Tn(this.clientOptions.otpToken)}`),this.clientOptions.otpToken=""):b?typeof window<"u"&&m.push(`mdg2wstoken-${Tn(b)}`):m.push("mdg2wstoken-1")),this.state=Ie.CONNECTING,u?this.ws=new ge(E,m,u):this.ws=new ge(E,m),this.ws.binaryType="arraybuffer",this.ws.onopen=()=>{this.logger.info("WebSocket connected",{wsUrl:E,subProtocols:m}),e&&(this.logger.info("User logged out"),this.ws&&this.ws.close()),this.hasActiveSession=!e&&l,t()},this.ws.onclose=T=>{this.state=Ie.DISCONNECTED;const S=T.reason?`: ${T.reason}`:"";r(new Error(`Connection closed while trying to connect${S}`))},this.ws.onerror=this.handleWsError.bind(this),this.ws.onmessage=this.onWebSocketMessage.bind(this)})}onWebSocketMessage(e){if(this.state===Ie.DISCONNECTED){this.logger.warn("onWebSocketMessage while state is disconnected",{data:e.data});return}const t=this.decodeMessage(e.data),r=this.handleMessage(t);this.logger.debug(`Received ${t.Message}`,t),r&&this.resolveOnMessage(r)}decodeMessage(e){const{encoding:t}=this.options;try{if(e instanceof ArrayBuffer&&Se.isCompressedJson(t)){const r=this.compressor.decompress(new Uint8Array(e));return JSON.parse(r)}if(typeof e=="string"&&Se.isPlainJson(t))return JSON.parse(e)}catch(r){this.logger.error("Decoding message failed",r)}return String(e.constructor.name)==="Buffer"?e:(this.logger.error(`Could not decode Message of type "${typeof e}" with encoding "${t}".`),{Message:`Invalid Message Type ${typeof e}`,Version:1})}static sanitizeOptions(e={}){return e.frontgateHost&&(e.host=e.frontgateHost),e.frontgatePathPrefix&&(e.path_prefix=e.frontgatePathPrefix),e.frontgateSplitAuthenticationTokenSecondFactor&&(e.split_authentication_token_second_factor=e.frontgateSplitAuthenticationTokenSecondFactor),e.frontgateWebsocketProtocol&&(e.encoding=e.frontgateWebsocketProtocol),e.deploymentStage&&(e.deployment_stage=e.deploymentStage),e}handleWsError(e){typeof process<"u"&&this.close(this.options.shouldReconnectOnConnectionLoss).then(()=>{this.logger.error("Connection closed due to WebSocket error")}),this.logger.error("WebSocket error: ",e),this.onError&&this.onError(e)}}var Lr=(n=>(n.FRONTGATE_HOST="frontgate-host",n.FRONTGATE_PATH_PREFIX="frontgate-path-prefix",n.FRONTGATE_SPLIT_AUTHENTICATION_TOKEN_SECOND_FACTOR="frontgate-split-authentication-token-second-factor",n.FRONTGATE_AUTHENTICATION_TYPE="frontgate-authentication-type",n.FRONTGATE_AUTHENTICATION_TOKEN="frontgate-authentication-token",n.FRONTGATE_WEBSOCKET_PROTOCOL="frontgate-websocket-protocol",n))(Lr||{});function $o(n){const e=[];if(n)for(let t=0;t<n.length;t++)e.push(n.readInt8(t));return e}function qr(n){const e={},t=Object.keys(n);return["frontgate-host","frontgate-path-prefix","frontgate-split-authentication-token-second-factor","frontgate-authentication-type","frontgate-authentication-token","frontgate-websocket-protocol"].forEach(r=>{t.includes(r)&&(e[r.replace(/-([a-z])/g,s=>s[1].toUpperCase())]=n[r])}),e}function Hr(n){const e={};return n.forEach((t,r)=>{e[r]=t}),e}async function Dt(n,e){const t=await fetch(n,e),r=Hr(t.headers);return{config:qr(r),response:t}}function Gr(n={},e,t){const r=n.frontgateAuthenticationType==="token"?new kn(n.frontgateAuthenticationToken):new Cn;return r.setFetchConfiguration(e,t),new lt(r,n)}function Br({frontgateHost:n,frontgateWebsocketProtocol:e}){localStorage.setItem("mdg2config",JSON.stringify({frontgateHost:n,frontgateWebsocketProtocol:e}))}function Jr(){const n=localStorage.getItem("mdg2config");return n?JSON.parse(n):null}function Wr(n){return n.name==="Foundation::ErrorResponse"}function zr(n){return n.name==="Foundation::PermissionDeniedResponse"}function Vr(n){return n.name==="Foundation::HighLevelResponse"}function Yr(n){return n.Message==="Foundation::HighLevelResponse"}function Kr(n){return n.name==="Foundation::RejectResponse"}function xt(n){return n.name==="Foundation::HighLevelUpdate"}function Qr(n){return n.name==="Foundation::SubscriptionLossMessage"}const Xr={version:"6.10.2",package:"@factset/frontgate-js-sdk"};function Lo(){const n=qo();return{userAgent:n.userAgent,platform:n.platform,version:Xr.version,package:Xr.package,mobile:/Mobi/i.test(n.userAgent)}}function qo(){return typeof navigator<"u"?navigator:typeof process<"u"?{userAgent:`node.js/io.js, ${process.version}`,platform:`${process.platform}_${process.arch}`}:{userAgent:"unknown",platform:"unknown"}}const Ho=n=>{const e=[18,20,9],t=r=>{for(let s=r.length;s>r.length-16;s-=2){let o=parseInt(r.substring(s-2,s),16);o>127&&(o-=256),e.push(o)}};return t(n.traceId),e.push(17),t(n.spanId),e.push(24),e.push(0),e},Go=async(n,e)=>new Promise((t,r)=>{setTimeout(()=>{r(e)},n)}),ue=async(n,e,t)=>Promise.race([Go(n,e),t]),Zr=n=>n+Math.random()*100,he=class he{constructor(){this.headerMembers={dataset:{id_dataset:0},id_job:0,flags_r2:0,resend_counter:0,timeout:wn,authentication_identifiers:{id_application:0,id_user:0},cache_key:{value:[]},previous_response_hash:{value:[]},tracing:{value:{value:[]}}},this.flags=[]}getPtlMessage(){return this.headerMembers}getQuality(){return Object.keys(he.PRICE_QUALITY).find(t=>he.PRICE_QUALITY[t]===this.headerMembers.dataset.id_dataset)}setQuality(e){this.headerMembers.dataset.id_dataset=he.PRICE_QUALITY[e]}setIdApplication(e,t=!1){(this.headerMembers.authentication_identifiers.id_application===0||t)&&(this.headerMembers.authentication_identifiers.id_application=e)}setIdUser(e,t=!1){(this.headerMembers.authentication_identifiers.id_user===0||t)&&(this.headerMembers.authentication_identifiers.id_user=e)}setFlag(e,t=!0){const r=this.flags.indexOf(e);t&&r===-1&&this.flags.push(e),!t&&r>-1&&this.flags.splice(r,1),this.headerMembers.flags_r2=this.getFlagsValue()}getFlagsValue(){return this.flags.reduce((e,t)=>e+he.FLAG_VALUE[t],0)}isFlagValueSet(e){return this.flags.find(t=>t===e)!==void 0}setJobId(e){this.headerMembers.id_job=e}getJobId(){return this.headerMembers.id_job}countResend(){this.headerMembers.resend_counter++}getResendCounter(){return this.headerMembers.resend_counter}setTimeout(e){if(e>0){this.headerMembers.timeout=e;return}throw new Error(`Attempted to set the timeout to "${e}". The timeout must be greater than 0.`)}getTimeout(){return this.headerMembers.timeout}setTracing(e){/^0+$/.test(e.traceId)||(this.headerMembers.tracing.value.value=Ho(e))}static getDataSet(e){return Object.prototype.hasOwnProperty.call(he.PRICE_QUALITY,e)?he.PRICE_QUALITY[e]:he.PRICE_QUALITY.DLY}};he.PRICE_QUALITY={RLT:129,DLY:0,EOD:130},he.FLAG_VALUE={add_subscription:1,no_merge:2,support_caching:4,permission_denied_response:8,internal_client:16,current_state_refresh:32,subscription_use_pull_permissions:64,allow_chunked_response:128};let ft=he;class Ye{constructor(e,t){this.header=new ft,this.coreMembers={Message:e,Version:t},this.members={}}getPtlMessage(){const e={header:this.header.getPtlMessage()};return jo(this.coreMembers,e,this.members)}}class dt{constructor(e,t){this.token=e,this.maximumIdleInterval=t}toJson(){const e=Lo();return{Message:"AuthenticationByTokenRequest",Version:1,token:{value:this.token},software:JSON.stringify(e),os:e.platform,feature_flags_wanted:{value:0},maximum_idle_interval:this.maximumIdleInterval,maximum_receivable_message_size:1048576,flags:0,cache_authentication_salt:{value:[]},cache_authentication_encrypted_secret:{encrypted_secret:[]}}}}const le=class le extends Ye{constructor(e,t,r,s,o=!1){super(le.NAME,le.VERSION),t&&this.header.setIdUser(t),r&&this.header.setIdApplication(r),s&&this.header.setTimeout(s),this.members.flags=o?le.FLAG_SINGLE_USAGE:0,this.members.lifetime_seconds_r2=e??le.LIFETIME_SECONDS_DEFAULT,this.header.setFlag("no_merge")}};le.NAME="AuthenticationTokenRequest",le.VERSION=6,le.LIFETIME_SECONDS_DEFAULT=-1,le.LIFETIME_SECONDS_MAXIMUM=-2,le.FLAG_SINGLE_USAGE=1;let De=le;const rt=class rt extends Ye{constructor(e){super(rt.NAME,rt.VERSION),this.members.id_job_subscription=e}};rt.NAME="CancelSubscriptionRequest",rt.VERSION=6;let Ae=rt;const fe=class fe extends Ye{constructor(e,t,r={},s){super(fe.NAME,fe.VERSION),this.members.accept="application/json",this.members.content_type="application/json",this.members.body={value:[]},this.members.query="",this.members.path=t,this.setMethod(e),Object.keys(r).length>0&&(e==="POST"?this.setBody(r):this.setQuery(r)),s&&this.setOptions(s)}setOptions(e){Object.hasOwnProperty.call(e,"accept")&&(this.members.accept=e.accept),Object.hasOwnProperty.call(e,"content_type")&&(this.members.content_type=e.content_type),Object.hasOwnProperty.call(e,"subscribe")&&e.subscribe&&this.header.setFlag("add_subscription"),Object.hasOwnProperty.call(e,"no_merge")&&e.no_merge&&this.header.setFlag("no_merge"),Object.hasOwnProperty.call(e,"allowChunkedResponse")&&e.allowChunkedResponse&&this.header.setFlag("allow_chunked_response"),Object.hasOwnProperty.call(e,"idApplication")&&e.idApplication&&this.header.setIdApplication(e.idApplication),Object.hasOwnProperty.call(e,"idUser")&&e.idUser&&this.header.setIdUser(e.idUser)}setMethod(e){const t=e==="POST"?fe.METHOD.POST:fe.METHOD.GET;this.members.method={value:t}}setBody(e={}){e instanceof Array?this.members.body={value:e}:this.members.body={value:JSON.stringify(e)}}getData(){return this.members.method.value===fe.METHOD.POST?fe.ptlToJsonData(this.members.body.value):this.members.query}setQuery(e={}){this.members.query=Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&")}static ptlToJsonData(e){if(typeof e=="string")return JSON.parse(e);if(e instanceof Array&&e.length>0){let t="";return e.forEach(r=>{t+=String.fromCharCode(r)}),JSON.parse(t)}}};fe.NAME="HighLevelRequest",fe.VERSION=3,fe.METHOD={GET:1,POST:2};let ve=fe;const oe=class oe extends Ye{constructor(e,t,r){super(oe.NAME,oe.VERSION),this.members.request={headers:{values:[{key:"accept",value:"application/json"},{key:"content-type",value:"application/json"}]},protocol:{value:oe.PROTOCOL.HTTPS},host:"",port:0,path:t,query:"",body:{value:[]}},this.setQuery(),this.setMethod(e),r&&this.setOptions(r)}setOptions(e){e.no_merge&&this.header.setFlag("no_merge"),e.idApplication&&this.header.setIdApplication(e.idApplication),e.idUser&&this.header.setIdUser(e.idUser),e.protocol&&(this.members.request.protocol=e.protocol.toUpperCase()==="HTTP"?{value:oe.PROTOCOL.HTTP}:{value:oe.PROTOCOL.HTTPS}),e.method&&(this.members.request.method={value:oe.METHOD[e.method]}),e.host&&(this.members.request.host=e.host),e.port&&(this.members.request.port=e.port),e.path&&(this.members.request.path=e.path),e.query&&(this.members.request.query=typeof e.query=="string"?e.query:Object.keys(e.query).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e.query[t])}`).join("&")),e.body&&this.setBody(e.body),e.headers&&this.setHeaders(e.headers)}setHeaders(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)){const r=e[t],s=this.members.request.headers.values.findIndex(i=>i.key===t);s!==-1&&this.members.request.headers.values.splice(s,1),this.members.request.headers.values.push({key:t,value:r})}}setQuery(){if(this.members.request.path.includes("?")){const e=this.members.request.path.split("?");this.members.request.path=e[0],this.members.request.query=e[1]}}setMethod(e){this.members.request.method={value:oe.METHOD[e]}}setBody(e={}){return e instanceof Array||typeof e=="string"?this.members.request.body={value:e}:this.members.request.body={value:JSON.stringify(e)},this}getData(){var e;if((e=this.members.request.body)!=null&&e.value)return ve.ptlToJsonData(this.members.request.body.value)}};oe.NAME="HTTPProxyRequest",oe.VERSION=2,oe.PROTOCOL={HTTP:1,HTTPS:2},oe.METHOD={GET:1,POST:2,OPTIONS:3,HEAD:4,PUT:5,DELETE:6,TRACE:7,CONNECT:8};let Ke=oe;class es extends Ye{constructor(e){super(e.Message,e.version?e.version:e.Version),this._extractRequestAttributes(e)}_extractRequestAttributes(e){for(const t of Object.keys(this.coreMembers))delete e[t];this.members=Dr(this.members,e)}}class Mn{static createFromString(e){return Mn.createFromObject(JSON.parse(e))}static createFromObject(e){const{header:t}=e;return t&&(t.id_job&&delete t.id_job,t.resend_counter&&delete t.resend_counter),new es(e)}}class ne{constructor(e){this.raw=e}get msg(){return this.raw}get name(){return this.raw.Message}get jobId(){return this.raw.header.id_job}get serviceId(){return this.raw.header.id_service}isUpdateMessage(){return Object.hasOwnProperty.call(this.raw,"header")&&(Object.hasOwnProperty.call(this.raw.header,"id_service")||Object.hasOwnProperty.call(this.raw.header,"id_job"))&&this.raw.Message.endsWith("Update")}isLossMessage(){return Object.hasOwnProperty.call(this.raw,"header")&&(Object.hasOwnProperty.call(this.raw.header,"id_service")||Object.hasOwnProperty.call(this.raw.header,"id_job"))&&(this.raw.Message.endsWith("LossMessage")||this.raw.Message.endsWith("Loss"))}}class Sn extends ne{constructor(e){if(super(e),!this.raw.token.value.b64)throw new Error("Token not set in AuthenticationTokenResponse");if(!this.raw.expiry.microseconds)throw new Error("Expiry not set in AuthenticationTokenResponse");this.token=this.raw.token.value.b64,this.expiry=parseInt(Nt(this.raw.expiry.microseconds),10)}getToken(){return this.token}getExpiry(){return this.expiry}}class ts extends ne{}class Z extends ne{get reason(){return this.raw.details}get jobId(){return this.raw.id_job}}class In extends ne{constructor(e){super(e);try{this.responseData=JSON.parse(this.raw.body.value)}catch(t){throw new Error(`Could not parse HighLevelResponse: ${t.message}`)}}get data(){return this.responseData.data}get meta(){return this.responseData.meta}get status(){return this.meta.status}get statusCode(){return this.status.code}}class An extends ne{constructor(e){super(e);try{const t=this.raw.response.body.value,r=t.substr(0,1)==="{";this.responseData=r?JSON.parse(t):t}catch(t){throw new Error(`Could not parse HTTPProxyResponse: ${t}`)}this.responseInfo=this.raw.info,this.statusReason=this.raw.response.status_reason,this.statusCode=this.raw.response.status_code.value}get data(){return this.responseData}get meta(){return this.responseData.meta}get status(){return{code:this.statusCode,reason:this.statusReason}}}class ns extends ne{get reason(){return this.raw.details}}class rs extends ne{get reason(){return this.raw.details}get jobId(){return this.raw.id_job}}const Bo=Object.freeze(Object.defineProperty({__proto__:null,AuthenticationTokenResponse:Sn,CancelSubscriptionResponse:ts,ErrorResponse:Z,HTTPProxyResponse:An,HighLevelResponse:In,Mdg2Response:ne,PermissionDeniedResponse:ns,PingResponse:je,RejectResponse:rs},Symbol.toStringTag,{value:"Module"}));class Ft extends ne{constructor(e){if(super(e),typeof this.raw.body.value!="string")throw new Error("Incorrect response type in HighLevelUpdate");try{this.responseData=JSON.parse(this.raw.body.value)}catch(t){throw new Error(`Could not parse HighLevelUpdate: ${t.message}`)}}get data(){return this.responseData}}class Ut extends ne{constructor(e){super(e),this.reason=e.reason}get reasonValue(){return this.reason.value}}const Jo=Object.freeze(Object.defineProperty({__proto__:null,HighLevelUpdate:Ft,SubscriptionLossMessage:Ut},Symbol.toStringTag,{value:"Module"}));class kn extends Rt{constructor(e,t=!0){if(super(-2,-2),t&&(!e||e.length<80))throw new Error("Invalid token passed to TokenAuthentication");this.setToken(e)}setToken(e){this.token=Do(e)?xo(e):e}setFetchConfiguration(e,t){this.fetchConfigurationInput=e,this.fetchConfigurationConfig=t}async authenticate(e){this.connection=e;const t=await this.sendAuthenticationByTokenRequest(),r=this.peerInfoFromMessage(t);this.connection.setPeerInfo(r)}async sendAuthenticationByTokenRequest(){const e={b64:this.token},t=new dt(e,this.connection.options.maximum_idle_interval);return await this.connection.submit(t.toJson())}get reconnectable(){return!!this.fetchConfigurationInput}async onReconnect(){if(this.fetchConfigurationInput){const{config:e}=await Dt(this.fetchConfigurationInput,this.fetchConfigurationConfig);e.frontgateAuthenticationType==="token"&&e.frontgateAuthenticationToken&&this.setToken(e.frontgateAuthenticationToken)}}}class Cn extends kn{constructor(){super("",!1)}getEncodedToken(){return[]}async onReconnect(){if(this.fetchConfigurationInput){const{config:e}=await Dt(this.fetchConfigurationInput,this.fetchConfigurationConfig);e.frontgateSplitAuthenticationTokenSecondFactor&&(this.connection.options.frontgateSplitAuthenticationTokenSecondFactor=e.frontgateSplitAuthenticationTokenSecondFactor)}}}class Rn{constructor(e){const t=Tn(e),r=Math.ceil(t.length/2);this.firstFactor=t.substring(0,r),this.secondFactor=t.substring(r)}getFirstFactor(){return this.firstFactor}getSecondFactor(){return this.secondFactor}}const rn=class rn{constructor(e,t){this.cb=e,this.conn=t,this.isRequestPending=!1,this.request=new ze}start(e){if(this.timeout!==void 0)throw new Error("LatencyTracker already running!");this.conn.setMessageProcessor("Foundation::PingResponse",this.handlePingResponse.bind(this)),this.timeout=setInterval(()=>{if(!this.conn.isAuthenticated()){this.cb(void 0,void 0,void 0,"Skipping ping request, connection not authenticated!");return}if(this.isRequestPending){if(Date.now()-this.request.timeAtSender<rn.MAX_RESPONSE_LATENCY_MS){this.cb(this.request.timeAtSender,void 0,void 0,"Skipping ping request, previous request pending!");return}this.cb(this.request.timeAtSender,void 0,void 0,"Clearing ping request, previous request exceeded timeout!")}this.isRequestPending=!0,this.request.resetTimeAtSender(),this.conn.send(this.request.getPtlMessage())},e),typeof window>"u"&&this.timeout.unref()}stop(){clearInterval(this.timeout),this.timeout=void 0,this.isRequestPending=!1,this.conn.removeMessageProcessor("Foundation::PingResponse")}handlePingResponse(e){const t=new je(e);return this.cb(t.timeOfRequest,t.latencyTotal,t.latencyAtPeer,void 0),this.isRequestPending=!1,!1}};rn.MAX_RESPONSE_LATENCY_MS=60*1e3;let On=rn;const Wo=()=>K(e=>class extends e{async requestAuthenticationToken(t=30,r=0,s=0,o=this.defaultTimeoutInMs){const a={message:new De(t,r,s,o).getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",a);const c=new Promise((u,l)=>{this.hooks.hookOnce(`frontgateConnection:response:${a.callbackId}`,b=>{if(!b.Message.includes("AuthenticationTokenResponse")){l(JSON.stringify(b));return}const f=new Sn(b);u({token:f.getToken(),expiry:f.getExpiry()})})}),h=`Request timeout reached (${o} ms) for ${a.message.Message}`;return ue(o,h,c)}async requestAuthenticationTokenForCookieTokenAuthentication(t=30,r=0,s=0,o=this.defaultTimeoutInMs){const i=await this.requestAuthenticationToken(t,r,s,o);return new Rn(i.token)}},{featureName:"AuthTokenRequest",featureGroups:["Misc"]}),$t=8,ss={...Bo,...Jo},st=class st{static createMessage(e){if(!e)throw new Error(`Could not create message because msg is "${e}"`);if(!e.Message||typeof e.Message!="string")throw new Error(`Could not create message because msg.Message is "${e.Message}"`);const t=e.Message.indexOf(st.msgNameSeparator);if(t===-1)throw new Error(`Could not create message for invalid msg.Message "${e.Message}"`);if(!(e!=null&&e.header))throw new Error("Could not create message because the header is missing in the msg");try{const r=e.Message.substring(t+st.msgNameSeparatorLength);return ss[r]?new ss[r](e):new ne(e)}catch(r){throw new Error(`Could not create message "${e.Message}": ${r.message}`)}}static hasNextChunk(e){var t;return((((t=e.header)==null?void 0:t.flags)??0)&$t)===$t}};st.msgNameSeparator="::",st.msgNameSeparatorLength=2;let Lt=st;const zo=n=>K(t=>{var r,Ls,o;return o=class extends t{constructor(){super(...arguments);O(this,r)}async requestEndpoint(a,c,h,u,l=this.defaultTimeoutInMs){const b=new ve(a,c,h,{...u,allowChunkedResponse:!(n!=null&&n.disableChunkedResponse)});b.header.setTimeout(l),n!=null&&n.allowPermissionDeniedResponse&&b.header.setFlag("permission_denied_response");const f={message:b.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",f);const E=new Promise((k,w)=>{const m=[],T=()=>{this.hooks.hookOnce(`frontgateConnection:response:${f.callbackId}`,S=>{var M,A,N,g;try{if(!S.Message.includes("HighLevelResponse")){w(JSON.stringify(S));return}if(q(this,r,Ls).call(this,S))m.push({body:((N=S.body)==null?void 0:N.value)??"",processingTime:((g=S.header)==null?void 0:g.processingTime)??0}),T();else{m.push({body:((M=S.body)==null?void 0:M.value)??"",processingTime:((A=S.header)==null?void 0:A.processingTime)??0});const p=new In({...S,body:{value:m.map(I=>I.body).join("")},header:{...S.header,processingTime:m.reduce((I,C)=>I+C.processingTime,0)}});k({response:p,data:p.data})}}catch(p){w(p)}})};T()}),_=`Request timeout reached (${l} ms) for ${f.message.Message}`;return ue(l,_,E)}},r=new WeakSet,Ls=function(a){var c;return((((c=a.header)==null?void 0:c.flags)??0)&$t)===$t},o},{featureName:"EndpointRequest",featureGroups:["Misc"]}),os=n=>K(t=>{var r,s,o,i,a,c,h,u,on,b,f,qs,Hs,Ct,fr,Gs,dr,Bs,Js,A;return A=class extends t{constructor(...g){super(...g);O(this,u);O(this,r);O(this,s);O(this,o,"disconnected");O(this,i);O(this,a,0);O(this,c);O(this,h);O(this,b);O(this,f,[]);R(this,c,-2),R(this,h,-1),n&&(this.conf=n),this.hooks.hook("frontgateConnection:setIdApp",p=>{R(this,c,p)}),this.hooks.hook("frontgateConnection:setIdUser",p=>{R(this,h,p)}),this.hooks.hook("frontgateConnection:sendMessage",p=>{if(p.callbackType==="job"){const I=q(this,u,Gs).call(this,p.message);p.callbackId=`${I}`,q(this,u,dr).call(this,p.message)}if(v(this,u,on)==="connected"&&p.callbackType==="response")q(this,u,Ct).call(this,p.message);else if(v(this,u,on)==="authenticated")q(this,u,Ct).call(this,p.message);else{if(v(this,f).length>=v(this,b))throw new Error("Message buffer is full");v(this,f).push(p)}}),this.hooks.hook("frontgateConnection:authenticated",()=>{if(!v(this,s))throw new Error("No connection configuration set");for(this.log(y.DEBUG,"Draining message buffer");v(this,f).length>0;){const p=v(this,f).shift();p&&(q(this,u,dr).call(this,p.message),q(this,u,Ct).call(this,p.message))}R(this,i,setInterval(()=>{this.log(y.DEBUG,"Sending keepalive"),this.hooks.callHook("frontgateConnection:sendMessage",{message:q(this,u,Hs).call(this),callbackType:"response",callbackId:"KeepAliveMessage"})},v(this,s).maximumIdleIntervalInS/2*1e3))}),this.hooks.hook("reconnect:attempt",async()=>{clearInterval(v(this,i)),this.log(y.DEBUG,"Reconnecting"),await this.hooks.callHook("frontgateConnection:reset");try{await this.connect(),await this.hooks.callHook("reconnect:success")}catch(p){this.log(y.ERROR,"Reconnect failed",p),await this.hooks.callHook("reconnect:failed",p)}})}set conf(g){const p=q(this,u,Js).call(this,g);R(this,b,p.messageBufferSize),R(this,s,p)}async connect(){if(!v(this,s))throw new Error("No connection configuration set");if(v(this,u,on)!=="disconnected")throw new Error("Client is already connected or is connecting right now");const{host:g,port:p,tls:I,pathPrefix:C}=v(this,s);R(this,o,"connecting");const z=`${I?"wss":"ws"}://${g}:${p}${C??""}/ws`,P={encoding:"jsjson-v2"};await this.hooks.callHook("frontgateConnection:afterSetEncoding",P);const[F,j]=P.encoding.split("-"),V=[`${j?`${j}.`:""}ws-${F}.mdgms.com`],$={url:z,subProtocols:V};await this.hooks.callHook("frontgateConnection:beforeConnect",$),this.log(y.DEBUG,`Connecting to ${$.url} with subprotocols ${$.subProtocols}`);const Je=new Promise((de,Y)=>{if(!v(this,s))throw new Error("No connection configuration set");v(this,s).wsClientOptions&&typeof window>"u"?R(this,r,new ge($.url,$.subProtocols,v(this,s).wsClientOptions)):R(this,r,new ge($.url,$.subProtocols)),v(this,r).binaryType="arraybuffer";let J;v(this,r).onopen=()=>{R(this,o,"connected"),this.log(y.DEBUG,"Connected"),this.hooks.callHook("frontgateConnection:connected",v(this,s)).catch(Y),J=this.hooks.hookOnce("frontgateConnection:authenticated",()=>{R(this,o,"authenticated"),this.log(y.DEBUG,"Authenticated"),de()})},v(this,r).onclose=D=>{J==null||J(),this.log(y.DEBUG,"Disconnected",D),v(this,o)==="connecting"||v(this,o)==="connected"?Y(JSON.stringify(D)):this.hooks.callHook("frontgateConnection:disconnected",D),clearInterval(v(this,i)),R(this,o,"disconnected")},v(this,r).onerror=D=>{J==null||J(),this.log(y.ERROR,"Error:",D),this.hooks.callHook("frontgateConnection:error",D),(v(this,o)==="connecting"||v(this,o)==="connected")&&Y(new Error("Websocket error")),clearInterval(v(this,i)),R(this,o,"disconnected")},v(this,r).onmessage=D=>{const{data:ie}=D;this.log(y.DEBUG,"Received data:",ie);const me={msg:ie};this.hooks.callHook("frontgateConnection:afterReceiveMessage",me).then(()=>{var We;this.log(y.DEBUG,"Received message",me.msg);const Pe=me.msg.toString("utf-8"),_e=JSON.parse(Pe);if(this.hooks.callHook("frontgateConnection:message",_e),_e.Message==="Foundation::DisconnectionMessage"){(We=v(this,r))==null||We.close(),this.hooks.callHook("frontgateConnection:disconnected",_e);return}q(this,u,fr).call(this,_e)})}}),ee=`Timeout reached (${this.defaultTimeoutInMs} ms) for connection to ${z}`;return ue(this.defaultTimeoutInMs,ee,Je)}async disconnect(){return new Promise(g=>{q(this,u,Ct).call(this,q(this,u,qs).call(this)),this.hooks.hookOnce("frontgateConnection:disconnected",()=>{var p;(p=v(this,r))==null||p.close(),g()})})}isConnected(){return v(this,o)==="authenticated"}isDisconnected(){return v(this,o)!=="authenticated"}isReadyToConnect(){return v(this,o)==="disconnected"}},r=new WeakMap,s=new WeakMap,o=new WeakMap,i=new WeakMap,a=new WeakMap,c=new WeakMap,h=new WeakMap,u=new WeakSet,on=function(){return v(this,r)&&v(this,r).readyState<2?v(this,o):"disconnected"},b=new WeakMap,f=new WeakMap,qs=function(){return{Message:"Foundation::DisconnectionMessage",Version:3,reason:{value:64},details:"client shutdown"}},Hs=function(){return{Message:"KeepAliveMessage",Version:2}},Ct=async function(g){var I;await this.hooks.callHook("frontgateConnection:beforeSerializeMessage",g);const p={msg:JSON.stringify(g)};await this.hooks.callHook("frontgateConnection:beforeSendMessage",p),this.log(y.DEBUG,"Sending message:",g),this.log(y.TRACE,"Sending data:",p.msg);try{(I=v(this,r))==null||I.send(p.msg)}catch(C){const x=q(this,u,Bs).call(this,C,g);q(this,u,fr).call(this,x.msg)}},fr=function(g){var p,I;if(typeof((p=g.header)==null?void 0:p.id_job)<"u"){this.hooks.callHook(`frontgateConnection:response:${g.header.id_job}`,g);return}if(typeof((I=g.header)==null?void 0:I.id_service)<"u"&&typeof g.id_notation<"u"){this.hooks.callHook(`frontgateConnection:response:${g.header.id_service}-${g.id_notation}`,g);return}if(typeof g.id_job<"u"){this.hooks.callHook(`frontgateConnection:response:${g.id_job}`,g);return}typeof g.Message=="string"&&this.hooks.callHook(`frontgateConnection:response:${g.Message.replace("Foundation::","")}`,g)},Gs=function(g){R(this,a,v(this,a)+1);const p=v(this,a);return g.header={...g.header,id_job:p},v(this,a)},dr=function(g){var p,I;g.header||(g.header={authentication_identifiers:{id_application:void 0,id_user:void 0}}),g.header.authentication_identifiers||(g.header={...g.header,authentication_identifiers:{id_application:void 0,id_user:void 0}}),(p=g.header.authentication_identifiers).id_application||(p.id_application=v(this,c)),(I=g.header.authentication_identifiers).id_user||(I.id_user=v(this,h))},Bs=function(g,p){var I;return new Z({Message:"Foundation::ErrorResponse",Version:1,id_job:(I=p.header)==null?void 0:I.id_job,reason:8,details:g})},Js=function(g){const p=g.maximumIdleIntervalInS??60,I=g.maximumIdleInterval??p*1e6;return{...g,payloadContent:g.payloadContent??"foundation",maximumIdleIntervalInS:p,maximumIdleInterval:I,tls:g.tls??!0,messageBufferSize:g.messageBufferSize??512}},A},{featureName:"WSConnection",disabledFeatureGroups:["Connection"]}),Vo=(n,e)=>(e&&n.setLevel(e),K(r=>class extends r{constructor(...s){super(...s),this.logger=n}},{featureName:"Logger",featureGroups:["Misc"]})),Yo=()=>K(e=>{var t,r;return r=class extends e{constructor(...o){super(...o);O(this,t);R(this,t,new kr),this.hooks.hook("frontgateConnection:reset",()=>{v(this,t).reset()}),this.hooks.hook("frontgateConnection:afterSetEncoding",i=>{i.encoding="jsjsonc-v2"}),this.hooks.hook("frontgateConnection:beforeSendMessage",i=>{const a=v(this,t).compress(i.msg);i.msg=a}),this.hooks.hook("frontgateConnection:afterReceiveMessage",i=>{const a=v(this,t).decompress(new Uint8Array(i.msg));i.msg=a})}},t=new WeakMap,r},{featureName:"MessageCompressor",featureGroups:["Misc"]}),Ko=()=>K(e=>class extends e{async request(t,r=this.defaultTimeoutInMs){t.header.setTimeout(r);const s={message:t.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",s);const o=new Promise(a=>{this.hooks.hookOnce(`frontgateConnection:response:${s.callbackId}`,c=>{const h=new ne(c);a(h)})}),i=`Request timeout reached (${r} ms) for ${s.message.Message}`;return ue(r,i,o)}},{featureName:"Request",featureGroups:["Misc"]}),Qo=n=>K(t=>{var s,o;const r={...n};return o=class extends t{constructor(){super(...arguments);O(this,s,new Map)}async observeEndpoint(a,c,h,u){const l=`${a}:${c}:${JSON.stringify(h)}:${JSON.stringify(u??{})}`,b=r.timeout??this.defaultTimeoutInMs,f=r.subscriptionResubscribeTimeout??1e3;if(v(this,s).has(l)){const m=v(this,s).get(l);if(m)return m.count++,this.log(y.INFO,`Reusing existing subscription for ${l}`),m.observer}this.log(y.INFO,`Creating new subscription for ${l}`);const E=new ve(a,c,h,{...u,subscribe:!0});E.header.setTimeout(b);const _={message:E.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",_);const k=new Promise((m,T)=>{this.hooks.hookOnce(`frontgateConnection:response:${_.callbackId}`,S=>{if(!S.Message.includes("HighLevelResponse")){this.log(y.ERROR,`Unexpected response: ${S.Message}`),T(new Z(JSON.stringify(S)));return}let M;try{M=JSON.parse(S.body.value)}catch(I){this.log(y.ERROR,`Failed to parse response: ${S.body.value}`),this.log(y.ERROR,I),T(I);return}const A=new is(S.header.id_job,M);let N=this.hooks.hook(`frontgateConnection:response:${_.callbackId}`,I=>{if(!I.Message.includes("HighLevelUpdate")){if(I.Message.includes("SubscriptionLoss")){this.log(y.DEBUG,`Received: ${I.Message}`),setTimeout(()=>{g()},Zr(f)),N();return}this.log(y.ERROR,`Unexpected response: ${S.Message}`),A.pushError(new Z(JSON.stringify(I))),N();return}let C;try{C=new Ft(I)}catch(x){this.log(y.ERROR,`Failed to parse response: ${I.body.value}`),A.pushError(x);return}A.pushPatchData(C.data)});const g=async()=>{N(),this.log(y.INFO,`Resubscribing to ${l} due to reconnect`),await this.hooks.callHook("frontgateConnection:sendMessage",_);const I=new Promise((C,x)=>{this.hooks.hookOnce(`frontgateConnection:response:${_.callbackId}`,z=>{if(!S.Message.includes("HighLevelResponse")){const P=new Z(z);this.log(y.ERROR,`Unexpected response: ${z.Message}`),N(),x(P);return}this.log(y.INFO,`Resubscribed to ${l} with ${z.header.id_job}`),A.idJob=z.header.id_job,N=this.hooks.hook(`frontgateConnection:response:${z.header.id_job}`,P=>{if(!P.Message.includes("HighLevelUpdate")){if(P.Message.includes("SubscriptionLoss")){this.log(y.DEBUG,`Received: ${P.Message}`),setTimeout(()=>{g()},Zr(f));return}this.log(y.ERROR,`Unexpected response: ${P.Message}`);const j=new Z(P);A.pushError(j);return}let F;try{F=new Ft(P)}catch(j){this.log(y.ERROR,`Failed to parse response: ${P.body.value}`),A.pushError(j);return}A.unsubscribe=()=>{const j=v(this,s).get(l);if(j){if(j.count--,j.count>0){this.log(y.INFO,`Not unsubscribing from ${l} as there are still ${j.count} subscribers`);return}v(this,s).delete(l)}this.log(y.INFO,`Unsubscribing from ${l}`);const V={message:new Ae(A.idJob).getPtlMessage(),callbackType:"job",callbackId:""};this.hooks.callHook("frontgateConnection:sendMessage",V),N(),p()},A.pushPatchData(F.data)}),C()})});try{await ue(b,"Request timeout reached",I)}catch(C){A.pushError(new Z({Message:"Reconnect failed",Error:C}))}},p=this.hooks.hook("reconnect:success",g);A.unsubscribe=()=>{const I=v(this,s).get(l);if(I){if(I.count--,I.count>0){this.log(y.INFO,`Not unsubscribing from ${l} as there are still ${I.count} subscribers`);return}v(this,s).delete(l)}this.log(y.INFO,`Unsubscribing from ${l}`);const x={message:new Ae(A.idJob).getPtlMessage(),callbackType:"job",callbackId:""};this.hooks.callHook("frontgateConnection:sendMessage",x),N(),p()},v(this,s).set(l,{observer:A,count:1}),m(A)})}),w=`Request timeout reached (${b} ms) for ${_.message.Message}`;return ue(b,w,k)}},s=new WeakMap,o},{featureName:"EndpointSubscriptions",featureGroups:["Misc"]}),Xo=()=>K(e=>{var t,r,pr,o;return o=class extends e{constructor(){super(...arguments);O(this,r);O(this,t,new Map)}async observe(a,c=this.defaultTimeoutInMs){return q(this,r,pr).call(this,a,"job",void 0,c)}async observeConnectionBased(a,c,h=this.defaultTimeoutInMs){return q(this,r,pr).call(this,a,"connection",c,h)}},t=new WeakMap,r=new WeakSet,pr=async function(a,c,h,u=this.defaultTimeoutInMs){const l=JSON.stringify(a.getPtlMessage());if(v(this,t).has(l)){const k=v(this,t).get(l);if(k)return k.count++,this.log(y.INFO,`Reusing existing subscription for ${l}`),k.observer}this.log(y.INFO,`Creating new subscription for ${l}`);const f={message:a.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",f);const E=new Promise((k,w)=>{this.hooks.hookOnce(`frontgateConnection:response:${f.callbackId}`,m=>{if(m.Message.includes("Error")||m.Message.includes("PermissionDenied")){this.log(y.ERROR,`Unexpected response: ${m.Message}`),w(new Error(`Unexpected response: ${m.Message}`));return}const T=c==="connection"?`${m.header.id_service}-${a.getPtlMessage().id_notation}`:m.header.id_job,S=typeof h>"u"?new Ae(m.header.id_job):new h(m.header.id_service,a.getPtlMessage().id_notation),M=new Nn(m.header.id_job,m);let A=this.hooks.hook(`frontgateConnection:response:${T}`,g=>{if(g.Message.includes("Error")||g.Message.includes("PermissionDenied")){this.log(y.ERROR,`Unexpected response: ${m.Message}`),M.pushError(new Z(JSON.stringify(g)));return}M.pushData(g)});const N=this.hooks.hook("reconnect:success",async()=>{A(),this.log(y.INFO,`Resubscribing to ${l} due to reconnect`),await this.hooks.callHook("frontgateConnection:sendMessage",f);const g=new Promise((p,I)=>{this.hooks.hookOnce(`frontgateConnection:response:${f.callbackId}`,C=>{if(C.Message.includes("Error")||C.Message.includes("PermissionDenied")){const P=new Z(C);this.log(y.ERROR,`Unexpected resp: ${C.Message}`),I(P);return}const x=c==="connection"?`${C.header.id_service}-${a.getPtlMessage().id_notation}`:C.header.id_job,z=typeof h>"u"?new Ae(C.header.id_job):new h(C.header.id_service,a.getPtlMessage().id_notation);M.idJob=C.header.id_job,A=this.hooks.hook(`frontgateConnection:response:${x}`,P=>{if(P.Message.includes("Error")||P.Message.includes("PermissionDenied")){this.log(y.ERROR,`Unexpected response: ${P.Message}`);const F=new Z(P);M.pushError(F);return}M.unsubscribe=()=>{const F=v(this,t).get(l);if(F){if(F.count--,F.count>0){this.log(y.INFO,`Not unsubscribing from ${l} as there are still ${F.count} subscribers`);return}v(this,t).delete(l)}this.log(y.INFO,`Unsubscribing from ${l}`);const j={message:z.getPtlMessage(),callbackType:"job",callbackId:""};this.hooks.callHook("frontgateConnection:sendMessage",j),A(),N()},M.pushData(P)}),p()})});try{await ue(u,"Request timeout reached",g)}catch(p){M.pushError(new Z({Message:"Reconnect failed",Error:p}))}});M.unsubscribe=()=>{const g=v(this,t).get(l);if(g){if(g.count--,g.count>0){this.log(y.INFO,`Not unsubscribing from ${l} as there are still ${g.count} subscribers`);return}v(this,t).delete(l)}this.log(y.INFO,`Unsubscribing from ${l}`);const p={message:S.getPtlMessage(),callbackType:"job",callbackId:""};this.hooks.callHook("frontgateConnection:sendMessage",p),A(),N()},v(this,t).set(l,{observer:M,count:1}),k(M)})}),_=`Request timeout reached (${u} ms) for ${f.message.Message}`;return ue(u,_,E)},o},{featureName:"RawSubscriptions",featureGroups:["Misc"]}),Pn=(n,e)=>{const t=e.split("/").slice(1);let r=n;for(let s=0;s<t.length-1;s++){const o=decodeURIComponent(t[s]);if(!(o in r))throw new Error(`Path not found: ${e}`);r=r[o]}return[r,decodeURIComponent(t[t.length-1])]},Zo=(n,e,t)=>{const[r,s]=Pn(n,e);r[s]=t},ei="-",ti=(n,e,t)=>{const[r,s]=Pn(n,e);Array.isArray(r)?s===ei?r.push(t):r.splice(parseInt(s,10),0,t):r[s]=t},ni=(n,e)=>{const[t,r]=Pn(n,e);Array.isArray(t)?t.splice(parseInt(r,10),1):delete t[r]};function ri(n,e){return e.forEach(t=>{switch(t.op){case"replace":Zo(n,t.path,t.value);break;case"add":ti(n,t.path,t.value);break;case"remove":ni(n,t.path);break;case"move":case"copy":case"test":default:throw new Error(`Unsupported op: ${t.op}`)}}),n}class Nn{constructor(e,t){O(this,qe);O(this,Mt,[]);O(this,St,[]);R(this,qe,t),this.idJob=e}get data(){return v(this,qe)}subscribe({next:e,error:t}){e(v(this,qe)),t&&v(this,St).push(t),v(this,Mt).push(e)}pushData(e){R(this,qe,e),v(this,Mt).forEach(t=>{t(e)})}pushError(e){v(this,St).forEach(t=>{t(e)})}}qe=new WeakMap,Mt=new WeakMap,St=new WeakMap;class is extends Nn{pushPatchData(e){try{const t=ri(this.data,e);super.pushData(t)}catch(t){super.pushError(new Z(t.message))}}}const si=n=>K(t=>class extends t{constructor(...r){super(...r),this.hooks.hook("frontgateConnection:beforeConnect",o=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2),this.log(y.DEBUG,"Adding mdg2auth subprotocol"),o.subProtocols.push(`mdg2auth-${n}`)});const s=async o=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2);const i={maximum_idle_interval:o.maximumIdleInterval},a={b64:""},h=new dt(a,i.maximum_idle_interval).toJson();this.log(y.INFO,"Sending message",h);const u={message:h,callbackType:"response",callbackId:h.Message.replace("Request","Response")};await this.hooks.callHook("frontgateConnection:sendMessage",u),this.hooks.hookOnce(`frontgateConnection:response:${u.callbackId}`,l=>{this.log(y.INFO,"Received response",l),this.hooks.callHook("frontgateConnection:authenticated")})};this.hooks.hookOnce("frontgateConnection:connected",s)}},{featureName:"CookieTokenAuth",featureGroups:["Auth"],disabledFeatureGroups:["Auth"]}),oi=n=>K(t=>{var r,s;return s=class extends t{constructor(...i){super(...i);O(this,r);R(this,r,n??"");const a=async c=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2);const h={maximum_idle_interval:c.maximumIdleInterval},u={b64:v(this,r)},b=new dt(u,h.maximum_idle_interval).toJson();this.log(y.INFO,"Sending message",b);const f={message:b,callbackType:"response",callbackId:b.Message.replace("Request","Response")};await this.hooks.callHook("frontgateConnection:sendMessage",f),this.hooks.hookOnce(`frontgateConnection:response:${f.callbackId}`,E=>{this.log(y.INFO,"Received response",E),this.hooks.callHook("frontgateConnection:authenticated")})};this.hooks.hook("frontgateConnection:connected",a)}set token(i){R(this,r,i)}},r=new WeakMap,s},{featureName:"TokenAuth",featureGroups:["Auth"],disabledFeatureGroups:["Auth"]}),ii=(n,e,t)=>K(s=>{var o,i,a,c,h,Ws,l;return l=class extends os({host:"",pathPrefix:"",port:0,tls:!0,maximumIdleIntervalInS:n.maximumIdleIntervalInS})(s){constructor(...f){super(...f);O(this,h);O(this,o,"");O(this,i,"");O(this,a);O(this,c);R(this,a,e),R(this,c,t),this.hooks.hook("frontgateConnection:beforeConnect",async _=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2),this.log(y.DEBUG,"Fetching connection configuration");const k=await q(this,h,Ws).call(this);if(this.log(y.DEBUG,"Connection configuration received",n),_.url=k.url,k.authtenticationType==="token"&&k.authenticationToken)R(this,o,k.authenticationToken);else if(k.splitAuthenticationTokenSecondFactor)R(this,i,k.splitAuthenticationTokenSecondFactor);else throw new Error("Invalid authentication configuration");this.log(y.DEBUG,"Adding mdg2auth subprotocol"),v(this,i)!==""&&_.subProtocols.push(`mdg2auth-${v(this,i)}`)});const E=async _=>{this.hooks.callHook("frontgateConnection:setIdApp",-2),this.hooks.callHook("frontgateConnection:setIdUser",-2);const k={maximum_idle_interval:_.maximumIdleInterval},w={b64:v(this,o)},T=new dt(w,k.maximum_idle_interval).toJson();this.log(y.INFO,"Sending message",T);const S={message:T,callbackType:"response",callbackId:T.Message.replace("Request","Response")};await this.hooks.callHook("frontgateConnection:sendMessage",S),this.hooks.hookOnce(`frontgateConnection:response:${S.callbackId}`,M=>{this.log(y.INFO,"Received response",M),this.hooks.callHook("frontgateConnection:authenticated")})};this.hooks.hook("frontgateConnection:connected",E)}},o=new WeakMap,i=new WeakMap,a=new WeakMap,c=new WeakMap,h=new WeakSet,Ws=async function(){const f=await fetch(v(this,a),v(this,c));if(!f.ok)throw new Error(`Failed to fetch connection configuration: ${f.status} ${f.statusText}`);const{headers:E}=f,_=E.get("frontgate-host"),k=E.get("frontgate-path-prefix"),w=E.get("frontgate-split-authentication-token-second-factor"),m=E.get("frontgate-authentication-type"),T=E.get("frontgate-authentication-token"),S=E.get("frontgate-websocket-port")??"443",M=`wss://${_}:${S}${k??""}/ws`;if(m==="token"&&!T)throw new Error("Authentication token is required for token authentication");if(m!=="token"&&!w)throw new Error("Split authentication token second factor is required");return{url:M,authtenticationType:m,authenticationToken:T,splitAuthenticationTokenSecondFactor:w}},l},{featureName:"FetchAuth",featureGroups:["Auth","Connection"],disabledFeatureGroups:["Auth","Connection"]}),ai=(n,e)=>({options:n,submit:async t=>{e.log(y.INFO,"Sending message",t);const r={message:t,callbackType:"response",callbackId:t.Message.replace("Request","Response")};await e.hooks.callHook("frontgateConnection:sendMessage",r);let s;return new Promise((o,i)=>{const a=e.hooks.hookOnce(`frontgateConnection:response:${r.callbackId}`,c=>{clearTimeout(s),e.log(y.INFO,"Received response",c),o(c)});s=setTimeout(()=>{a(),i(new Error("Authentication message timeout"))},3e3)})},setPeerInfo:t=>{e.log(y.INFO,"Peer info:",t)},auth:{}}),ci=()=>K(e=>{var t,r,s,o;return o=class extends e{constructor(...a){super(...a);O(this,t,0);O(this,r,[1e3,2e3,4e3,8e3,16e3,32e3]);O(this,s);const c=h=>{if(h.code!==1e3){v(this,s)&&(this.log(y.WARN,"Aborting previous reconnect attempt"),clearTimeout(v(this,s)),R(this,t,0));let u=v(this,t);v(this,t)>v(this,r).length&&(u=v(this,r).length-1);const l=v(this,r)[u];R(this,s,setTimeout(()=>{this.log(y.INFO,`Reconnecting... Attempt ${v(this,t)}`);const b=this.hooks.hookOnce("reconnect:failed",c);this.hooks.callHook("reconnect:attempt",h).then(b).catch(()=>{this.log(y.ERROR,"Failed to reconnect")}),R(this,s,void 0)},l)),$s(this,t)._++}};this.hooks.hookOnce("frontgateConnection:disconnected",c),this.hooks.hook("reconnect:success",()=>{clearTimeout(v(this,s)),R(this,s,void 0),R(this,t,0),this.log(y.INFO,"Reconnected"),this.hooks.hookOnce("frontgateConnection:disconnected",c)})}},t=new WeakMap,r=new WeakMap,s=new WeakMap,o},{featureName:"Reconnect",featureGroups:["Misc"],disabledFeatures:["TokenAuth","CookieTokenAuth"]});var ui=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{},xe="1.9.0",as=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function hi(n){var e=new Set([n]),t=new Set,r=n.match(as);if(!r)return function(){return!1};var s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(s.prerelease!=null)return function(c){return c===n};function o(a){return t.add(a),!1}function i(a){return e.add(a),!0}return function(c){if(e.has(c))return!0;if(t.has(c))return!1;var h=c.match(as);if(!h)return o(c);var u={major:+h[1],minor:+h[2],patch:+h[3],prerelease:h[4]};return u.prerelease!=null||s.major!==u.major?o(c):s.major===0?s.minor===u.minor&&s.patch<=u.patch?i(c):o(c):s.minor<=u.minor?i(c):o(c)}}var li=hi(xe),fi=xe.split(".")[0],pt=Symbol.for("opentelemetry.js.api."+fi),gt=ui;function vt(n,e,t,r){var s;r===void 0&&(r=!1);var o=gt[pt]=(s=gt[pt])!==null&&s!==void 0?s:{version:xe};if(!r&&o[n]){var i=new Error("@opentelemetry/api: Attempted duplicate registration of API: "+n);return t.error(i.stack||i.message),!1}if(o.version!==xe){var i=new Error("@opentelemetry/api: Registration of version v"+o.version+" for "+n+" does not match previously registered API v"+xe);return t.error(i.stack||i.message),!1}return o[n]=e,t.debug("@opentelemetry/api: Registered a global for "+n+" v"+xe+"."),!0}function Fe(n){var e,t,r=(e=gt[pt])===null||e===void 0?void 0:e.version;if(!(!r||!li(r)))return(t=gt[pt])===null||t===void 0?void 0:t[n]}function bt(n,e){e.debug("@opentelemetry/api: Unregistering a global for "+n+" v"+xe+".");var t=gt[pt];t&&delete t[n]}var di=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},pi=function(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))},gi=function(){function n(e){this._namespace=e.namespace||"DiagComponentLogger"}return n.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("debug",this._namespace,e)},n.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("error",this._namespace,e)},n.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("info",this._namespace,e)},n.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("warn",this._namespace,e)},n.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return mt("verbose",this._namespace,e)},n}();function mt(n,e,t){var r=Fe("diag");if(r)return t.unshift(e),r[n].apply(r,pi([],di(t),!1))}var re;(function(n){n[n.NONE=0]="NONE",n[n.ERROR=30]="ERROR",n[n.WARN=50]="WARN",n[n.INFO=60]="INFO",n[n.DEBUG=70]="DEBUG",n[n.VERBOSE=80]="VERBOSE",n[n.ALL=9999]="ALL"})(re||(re={}));function vi(n,e){n<re.NONE?n=re.NONE:n>re.ALL&&(n=re.ALL),e=e||{};function t(r,s){var o=e[r];return typeof o=="function"&&n>=s?o.bind(e):function(){}}return{error:t("error",re.ERROR),warn:t("warn",re.WARN),info:t("info",re.INFO),debug:t("debug",re.DEBUG),verbose:t("verbose",re.VERBOSE)}}var bi=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},mi=function(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))},yi="diag",be=function(){function n(){function e(s){return function(){for(var o=[],i=0;i<arguments.length;i++)o[i]=arguments[i];var a=Fe("diag");if(a)return a[s].apply(a,mi([],bi(o),!1))}}var t=this,r=function(s,o){var i,a,c;if(o===void 0&&(o={logLevel:re.INFO}),s===t){var h=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error((i=h.stack)!==null&&i!==void 0?i:h.message),!1}typeof o=="number"&&(o={logLevel:o});var u=Fe("diag"),l=vi((a=o.logLevel)!==null&&a!==void 0?a:re.INFO,s);if(u&&!o.suppressOverrideMessage){var b=(c=new Error().stack)!==null&&c!==void 0?c:"<failed to generate stacktrace>";u.warn("Current logger will be overwritten from "+b),l.warn("Current logger will overwrite one already registered from "+b)}return vt("diag",l,t,!0)};t.setLogger=r,t.disable=function(){bt(yi,t)},t.createComponentLogger=function(s){return new gi(s)},t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}return n.instance=function(){return this._instance||(this._instance=new n),this._instance},n}(),wi=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},_i=function(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")},Ti=function(){function n(e){this._entries=e?new Map(e):new Map}return n.prototype.getEntry=function(e){var t=this._entries.get(e);if(t)return Object.assign({},t)},n.prototype.getAllEntries=function(){return Array.from(this._entries.entries()).map(function(e){var t=wi(e,2),r=t[0],s=t[1];return[r,s]})},n.prototype.setEntry=function(e,t){var r=new n(this._entries);return r._entries.set(e,t),r},n.prototype.removeEntry=function(e){var t=new n(this._entries);return t._entries.delete(e),t},n.prototype.removeEntries=function(){for(var e,t,r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];var o=new n(this._entries);try{for(var i=_i(r),a=i.next();!a.done;a=i.next()){var c=a.value;o._entries.delete(c)}}catch(h){e={error:h}}finally{try{a&&!a.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return o},n.prototype.clear=function(){return new n},n}();be.instance();function Ei(n){return n===void 0&&(n={}),new Ti(new Map(Object.entries(n)))}function cs(n){return Symbol.for(n)}var Mi=function(){function n(e){var t=this;t._currentContext=e?new Map(e):new Map,t.getValue=function(r){return t._currentContext.get(r)},t.setValue=function(r,s){var o=new n(t._currentContext);return o._currentContext.set(r,s),o},t.deleteValue=function(r){var s=new n(t._currentContext);return s._currentContext.delete(r),s}}return n}(),Si=new Mi,Ue=function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},n(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}}(),Ii=function(){function n(){}return n.prototype.createGauge=function(e,t){return xi},n.prototype.createHistogram=function(e,t){return Fi},n.prototype.createCounter=function(e,t){return Di},n.prototype.createUpDownCounter=function(e,t){return Ui},n.prototype.createObservableGauge=function(e,t){return Li},n.prototype.createObservableCounter=function(e,t){return $i},n.prototype.createObservableUpDownCounter=function(e,t){return qi},n.prototype.addBatchObservableCallback=function(e,t){},n.prototype.removeBatchObservableCallback=function(e){},n}(),qt=function(){function n(){}return n}(),Ai=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.add=function(t,r){},e}(qt),ki=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.add=function(t,r){},e}(qt),Ci=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.record=function(t,r){},e}(qt),Ri=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e.prototype.record=function(t,r){},e}(qt),jn=function(){function n(){}return n.prototype.addCallback=function(e){},n.prototype.removeCallback=function(e){},n}(),Oi=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(jn),Pi=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(jn),Ni=function(n){Ue(e,n);function e(){return n!==null&&n.apply(this,arguments)||this}return e}(jn),ji=new Ii,Di=new Ai,xi=new Ci,Fi=new Ri,Ui=new ki,$i=new Oi,Li=new Pi,qi=new Ni,Hi={get:function(n,e){if(n!=null)return n[e]},keys:function(n){return n==null?[]:Object.keys(n)}},Gi={set:function(n,e,t){n!=null&&(n[e]=t)}},Bi=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},Ji=function(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))},Wi=function(){function n(){}return n.prototype.active=function(){return Si},n.prototype.with=function(e,t,r){for(var s=[],o=3;o<arguments.length;o++)s[o-3]=arguments[o];return t.call.apply(t,Ji([r],Bi(s),!1))},n.prototype.bind=function(e,t){return t},n.prototype.enable=function(){return this},n.prototype.disable=function(){return this},n}(),zi=function(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o},Vi=function(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))},Dn="context",Yi=new Wi,Ht=function(){function n(){}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setGlobalContextManager=function(e){return vt(Dn,e,be.instance())},n.prototype.active=function(){return this._getContextManager().active()},n.prototype.with=function(e,t,r){for(var s,o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];return(s=this._getContextManager()).with.apply(s,Vi([e,t,r],zi(o),!1))},n.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},n.prototype._getContextManager=function(){return Fe(Dn)||Yi},n.prototype.disable=function(){this._getContextManager().disable(),bt(Dn,be.instance())},n}(),xn;(function(n){n[n.NONE=0]="NONE",n[n.SAMPLED=1]="SAMPLED"})(xn||(xn={}));var us="0000000000000000",hs="00000000000000000000000000000000",Ki={traceId:hs,spanId:us,traceFlags:xn.NONE},yt=function(){function n(e){e===void 0&&(e=Ki),this._spanContext=e}return n.prototype.spanContext=function(){return this._spanContext},n.prototype.setAttribute=function(e,t){return this},n.prototype.setAttributes=function(e){return this},n.prototype.addEvent=function(e,t){return this},n.prototype.addLink=function(e){return this},n.prototype.addLinks=function(e){return this},n.prototype.setStatus=function(e){return this},n.prototype.updateName=function(e){return this},n.prototype.end=function(e){},n.prototype.isRecording=function(){return!1},n.prototype.recordException=function(e,t){},n}(),Fn=cs("OpenTelemetry Context Key SPAN");function Un(n){return n.getValue(Fn)||void 0}function Qi(){return Un(Ht.getInstance().active())}function $n(n,e){return n.setValue(Fn,e)}function Xi(n){return n.deleteValue(Fn)}function Zi(n,e){return $n(n,new yt(e))}function ls(n){var e;return(e=Un(n))===null||e===void 0?void 0:e.spanContext()}var ea=/^([0-9a-f]{32})$/i,ta=/^[0-9a-f]{16}$/i;function na(n){return ea.test(n)&&n!==hs}function ra(n){return ta.test(n)&&n!==us}function fs(n){return na(n.traceId)&&ra(n.spanId)}function sa(n){return new yt(n)}var Ln=Ht.getInstance(),ds=function(){function n(){}return n.prototype.startSpan=function(e,t,r){r===void 0&&(r=Ln.active());var s=!!(t!=null&&t.root);if(s)return new yt;var o=r&&ls(r);return oa(o)&&fs(o)?new yt(o):new yt},n.prototype.startActiveSpan=function(e,t,r,s){var o,i,a;if(!(arguments.length<2)){arguments.length===2?a=t:arguments.length===3?(o=t,a=r):(o=t,i=r,a=s);var c=i??Ln.active(),h=this.startSpan(e,o,c),u=$n(c,h);return Ln.with(u,a,void 0,h)}},n}();function oa(n){return typeof n=="object"&&typeof n.spanId=="string"&&typeof n.traceId=="string"&&typeof n.traceFlags=="number"}var ia=new ds,aa=function(){function n(e,t,r,s){this._provider=e,this.name=t,this.version=r,this.options=s}return n.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},n.prototype.startActiveSpan=function(e,t,r,s){var o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)},n.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):ia},n}(),ca=function(){function n(){}return n.prototype.getTracer=function(e,t,r){return new ds},n}(),ua=new ca,ps=function(){function n(){}return n.prototype.getTracer=function(e,t,r){var s;return(s=this.getDelegateTracer(e,t,r))!==null&&s!==void 0?s:new aa(this,e,t,r)},n.prototype.getDelegate=function(){var e;return(e=this._delegate)!==null&&e!==void 0?e:ua},n.prototype.setDelegate=function(e){this._delegate=e},n.prototype.getDelegateTracer=function(e,t,r){var s;return(s=this._delegate)===null||s===void 0?void 0:s.getTracer(e,t,r)},n}();Ht.getInstance(),be.instance();var ha=function(){function n(){}return n.prototype.getMeter=function(e,t,r){return ji},n}(),la=new ha,qn="metrics",fa=function(){function n(){}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setGlobalMeterProvider=function(e){return vt(qn,e,be.instance())},n.prototype.getMeterProvider=function(){return Fe(qn)||la},n.prototype.getMeter=function(e,t,r){return this.getMeterProvider().getMeter(e,t,r)},n.prototype.disable=function(){bt(qn,be.instance())},n}();fa.getInstance();var da=function(){function n(){}return n.prototype.inject=function(e,t){},n.prototype.extract=function(e,t){return e},n.prototype.fields=function(){return[]},n}(),Hn=cs("OpenTelemetry Baggage Key");function gs(n){return n.getValue(Hn)||void 0}function pa(){return gs(Ht.getInstance().active())}function ga(n,e){return n.setValue(Hn,e)}function va(n){return n.deleteValue(Hn)}var Gn="propagation",ba=new da,ma=function(){function n(){this.createBaggage=Ei,this.getBaggage=gs,this.getActiveBaggage=pa,this.setBaggage=ga,this.deleteBaggage=va}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setGlobalPropagator=function(e){return vt(Gn,e,be.instance())},n.prototype.inject=function(e,t,r){return r===void 0&&(r=Gi),this._getGlobalPropagator().inject(e,t,r)},n.prototype.extract=function(e,t,r){return r===void 0&&(r=Hi),this._getGlobalPropagator().extract(e,t,r)},n.prototype.fields=function(){return this._getGlobalPropagator().fields()},n.prototype.disable=function(){bt(Gn,be.instance())},n.prototype._getGlobalPropagator=function(){return Fe(Gn)||ba},n}();ma.getInstance();var Bn="trace",ya=function(){function n(){this._proxyTracerProvider=new ps,this.wrapSpanContext=sa,this.isSpanContextValid=fs,this.deleteSpan=Xi,this.getSpan=Un,this.getActiveSpan=Qi,this.getSpanContext=ls,this.setSpan=$n,this.setSpanContext=Zi}return n.getInstance=function(){return this._instance||(this._instance=new n),this._instance},n.prototype.setGlobalTracerProvider=function(e){var t=vt(Bn,this._proxyTracerProvider,be.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},n.prototype.getTracerProvider=function(){return Fe(Bn)||this._proxyTracerProvider},n.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},n.prototype.disable=function(){bt(Bn,be.instance()),this._proxyTracerProvider=new ps},n}(),vs=ya.getInstance();const wa=()=>K(e=>{var t,zs,s;return s=class extends e{constructor(...i){super(...i);O(this,t);this.hooks.hook("frontgateConnection:beforeSerializeMessage",a=>{a.header&&vs.getTracer("frontgate-js-sdk").startActiveSpan("frontgateConnection:sendMessage",c=>{const h=q(this,t,zs).call(this,c.spanContext());h&&(a.header={...a.header,...h}),c.end()})})}},t=new WeakSet,zs=function(i){if(!/^0+$/.test(i.traceId))return{tracing:{value:{value:bs(i)}}}},s},{featureName:"OpenTelemetry",featureGroups:["Misc"]}),bs=n=>{const e=[18,20,9],t=r=>{for(let s=r.length;s>r.length-16;s-=2){let o=parseInt(r.substring(s-2,s),16);o>127&&(o-=256),e.push(o)}};return t(n.traceId),e.push(17),t(n.spanId),e.push(24),e.push(0),e},_a=()=>K(e=>class extends e{async requestProxyEndpoint(t,r,s,o,i=this.defaultTimeoutInMs){const a=new Ke(t,r,o);s&&a.setBody(s),a.header.setTimeout(i);const c={message:a.getPtlMessage(),callbackType:"job",callbackId:""};await this.hooks.callHook("frontgateConnection:sendMessage",c);const h=new Promise((l,b)=>{this.hooks.hookOnce(`frontgateConnection:response:${c.callbackId}`,f=>{try{if(!f.Message.includes("HTTPProxyResponse")){b(JSON.stringify(f));return}const E=new An(f);l({response:E,data:E.data})}catch(E){b(E)}})}),u=`Request timeout reached (${i} ms) for ${c.message.Message}`;return ue(i,u,h)}},{featureName:"HTTPProxyRequest",featureGroups:["Misc"]}),Ta=()=>K(e=>class extends e{async ping(t=this.defaultTimeoutInMs){const s={message:new ze().getPtlMessage(),callbackType:"response",callbackId:"PingResponse"};await this.hooks.callHook("frontgateConnection:sendMessage",s);const o=new Promise(a=>{this.hooks.hookOnce(`frontgateConnection:response:${s.callbackId}`,c=>{const h=new je(c);a(h)})}),i=`Request timeout reached (${t} ms) for ${s.message.Message}`;return ue(t,i,o)}},{featureName:"Pingable",featureGroups:["Misc"]}),K=(n,e)=>{const t=n;return t.featureName=e.featureName,t.featureGroups=e.featureGroups,t.disabledFeatures=e.disabledFeatures,t.disabledFeatureGroups=e.disabledFeatureGroups,t};var Jn=function(n,e){return Jn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(t[s]=r[s])},Jn(n,e)};function Qe(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Jn(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Ea(n,e,t,r){function s(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{h(r.next(u))}catch(l){i(l)}}function c(u){try{h(r.throw(u))}catch(l){i(l)}}function h(u){u.done?o(u.value):s(u.value).then(a,c)}h((r=r.apply(n,e||[])).next())})}function ms(n,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,s,o,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(h){return function(u){return c([h,u])}}function c(h){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,h[0]&&(t=0)),t;)try{if(r=1,s&&(o=h[0]&2?s.return:h[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,h[1])).done)return o;switch(s=0,o&&(h=[h[0]&2,o.value]),h[0]){case 0:case 1:o=h;break;case 4:return t.label++,{value:h[1],done:!1};case 5:t.label++,s=h[1],h=[0];continue;case 7:h=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(h[0]===6||h[0]===2)){t=0;continue}if(h[0]===3&&(!o||h[1]>o[0]&&h[1]<o[3])){t.label=h[1];break}if(h[0]===6&&t.label<o[1]){t.label=o[1],o=h;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(h);break}o[2]&&t.ops.pop(),t.trys.pop();continue}h=e.call(n,t)}catch(u){h=[6,u],s=0}finally{r=o=0}if(h[0]&5)throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}}function Xe(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],r=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Gt(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var r=t.call(n),s,o=[],i;try{for(;(e===void 0||e-- >0)&&!(s=r.next()).done;)o.push(s.value)}catch(a){i={error:a}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o}function Bt(n,e,t){if(t||arguments.length===2)for(var r=0,s=e.length,o;r<s;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return n.concat(o||Array.prototype.slice.call(e))}function Ze(n){return this instanceof Ze?(this.v=n,this):new Ze(n)}function Ma(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(n,e||[]),s,o=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),s[Symbol.asyncIterator]=function(){return this},s;function i(f){return function(E){return Promise.resolve(E).then(f,l)}}function a(f,E){r[f]&&(s[f]=function(_){return new Promise(function(k,w){o.push([f,_,k,w])>1||c(f,_)})},E&&(s[f]=E(s[f])))}function c(f,E){try{h(r[f](E))}catch(_){b(o[0][3],_)}}function h(f){f.value instanceof Ze?Promise.resolve(f.value.v).then(u,l):b(o[0][2],f)}function u(f){c("next",f)}function l(f){c("throw",f)}function b(f,E){f(E),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Sa(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof Xe=="function"?Xe(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(i){return new Promise(function(a,c){i=n[o](i),s(a,c,i.done,i.value)})}}function s(o,i,a,c){Promise.resolve(c).then(function(h){o({value:h,done:a})},i)}}typeof SuppressedError=="function"&&SuppressedError;function Q(n){return typeof n=="function"}function ys(n){var e=function(r){Error.call(r),r.stack=new Error().stack},t=n(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Wn=ys(function(n){return function(t){n(this),this.message=t?t.length+` errors occurred during unsubscription:
2
2
  `+t.map(function(r,s){return s+1+") "+r.toString()}).join(`
3
3
  `):"",this.name="UnsubscriptionError",this.errors=t}});function zn(n,e){if(n){var t=n.indexOf(e);0<=t&&n.splice(t,1)}}var wt=function(){function n(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return n.prototype.unsubscribe=function(){var e,t,r,s,o;if(!this.closed){this.closed=!0;var i=this._parentage;if(i)if(this._parentage=null,Array.isArray(i))try{for(var a=Xe(i),c=a.next();!c.done;c=a.next()){var h=c.value;h.remove(this)}}catch(_){e={error:_}}finally{try{c&&!c.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else i.remove(this);var u=this.initialTeardown;if(Q(u))try{u()}catch(_){o=_ instanceof Wn?_.errors:[_]}var l=this._finalizers;if(l){this._finalizers=null;try{for(var b=Xe(l),f=b.next();!f.done;f=b.next()){var E=f.value;try{Ts(E)}catch(_){o=o??[],_ instanceof Wn?o=Bt(Bt([],Gt(o)),Gt(_.errors)):o.push(_)}}}catch(_){r={error:_}}finally{try{f&&!f.done&&(s=b.return)&&s.call(b)}finally{if(r)throw r.error}}}if(o)throw new Wn(o)}},n.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Ts(e);else{if(e instanceof n){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},n.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},n.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},n.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&zn(t,e)},n.prototype.remove=function(e){var t=this._finalizers;t&&zn(t,e),e instanceof n&&e._removeParent(this)},n.EMPTY=function(){var e=new n;return e.closed=!0,e}(),n}(),ws=wt.EMPTY;function _s(n){return n instanceof wt||n&&"closed"in n&&Q(n.remove)&&Q(n.add)&&Q(n.unsubscribe)}function Ts(n){Q(n)?n():n.unsubscribe()}var Ia={Promise:void 0},Aa={setTimeout:function(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];return setTimeout.apply(void 0,Bt([n,e],Gt(t)))},clearTimeout:function(n){return clearTimeout(n)},delegate:void 0};function Es(n){Aa.setTimeout(function(){throw n})}function Ms(){}function Jt(n){n()}var Vn=function(n){Qe(e,n);function e(t){var r=n.call(this)||this;return r.isStopped=!1,t?(r.destination=t,_s(t)&&t.add(r)):r.destination=Ra,r}return e.create=function(t,r,s){return new _t(t,r,s)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,n.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(wt),ka=function(){function n(e){this.partialObserver=e}return n.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(r){Wt(r)}},n.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(r){Wt(r)}else Wt(e)},n.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){Wt(t)}},n}(),_t=function(n){Qe(e,n);function e(t,r,s){var o=n.call(this)||this,i;return Q(t)||!t?i={next:t??void 0,error:r??void 0,complete:s??void 0}:i=t,o.destination=new ka(i),o}return e}(Vn);function Wt(n){Es(n)}function Ca(n){throw n}var Ra={closed:!0,next:Ms,error:Ca,complete:Ms},Yn=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Ss(n){return n}function Oa(n){return n.length===0?Ss:n.length===1?n[0]:function(t){return n.reduce(function(r,s){return s(r)},t)}}var ke=function(){function n(e){e&&(this._subscribe=e)}return n.prototype.lift=function(e){var t=new n;return t.source=this,t.operator=e,t},n.prototype.subscribe=function(e,t,r){var s=this,o=Na(e)?e:new _t(e,t,r);return Jt(function(){var i=s,a=i.operator,c=i.source;o.add(a?a.call(o,c):c?s._subscribe(o):s._trySubscribe(o))}),o},n.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},n.prototype.forEach=function(e,t){var r=this;return t=Is(t),new t(function(s,o){var i=new _t({next:function(a){try{e(a)}catch(c){o(c),i.unsubscribe()}},error:o,complete:s});r.subscribe(i)})},n.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},n.prototype[Yn]=function(){return this},n.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Oa(e)(this)},n.prototype.toPromise=function(e){var t=this;return e=Is(e),new e(function(r,s){var o;t.subscribe(function(i){return o=i},function(i){return s(i)},function(){return r(o)})})},n.create=function(e){return new n(e)},n}();function Is(n){var e;return(e=n??Ia.Promise)!==null&&e!==void 0?e:Promise}function Pa(n){return n&&Q(n.next)&&Q(n.error)&&Q(n.complete)}function Na(n){return n&&n instanceof Vn||Pa(n)&&_s(n)}function ja(n){return Q(n==null?void 0:n.lift)}function zt(n){return function(e){if(ja(e))return e.lift(function(t){try{return n(t,this)}catch(r){this.error(r)}});throw new TypeError("Unable to lift unknown Observable type")}}function Vt(n,e,t,r,s){return new Da(n,e,t,r,s)}var Da=function(n){Qe(e,n);function e(t,r,s,o,i,a){var c=n.call(this,t)||this;return c.onFinalize=i,c.shouldUnsubscribe=a,c._next=r?function(h){try{r(h)}catch(u){t.error(u)}}:n.prototype._next,c._error=o?function(h){try{o(h)}catch(u){t.error(u)}finally{this.unsubscribe()}}:n.prototype._error,c._complete=s?function(){try{s()}catch(h){t.error(h)}finally{this.unsubscribe()}}:n.prototype._complete,c}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;n.prototype.unsubscribe.call(this),!r&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e}(Vn),xa=ys(function(n){return function(){n(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Tt=function(n){Qe(e,n);function e(){var t=n.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var r=new As(this,this);return r.operator=t,r},e.prototype._throwIfClosed=function(){if(this.closed)throw new xa},e.prototype.next=function(t){var r=this;Jt(function(){var s,o;if(r._throwIfClosed(),!r.isStopped){r.currentObservers||(r.currentObservers=Array.from(r.observers));try{for(var i=Xe(r.currentObservers),a=i.next();!a.done;a=i.next()){var c=a.value;c.next(t)}}catch(h){s={error:h}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(s)throw s.error}}}})},e.prototype.error=function(t){var r=this;Jt(function(){if(r._throwIfClosed(),!r.isStopped){r.hasError=r.isStopped=!0,r.thrownError=t;for(var s=r.observers;s.length;)s.shift().error(t)}})},e.prototype.complete=function(){var t=this;Jt(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var r=t.observers;r.length;)r.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),n.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var r=this,s=this,o=s.hasError,i=s.isStopped,a=s.observers;return o||i?ws:(this.currentObservers=null,a.push(t),new wt(function(){r.currentObservers=null,zn(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var r=this,s=r.hasError,o=r.thrownError,i=r.isStopped;s?t.error(o):i&&t.complete()},e.prototype.asObservable=function(){var t=new ke;return t.source=this,t},e.create=function(t,r){return new As(t,r)},e}(ke),As=function(n){Qe(e,n);function e(t,r){var s=n.call(this)||this;return s.destination=t,s.source=r,s}return e.prototype.next=function(t){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.next)===null||s===void 0||s.call(r,t)},e.prototype.error=function(t){var r,s;(s=(r=this.destination)===null||r===void 0?void 0:r.error)===null||s===void 0||s.call(r,t)},e.prototype.complete=function(){var t,r;(r=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||r===void 0||r.call(t)},e.prototype._subscribe=function(t){var r,s;return(s=(r=this.source)===null||r===void 0?void 0:r.subscribe(t))!==null&&s!==void 0?s:ws},e}(Tt),ks={now:function(){return(ks.delegate||Date).now()},delegate:void 0},Yt=function(n){Qe(e,n);function e(t,r,s){t===void 0&&(t=1/0),r===void 0&&(r=1/0),s===void 0&&(s=ks);var o=n.call(this)||this;return o._bufferSize=t,o._windowTime=r,o._timestampProvider=s,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,t),o._windowTime=Math.max(1,r),o}return e.prototype.next=function(t){var r=this,s=r.isStopped,o=r._buffer,i=r._infiniteTimeWindow,a=r._timestampProvider,c=r._windowTime;s||(o.push(t),!i&&o.push(a.now()+c)),this._trimBuffer(),n.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(t),s=this,o=s._infiniteTimeWindow,i=s._buffer,a=i.slice(),c=0;c<a.length&&!t.closed;c+=o?1:2)t.next(a[c]);return this._checkFinalizedStatuses(t),r},e.prototype._trimBuffer=function(){var t=this,r=t._bufferSize,s=t._timestampProvider,o=t._buffer,i=t._infiniteTimeWindow,a=(i?1:2)*r;if(r<1/0&&a<o.length&&o.splice(0,o.length-a),!i){for(var c=s.now(),h=0,u=1;u<o.length&&o[u]<=c;u+=2)h=u;h&&o.splice(0,h+1)}},e}(Tt),Fa=function(n){return n&&typeof n.length=="number"&&typeof n!="function"};function Ua(n){return Q(n==null?void 0:n.then)}function $a(n){return Q(n[Yn])}function La(n){return Symbol.asyncIterator&&Q(n==null?void 0:n[Symbol.asyncIterator])}function qa(n){return new TypeError("You provided "+(n!==null&&typeof n=="object"?"an invalid object":"'"+n+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Ha(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ga=Ha();function Ba(n){return Q(n==null?void 0:n[Ga])}function Ja(n){return Ma(this,arguments,function(){var t,r,s,o;return ms(this,function(i){switch(i.label){case 0:t=n.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Ze(t.read())];case 3:return r=i.sent(),s=r.value,o=r.done,o?[4,Ze(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Ze(s)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Wa(n){return Q(n==null?void 0:n.getReader)}function Kn(n){if(n instanceof ke)return n;if(n!=null){if($a(n))return za(n);if(Fa(n))return Va(n);if(Ua(n))return Ya(n);if(La(n))return Cs(n);if(Ba(n))return Ka(n);if(Wa(n))return Qa(n)}throw qa(n)}function za(n){return new ke(function(e){var t=n[Yn]();if(Q(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Va(n){return new ke(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()})}function Ya(n){return new ke(function(e){n.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,Es)})}function Ka(n){return new ke(function(e){var t,r;try{for(var s=Xe(n),o=s.next();!o.done;o=s.next()){var i=o.value;if(e.next(i),e.closed)return}}catch(a){t={error:a}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}e.complete()})}function Cs(n){return new ke(function(e){Xa(n,e).catch(function(t){return e.error(t)})})}function Qa(n){return Cs(Ja(n))}function Xa(n,e){var t,r,s,o;return Ea(this,void 0,void 0,function(){var i,a;return ms(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),t=Sa(n),c.label=1;case 1:return[4,t.next()];case 2:if(r=c.sent(),!!r.done)return[3,4];if(i=r.value,e.next(i),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),s={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(o=t.return)?[4,o.call(t)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function Za(n,e){return zt(function(t,r){var s=0;t.subscribe(Vt(r,function(o){r.next(n.call(e,o,s++))}))})}function ec(n,e){return zt(function(t,r){var s=0;t.subscribe(Vt(r,function(o){return n.call(e,o,s++)&&r.next(o)}))})}function tc(n){n===void 0&&(n={});var e=n.connector,t=e===void 0?function(){return new Tt}:e,r=n.resetOnError,s=r===void 0?!0:r,o=n.resetOnComplete,i=o===void 0?!0:o,a=n.resetOnRefCountZero,c=a===void 0?!0:a;return function(h){var u,l,b,f=0,E=!1,_=!1,k=function(){l==null||l.unsubscribe(),l=void 0},w=function(){k(),u=b=void 0,E=_=!1},m=function(){var T=u;w(),T==null||T.unsubscribe()};return zt(function(T,S){f++,!_&&!E&&k();var M=b=b??t();S.add(function(){f--,f===0&&!_&&!E&&(l=Qn(m,c))}),M.subscribe(S),!u&&f>0&&(u=new _t({next:function(A){return M.next(A)},error:function(A){_=!0,k(),l=Qn(w,s,A),M.error(A)},complete:function(){E=!0,k(),l=Qn(w,i),M.complete()}}),Kn(T).subscribe(u))})(h)}}function Qn(n,e){for(var t=[],r=2;r<arguments.length;r++)t[r-2]=arguments[r];if(e===!0){n();return}if(e!==!1){var s=new _t({next:function(){s.unsubscribe(),n()}});return Kn(e.apply(void 0,Bt([],Gt(t)))).subscribe(s)}}function Rs(n,e,t){var r,s=!1;return r=n,tc({connector:function(){return new Yt(r,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:s})}function nc(n,e){return zt(function(t,r){var s=null,o=0,i=!1,a=function(){return i&&!s&&r.complete()};t.subscribe(Vt(r,function(c){s==null||s.unsubscribe();var h=0,u=o++;Kn(n(c,u)).subscribe(s=Vt(r,function(l){return r.next(e?e(c,l,u,h++):l)},function(){s=null,a()}))},function(){i=!0,a()}))})}function rc(){return nc(Ss)}const sc={defaultTimeoutInMs:wn,defaultTimeoutTokenInMs:Rr,maxTimeoutsBeforeReconnect:Or,flagPermissionDenied:Pr,replaySubjectBufferSize:Nr};class Kt{constructor(e,t,r=sc){this.getConnection=e,this.logger=t,this.options=r,this.rejectResponsesTimeout=[50,100,200,400,800,1600,3200],this.timeoutCounter=0,this.subscription=wt.EMPTY,this.chunks=new Map,this.replaySubjectBufferSize=r.replaySubjectBufferSize,this.requestSubject=new Yt(this.replaySubjectBufferSize),this.jobs=new Map}setLogger(e){this.logger=e}reset(){this.logger.trace("requestModule.reset()"),this.requestSubject.complete(),this.requestSubject=new Yt(this.replaySubjectBufferSize),this.chunks.clear()}async requestWithQuality(e,t,r=this.options.defaultTimeoutInMs){return t==="BST"?this.requestBestQuality(e,r):(t&&Object.keys(ft.PRICE_QUALITY).includes(t)&&e.header.setQuality(t),this.request(e,r))}async requestEndpoint(e,t,r,s,o=this.options.defaultTimeoutInMs){const i=new ve(e,t,r,s);try{const a=await this.request(i,o);return this.logger.info(`Endpoint Response: [${e}] ${t}`,{request:r,response:a.data}),{response:a,data:a.data}}catch(a){const c=En(a);throw this.logger.warn(`Endpoint Request Failed. ${c.message}`,a),c}}async requestProxyEndpoint(e,t,r,s,o=this.options.defaultTimeoutInMs){const i=new Ke(e,t,s);r&&i.setBody(r);try{const a=await this.request(i,o);return this.logger.info(`Proxy Endpoint Response: [${e}] ${t}`,{request:r,response:a.data}),{response:a,data:a.data}}catch(a){const c=En(a);throw this.logger.warn(`Proxy Endpoint Request Failed. ${c.message}`,a),c}}async requestAuthenticationToken(e,t,r,s=this.options.defaultTimeoutTokenInMs){const o=new De(e,t,r,s);return(await this.request(o,s)).getToken()}async requestAuthenticationTokenExpiry(e,t,r,s=this.options.defaultTimeoutTokenInMs,o=!1){const i=new De(e,t,r,s,o),a=await this.request(i,s),c=a.getToken(),h=a.getExpiry();return{token:c,expiry:h}}async requestAuthenticationTokenFactorsForCookieAuthentication(e,t,r,s=this.options.defaultTimeoutTokenInMs){const o=await this.requestAuthenticationToken(e,t,r,s);return new Rn(o)}onConnection(){const e=this.getConnection();if(!e)throw new Error("Runtime error: Please assign a connection to the client instance.");this.subscription.closed&&(e.onMessage=this.handleMessage.bind(this),this.subscription=this.requestSubject.subscribe(this.sendRequest.bind(this)),this.logger.trace("onConnection"))}setUpdateMessageHandler(e){this.updateMessageHandler=e}setLossMessageHandler(e){this.lossMessageHandler=e}async request(e,t=this.options.defaultTimeoutInMs){const r=this.getConnection();if(!r)throw new Error("Runtime error: Please assign a connection to the client instance.");return Kt.supportedPermissionDeniedResponseMessages(e)&&this.options.flagPermissionDenied&&e.header.setFlag("permission_denied_response"),Kt.supportsChunkedResponse(e)&&e.header.setFlag("allow_chunked_response"),e.header.setTimeout(t),vs.getTracer("MDG2Client").startActiveSpan("RequestModule.request",async s=>{e.header.setTracing(s.spanContext());const o=`Request timeout reached (${t} ms) for ${e.getPtlMessage().Message}`,i=new Promise((a,c)=>{this.requestSubject.next({msg:e,insertedAt:Date.now(),resolve:a,reject:c})});return Ve.wrap(i,t,o).then(a=>(this.logger.trace("Reset timeout counter"),this.timeoutCounter=0,a)).catch(a=>{if(a.code===408){this.timeoutCounter++,this.logger.trace(`Increment timeout counter to ${this.timeoutCounter}`);const c=this.options.maxTimeoutsBeforeReconnect;this.timeoutCounter===c&&(this.logger.warn(`Closing connection due to max number of timeouts reached (${c})`),r.close(!0).catch(h=>{this.logger.error("Error while closing connection",h)}),this.timeoutCounter=0)}else{const c=En(a);this.logger.trace(`Endpoint Request Failed. ${c.message}`)}throw a}).finally(()=>{s.end()})})}reRequest(e){this.requestSubject.next({msg:e.msg,resolve:e.resolve,reject:e.reject})}async requestBestQuality(e,t=this.options.defaultTimeoutInMs){const r=["RLT","DLY","EOD"];for(let s=0;s<r.length;s++){e.header.setQuality(r[s]);const o=this.request(e,t);try{return await o}catch(i){this.logger.debug(`Failed to perform request in "${r[s]}" quality.`,i,e)}if(s===r.length-1)return o}return{Message:"Should never happen",Version:1}}prependCollectedChunks(e){const t=this.chunks.get(e.header.id_job);if(t===void 0)return;this.logger.trace("Prepending previous chunks to message",e);let r="";t.forEach(s=>{this.logger.trace("Prepending previous chunk to message",s),r+=s.body.value,e.header.processingTime+=s.header.processingTime}),r+=e.body.value,e.body.value=r,this.chunks.delete(e.header.id_job)}collectChunk(e){var t;this.chunks.has(e.header.id_job)?(t=this.chunks.get(e.header.id_job))==null||t.push(e):this.chunks.set(e.header.id_job,[e])}handleMessage(e){let t;if(Yr(e)){if(Lt.hasNextChunk(e)){this.logger.trace("Received message chunk",e),this.collectChunk(e);return}this.prependCollectedChunks(e)}try{t=Lt.createMessage(e)}catch(o){this.logger.error("Problem while creating message",o,e);return}const{jobId:r}=t,s=this.jobs.get(r);if(t.isUpdateMessage()&&this.updateMessageHandler){this.updateMessageHandler(t,r);return}if(t.isLossMessage()&&this.lossMessageHandler){this.lossMessageHandler(t,r),this.jobs.delete(r);return}if(!s){this.logger.error(`Could not find idJob ${r}`,e);return}if(Kr(t)){this.logger.debug(`RejectResponse received for idJob ${r}`,e),this.rejectResponseHandler(s);return}if(Wr(t)||zr(t)){const o={request:s.request,response:t};this.logger.warn(`Received ${t.name} with idJob: ${r}`,o),s.reject(t),this.jobs.delete(r);return}this.logger.trace(`Received ${t.name} with idJob: ${r}`,t),this.jobs.delete(r),s.resolve(t)}rejectResponseHandler(e){const t=this.getRejectResponseTimeout(e.msg.header.getResendCounter()),r=e.expirationTime-Date.now()-t;if(r<1){const s=`Timeout for idJob ${e.msg.header.getJobId()}`;this.logger.error(s),e.reject(new Z({Message:"Foundation::ErrorResponse",Version:1,id_job:e.msg.header.getJobId(),reason:8,details:s}))}this.logger.debug(`Retry request after ${t}ms for idJob ${e.msg.header.getJobId()}`),setTimeout(()=>{e.msg.header.setTimeout(r),e.msg.header.countResend(),this.reRequest(e)},t)}getRejectResponseTimeout(e=0){const t=this.rejectResponsesTimeout.length-1;return this.rejectResponsesTimeout[e]??this.rejectResponsesTimeout[t]}async sendRequest(e){const t=this.getConnection();if(!t){e.reject("Runtime error: Please assign a connection to the client instance.");return}for(;!t.isAuthenticated();){if(e.insertedAt&&e.insertedAt+e.msg.header.getTimeout()<Date.now()){e.reject("sendRequest timeout reached");return}await new Promise(a=>{setTimeout(()=>{a("Timeout reached")},1e3)})}e.msg.header.setIdApplication(t.auth.idApplication),e.msg.header.setIdUser(t.auth.idUser);const r=e.msg.getPtlMessage(),s=t.send(r).idJob;e.msg.header.setJobId(s);const o={json:r};(r.Message===ve.NAME||r.Message===Ke.NAME)&&typeof e.msg.getData=="function"&&(o.data=e.msg.getData());const i={msg:e.msg,expirationTime:Date.now()+e.msg.header.getTimeout(),resolve:e.resolve,reject:e.reject,request:o};this.jobs.set(s,i),this.logger.trace(`Sending ${r.Message} with idJob: ${s}`,o)}clearPendingRequests(){this.jobs.forEach((e,t)=>{const r=new Z({Message:"Foundation::ErrorResponse",header:{id_job:t,id_service:"0"},reason:{value:1001}});e.reject(r)}),this.jobs.clear(),this.reset()}static supportedPermissionDeniedResponseMessages(e){const t=[ve];for(const r of t)if(e instanceof r)return!0;return!1}static supportsChunkedResponse(e){return e instanceof ve&&!e.header.isFlagValueSet("add_subscription")}}/*!
4
4
  * https://github.com/Starcounter-Jack/JSON-Patch
@@ -2298,7 +2298,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
2298
2298
  function isSubscriptionLossMessage(response) {
2299
2299
  return response.name === "Foundation::SubscriptionLossMessage";
2300
2300
  }
2301
- const PACKAGE_JSON = { version: "6.10.1", package: "@factset/frontgate-js-sdk" };
2301
+ const PACKAGE_JSON = { version: "6.10.2", package: "@factset/frontgate-js-sdk" };
2302
2302
  function getClientInformation() {
2303
2303
  const navigator2 = getNavigator();
2304
2304
  return {
@@ -3343,9 +3343,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
3343
3343
  __privateGet(this, _ws).onclose = (closeEvent) => {
3344
3344
  unhookOnFrontgateConnectionAuthenticated == null ? void 0 : unhookOnFrontgateConnectionAuthenticated();
3345
3345
  this.log(LogLevel.DEBUG, "Disconnected", closeEvent);
3346
- void this.hooks.callHook("frontgateConnection:disconnected", closeEvent);
3347
3346
  if (__privateGet(this, _wsStateInternal) === "connecting" || __privateGet(this, _wsStateInternal) === "connected") {
3348
3347
  reject(JSON.stringify(closeEvent));
3348
+ } else {
3349
+ void this.hooks.callHook("frontgateConnection:disconnected", closeEvent);
3349
3350
  }
3350
3351
  clearInterval(__privateGet(this, _keepAliveTimer));
3351
3352
  __privateSet(this, _wsStateInternal, "disconnected");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@factset/frontgate-js-sdk",
3
3
  "author": "Factset GmbH",
4
- "version": "6.10.1",
4
+ "version": "6.10.2",
5
5
  "description": "Typescript based client to request and subscribe values from mdg2 (frontgate)",
6
6
  "license": "Apache-2.0",
7
7
  "main": "./dist/lib/node/index.js",