@novu/js 3.1.0 → 3.2.0
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/README.md +1 -1
- package/dist/cjs/{chunk-WONVNOTK.js → chunk-4KMXR5HJ.js} +33 -19
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +8 -8
- package/dist/{esm/novu-DDPQzl99.d.mts → cjs/novu-jtIKy6p0.d.ts} +23 -12
- package/dist/cjs/themes/index.d.ts +2 -2
- package/dist/cjs/{types-CVvP6EyP.d.ts → types-qgZnJ8j8.d.ts} +1 -1
- package/dist/cjs/ui/index.d.ts +4 -4
- package/dist/cjs/ui/index.js +5 -5
- package/dist/esm/{chunk-WQDFFXIB.mjs → chunk-3SPOLIN3.mjs} +33 -19
- package/dist/esm/index.d.mts +2 -2
- package/dist/esm/index.mjs +1 -1
- package/dist/{cjs/novu-DDPQzl99.d.ts → esm/novu-jtIKy6p0.d.mts} +23 -12
- package/dist/esm/themes/index.d.mts +2 -2
- package/dist/esm/{types-DFXwHejb.d.mts → types-Bi1DqOQ-.d.mts} +1 -1
- package/dist/esm/ui/index.d.mts +4 -4
- package/dist/esm/ui/index.mjs +2 -2
- package/dist/novu.min.js +10 -10
- package/dist/novu.min.js.gz +0 -0
- package/package.json +1 -1
package/dist/novu.min.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";(()=>{var no=Object.create;var Jt=Object.defineProperty,oo=Object.defineProperties,ao=Object.getOwnPropertyDescriptor,co=Object.getOwnPropertyDescriptors,lo=Object.getOwnPropertyNames,Xt=Object.getOwnPropertySymbols,fo=Object.getPrototypeOf,Mi=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable;var qr=i=>{throw TypeError(i)};var Dr=(i,e,t)=>e in i?Jt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,b=(i,e)=>{for(var t in e||(e={}))Mi.call(e,t)&&Dr(i,t,e[t]);if(Xt)for(var t of Xt(e))Mr.call(e,t)&&Dr(i,t,e[t]);return i},O=(i,e)=>oo(i,co(e));var w=(i=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(i,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):i)(function(i){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Wr=(i,e)=>{var t={};for(var r in i)Mi.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&Xt)for(var r of Xt(i))e.indexOf(r)<0&&Mr.call(i,r)&&(t[r]=i[r]);return t};var T=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),ho=(i,e)=>{for(var t in e)Jt(i,t,{get:e[t],enumerable:!0})},uo=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of lo(e))!Mi.call(i,s)&&s!==t&&Jt(i,s,{get:()=>e[s],enumerable:!(r=ao(e,s))||r.enumerable});return i};var z=(i,e,t)=>(t=i!=null?no(fo(i)):{},uo(e||!i||!i.__esModule?Jt(t,"default",{value:i,enumerable:!0}):t,i));var qi=(i,e,t)=>e.has(i)||qr("Cannot "+t);var l=(i,e,t)=>(qi(i,e,"read from private field"),t?t.call(i):e.get(i)),_=(i,e,t)=>e.has(i)?qr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),E=(i,e,t,r)=>(qi(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Ke=(i,e,t)=>(qi(i,e,"access private method"),t);var g=(i,e,t)=>new Promise((r,s)=>{var n=c=>{try{a(t.next(c))}catch(u){s(u)}},o=c=>{try{a(t.throw(c))}catch(u){s(u)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(n,o);a((t=t.apply(i,e)).next())});var Ki=T((hf,ss)=>{"use strict";var it=1e3,rt=it*60,st=rt*60,Ue=st*24,Ro=Ue*7,To=Ue*365.25;ss.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Oo(i);if(t==="number"&&isFinite(i))return e.long?Po(i):Io(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Oo(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*To;case"weeks":case"week":case"w":return t*Ro;case"days":case"day":case"d":return t*Ue;case"hours":case"hour":case"hrs":case"hr":case"h":return t*st;case"minutes":case"minute":case"mins":case"min":case"m":return t*rt;case"seconds":case"second":case"secs":case"sec":case"s":return t*it;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Io(i){var e=Math.abs(i);return e>=Ue?Math.round(i/Ue)+"d":e>=st?Math.round(i/st)+"h":e>=rt?Math.round(i/rt)+"m":e>=it?Math.round(i/it)+"s":i+"ms"}function Po(i){var e=Math.abs(i);return e>=Ue?ui(i,e,Ue,"day"):e>=st?ui(i,e,st,"hour"):e>=rt?ui(i,e,rt,"minute"):e>=it?ui(i,e,it,"second"):i+" ms"}function ui(i,e,t,r){var s=e>=t*1.5;return Math.round(i/t)+" "+r+(s?"s":"")}});var Yi=T((uf,ns)=>{"use strict";function Lo(i){t.debug=t,t.default=t,t.coerce=c,t.disable=n,t.enable=s,t.enabled=o,t.humanize=Ki(),t.destroy=u,Object.keys(i).forEach(f=>{t[f]=i[f]}),t.names=[],t.skips=[],t.formatters={};function e(f){let h=0;for(let d=0;d<f.length;d++)h=(h<<5)-h+f.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(f){let h,d=null,x,S;function m(...v){if(!m.enabled)return;let N=m,A=Number(new Date),p=A-(h||A);N.diff=p,N.prev=h,N.curr=A,h=A,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let y=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(k,V)=>{if(k==="%%")return"%";y++;let G=t.formatters[V];if(typeof G=="function"){let de=v[y];k=G.call(N,de),v.splice(y,1),y--}return k}),t.formatArgs.call(N,v),(N.log||t.log).apply(N,v)}return m.namespace=f,m.useColors=t.useColors(),m.color=t.selectColor(f),m.extend=r,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(x!==t.namespaces&&(x=t.namespaces,S=t.enabled(f)),S),set:v=>{d=v}}),typeof t.init=="function"&&t.init(m),m}function r(f,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+f);return d.log=this.log,d}function s(f){t.save(f),t.namespaces=f,t.names=[],t.skips=[];let h,d=(typeof f=="string"?f:"").split(/[\s,]+/),x=d.length;for(h=0;h<x;h++)d[h]&&(f=d[h].replace(/\*/g,".*?"),f[0]==="-"?t.skips.push(new RegExp("^"+f.slice(1)+"$")):t.names.push(new RegExp("^"+f+"$")))}function n(){let f=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");return t.enable(""),f}function o(f){if(f[f.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(f))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(f))return!0;return!1}function a(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}function c(f){return f instanceof Error?f.stack||f.message:f}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}ns.exports=Lo});var os=T((J,di)=>{"use strict";J.formatArgs=Bo;J.save=Uo;J.load=Do;J.useColors=Fo;J.storage=Mo();J.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();J.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fo(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Bo(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+di.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),i.splice(r,0,e)}J.log=console.debug||console.log||(()=>{});function Uo(i){try{i?J.storage.setItem("debug",i):J.storage.removeItem("debug")}catch(e){}}function Do(){let i;try{i=J.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Mo(){try{return localStorage}catch(i){}}di.exports=Yi()(J);var{formatters:qo}=di.exports;qo.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var cs=T((df,as)=>{"use strict";as.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),s=e.indexOf("--");return r!==-1&&(s===-1||r<s)}});var Qi=T((pf,fs)=>{"use strict";var Wo=w("os"),ls=w("tty"),oe=cs(),{env:M}=process,ke;oe("no-color")||oe("no-colors")||oe("color=false")||oe("color=never")?ke=0:(oe("color")||oe("colors")||oe("color=true")||oe("color=always"))&&(ke=1);"FORCE_COLOR"in M&&(M.FORCE_COLOR==="true"?ke=1:M.FORCE_COLOR==="false"?ke=0:ke=M.FORCE_COLOR.length===0?1:Math.min(parseInt(M.FORCE_COLOR,10),3));function Xi(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function Ji(i,e){if(ke===0)return 0;if(oe("color=16m")||oe("color=full")||oe("color=truecolor"))return 3;if(oe("color=256"))return 2;if(i&&!e&&ke===void 0)return 0;let t=ke||0;if(M.TERM==="dumb")return t;if(process.platform==="win32"){let r=Wo.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in M)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in M)||M.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in M){let r=parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(M.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM)||"COLORTERM"in M?1:t}function $o(i){let e=Ji(i,i&&i.isTTY);return Xi(e)}fs.exports={supportsColor:$o,stdout:Xi(Ji(!0,ls.isatty(1))),stderr:Xi(Ji(!0,ls.isatty(2)))}});var us=T((q,mi)=>{"use strict";var Vo=w("tty"),pi=w("util");q.init=Xo;q.log=zo;q.formatArgs=Ho;q.save=Ko;q.load=Yo;q.useColors=jo;q.destroy=pi.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");q.colors=[6,2,3,4,5,1];try{let i=Qi();i&&(i.stderr||i).level>=2&&(q.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(i){}q.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,n)=>n.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function jo(){return"colors"in q.inspectOpts?!!q.inspectOpts.colors:Vo.isatty(process.stderr.fd)}function Ho(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),n=` ${s};1m${e} \x1B[0m`;i[0]=n+i[0].split(`
|
|
1
|
+
"use strict";(()=>{var no=Object.create;var Yt=Object.defineProperty,oo=Object.defineProperties,ao=Object.getOwnPropertyDescriptor,co=Object.getOwnPropertyDescriptors,lo=Object.getOwnPropertyNames,Kt=Object.getOwnPropertySymbols,fo=Object.getPrototypeOf,Ui=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable;var qr=i=>{throw TypeError(i)};var Dr=(i,e,t)=>e in i?Yt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,b=(i,e)=>{for(var t in e||(e={}))Ui.call(e,t)&&Dr(i,t,e[t]);if(Kt)for(var t of Kt(e))Mr.call(e,t)&&Dr(i,t,e[t]);return i},O=(i,e)=>oo(i,co(e));var w=(i=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(i,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):i)(function(i){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Wr=(i,e)=>{var t={};for(var r in i)Ui.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&Kt)for(var r of Kt(i))e.indexOf(r)<0&&Mr.call(i,r)&&(t[r]=i[r]);return t};var T=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),ho=(i,e)=>{for(var t in e)Yt(i,t,{get:e[t],enumerable:!0})},uo=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of lo(e))!Ui.call(i,s)&&s!==t&&Yt(i,s,{get:()=>e[s],enumerable:!(r=ao(e,s))||r.enumerable});return i};var z=(i,e,t)=>(t=i!=null?no(fo(i)):{},uo(e||!i||!i.__esModule?Yt(t,"default",{value:i,enumerable:!0}):t,i));var Di=(i,e,t)=>e.has(i)||qr("Cannot "+t);var l=(i,e,t)=>(Di(i,e,"read from private field"),t?t.call(i):e.get(i)),_=(i,e,t)=>e.has(i)?qr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),E=(i,e,t,r)=>(Di(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),ze=(i,e,t)=>(Di(i,e,"access private method"),t);var g=(i,e,t)=>new Promise((r,s)=>{var n=a=>{try{c(t.next(a))}catch(u){s(u)}},o=a=>{try{c(t.throw(a))}catch(u){s(u)}},c=a=>a.done?r(a.value):Promise.resolve(a.value).then(n,o);c((t=t.apply(i,e)).next())});var Gi=T((uf,ss)=>{"use strict";var tt=1e3,it=tt*60,rt=it*60,Ue=rt*24,Ro=Ue*7,To=Ue*365.25;ss.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Oo(i);if(t==="number"&&isFinite(i))return e.long?Po(i):Io(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Oo(i){if(i=String(i),!(i.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(e){var t=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return t*To;case"weeks":case"week":case"w":return t*Ro;case"days":case"day":case"d":return t*Ue;case"hours":case"hour":case"hrs":case"hr":case"h":return t*rt;case"minutes":case"minute":case"mins":case"min":case"m":return t*it;case"seconds":case"second":case"secs":case"sec":case"s":return t*tt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Io(i){var e=Math.abs(i);return e>=Ue?Math.round(i/Ue)+"d":e>=rt?Math.round(i/rt)+"h":e>=it?Math.round(i/it)+"m":e>=tt?Math.round(i/tt)+"s":i+"ms"}function Po(i){var e=Math.abs(i);return e>=Ue?fi(i,e,Ue,"day"):e>=rt?fi(i,e,rt,"hour"):e>=it?fi(i,e,it,"minute"):e>=tt?fi(i,e,tt,"second"):i+" ms"}function fi(i,e,t,r){var s=e>=t*1.5;return Math.round(i/t)+" "+r+(s?"s":"")}});var zi=T((df,ns)=>{"use strict";function Lo(i){t.debug=t,t.default=t,t.coerce=a,t.disable=n,t.enable=s,t.enabled=o,t.humanize=Gi(),t.destroy=u,Object.keys(i).forEach(f=>{t[f]=i[f]}),t.names=[],t.skips=[],t.formatters={};function e(f){let h=0;for(let d=0;d<f.length;d++)h=(h<<5)-h+f.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(f){let h,d=null,x,S;function m(...v){if(!m.enabled)return;let N=m,A=Number(new Date),p=A-(h||A);N.diff=p,N.prev=h,N.curr=A,h=A,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let y=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(k,V)=>{if(k==="%%")return"%";y++;let G=t.formatters[V];if(typeof G=="function"){let de=v[y];k=G.call(N,de),v.splice(y,1),y--}return k}),t.formatArgs.call(N,v),(N.log||t.log).apply(N,v)}return m.namespace=f,m.useColors=t.useColors(),m.color=t.selectColor(f),m.extend=r,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(x!==t.namespaces&&(x=t.namespaces,S=t.enabled(f)),S),set:v=>{d=v}}),typeof t.init=="function"&&t.init(m),m}function r(f,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+f);return d.log=this.log,d}function s(f){t.save(f),t.namespaces=f,t.names=[],t.skips=[];let h,d=(typeof f=="string"?f:"").split(/[\s,]+/),x=d.length;for(h=0;h<x;h++)d[h]&&(f=d[h].replace(/\*/g,".*?"),f[0]==="-"?t.skips.push(new RegExp("^"+f.slice(1)+"$")):t.names.push(new RegExp("^"+f+"$")))}function n(){let f=[...t.names.map(c),...t.skips.map(c).map(h=>"-"+h)].join(",");return t.enable(""),f}function o(f){if(f[f.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(f))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(f))return!0;return!1}function c(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}function a(f){return f instanceof Error?f.stack||f.message:f}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}ns.exports=Lo});var os=T((Q,hi)=>{"use strict";Q.formatArgs=Bo;Q.save=Uo;Q.load=Do;Q.useColors=Fo;Q.storage=Mo();Q.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();Q.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function Fo(){if(typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let i;return typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&(i=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(i[1],10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Bo(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+hi.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),i.splice(r,0,e)}Q.log=console.debug||console.log||(()=>{});function Uo(i){try{i?Q.storage.setItem("debug",i):Q.storage.removeItem("debug")}catch(e){}}function Do(){let i;try{i=Q.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Mo(){try{return localStorage}catch(i){}}hi.exports=zi()(Q);var{formatters:qo}=hi.exports;qo.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var cs=T((pf,as)=>{"use strict";as.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),s=e.indexOf("--");return r!==-1&&(s===-1||r<s)}});var Xi=T((mf,fs)=>{"use strict";var Wo=w("os"),ls=w("tty"),oe=cs(),{env:M}=process,ke;oe("no-color")||oe("no-colors")||oe("color=false")||oe("color=never")?ke=0:(oe("color")||oe("colors")||oe("color=true")||oe("color=always"))&&(ke=1);"FORCE_COLOR"in M&&(M.FORCE_COLOR==="true"?ke=1:M.FORCE_COLOR==="false"?ke=0:ke=M.FORCE_COLOR.length===0?1:Math.min(parseInt(M.FORCE_COLOR,10),3));function Ki(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function Yi(i,e){if(ke===0)return 0;if(oe("color=16m")||oe("color=full")||oe("color=truecolor"))return 3;if(oe("color=256"))return 2;if(i&&!e&&ke===void 0)return 0;let t=ke||0;if(M.TERM==="dumb")return t;if(process.platform==="win32"){let r=Wo.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in M)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in M)||M.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in M)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(M.TEAMCITY_VERSION)?1:0;if(M.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in M){let r=parseInt((M.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(M.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(M.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(M.TERM)||"COLORTERM"in M?1:t}function $o(i){let e=Yi(i,i&&i.isTTY);return Ki(e)}fs.exports={supportsColor:$o,stdout:Ki(Yi(!0,ls.isatty(1))),stderr:Ki(Yi(!0,ls.isatty(2)))}});var us=T((q,di)=>{"use strict";var Vo=w("tty"),ui=w("util");q.init=Xo;q.log=zo;q.formatArgs=Ho;q.save=Ko;q.load=Yo;q.useColors=jo;q.destroy=ui.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");q.colors=[6,2,3,4,5,1];try{let i=Xi();i&&(i.stderr||i).level>=2&&(q.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(i){}q.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,n)=>n.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function jo(){return"colors"in q.inspectOpts?!!q.inspectOpts.colors:Vo.isatty(process.stderr.fd)}function Ho(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),n=` ${s};1m${e} \x1B[0m`;i[0]=n+i[0].split(`
|
|
2
2
|
`).join(`
|
|
3
|
-
`+n),i.push(s+"m+"+
|
|
4
|
-
`)}function Ko(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Yo(){return process.env.DEBUG}function Xo(i){i.inspectOpts={};let e=Object.keys(q.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=q.inspectOpts[e[t]]}
|
|
5
|
-
`).map(e=>e.trim()).join(" ")};hs.O=function(i){return this.inspectOpts.colors=this.useColors,
|
|
6
|
-
`);return p.substr(0,p.length-2)},this.getRequestHeader=function(p){return typeof p=="string"&&u[p]?u[p]:""},this.send=function(p){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(d)throw new Error("INVALID_STATE_ERR: send has already been called");var y=!1,$=!1,k=Es.parse(o.url),V;switch(k.protocol){case"https:":y=!0;case"http:":V=k.hostname;break;case"file:":$=!0;break;case void 0:case"":V="localhost";break;default:throw new Error("Protocol not supported.")}if($){if(o.method!=="GET")throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)nt.readFile(unescape(k.pathname),"utf8",function(re,ze){re?e.handleError(re,re.errno||-1):(e.status=200,e.responseText=ze,A(e.DONE))});else try{this.responseText=nt.readFileSync(unescape(k.pathname),"utf8"),this.status=200,A(e.DONE)}catch(re){this.handleError(re,re.errno||-1)}return}var G=k.port||(y?443:80),de=k.pathname+(k.search?k.search:"");if(u.Host=V,y&&G===443||G===80||(u.Host+=":"+k.port),o.user){typeof o.password=="undefined"&&(o.password="");var zt=new Buffer(o.user+":"+o.password);u.Authorization="Basic "+zt.toString("base64")}o.method==="GET"||o.method==="HEAD"?p=null:p?(u["Content-Length"]=Buffer.isBuffer(p)?p.length:Buffer.byteLength(p),u["Content-Type"]||(u["Content-Type"]="text/plain;charset=UTF-8")):o.method==="POST"&&(u["Content-Length"]=0);var Kt=i.agent||!1,ie={host:V,port:G,path:de,method:o.method,headers:u,agent:Kt};if(y&&(ie.pfx=i.pfx,ie.key=i.key,ie.passphrase=i.passphrase,ie.cert=i.cert,ie.ca=i.ca,ie.ciphers=i.ciphers,ie.rejectUnauthorized=i.rejectUnauthorized!==!1),x=!1,o.async){var pt=y?r.request:t.request;d=!0,e.dispatchEvent("readystatechange");var Ge=function(re){if(n=re,n.statusCode===302||n.statusCode===303||n.statusCode===307){o.url=n.headers.location;var ze=Es.parse(o.url);V=ze.hostname;var Ce={hostname:ze.hostname,port:ze.port,path:ze.path,method:n.statusCode===303?"GET":o.method,headers:u};y&&(Ce.pfx=i.pfx,Ce.key=i.key,Ce.passphrase=i.passphrase,Ce.cert=i.cert,Ce.ca=i.ca,Ce.ciphers=i.ciphers,Ce.rejectUnauthorized=i.rejectUnauthorized!==!1),s=pt(Ce,Ge).on("error",Ur),s.end();return}n&&n.setEncoding&&n.setEncoding("utf8"),A(e.HEADERS_RECEIVED),e.status=n.statusCode,n.on("data",function(Yt){Yt&&(e.responseText+=Yt),d&&A(e.LOADING)}),n.on("end",function(){d&&(d=!1,A(e.DONE))}),n.on("error",function(Yt){e.handleError(Yt)})},Ur=function(re){e.handleError(re)};s=pt(ie,Ge).on("error",Ur),i.autoUnref&&s.on("socket",re=>{re.unref()}),p&&s.write(p),s.end(),e.dispatchEvent("loadstart")}else{var mt=".node-xmlhttprequest-content-"+process.pid,gt=".node-xmlhttprequest-sync-"+process.pid;nt.writeFileSync(gt,"","utf8");for(var io="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(y?"s":"")+".request;var options = "+JSON.stringify(ie)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+mt+"', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');fs.unlinkSync('"+gt+"');});response.on('error', function(error) {fs.writeFileSync('"+mt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+gt+"');});}).on('error', function(error) {fs.writeFileSync('"+mt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+gt+"');});"+(p?"req.write('"+JSON.stringify(p).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",ro=Zo(process.argv[0],["-e",io]),jc;nt.existsSync(gt););if(e.responseText=nt.readFileSync(mt,"utf8"),ro.stdin.end(),nt.unlinkSync(mt),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var so=e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,"");e.handleError(so,503)}else e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1"),e.responseText=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"),A(e.DONE)}},this.handleError=function(p,y){this.status=y||0,this.statusText=p,this.responseText=p.stack,x=!0,A(this.DONE)},this.abort=function(){s&&(s.abort(),s=null),u=Object.assign({},c),this.responseText="",this.responseXML="",x=S=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||d)&&this.readyState!==this.DONE&&(d=!1,A(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(p,y){p in m||(m[p]=[]),m[p].push(y)},this.removeEventListener=function(p,y){p in m&&(m[p]=m[p].filter(function($){return $!==y}))},this.dispatchEvent=function(p){if(typeof e["on"+p]=="function"&&(this.readyState===this.DONE?setImmediate(function(){e["on"+p]()}):e["on"+p]()),p in m)for(let y=0,$=m[p].length;y<$;y++)this.readyState===this.DONE?setImmediate(function(){m[p][y].call(e)}):m[p][y].call(e)};var A=function(p){if(!(e.readyState===p||e.readyState===e.UNSENT&&S)&&(e.readyState=p,(o.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let y;S?y="abort":x?y="error":y="load",e.dispatchEvent(y),e.dispatchEvent("loadend")}}}});var Rs=T((Pf,ks)=>{"use strict";var{Duplex:ra}=w("stream");function Ns(i){i.emit("close")}function sa(){!this.destroyed&&this._writableState.finished&&this.destroy()}function As(i){this.removeListener("error",As),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function na(i,e){let t=!0,r=new ra(O(b({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return i.on("message",function(n,o){let a=!o&&r._readableState.objectMode?n.toString():n;r.push(a)||i.pause()}),i.once("error",function(n){r.destroyed||(t=!1,r.destroy(n))}),i.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(s,n){if(i.readyState===i.CLOSED){n(s),process.nextTick(Ns,r);return}let o=!1;i.once("error",function(c){o=!0,n(c)}),i.once("close",function(){o||n(s),process.nextTick(Ns,r)}),t&&i.terminate()},r._final=function(s){if(i.readyState===i.CONNECTING){i.once("open",function(){r._final(s)});return}i._socket!==null&&(i._socket._writableState.finished?(s(),r._readableState.endEmitted&&r.destroy()):(i._socket.once("finish",function(){s()}),i.close()))},r._read=function(){i.isPaused&&i.resume()},r._write=function(s,n,o){if(i.readyState===i.CONNECTING){i.once("open",function(){r._write(s,n,o)});return}i.send(s,o)},r.on("end",sa),r.on("error",As),r}ks.exports=na});var Te=T((Ff,Ts)=>{"use strict";Ts.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Rt=T((Bf,_i)=>{"use strict";var{EMPTY_BUFFER:oa}=Te();function aa(i,e){if(i.length===0)return oa;if(i.length===1)return i[0];let t=Buffer.allocUnsafe(e),r=0;for(let s=0;s<i.length;s++){let n=i[s];t.set(n,r),r+=n.length}return r<e?t.slice(0,r):t}function Os(i,e,t,r,s){for(let n=0;n<s;n++)t[r+n]=i[n]^e[n&3]}function Is(i,e){for(let t=0;t<i.length;t++)i[t]^=e[t&3]}function ca(i){return i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}function or(i){if(or.readOnly=!0,Buffer.isBuffer(i))return i;let e;return i instanceof ArrayBuffer?e=Buffer.from(i):ArrayBuffer.isView(i)?e=Buffer.from(i.buffer,i.byteOffset,i.byteLength):(e=Buffer.from(i),or.readOnly=!1),e}_i.exports={concat:aa,mask:Os,toArrayBuffer:ca,toBuffer:or,unmask:Is};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=w("bufferutil");_i.exports.mask=function(e,t,r,s,n){n<48?Os(e,t,r,s,n):i.mask(e,t,r,s,n)},_i.exports.unmask=function(e,t){e.length<32?Is(e,t):i.unmask(e,t)}}catch(i){}});var Fs=T((Uf,Ls)=>{"use strict";var Ps=Symbol("kDone"),ar=Symbol("kRun"),cr=class{constructor(e){this[Ps]=()=>{this.pending--,this[ar]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ar]()}[ar](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Ps])}}};Ls.exports=cr});var It=T((Df,Ms)=>{"use strict";var Tt=w("zlib"),Bs=Rt(),la=Fs(),{kStatusCode:Us}=Te(),fa=Buffer.from([0,0,255,255]),xi=Symbol("permessage-deflate"),Ee=Symbol("total-length"),Ot=Symbol("callback"),Oe=Symbol("buffers"),bi=Symbol("error"),Ei,lr=class{constructor(e,t,r){if(this._maxPayload=r|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!Ei){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Ei=new la(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Ot];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,r=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(r.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?r.client_max_window_bits=t.clientMaxWindowBits:(r.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(r=>{let s=t[r];if(s.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(s=s[0],r==="client_max_window_bits"){if(s!==!0){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else if(r==="server_max_window_bits"){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=s})}),e}decompress(e,t,r){Ei.add(s=>{this._decompress(e,t,(n,o)=>{s(),r(n,o)})})}compress(e,t,r){Ei.add(s=>{this._compress(e,t,(n,o)=>{s(),r(n,o)})})}_decompress(e,t,r){let s=this._isServer?"client":"server";if(!this._inflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Tt.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=Tt.createInflateRaw(O(b({},this._options.zlibInflateOptions),{windowBits:o})),this._inflate[xi]=this,this._inflate[Ee]=0,this._inflate[Oe]=[],this._inflate.on("error",ua),this._inflate.on("data",Ds)}this._inflate[Ot]=r,this._inflate.write(e),t&&this._inflate.write(fa),this._inflate.flush(()=>{let n=this._inflate[bi];if(n){this._inflate.close(),this._inflate=null,r(n);return}let o=Bs.concat(this._inflate[Oe],this._inflate[Ee]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ee]=0,this._inflate[Oe]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let s=this._isServer?"server":"client";if(!this._deflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?Tt.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=Tt.createDeflateRaw(O(b({},this._options.zlibDeflateOptions),{windowBits:o})),this._deflate[Ee]=0,this._deflate[Oe]=[],this._deflate.on("data",ha)}this._deflate[Ot]=r,this._deflate.write(e),this._deflate.flush(Tt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Bs.concat(this._deflate[Oe],this._deflate[Ee]);t&&(n=n.slice(0,n.length-4)),this._deflate[Ot]=null,this._deflate[Ee]=0,this._deflate[Oe]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),r(null,n)})}};Ms.exports=lr;function ha(i){this[Oe].push(i),this[Ee]+=i.length}function Ds(i){if(this[Ee]+=i.length,this[xi]._maxPayload<1||this[Ee]<=this[xi]._maxPayload){this[Oe].push(i);return}this[bi]=new RangeError("Max payload size exceeded"),this[bi].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[bi][Us]=1009,this.removeListener("data",Ds),this.reset()}function ua(i){this[xi]._inflate=null,i[Us]=1007,this[Ot](i)}});var Pt=T((qf,fr)=>{"use strict";var da=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function pa(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function qs(i){let e=i.length,t=0;for(;t<e;)if(!(i[t]&128))t++;else if((i[t]&224)===192){if(t+1===e||(i[t+1]&192)!==128||(i[t]&254)===192)return!1;t+=2}else if((i[t]&240)===224){if(t+2>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||i[t]===224&&(i[t+1]&224)===128||i[t]===237&&(i[t+1]&224)===160)return!1;t+=3}else if((i[t]&248)===240){if(t+3>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||(i[t+3]&192)!==128||i[t]===240&&(i[t+1]&240)===128||i[t]===244&&i[t+1]>143||i[t]>244)return!1;t+=4}else return!1;return!0}fr.exports={isValidStatusCode:pa,isValidUTF8:qs,tokenChars:da};if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=w("utf-8-validate");fr.exports.isValidUTF8=function(e){return e.length<150?qs(e):i(e)}}catch(i){}});var pr=T((Wf,zs)=>{"use strict";var{Writable:ma}=w("stream"),Ws=It(),{BINARY_TYPES:ga,EMPTY_BUFFER:$s,kStatusCode:ya,kWebSocket:va}=Te(),{concat:hr,toArrayBuffer:_a,unmask:Ea}=Rt(),{isValidStatusCode:ba,isValidUTF8:Vs}=Pt(),Lt=0,js=1,Hs=2,Gs=3,ur=4,xa=5,dr=class extends ma{constructor(e={}){super(),this._binaryType=e.binaryType||ga[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[va]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=Lt,this._loop=!1}_write(e,t,r){if(this._opcode===8&&this._state==Lt)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=r.slice(e),r.slice(0,e)}let t=Buffer.allocUnsafe(e);do{let r=this._buffers[0],s=t.length-e;e>=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do switch(this._state){case Lt:t=this.getInfo();break;case js:t=this.getPayloadLength16();break;case Hs:t=this.getPayloadLength64();break;case Gs:this.getMask();break;case ur:t=this.getData(e);break;default:this._loop=!1;return}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48)return this._loop=!1,B(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");let t=(e[0]&64)===64;if(t&&!this._extensions[Ws.extensionName])return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,B(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,B(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,B(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}else return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked)return this._loop=!1,B(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,B(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(this._payloadLength===126)this._state=js;else if(this._payloadLength===127)this._state=Hs;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,B(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=Gs:this._state=ur}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=ur}getData(e){let t=$s;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&Ea(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=xa,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[Ws.extensionName].decompress(e,this._fin,(s,n)=>{if(s)return t(s);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}let o=this.dataMessage();if(o)return t(o);this.startLoop(t)})}dataMessage(){if(this._fin){let e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=hr(t,e):this._binaryType==="arraybuffer"?r=_a(hr(t,e)):r=t,this.emit("message",r,!0)}else{let r=hr(t,e);if(!this._skipUTF8Validation&&!Vs(r))return this._loop=!1,B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=Lt}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,$s),this.end();else{if(e.length===1)return B(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{let t=e.readUInt16BE(0);if(!ba(t))return B(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let r=e.slice(2);if(!this._skipUTF8Validation&&!Vs(r))return B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}}else this._opcode===9?this.emit("ping",e):this.emit("pong",e);this._state=Lt}};zs.exports=dr;function B(i,e,t,r,s){let n=new i(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,B),n.code=s,n[ya]=r,n}});var gr=T((jf,Xs)=>{"use strict";var $f=w("net"),Vf=w("tls"),{randomFillSync:Ca}=w("crypto"),Ks=It(),{EMPTY_BUFFER:Sa}=Te(),{isValidStatusCode:wa}=Pt(),{mask:Ys,toBuffer:ot}=Rt(),he=Symbol("kByteLength"),Na=Buffer.alloc(4),mr=class i{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let r,s=!1,n=2,o=!1;t.mask&&(r=t.maskBuffer||Na,t.generateMask?t.generateMask(r):Ca(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let a;typeof e=="string"?(!t.mask||o)&&t[he]!==void 0?a=t[he]:(e=Buffer.from(e),a=e.length):(a=e.length,s=t.mask&&t.readOnly&&!o);let c=a;a>=65536?(n+=8,c=127):a>125&&(n+=2,c=126);let u=Buffer.allocUnsafe(s?a+n:n);return u[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(u[0]|=64),u[1]=c,c===126?u.writeUInt16BE(a,2):c===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),t.mask?(u[1]|=128,u[n-4]=r[0],u[n-3]=r[1],u[n-2]=r[2],u[n-1]=r[3],o?[u,e]:s?(Ys(e,r,u,n,a),[u]):(Ys(e,r,e,0,a),[u,e])):[u,e]}close(e,t,r,s){let n;if(e===void 0)n=Sa;else{if(typeof e!="number"||!wa(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let a=Buffer.byteLength(t);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+a),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[he]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(i.frame(n,o),s)}ping(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=ot(e),s=e.length,n=ot.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}pong(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=ot(e),s=e.length,n=ot.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}send(e,t,r){let s=this._extensions[Ks.extensionName],n=t.binary?2:1,o=t.compress,a,c;if(typeof e=="string"?(a=Buffer.byteLength(e),c=!1):(e=ot(e),a=e.length,c=ot.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=a>=s._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),s){let u={[he]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,u,r]):this.dispatch(e,this._compress,u,r)}else this.sendFrame(i.frame(e,{[he]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:c,rsv1:!1}),r)}dispatch(e,t,r,s){if(!t){this.sendFrame(i.frame(e,r),s);return}let n=this._extensions[Ks.extensionName];this._bufferedBytes+=r[he],this._deflating=!0,n.compress(e,r.fin,(o,a)=>{if(this._socket.destroyed){let c=new Error("The socket was closed while data was being compressed");typeof s=="function"&&s(c);for(let u=0;u<this._queue.length;u++){let f=this._queue[u],h=f[f.length-1];typeof h=="function"&&h(c)}return}this._bufferedBytes-=r[he],this._deflating=!1,r.readOnly=!1,this.sendFrame(i.frame(a,r),s),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};Xs.exports=mr});var on=T((Hf,nn)=>{"use strict";var{kForOnEventAttribute:Ft,kListener:yr}=Te(),Js=Symbol("kCode"),Qs=Symbol("kData"),Zs=Symbol("kError"),en=Symbol("kMessage"),tn=Symbol("kReason"),at=Symbol("kTarget"),rn=Symbol("kType"),sn=Symbol("kWasClean"),be=class{constructor(e){this[at]=null,this[rn]=e}get target(){return this[at]}get type(){return this[rn]}};Object.defineProperty(be.prototype,"target",{enumerable:!0});Object.defineProperty(be.prototype,"type",{enumerable:!0});var Me=class extends be{constructor(e,t={}){super(e),this[Js]=t.code===void 0?0:t.code,this[tn]=t.reason===void 0?"":t.reason,this[sn]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[Js]}get reason(){return this[tn]}get wasClean(){return this[sn]}};Object.defineProperty(Me.prototype,"code",{enumerable:!0});Object.defineProperty(Me.prototype,"reason",{enumerable:!0});Object.defineProperty(Me.prototype,"wasClean",{enumerable:!0});var ct=class extends be{constructor(e,t={}){super(e),this[Zs]=t.error===void 0?null:t.error,this[en]=t.message===void 0?"":t.message}get error(){return this[Zs]}get message(){return this[en]}};Object.defineProperty(ct.prototype,"error",{enumerable:!0});Object.defineProperty(ct.prototype,"message",{enumerable:!0});var Bt=class extends be{constructor(e,t={}){super(e),this[Qs]=t.data===void 0?null:t.data}get data(){return this[Qs]}};Object.defineProperty(Bt.prototype,"data",{enumerable:!0});var Aa={addEventListener(i,e,t={}){for(let s of this.listeners(i))if(!t[Ft]&&s[yr]===e&&!s[Ft])return;let r;if(i==="message")r=function(n,o){let a=new Bt("message",{data:o?n:n.toString()});a[at]=this,Ci(e,this,a)};else if(i==="close")r=function(n,o){let a=new Me("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[at]=this,Ci(e,this,a)};else if(i==="error")r=function(n){let o=new ct("error",{error:n,message:n.message});o[at]=this,Ci(e,this,o)};else if(i==="open")r=function(){let n=new be("open");n[at]=this,Ci(e,this,n)};else return;r[Ft]=!!t[Ft],r[yr]=e,t.once?this.once(i,r):this.on(i,r)},removeEventListener(i,e){for(let t of this.listeners(i))if(t[yr]===e&&!t[Ft]){this.removeListener(i,t);break}}};nn.exports={CloseEvent:Me,ErrorEvent:ct,Event:be,EventTarget:Aa,MessageEvent:Bt};function Ci(i,e,t){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,t):i.call(e,t)}});var vr=T((Gf,an)=>{"use strict";var{tokenChars:Ut}=Pt();function me(i,e,t){i[e]===void 0?i[e]=[t]:i[e].push(t)}function ka(i){let e=Object.create(null),t=Object.create(null),r=!1,s=!1,n=!1,o,a,c=-1,u=-1,f=-1,h=0;for(;h<i.length;h++)if(u=i.charCodeAt(h),o===void 0)if(f===-1&&Ut[u]===1)c===-1&&(c=h);else if(h!==0&&(u===32||u===9))f===-1&&c!==-1&&(f=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1&&(f=h);let x=i.slice(c,f);u===44?(me(e,x,t),t=Object.create(null)):o=x,c=f=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===void 0)if(f===-1&&Ut[u]===1)c===-1&&(c=h);else if(u===32||u===9)f===-1&&c!==-1&&(f=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1&&(f=h),me(t,i.slice(c,f),!0),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),c=f=-1}else if(u===61&&c!==-1&&f===-1)a=i.slice(c,h),c=f=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(s){if(Ut[u]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1?c=h:r||(r=!0),s=!1}else if(n)if(Ut[u]===1)c===-1&&(c=h);else if(u===34&&c!==-1)n=!1,f=h;else if(u===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(u===34&&i.charCodeAt(h-1)===61)n=!0;else if(f===-1&&Ut[u]===1)c===-1&&(c=h);else if(c!==-1&&(u===32||u===9))f===-1&&(f=h);else if(u===59||u===44){if(c===-1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1&&(f=h);let x=i.slice(c,f);r&&(x=x.replace(/\\/g,""),r=!1),me(t,a,x),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),a=void 0,c=f=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(c===-1||n||u===32||u===9)throw new SyntaxError("Unexpected end of input");f===-1&&(f=h);let d=i.slice(c,f);return o===void 0?me(e,d,t):(a===void 0?me(t,d,!0):r?me(t,a,d.replace(/\\/g,"")):me(t,a,d),me(e,o,t)),e}function Ra(i){return Object.keys(i).map(e=>{let t=i[e];return Array.isArray(t)||(t=[t]),t.map(r=>[e].concat(Object.keys(r).map(s=>{let n=r[s];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}an.exports={format:Ra,parse:ka}});var Cr=T((Kf,vn)=>{"use strict";var Ta=w("events"),Oa=w("https"),Ia=w("http"),fn=w("net"),Pa=w("tls"),{randomBytes:La,createHash:Fa}=w("crypto"),{Readable:zf}=w("stream"),{URL:_r}=w("url"),Ie=It(),Ba=pr(),Ua=gr(),{BINARY_TYPES:cn,EMPTY_BUFFER:Si,GUID:Da,kForOnEventAttribute:Er,kListener:Ma,kStatusCode:qa,kWebSocket:K,NOOP:hn}=Te(),{EventTarget:{addEventListener:Wa,removeEventListener:$a}}=on(),{format:Va,parse:ja}=vr(),{toBuffer:Ha}=Rt(),Ga=30*1e3,un=Symbol("kAborted"),br=[8,13],xe=["CONNECTING","OPEN","CLOSING","CLOSED"],za=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,L=class i extends Ta{constructor(e,t,r){super(),this._binaryType=cn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Si,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=i.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(r=t,t=[]):t=[t]),dn(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){cn.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){let s=new Ba({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new Ua(e,this._extensions,r.generateMask),this._receiver=s,this._socket=e,s[K]=this,e[K]=this,s.on("conclude",Xa),s.on("drain",Ja),s.on("error",Qa),s.on("message",Za),s.on("ping",ec),s.on("pong",tc),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",mn),e.on("data",Ni),e.on("end",gn),e.on("error",yn),this._readyState=i.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ie.extensionName]&&this._extensions[Ie.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Q(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===i.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=i.CLOSING,this._sender.close(e,t,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Ga)}}pause(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){xr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||Si,t,r)}pong(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){xr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||Si,t,r)}resume(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(r=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){xr(this,e,r);return}let s=b({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},t);this._extensions[Ie.extensionName]||(s.compress=!1),this._sender.send(e||Si,s,r)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Q(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(L,"CONNECTING",{enumerable:!0,value:xe.indexOf("CONNECTING")});Object.defineProperty(L.prototype,"CONNECTING",{enumerable:!0,value:xe.indexOf("CONNECTING")});Object.defineProperty(L,"OPEN",{enumerable:!0,value:xe.indexOf("OPEN")});Object.defineProperty(L.prototype,"OPEN",{enumerable:!0,value:xe.indexOf("OPEN")});Object.defineProperty(L,"CLOSING",{enumerable:!0,value:xe.indexOf("CLOSING")});Object.defineProperty(L.prototype,"CLOSING",{enumerable:!0,value:xe.indexOf("CLOSING")});Object.defineProperty(L,"CLOSED",{enumerable:!0,value:xe.indexOf("CLOSED")});Object.defineProperty(L.prototype,"CLOSED",{enumerable:!0,value:xe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(L.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(L.prototype,`on${i}`,{enumerable:!0,get(){for(let e of this.listeners(i))if(e[Er])return e[Ma];return null},set(e){for(let t of this.listeners(i))if(t[Er]){this.removeListener(i,t);break}typeof e=="function"&&this.addEventListener(i,e,{[Er]:!0})}})});L.prototype.addEventListener=Wa;L.prototype.removeEventListener=$a;vn.exports=L;function dn(i,e,t,r){let s=O(b({protocolVersion:br[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10},r),{createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0});if(!br.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${br.join(", ")})`);let n;if(e instanceof _r)n=e,i._url=e.href;else{try{n=new _r(e)}catch(m){throw new SyntaxError(`Invalid URL: ${e}`)}i._url=e}let o=n.protocol==="wss:",a=n.protocol==="ws+unix:",c;if(n.protocol!=="ws:"&&!o&&!a?c=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:a&&!n.pathname?c="The URL's pathname is empty":n.hash&&(c="The URL contains a fragment identifier"),c){let m=new SyntaxError(c);if(i._redirects===0)throw m;wi(i,m);return}let u=o?443:80,f=La(16).toString("base64"),h=o?Oa.request:Ia.request,d=new Set,x;if(s.createConnection=o?Ya:Ka,s.defaultPort=s.defaultPort||u,s.port=n.port||u,s.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,s.headers=O(b({},s.headers),{"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":f,Connection:"Upgrade",Upgrade:"websocket"}),s.path=n.pathname+n.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(x=new Ie(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=Va({[Ie.extensionName]:x.offer()})),t.length){for(let m of t){if(typeof m!="string"||!za.test(m)||d.has(m))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(m)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(n.username||n.password)&&(s.auth=`${n.username}:${n.password}`),a){let m=s.path.split(":");s.socketPath=m[0],s.path=m[1]}let S;if(s.followRedirects){if(i._redirects===0){i._originalIpc=a,i._originalSecure=o,i._originalHostOrSocketPath=a?s.socketPath:n.host;let m=r&&r.headers;if(r=O(b({},r),{headers:{}}),m)for(let[v,N]of Object.entries(m))r.headers[v.toLowerCase()]=N}else if(i.listenerCount("redirect")===0){let m=a?i._originalIpc?s.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:n.host===i._originalHostOrSocketPath;(!m||i._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,m||delete s.headers.host,s.auth=void 0)}s.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),S=i._req=h(s),i._redirects&&i.emit("redirect",i.url,S)}else S=i._req=h(s);s.timeout&&S.on("timeout",()=>{Q(i,S,"Opening handshake has timed out")}),S.on("error",m=>{S===null||S[un]||(S=i._req=null,wi(i,m))}),S.on("response",m=>{let v=m.headers.location,N=m.statusCode;if(v&&s.followRedirects&&N>=300&&N<400){if(++i._redirects>s.maxRedirects){Q(i,S,"Maximum redirects exceeded");return}S.abort();let A;try{A=new _r(v,e)}catch(p){let y=new SyntaxError(`Invalid URL: ${v}`);wi(i,y);return}dn(i,A,t,r)}else i.emit("unexpected-response",S,m)||Q(i,S,`Unexpected server response: ${m.statusCode}`)}),S.on("upgrade",(m,v,N)=>{if(i.emit("upgrade",m),i.readyState!==L.CONNECTING)return;if(S=i._req=null,m.headers.upgrade.toLowerCase()!=="websocket"){Q(i,v,"Invalid Upgrade header");return}let A=Fa("sha1").update(f+Da).digest("base64");if(m.headers["sec-websocket-accept"]!==A){Q(i,v,"Invalid Sec-WebSocket-Accept header");return}let p=m.headers["sec-websocket-protocol"],y;if(p!==void 0?d.size?d.has(p)||(y="Server sent an invalid subprotocol"):y="Server sent a subprotocol but none was requested":d.size&&(y="Server sent no subprotocol"),y){Q(i,v,y);return}p&&(i._protocol=p);let $=m.headers["sec-websocket-extensions"];if($!==void 0){if(!x){Q(i,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let k;try{k=ja($)}catch(G){Q(i,v,"Invalid Sec-WebSocket-Extensions header");return}let V=Object.keys(k);if(V.length!==1||V[0]!==Ie.extensionName){Q(i,v,"Server indicated an extension that was not requested");return}try{x.accept(k[Ie.extensionName])}catch(G){Q(i,v,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[Ie.extensionName]=x}i.setSocket(v,N,{generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),S.end()}function wi(i,e){i._readyState=L.CLOSING,i.emit("error",e),i.emitClose()}function Ka(i){return i.path=i.socketPath,fn.connect(i)}function Ya(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=fn.isIP(i.host)?"":i.host),Pa.connect(i)}function Q(i,e,t){i._readyState=L.CLOSING;let r=new Error(t);Error.captureStackTrace(r,Q),e.setHeader?(e[un]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(wi,i,r)):(e.destroy(r),e.once("error",i.emit.bind(i,"error")),e.once("close",i.emitClose.bind(i)))}function xr(i,e,t){if(e){let r=Ha(e).length;i._socket?i._sender._bufferedBytes+=r:i._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${i.readyState} (${xe[i.readyState]})`);t(r)}}function Xa(i,e){let t=this[K];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=i,t._socket[K]!==void 0&&(t._socket.removeListener("data",Ni),process.nextTick(pn,t._socket),i===1005?t.close():t.close(i,e))}function Ja(){let i=this[K];i.isPaused||i._socket.resume()}function Qa(i){let e=this[K];e._socket[K]!==void 0&&(e._socket.removeListener("data",Ni),process.nextTick(pn,e._socket),e.close(i[qa])),e.emit("error",i)}function ln(){this[K].emitClose()}function Za(i,e){this[K].emit("message",i,e)}function ec(i){let e=this[K];e.pong(i,!e._isServer,hn),e.emit("ping",i)}function tc(i){this[K].emit("pong",i)}function pn(i){i.resume()}function mn(){let i=this[K];this.removeListener("close",mn),this.removeListener("data",Ni),this.removeListener("end",gn),i._readyState=L.CLOSING;let e;!this._readableState.endEmitted&&!i._closeFrameReceived&&!i._receiver._writableState.errorEmitted&&(e=i._socket.read())!==null&&i._receiver.write(e),i._receiver.end(),this[K]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",ln),i._receiver.on("finish",ln))}function Ni(i){this[K]._receiver.write(i)||this.pause()}function gn(){let i=this[K];i._readyState=L.CLOSING,i._receiver.end(),this.end()}function yn(){let i=this[K];this.removeListener("error",yn),this.on("error",hn),i&&(i._readyState=L.CLOSING,this.destroy())}});var En=T((Xf,_n)=>{"use strict";var{tokenChars:ic}=Pt();function rc(i){let e=new Set,t=-1,r=-1,s=0;for(s;s<i.length;s++){let o=i.charCodeAt(s);if(r===-1&&ic[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);r===-1&&(r=s);let a=i.slice(t,r);if(e.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);e.add(a),t=r=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let n=i.slice(t,s);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}_n.exports={parse:rc}});var An=T((eh,Nn)=>{"use strict";var sc=w("events"),Ai=w("http"),Jf=w("https"),Qf=w("net"),Zf=w("tls"),{createHash:nc}=w("crypto"),bn=vr(),qe=It(),oc=En(),ac=Cr(),{GUID:cc,kWebSocket:lc}=Te(),fc=/^[+/0-9A-Za-z]{22}==$/,xn=0,Cn=1,wn=2,Sr=class extends sc{constructor(e,t){if(super(),e=b({maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:ac},e),e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Ai.createServer((r,s)=>{let n=Ai.STATUS_CODES[426];s.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),s.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=hc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,n,o)=>{this.handleUpgrade(s,n,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=xn}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===wn){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Dt,this);return}if(e&&this.once("close",e),this._state!==Cn)if(this._state=Cn,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Dt,this):process.nextTick(Dt,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Dt(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",Sn);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){We(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){We(this,e,t,400,"Invalid Upgrade header");return}if(!n||!fc.test(n)){We(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){We(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){Mt(t,400);return}let a=e.headers["sec-websocket-protocol"],c=new Set;if(a!==void 0)try{c=oc.parse(a)}catch(h){We(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],f={};if(this.options.perMessageDeflate&&u!==void 0){let h=new qe(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let d=bn.parse(u);d[qe.extensionName]&&(h.accept(d[qe.extensionName]),f[qe.extensionName]=h)}catch(d){We(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(d,x,S,m)=>{if(!d)return Mt(t,x||401,S,m);this.completeUpgrade(f,n,c,e,t,r,s)});return}if(!this.options.verifyClient(h))return Mt(t,401)}this.completeUpgrade(f,n,c,e,t,r,s)}completeUpgrade(e,t,r,s,n,o,a){if(!n.readable||!n.writable)return n.destroy();if(n[lc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>xn)return Mt(n,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${nc("sha1").update(t+cc).digest("base64")}`],f=new this.options.WebSocket(null);if(r.size){let h=this.options.handleProtocols?this.options.handleProtocols(r,s):r.values().next().value;h&&(u.push(`Sec-WebSocket-Protocol: ${h}`),f._protocol=h)}if(e[qe.extensionName]){let h=e[qe.extensionName].params,d=bn.format({[qe.extensionName]:[h]});u.push(`Sec-WebSocket-Extensions: ${d}`),f._extensions=e}this.emit("headers",u,s),n.write(u.concat(`\r
|
|
3
|
+
`+n),i.push(s+"m+"+di.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Go()+e+" "+i[0]}function Go(){return q.inspectOpts.hideDate?"":new Date().toISOString()+" "}function zo(...i){return process.stderr.write(ui.formatWithOptions(q.inspectOpts,...i)+`
|
|
4
|
+
`)}function Ko(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Yo(){return process.env.DEBUG}function Xo(i){i.inspectOpts={};let e=Object.keys(q.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=q.inspectOpts[e[t]]}di.exports=zi()(q);var{formatters:hs}=di.exports;hs.o=function(i){return this.inspectOpts.colors=this.useColors,ui.inspect(i,this.inspectOpts).split(`
|
|
5
|
+
`).map(e=>e.trim()).join(" ")};hs.O=function(i){return this.inspectOpts.colors=this.useColors,ui.inspect(i,this.inspectOpts)}});var De=T((gf,Ji)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ji.exports=os():Ji.exports=us()});var xs=T((Sf,bs)=>{"use strict";var st=w("fs"),Es=w("url"),Zo=w("child_process").spawn;bs.exports=er;er.XMLHttpRequest=er;function er(i){"use strict";i=i||{};var e=this,t=w("http"),r=w("https"),s,n,o={},c=!1,a={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},u=Object.assign({},a),f=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","content-transfer-encoding","cookie","cookie2","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"],h=["TRACE","TRACK","CONNECT"],d=!1,x=!1,S=!1,m={};this.UNSENT=0,this.OPENED=1,this.HEADERS_RECEIVED=2,this.LOADING=3,this.DONE=4,this.readyState=this.UNSENT,this.onreadystatechange=null,this.responseText="",this.responseXML="",this.status=null,this.statusText=null;var v=function(p){return c||p&&f.indexOf(p.toLowerCase())===-1},N=function(p){return p&&h.indexOf(p)===-1};this.open=function(p,y,$,k,V){if(this.abort(),x=!1,S=!1,!N(p))throw new Error("SecurityError: Request method not allowed");o={method:p,url:y.toString(),async:typeof $!="boolean"?!0:$,user:k||null,password:V||null},A(this.OPENED)},this.setDisableHeaderCheck=function(p){c=p},this.setRequestHeader=function(p,y){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: setRequestHeader can only be called when state is OPEN");if(!v(p))return console.warn('Refused to set unsafe header "'+p+'"'),!1;if(d)throw new Error("INVALID_STATE_ERR: send flag is true");return u[p]=y,!0},this.getResponseHeader=function(p){return typeof p=="string"&&this.readyState>this.OPENED&&n.headers[p.toLowerCase()]&&!x?n.headers[p.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||x)return"";var p="";for(var y in n.headers)y!=="set-cookie"&&y!=="set-cookie2"&&(p+=y+": "+n.headers[y]+`\r
|
|
6
|
+
`);return p.substr(0,p.length-2)},this.getRequestHeader=function(p){return typeof p=="string"&&u[p]?u[p]:""},this.send=function(p){if(this.readyState!=this.OPENED)throw new Error("INVALID_STATE_ERR: connection must be opened before send() is called");if(d)throw new Error("INVALID_STATE_ERR: send has already been called");var y=!1,$=!1,k=Es.parse(o.url),V;switch(k.protocol){case"https:":y=!0;case"http:":V=k.hostname;break;case"file:":$=!0;break;case void 0:case"":V="localhost";break;default:throw new Error("Protocol not supported.")}if($){if(o.method!=="GET")throw new Error("XMLHttpRequest: Only GET method is supported");if(o.async)st.readFile(unescape(k.pathname),"utf8",function(re,Ge){re?e.handleError(re,re.errno||-1):(e.status=200,e.responseText=Ge,A(e.DONE))});else try{this.responseText=st.readFileSync(unescape(k.pathname),"utf8"),this.status=200,A(e.DONE)}catch(re){this.handleError(re,re.errno||-1)}return}var G=k.port||(y?443:80),de=k.pathname+(k.search?k.search:"");if(u.Host=V,y&&G===443||G===80||(u.Host+=":"+k.port),o.user){typeof o.password=="undefined"&&(o.password="");var Ht=new Buffer(o.user+":"+o.password);u.Authorization="Basic "+Ht.toString("base64")}o.method==="GET"||o.method==="HEAD"?p=null:p?(u["Content-Length"]=Buffer.isBuffer(p)?p.length:Buffer.byteLength(p),u["Content-Type"]||(u["Content-Type"]="text/plain;charset=UTF-8")):o.method==="POST"&&(u["Content-Length"]=0);var Gt=i.agent||!1,J={host:V,port:G,path:de,method:o.method,headers:u,agent:Gt};if(y&&(J.pfx=i.pfx,J.key=i.key,J.passphrase=i.passphrase,J.cert=i.cert,J.ca=i.ca,J.ciphers=i.ciphers,J.rejectUnauthorized=i.rejectUnauthorized!==!1),x=!1,o.async){var Fr=y?r.request:t.request;d=!0,e.dispatchEvent("readystatechange");var Br=function(re){if(n=re,n.statusCode===302||n.statusCode===303||n.statusCode===307){o.url=n.headers.location;var Ge=Es.parse(o.url);V=Ge.hostname;var Ce={hostname:Ge.hostname,port:Ge.port,path:Ge.path,method:n.statusCode===303?"GET":o.method,headers:u};y&&(Ce.pfx=i.pfx,Ce.key=i.key,Ce.passphrase=i.passphrase,Ce.cert=i.cert,Ce.ca=i.ca,Ce.ciphers=i.ciphers,Ce.rejectUnauthorized=i.rejectUnauthorized!==!1),s=Fr(Ce,Br).on("error",Ur),s.end();return}n&&n.setEncoding&&n.setEncoding("utf8"),A(e.HEADERS_RECEIVED),e.status=n.statusCode,n.on("data",function(zt){zt&&(e.responseText+=zt),d&&A(e.LOADING)}),n.on("end",function(){d&&(d=!1,A(e.DONE))}),n.on("error",function(zt){e.handleError(zt)})},Ur=function(re){e.handleError(re)};s=Fr(J,Br).on("error",Ur),i.autoUnref&&s.on("socket",re=>{re.unref()}),p&&s.write(p),s.end(),e.dispatchEvent("loadstart")}else{var dt=".node-xmlhttprequest-content-"+process.pid,pt=".node-xmlhttprequest-sync-"+process.pid;st.writeFileSync(pt,"","utf8");for(var io="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(y?"s":"")+".request;var options = "+JSON.stringify(J)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+dt+"', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');fs.unlinkSync('"+pt+"');});response.on('error', function(error) {fs.writeFileSync('"+dt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+pt+"');});}).on('error', function(error) {fs.writeFileSync('"+dt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+pt+"');});"+(p?"req.write('"+JSON.stringify(p).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",ro=Zo(process.argv[0],["-e",io]),Hc;st.existsSync(pt););if(e.responseText=st.readFileSync(dt,"utf8"),ro.stdin.end(),st.unlinkSync(dt),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var so=e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,"");e.handleError(so,503)}else e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1"),e.responseText=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"),A(e.DONE)}},this.handleError=function(p,y){this.status=y||0,this.statusText=p,this.responseText=p.stack,x=!0,A(this.DONE)},this.abort=function(){s&&(s.abort(),s=null),u=Object.assign({},a),this.responseText="",this.responseXML="",x=S=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||d)&&this.readyState!==this.DONE&&(d=!1,A(this.DONE)),this.readyState=this.UNSENT},this.addEventListener=function(p,y){p in m||(m[p]=[]),m[p].push(y)},this.removeEventListener=function(p,y){p in m&&(m[p]=m[p].filter(function($){return $!==y}))},this.dispatchEvent=function(p){if(typeof e["on"+p]=="function"&&(this.readyState===this.DONE?setImmediate(function(){e["on"+p]()}):e["on"+p]()),p in m)for(let y=0,$=m[p].length;y<$;y++)this.readyState===this.DONE?setImmediate(function(){m[p][y].call(e)}):m[p][y].call(e)};var A=function(p){if(!(e.readyState===p||e.readyState===e.UNSENT&&S)&&(e.readyState=p,(o.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let y;S?y="abort":x?y="error":y="load",e.dispatchEvent(y),e.dispatchEvent("loadend")}}}});var Rs=T((Lf,ks)=>{"use strict";var{Duplex:ra}=w("stream");function Ns(i){i.emit("close")}function sa(){!this.destroyed&&this._writableState.finished&&this.destroy()}function As(i){this.removeListener("error",As),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function na(i,e){let t=!0,r=new ra(O(b({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return i.on("message",function(n,o){let c=!o&&r._readableState.objectMode?n.toString():n;r.push(c)||i.pause()}),i.once("error",function(n){r.destroyed||(t=!1,r.destroy(n))}),i.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(s,n){if(i.readyState===i.CLOSED){n(s),process.nextTick(Ns,r);return}let o=!1;i.once("error",function(a){o=!0,n(a)}),i.once("close",function(){o||n(s),process.nextTick(Ns,r)}),t&&i.terminate()},r._final=function(s){if(i.readyState===i.CONNECTING){i.once("open",function(){r._final(s)});return}i._socket!==null&&(i._socket._writableState.finished?(s(),r._readableState.endEmitted&&r.destroy()):(i._socket.once("finish",function(){s()}),i.close()))},r._read=function(){i.isPaused&&i.resume()},r._write=function(s,n,o){if(i.readyState===i.CONNECTING){i.once("open",function(){r._write(s,n,o)});return}i.send(s,o)},r.on("end",sa),r.on("error",As),r}ks.exports=na});var Te=T((Bf,Ts)=>{"use strict";Ts.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var At=T((Uf,yi)=>{"use strict";var{EMPTY_BUFFER:oa}=Te();function aa(i,e){if(i.length===0)return oa;if(i.length===1)return i[0];let t=Buffer.allocUnsafe(e),r=0;for(let s=0;s<i.length;s++){let n=i[s];t.set(n,r),r+=n.length}return r<e?t.slice(0,r):t}function Os(i,e,t,r,s){for(let n=0;n<s;n++)t[r+n]=i[n]^e[n&3]}function Is(i,e){for(let t=0;t<i.length;t++)i[t]^=e[t&3]}function ca(i){return i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}function sr(i){if(sr.readOnly=!0,Buffer.isBuffer(i))return i;let e;return i instanceof ArrayBuffer?e=Buffer.from(i):ArrayBuffer.isView(i)?e=Buffer.from(i.buffer,i.byteOffset,i.byteLength):(e=Buffer.from(i),sr.readOnly=!1),e}yi.exports={concat:aa,mask:Os,toArrayBuffer:ca,toBuffer:sr,unmask:Is};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=w("bufferutil");yi.exports.mask=function(e,t,r,s,n){n<48?Os(e,t,r,s,n):i.mask(e,t,r,s,n)},yi.exports.unmask=function(e,t){e.length<32?Is(e,t):i.unmask(e,t)}}catch(i){}});var Fs=T((Df,Ls)=>{"use strict";var Ps=Symbol("kDone"),nr=Symbol("kRun"),or=class{constructor(e){this[Ps]=()=>{this.pending--,this[nr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[nr]()}[nr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Ps])}}};Ls.exports=or});var Tt=T((Mf,Ms)=>{"use strict";var kt=w("zlib"),Bs=At(),la=Fs(),{kStatusCode:Us}=Te(),fa=Buffer.from([0,0,255,255]),Ei=Symbol("permessage-deflate"),Ee=Symbol("total-length"),Rt=Symbol("callback"),Oe=Symbol("buffers"),_i=Symbol("error"),vi,ar=class{constructor(e,t,r){if(this._maxPayload=r|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!vi){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;vi=new la(s)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[Rt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let t=this._options,r=e.find(s=>!(t.serverNoContextTakeover===!1&&s.server_no_context_takeover||s.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>s.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!s.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(r.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?r.client_max_window_bits=t.clientMaxWindowBits:(r.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(r=>{let s=t[r];if(s.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(s=s[0],r==="client_max_window_bits"){if(s!==!0){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else if(r==="server_max_window_bits"){let n=+s;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${s}`);s=n}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(s!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${s}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=s})}),e}decompress(e,t,r){vi.add(s=>{this._decompress(e,t,(n,o)=>{s(),r(n,o)})})}compress(e,t,r){vi.add(s=>{this._compress(e,t,(n,o)=>{s(),r(n,o)})})}_decompress(e,t,r){let s=this._isServer?"client":"server";if(!this._inflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?kt.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=kt.createInflateRaw(O(b({},this._options.zlibInflateOptions),{windowBits:o})),this._inflate[Ei]=this,this._inflate[Ee]=0,this._inflate[Oe]=[],this._inflate.on("error",ua),this._inflate.on("data",Ds)}this._inflate[Rt]=r,this._inflate.write(e),t&&this._inflate.write(fa),this._inflate.flush(()=>{let n=this._inflate[_i];if(n){this._inflate.close(),this._inflate=null,r(n);return}let o=Bs.concat(this._inflate[Oe],this._inflate[Ee]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ee]=0,this._inflate[Oe]=[],t&&this.params[`${s}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let s=this._isServer?"server":"client";if(!this._deflate){let n=`${s}_max_window_bits`,o=typeof this.params[n]!="number"?kt.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=kt.createDeflateRaw(O(b({},this._options.zlibDeflateOptions),{windowBits:o})),this._deflate[Ee]=0,this._deflate[Oe]=[],this._deflate.on("data",ha)}this._deflate[Rt]=r,this._deflate.write(e),this._deflate.flush(kt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Bs.concat(this._deflate[Oe],this._deflate[Ee]);t&&(n=n.slice(0,n.length-4)),this._deflate[Rt]=null,this._deflate[Ee]=0,this._deflate[Oe]=[],t&&this.params[`${s}_no_context_takeover`]&&this._deflate.reset(),r(null,n)})}};Ms.exports=ar;function ha(i){this[Oe].push(i),this[Ee]+=i.length}function Ds(i){if(this[Ee]+=i.length,this[Ei]._maxPayload<1||this[Ee]<=this[Ei]._maxPayload){this[Oe].push(i);return}this[_i]=new RangeError("Max payload size exceeded"),this[_i].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[_i][Us]=1009,this.removeListener("data",Ds),this.reset()}function ua(i){this[Ei]._inflate=null,i[Us]=1007,this[Rt](i)}});var Ot=T((Wf,cr)=>{"use strict";var da=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function pa(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function qs(i){let e=i.length,t=0;for(;t<e;)if(!(i[t]&128))t++;else if((i[t]&224)===192){if(t+1===e||(i[t+1]&192)!==128||(i[t]&254)===192)return!1;t+=2}else if((i[t]&240)===224){if(t+2>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||i[t]===224&&(i[t+1]&224)===128||i[t]===237&&(i[t+1]&224)===160)return!1;t+=3}else if((i[t]&248)===240){if(t+3>=e||(i[t+1]&192)!==128||(i[t+2]&192)!==128||(i[t+3]&192)!==128||i[t]===240&&(i[t+1]&240)===128||i[t]===244&&i[t+1]>143||i[t]>244)return!1;t+=4}else return!1;return!0}cr.exports={isValidStatusCode:pa,isValidUTF8:qs,tokenChars:da};if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=w("utf-8-validate");cr.exports.isValidUTF8=function(e){return e.length<150?qs(e):i(e)}}catch(i){}});var ur=T(($f,zs)=>{"use strict";var{Writable:ma}=w("stream"),Ws=Tt(),{BINARY_TYPES:ga,EMPTY_BUFFER:$s,kStatusCode:ya,kWebSocket:va}=Te(),{concat:lr,toArrayBuffer:_a,unmask:Ea}=At(),{isValidStatusCode:ba,isValidUTF8:Vs}=Ot(),It=0,js=1,Hs=2,Gs=3,fr=4,xa=5,hr=class extends ma{constructor(e={}){super(),this._binaryType=e.binaryType||ga[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[va]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=It,this._loop=!1}_write(e,t,r){if(this._opcode===8&&this._state==It)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=r.slice(e),r.slice(0,e)}let t=Buffer.allocUnsafe(e);do{let r=this._buffers[0],s=t.length-e;e>=r.length?t.set(this._buffers.shift(),s):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),s),this._buffers[0]=r.slice(e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do switch(this._state){case It:t=this.getInfo();break;case js:t=this.getPayloadLength16();break;case Hs:t=this.getPayloadLength64();break;case Gs:this.getMask();break;case fr:t=this.getData(e);break;default:this._loop=!1;return}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48)return this._loop=!1,B(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");let t=(e[0]&64)===64;if(t&&!this._extensions[Ws.extensionName])return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,B(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,B(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,B(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125)return this._loop=!1,B(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}else return this._loop=!1,B(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked)return this._loop=!1,B(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,B(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(this._payloadLength===126)this._state=js;else if(this._payloadLength===127)this._state=Hs;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,B(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=Gs:this._state=fr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=fr}getData(e){let t=$s;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&Ea(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=xa,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[Ws.extensionName].decompress(e,this._fin,(s,n)=>{if(s)return t(s);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(B(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}let o=this.dataMessage();if(o)return t(o);this.startLoop(t)})}dataMessage(){if(this._fin){let e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=lr(t,e):this._binaryType==="arraybuffer"?r=_a(lr(t,e)):r=t,this.emit("message",r,!0)}else{let r=lr(t,e);if(!this._skipUTF8Validation&&!Vs(r))return this._loop=!1,B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=It}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,$s),this.end();else{if(e.length===1)return B(RangeError,"invalid payload length 1",!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");{let t=e.readUInt16BE(0);if(!ba(t))return B(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let r=e.slice(2);if(!this._skipUTF8Validation&&!Vs(r))return B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}}else this._opcode===9?this.emit("ping",e):this.emit("pong",e);this._state=It}};zs.exports=hr;function B(i,e,t,r,s){let n=new i(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,B),n.code=s,n[ya]=r,n}});var pr=T((Hf,Xs)=>{"use strict";var Vf=w("net"),jf=w("tls"),{randomFillSync:Ca}=w("crypto"),Ks=Tt(),{EMPTY_BUFFER:Sa}=Te(),{isValidStatusCode:wa}=Ot(),{mask:Ys,toBuffer:nt}=At(),he=Symbol("kByteLength"),Na=Buffer.alloc(4),dr=class i{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let r,s=!1,n=2,o=!1;t.mask&&(r=t.maskBuffer||Na,t.generateMask?t.generateMask(r):Ca(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let c;typeof e=="string"?(!t.mask||o)&&t[he]!==void 0?c=t[he]:(e=Buffer.from(e),c=e.length):(c=e.length,s=t.mask&&t.readOnly&&!o);let a=c;c>=65536?(n+=8,a=127):c>125&&(n+=2,a=126);let u=Buffer.allocUnsafe(s?c+n:n);return u[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(u[0]|=64),u[1]=a,a===126?u.writeUInt16BE(c,2):a===127&&(u[2]=u[3]=0,u.writeUIntBE(c,4,6)),t.mask?(u[1]|=128,u[n-4]=r[0],u[n-3]=r[1],u[n-2]=r[2],u[n-1]=r[3],o?[u,e]:s?(Ys(e,r,u,n,c),[u]):(Ys(e,r,e,0,c),[u,e])):[u,e]}close(e,t,r,s){let n;if(e===void 0)n=Sa;else{if(typeof e!="number"||!wa(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{let c=Buffer.byteLength(t);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+c),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}let o={[he]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,s]):this.sendFrame(i.frame(n,o),s)}ping(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=nt(e),s=e.length,n=nt.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}pong(e,t,r){let s,n;if(typeof e=="string"?(s=Buffer.byteLength(e),n=!1):(e=nt(e),s=e.length,n=nt.readOnly),s>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:s,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}send(e,t,r){let s=this._extensions[Ks.extensionName],n=t.binary?2:1,o=t.compress,c,a;if(typeof e=="string"?(c=Buffer.byteLength(e),a=!1):(e=nt(e),c=e.length,a=nt.readOnly),this._firstFragment?(this._firstFragment=!1,o&&s&&s.params[s._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=c>=s._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),s){let u={[he]:c,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:a,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,u,r]):this.dispatch(e,this._compress,u,r)}else this.sendFrame(i.frame(e,{[he]:c,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:a,rsv1:!1}),r)}dispatch(e,t,r,s){if(!t){this.sendFrame(i.frame(e,r),s);return}let n=this._extensions[Ks.extensionName];this._bufferedBytes+=r[he],this._deflating=!0,n.compress(e,r.fin,(o,c)=>{if(this._socket.destroyed){let a=new Error("The socket was closed while data was being compressed");typeof s=="function"&&s(a);for(let u=0;u<this._queue.length;u++){let f=this._queue[u],h=f[f.length-1];typeof h=="function"&&h(a)}return}this._bufferedBytes-=r[he],this._deflating=!1,r.readOnly=!1,this.sendFrame(i.frame(c,r),s),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};Xs.exports=dr});var on=T((Gf,nn)=>{"use strict";var{kForOnEventAttribute:Pt,kListener:mr}=Te(),Js=Symbol("kCode"),Qs=Symbol("kData"),Zs=Symbol("kError"),en=Symbol("kMessage"),tn=Symbol("kReason"),ot=Symbol("kTarget"),rn=Symbol("kType"),sn=Symbol("kWasClean"),be=class{constructor(e){this[ot]=null,this[rn]=e}get target(){return this[ot]}get type(){return this[rn]}};Object.defineProperty(be.prototype,"target",{enumerable:!0});Object.defineProperty(be.prototype,"type",{enumerable:!0});var Me=class extends be{constructor(e,t={}){super(e),this[Js]=t.code===void 0?0:t.code,this[tn]=t.reason===void 0?"":t.reason,this[sn]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[Js]}get reason(){return this[tn]}get wasClean(){return this[sn]}};Object.defineProperty(Me.prototype,"code",{enumerable:!0});Object.defineProperty(Me.prototype,"reason",{enumerable:!0});Object.defineProperty(Me.prototype,"wasClean",{enumerable:!0});var at=class extends be{constructor(e,t={}){super(e),this[Zs]=t.error===void 0?null:t.error,this[en]=t.message===void 0?"":t.message}get error(){return this[Zs]}get message(){return this[en]}};Object.defineProperty(at.prototype,"error",{enumerable:!0});Object.defineProperty(at.prototype,"message",{enumerable:!0});var Lt=class extends be{constructor(e,t={}){super(e),this[Qs]=t.data===void 0?null:t.data}get data(){return this[Qs]}};Object.defineProperty(Lt.prototype,"data",{enumerable:!0});var Aa={addEventListener(i,e,t={}){for(let s of this.listeners(i))if(!t[Pt]&&s[mr]===e&&!s[Pt])return;let r;if(i==="message")r=function(n,o){let c=new Lt("message",{data:o?n:n.toString()});c[ot]=this,bi(e,this,c)};else if(i==="close")r=function(n,o){let c=new Me("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[ot]=this,bi(e,this,c)};else if(i==="error")r=function(n){let o=new at("error",{error:n,message:n.message});o[ot]=this,bi(e,this,o)};else if(i==="open")r=function(){let n=new be("open");n[ot]=this,bi(e,this,n)};else return;r[Pt]=!!t[Pt],r[mr]=e,t.once?this.once(i,r):this.on(i,r)},removeEventListener(i,e){for(let t of this.listeners(i))if(t[mr]===e&&!t[Pt]){this.removeListener(i,t);break}}};nn.exports={CloseEvent:Me,ErrorEvent:at,Event:be,EventTarget:Aa,MessageEvent:Lt};function bi(i,e,t){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,t):i.call(e,t)}});var gr=T((zf,an)=>{"use strict";var{tokenChars:Ft}=Ot();function me(i,e,t){i[e]===void 0?i[e]=[t]:i[e].push(t)}function ka(i){let e=Object.create(null),t=Object.create(null),r=!1,s=!1,n=!1,o,c,a=-1,u=-1,f=-1,h=0;for(;h<i.length;h++)if(u=i.charCodeAt(h),o===void 0)if(f===-1&&Ft[u]===1)a===-1&&(a=h);else if(h!==0&&(u===32||u===9))f===-1&&a!==-1&&(f=h);else if(u===59||u===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1&&(f=h);let x=i.slice(a,f);u===44?(me(e,x,t),t=Object.create(null)):o=x,a=f=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(c===void 0)if(f===-1&&Ft[u]===1)a===-1&&(a=h);else if(u===32||u===9)f===-1&&a!==-1&&(f=h);else if(u===59||u===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1&&(f=h),me(t,i.slice(a,f),!0),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),a=f=-1}else if(u===61&&a!==-1&&f===-1)c=i.slice(a,h),a=f=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(s){if(Ft[u]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);a===-1?a=h:r||(r=!0),s=!1}else if(n)if(Ft[u]===1)a===-1&&(a=h);else if(u===34&&a!==-1)n=!1,f=h;else if(u===92)s=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(u===34&&i.charCodeAt(h-1)===61)n=!0;else if(f===-1&&Ft[u]===1)a===-1&&(a=h);else if(a!==-1&&(u===32||u===9))f===-1&&(f=h);else if(u===59||u===44){if(a===-1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1&&(f=h);let x=i.slice(a,f);r&&(x=x.replace(/\\/g,""),r=!1),me(t,c,x),u===44&&(me(e,o,t),t=Object.create(null),o=void 0),c=void 0,a=f=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(a===-1||n||u===32||u===9)throw new SyntaxError("Unexpected end of input");f===-1&&(f=h);let d=i.slice(a,f);return o===void 0?me(e,d,t):(c===void 0?me(t,d,!0):r?me(t,c,d.replace(/\\/g,"")):me(t,c,d),me(e,o,t)),e}function Ra(i){return Object.keys(i).map(e=>{let t=i[e];return Array.isArray(t)||(t=[t]),t.map(r=>[e].concat(Object.keys(r).map(s=>{let n=r[s];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?s:`${s}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}an.exports={format:Ra,parse:ka}});var br=T((Yf,vn)=>{"use strict";var Ta=w("events"),Oa=w("https"),Ia=w("http"),fn=w("net"),Pa=w("tls"),{randomBytes:La,createHash:Fa}=w("crypto"),{Readable:Kf}=w("stream"),{URL:yr}=w("url"),Ie=Tt(),Ba=ur(),Ua=pr(),{BINARY_TYPES:cn,EMPTY_BUFFER:xi,GUID:Da,kForOnEventAttribute:vr,kListener:Ma,kStatusCode:qa,kWebSocket:K,NOOP:hn}=Te(),{EventTarget:{addEventListener:Wa,removeEventListener:$a}}=on(),{format:Va,parse:ja}=gr(),{toBuffer:Ha}=At(),Ga=30*1e3,un=Symbol("kAborted"),_r=[8,13],xe=["CONNECTING","OPEN","CLOSING","CLOSED"],za=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,L=class i extends Ta{constructor(e,t,r){super(),this._binaryType=cn[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=xi,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=i.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(r=t,t=[]):t=[t]),dn(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){cn.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){let s=new Ba({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new Ua(e,this._extensions,r.generateMask),this._receiver=s,this._socket=e,s[K]=this,e[K]=this,s.on("conclude",Xa),s.on("drain",Ja),s.on("error",Qa),s.on("message",Za),s.on("ping",ec),s.on("pong",tc),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",mn),e.on("data",Si),e.on("end",gn),e.on("error",yn),this._readyState=i.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ie.extensionName]&&this._extensions[Ie.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=i.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Z(this,this._req,"WebSocket was closed before the connection was established");if(this.readyState===i.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=i.CLOSING,this._sender.close(e,t,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Ga)}}pause(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){Er(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||xi,t,r)}pong(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){Er(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||xi,t,r)}resume(){this.readyState===i.CONNECTING||this.readyState===i.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===i.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(r=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==i.OPEN){Er(this,e,r);return}let s=b({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},t);this._extensions[Ie.extensionName]||(s.compress=!1),this._sender.send(e||xi,s,r)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return Z(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(L,"CONNECTING",{enumerable:!0,value:xe.indexOf("CONNECTING")});Object.defineProperty(L.prototype,"CONNECTING",{enumerable:!0,value:xe.indexOf("CONNECTING")});Object.defineProperty(L,"OPEN",{enumerable:!0,value:xe.indexOf("OPEN")});Object.defineProperty(L.prototype,"OPEN",{enumerable:!0,value:xe.indexOf("OPEN")});Object.defineProperty(L,"CLOSING",{enumerable:!0,value:xe.indexOf("CLOSING")});Object.defineProperty(L.prototype,"CLOSING",{enumerable:!0,value:xe.indexOf("CLOSING")});Object.defineProperty(L,"CLOSED",{enumerable:!0,value:xe.indexOf("CLOSED")});Object.defineProperty(L.prototype,"CLOSED",{enumerable:!0,value:xe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(L.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(L.prototype,`on${i}`,{enumerable:!0,get(){for(let e of this.listeners(i))if(e[vr])return e[Ma];return null},set(e){for(let t of this.listeners(i))if(t[vr]){this.removeListener(i,t);break}typeof e=="function"&&this.addEventListener(i,e,{[vr]:!0})}})});L.prototype.addEventListener=Wa;L.prototype.removeEventListener=$a;vn.exports=L;function dn(i,e,t,r){let s=O(b({protocolVersion:_r[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10},r),{createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0});if(!_r.includes(s.protocolVersion))throw new RangeError(`Unsupported protocol version: ${s.protocolVersion} (supported versions: ${_r.join(", ")})`);let n;if(e instanceof yr)n=e,i._url=e.href;else{try{n=new yr(e)}catch(m){throw new SyntaxError(`Invalid URL: ${e}`)}i._url=e}let o=n.protocol==="wss:",c=n.protocol==="ws+unix:",a;if(n.protocol!=="ws:"&&!o&&!c?a=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:c&&!n.pathname?a="The URL's pathname is empty":n.hash&&(a="The URL contains a fragment identifier"),a){let m=new SyntaxError(a);if(i._redirects===0)throw m;Ci(i,m);return}let u=o?443:80,f=La(16).toString("base64"),h=o?Oa.request:Ia.request,d=new Set,x;if(s.createConnection=o?Ya:Ka,s.defaultPort=s.defaultPort||u,s.port=n.port||u,s.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,s.headers=O(b({},s.headers),{"Sec-WebSocket-Version":s.protocolVersion,"Sec-WebSocket-Key":f,Connection:"Upgrade",Upgrade:"websocket"}),s.path=n.pathname+n.search,s.timeout=s.handshakeTimeout,s.perMessageDeflate&&(x=new Ie(s.perMessageDeflate!==!0?s.perMessageDeflate:{},!1,s.maxPayload),s.headers["Sec-WebSocket-Extensions"]=Va({[Ie.extensionName]:x.offer()})),t.length){for(let m of t){if(typeof m!="string"||!za.test(m)||d.has(m))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(m)}s.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(s.origin&&(s.protocolVersion<13?s.headers["Sec-WebSocket-Origin"]=s.origin:s.headers.Origin=s.origin),(n.username||n.password)&&(s.auth=`${n.username}:${n.password}`),c){let m=s.path.split(":");s.socketPath=m[0],s.path=m[1]}let S;if(s.followRedirects){if(i._redirects===0){i._originalIpc=c,i._originalSecure=o,i._originalHostOrSocketPath=c?s.socketPath:n.host;let m=r&&r.headers;if(r=O(b({},r),{headers:{}}),m)for(let[v,N]of Object.entries(m))r.headers[v.toLowerCase()]=N}else if(i.listenerCount("redirect")===0){let m=c?i._originalIpc?s.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:n.host===i._originalHostOrSocketPath;(!m||i._originalSecure&&!o)&&(delete s.headers.authorization,delete s.headers.cookie,m||delete s.headers.host,s.auth=void 0)}s.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(s.auth).toString("base64")),S=i._req=h(s),i._redirects&&i.emit("redirect",i.url,S)}else S=i._req=h(s);s.timeout&&S.on("timeout",()=>{Z(i,S,"Opening handshake has timed out")}),S.on("error",m=>{S===null||S[un]||(S=i._req=null,Ci(i,m))}),S.on("response",m=>{let v=m.headers.location,N=m.statusCode;if(v&&s.followRedirects&&N>=300&&N<400){if(++i._redirects>s.maxRedirects){Z(i,S,"Maximum redirects exceeded");return}S.abort();let A;try{A=new yr(v,e)}catch(p){let y=new SyntaxError(`Invalid URL: ${v}`);Ci(i,y);return}dn(i,A,t,r)}else i.emit("unexpected-response",S,m)||Z(i,S,`Unexpected server response: ${m.statusCode}`)}),S.on("upgrade",(m,v,N)=>{if(i.emit("upgrade",m),i.readyState!==L.CONNECTING)return;if(S=i._req=null,m.headers.upgrade.toLowerCase()!=="websocket"){Z(i,v,"Invalid Upgrade header");return}let A=Fa("sha1").update(f+Da).digest("base64");if(m.headers["sec-websocket-accept"]!==A){Z(i,v,"Invalid Sec-WebSocket-Accept header");return}let p=m.headers["sec-websocket-protocol"],y;if(p!==void 0?d.size?d.has(p)||(y="Server sent an invalid subprotocol"):y="Server sent a subprotocol but none was requested":d.size&&(y="Server sent no subprotocol"),y){Z(i,v,y);return}p&&(i._protocol=p);let $=m.headers["sec-websocket-extensions"];if($!==void 0){if(!x){Z(i,v,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let k;try{k=ja($)}catch(G){Z(i,v,"Invalid Sec-WebSocket-Extensions header");return}let V=Object.keys(k);if(V.length!==1||V[0]!==Ie.extensionName){Z(i,v,"Server indicated an extension that was not requested");return}try{x.accept(k[Ie.extensionName])}catch(G){Z(i,v,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[Ie.extensionName]=x}i.setSocket(v,N,{generateMask:s.generateMask,maxPayload:s.maxPayload,skipUTF8Validation:s.skipUTF8Validation})}),S.end()}function Ci(i,e){i._readyState=L.CLOSING,i.emit("error",e),i.emitClose()}function Ka(i){return i.path=i.socketPath,fn.connect(i)}function Ya(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=fn.isIP(i.host)?"":i.host),Pa.connect(i)}function Z(i,e,t){i._readyState=L.CLOSING;let r=new Error(t);Error.captureStackTrace(r,Z),e.setHeader?(e[un]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Ci,i,r)):(e.destroy(r),e.once("error",i.emit.bind(i,"error")),e.once("close",i.emitClose.bind(i)))}function Er(i,e,t){if(e){let r=Ha(e).length;i._socket?i._sender._bufferedBytes+=r:i._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${i.readyState} (${xe[i.readyState]})`);t(r)}}function Xa(i,e){let t=this[K];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=i,t._socket[K]!==void 0&&(t._socket.removeListener("data",Si),process.nextTick(pn,t._socket),i===1005?t.close():t.close(i,e))}function Ja(){let i=this[K];i.isPaused||i._socket.resume()}function Qa(i){let e=this[K];e._socket[K]!==void 0&&(e._socket.removeListener("data",Si),process.nextTick(pn,e._socket),e.close(i[qa])),e.emit("error",i)}function ln(){this[K].emitClose()}function Za(i,e){this[K].emit("message",i,e)}function ec(i){let e=this[K];e.pong(i,!e._isServer,hn),e.emit("ping",i)}function tc(i){this[K].emit("pong",i)}function pn(i){i.resume()}function mn(){let i=this[K];this.removeListener("close",mn),this.removeListener("data",Si),this.removeListener("end",gn),i._readyState=L.CLOSING;let e;!this._readableState.endEmitted&&!i._closeFrameReceived&&!i._receiver._writableState.errorEmitted&&(e=i._socket.read())!==null&&i._receiver.write(e),i._receiver.end(),this[K]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",ln),i._receiver.on("finish",ln))}function Si(i){this[K]._receiver.write(i)||this.pause()}function gn(){let i=this[K];i._readyState=L.CLOSING,i._receiver.end(),this.end()}function yn(){let i=this[K];this.removeListener("error",yn),this.on("error",hn),i&&(i._readyState=L.CLOSING,this.destroy())}});var En=T((Jf,_n)=>{"use strict";var{tokenChars:ic}=Ot();function rc(i){let e=new Set,t=-1,r=-1,s=0;for(s;s<i.length;s++){let o=i.charCodeAt(s);if(r===-1&&ic[o]===1)t===-1&&(t=s);else if(s!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=s);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${s}`);r===-1&&(r=s);let c=i.slice(t,r);if(e.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);e.add(c),t=r=-1}else throw new SyntaxError(`Unexpected character at index ${s}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let n=i.slice(t,s);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}_n.exports={parse:rc}});var An=T((th,Nn)=>{"use strict";var sc=w("events"),wi=w("http"),Qf=w("https"),Zf=w("net"),eh=w("tls"),{createHash:nc}=w("crypto"),bn=gr(),qe=Tt(),oc=En(),ac=br(),{GUID:cc,kWebSocket:lc}=Te(),fc=/^[+/0-9A-Za-z]{22}==$/,xn=0,Cn=1,wn=2,xr=class extends sc{constructor(e,t){if(super(),e=b({maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:ac},e),e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=wi.createServer((r,s)=>{let n=wi.STATUS_CODES[426];s.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),s.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=hc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(s,n,o)=>{this.handleUpgrade(s,n,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=xn}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===wn){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Bt,this);return}if(e&&this.once("close",e),this._state!==Cn)if(this._state=Cn,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Bt,this):process.nextTick(Bt,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Bt(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,s){t.on("error",Sn);let n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){We(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){We(this,e,t,400,"Invalid Upgrade header");return}if(!n||!fc.test(n)){We(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){We(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){Ut(t,400);return}let c=e.headers["sec-websocket-protocol"],a=new Set;if(c!==void 0)try{a=oc.parse(c)}catch(h){We(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],f={};if(this.options.perMessageDeflate&&u!==void 0){let h=new qe(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let d=bn.parse(u);d[qe.extensionName]&&(h.accept(d[qe.extensionName]),f[qe.extensionName]=h)}catch(d){We(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(d,x,S,m)=>{if(!d)return Ut(t,x||401,S,m);this.completeUpgrade(f,n,a,e,t,r,s)});return}if(!this.options.verifyClient(h))return Ut(t,401)}this.completeUpgrade(f,n,a,e,t,r,s)}completeUpgrade(e,t,r,s,n,o,c){if(!n.readable||!n.writable)return n.destroy();if(n[lc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>xn)return Ut(n,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${nc("sha1").update(t+cc).digest("base64")}`],f=new this.options.WebSocket(null);if(r.size){let h=this.options.handleProtocols?this.options.handleProtocols(r,s):r.values().next().value;h&&(u.push(`Sec-WebSocket-Protocol: ${h}`),f._protocol=h)}if(e[qe.extensionName]){let h=e[qe.extensionName].params,d=bn.format({[qe.extensionName]:[h]});u.push(`Sec-WebSocket-Extensions: ${d}`),f._extensions=e}this.emit("headers",u,s),n.write(u.concat(`\r
|
|
7
7
|
`).join(`\r
|
|
8
|
-
`)),n.removeListener("error",Sn),f.setSocket(n,o,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(f),f.on("close",()=>{this.clients.delete(f),this._shouldEmitClose&&!this.clients.size&&process.nextTick(
|
|
8
|
+
`)),n.removeListener("error",Sn),f.setSocket(n,o,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(f),f.on("close",()=>{this.clients.delete(f),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Bt,this)})),c(f,s)}};Nn.exports=xr;function hc(i,e){for(let t of Object.keys(e))i.on(t,e[t]);return function(){for(let r of Object.keys(e))i.removeListener(r,e[r])}}function Bt(i){i._state=wn,i.emit("close")}function Sn(){this.destroy()}function Ut(i,e,t,r){t=t||wi.STATUS_CODES[e],r=b({Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t)},r),i.once("finish",i.destroy),i.end(`HTTP/1.1 ${e} ${wi.STATUS_CODES[e]}\r
|
|
9
9
|
`+Object.keys(r).map(s=>`${s}: ${r[s]}`).join(`\r
|
|
10
10
|
`)+`\r
|
|
11
11
|
\r
|
|
12
|
-
`+t)}function We(i,e,t,r,s){if(i.listenerCount("wsClientError")){let n=new Error(s);Error.captureStackTrace(n,We),i.emit("wsClientError",n,t,e)}else
|
|
12
|
+
`+t)}function We(i,e,t,r,s){if(i.listenerCount("wsClientError")){let n=new Error(s);Error.captureStackTrace(n,We),i.emit("wsClientError",n,t,e)}else Ut(t,r,s)}});var Sr=T((Uh,Fn)=>{"use strict";function bc(i){t.debug=t,t.default=t,t.coerce=a,t.disable=n,t.enable=s,t.enabled=o,t.humanize=Gi(),t.destroy=u,Object.keys(i).forEach(f=>{t[f]=i[f]}),t.names=[],t.skips=[],t.formatters={};function e(f){let h=0;for(let d=0;d<f.length;d++)h=(h<<5)-h+f.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(f){let h,d=null,x,S;function m(...v){if(!m.enabled)return;let N=m,A=Number(new Date),p=A-(h||A);N.diff=p,N.prev=h,N.curr=A,h=A,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let y=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(k,V)=>{if(k==="%%")return"%";y++;let G=t.formatters[V];if(typeof G=="function"){let de=v[y];k=G.call(N,de),v.splice(y,1),y--}return k}),t.formatArgs.call(N,v),(N.log||t.log).apply(N,v)}return m.namespace=f,m.useColors=t.useColors(),m.color=t.selectColor(f),m.extend=r,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(x!==t.namespaces&&(x=t.namespaces,S=t.enabled(f)),S),set:v=>{d=v}}),typeof t.init=="function"&&t.init(m),m}function r(f,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+f);return d.log=this.log,d}function s(f){t.save(f),t.namespaces=f,t.names=[],t.skips=[];let h,d=(typeof f=="string"?f:"").split(/[\s,]+/),x=d.length;for(h=0;h<x;h++)d[h]&&(f=d[h].replace(/\*/g,".*?"),f[0]==="-"?t.skips.push(new RegExp("^"+f.slice(1)+"$")):t.names.push(new RegExp("^"+f+"$")))}function n(){let f=[...t.names.map(c),...t.skips.map(c).map(h=>"-"+h)].join(",");return t.enable(""),f}function o(f){if(f[f.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(f))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(f))return!0;return!1}function c(f){return f.toString().substring(2,f.toString().length-2).replace(/\.\*\?$/,"*")}function a(f){return f instanceof Error?f.stack||f.message:f}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}Fn.exports=bc});var Bn=T((ee,Ri)=>{"use strict";ee.formatArgs=Cc;ee.save=Sc;ee.load=wc;ee.useColors=xc;ee.storage=Nc();ee.destroy=(()=>{let i=!1;return()=>{i||(i=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();ee.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function xc(){return typeof window!="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Cc(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+Ri.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;i.splice(1,0,e,"color: inherit");let t=0,r=0;i[0].replace(/%[a-zA-Z%]/g,s=>{s!=="%%"&&(t++,s==="%c"&&(r=t))}),i.splice(r,0,e)}ee.log=console.debug||console.log||(()=>{});function Sc(i){try{i?ee.storage.setItem("debug",i):ee.storage.removeItem("debug")}catch(e){}}function wc(){let i;try{i=ee.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Nc(){try{return localStorage}catch(i){}}Ri.exports=Sr()(ee);var{formatters:Ac}=Ri.exports;Ac.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Dn=T((W,Oi)=>{"use strict";var kc=w("tty"),Ti=w("util");W.init=Fc;W.log=Ic;W.formatArgs=Tc;W.save=Pc;W.load=Lc;W.useColors=Rc;W.destroy=Ti.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");W.colors=[6,2,3,4,5,1];try{let i=Xi();i&&(i.stderr||i).level>=2&&(W.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(i){}W.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(s,n)=>n.toUpperCase()),r=process.env[e];return/^(yes|on|true|enabled)$/i.test(r)?r=!0:/^(no|off|false|disabled)$/i.test(r)?r=!1:r==="null"?r=null:r=Number(r),i[t]=r,i},{});function Rc(){return"colors"in W.inspectOpts?!!W.inspectOpts.colors:kc.isatty(process.stderr.fd)}function Tc(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,s="\x1B[3"+(r<8?r:"8;5;"+r),n=` ${s};1m${e} \x1B[0m`;i[0]=n+i[0].split(`
|
|
13
13
|
`).join(`
|
|
14
|
-
`+n),i.push(s+"m+"+
|
|
15
|
-
`)}function Pc(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Lc(){return process.env.DEBUG}function Fc(i){i.inspectOpts={};let e=Object.keys(W.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=W.inspectOpts[e[t]]}
|
|
16
|
-
`).map(e=>e.trim()).join(" ")};Un.O=function(i){return this.inspectOpts.colors=this.useColors,Ii.inspect(i,this.inspectOpts)}});var $t=T((Uh,Ar)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ar.exports=Bn():Ar.exports=Dn()});var po="v1",mo="https://api.novu.co",go=`${PACKAGE_NAME}@${PACKAGE_VERSION}`,Qt=class{constructor(e={}){let{apiVersion:t=po,apiUrl:r=mo,userAgent:s=go}=e||{};this.apiVersion=t,this.apiUrl=`${r}/${this.apiVersion}`,this.headers={"Novu-API-Version":NOVU_API_VERSION,"Content-Type":"application/json","User-Agent":s}}setAuthorizationToken(e){this.headers.Authorization=`Bearer ${e}`}setHeaders(e){this.headers=b(b({},this.headers),e)}get(e,t,r=!0){return g(this,null,function*(){return this.doFetch({path:e,searchParams:t,options:{method:"GET"},unwrapEnvelope:r})})}post(e,t){return g(this,null,function*(){return this.doFetch({path:e,options:{method:"POST",body:t}})})}patch(e,t){return g(this,null,function*(){return this.doFetch({path:e,options:{method:"PATCH",body:t}})})}delete(e,t){return g(this,null,function*(){return this.doFetch({path:e,options:{method:"DELETE",body:t}})})}doFetch(n){return g(this,arguments,function*({path:e,searchParams:t,options:r,unwrapEnvelope:s=!0}){let o=yo(this.apiUrl,e,t?`?${t.toString()}`:""),a={method:(r==null?void 0:r.method)||"GET",headers:b(b({},this.headers),(r==null?void 0:r.headers)||{}),body:r!=null&&r.body?JSON.stringify(r.body):void 0},c=yield fetch(o,a);if(!c.ok){let f=yield c.json();throw new Error(`${this.headers["User-Agent"]} error. Status: ${c.status}, Message: ${f.message}`)}if(c.status===204)return;let u=yield c.json();return s?u.data:u})}};function yo(...i){return i.reduce((e,t)=>(t&&e.push(t.replace(new RegExp("(?<!https?:)\\/+","g"),"/").replace(/^\/+|\/+$/g,"")),e),[]).join("/").replace(/\/\?/,"?")}var yt="/inbox",ae=`${yt}/notifications`,F,Zt=class{constructor(e={}){this.isSessionInitialized=!1;_(this,F);E(this,F,new Qt(e))}initializeSession(s){return g(this,arguments,function*({applicationIdentifier:e,subscriberId:t,subscriberHash:r}){let n=yield l(this,F).post(`${yt}/session`,{applicationIdentifier:e,subscriberId:t,subscriberHash:r});return l(this,F).setAuthorizationToken(n.token),this.isSessionInitialized=!0,n})}fetchNotifications({after:e,archived:t,limit:r=10,offset:s,read:n,tags:o}){let a=new URLSearchParams(`limit=${r}`);return e&&a.append("after",e),s&&a.append("offset",`${s}`),o&&o.forEach(c=>a.append("tags[]",c)),n!==void 0&&a.append("read",`${n}`),t!==void 0&&a.append("archived",`${t}`),l(this,F).get(ae,a,!1)}count({filters:e}){return l(this,F).get(`${ae}/count`,new URLSearchParams({filters:JSON.stringify(e)}),!1)}read(e){return l(this,F).patch(`${ae}/${e}/read`)}unread(e){return l(this,F).patch(`${ae}/${e}/unread`)}archive(e){return l(this,F).patch(`${ae}/${e}/archive`)}unarchive(e){return l(this,F).patch(`${ae}/${e}/unarchive`)}readAll({tags:e}){return l(this,F).post(`${ae}/read`,{tags:e})}archiveAll({tags:e}){return l(this,F).post(`${ae}/archive`,{tags:e})}archiveAllRead({tags:e}){return l(this,F).post(`${ae}/read-archive`,{tags:e})}completeAction({actionType:e,notificationId:t}){return l(this,F).patch(`${ae}/${t}/complete`,{actionType:e})}revertAction({actionType:e,notificationId:t}){return l(this,F).patch(`${ae}/${t}/revert`,{actionType:e})}fetchPreferences(e){let t=new URLSearchParams;e&&e.forEach(s=>t.append("tags[]",s));let r=t.size?`?${t.toString()}`:"";return l(this,F).get(`${yt}/preferences${r}`)}updateGlobalPreferences(e){return l(this,F).patch(`${yt}/preferences`,e)}updateWorkflowPreferences({workflowId:e,channels:t}){return l(this,F).patch(`${yt}/preferences/${e}`,t)}};F=new WeakMap;function $r(i){return{all:i=i||new Map,on:function(e,t){var r=i.get(e);r?r.push(t):i.set(e,[t])},off:function(e,t){var r=i.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):i.set(e,[]))},emit:function(e,t){var r=i.get(e);r&&r.slice().map(function(s){s(t)}),(r=i.get("*"))&&r.slice().map(function(s){s(e,t)})}}}var Le,ei=class{constructor(){_(this,Le);E(this,Le,$r())}on(e,t){return l(this,Le).on(e,t),()=>{this.off(e,t)}}off(e,t){l(this,Le).off(e,t)}emit(e,t){l(this,Le).emit(e,t)}};Le=new WeakMap;var I=class extends Error{constructor(e,t){super(e),this.originalError=t}};var Se,Ye,we=class{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){_(this,Se,[]);_(this,Ye);this._emitter=t,this._inboxService=e,this._emitter.on("session.initialize.resolved",({error:r,data:s})=>{s?(this.onSessionSuccess(s),l(this,Se).forEach(a=>g(this,[a],function*({fn:n,resolve:o}){o(yield n())})),E(this,Se,[])):r&&(this.onSessionError(r),E(this,Ye,r),l(this,Se).forEach(({resolve:n})=>{n({error:new I("Failed to initialize session, please contact the support",r)})}),E(this,Se,[]))})}onSessionSuccess(e){}onSessionError(e){}callWithSession(e){return g(this,null,function*(){return this._inboxService.isSessionInitialized?e():l(this,Ye)?Promise.resolve({error:new I("Failed to initialize session, please contact the support",l(this,Ye))}):new Promise((t,r)=>{l(this,Se).push({fn:e,resolve:t,reject:r})})})}};Se=new WeakMap,Ye=new WeakMap;var Y,se,j=class{constructor(e,t,r){_(this,Y);_(this,se);E(this,Y,t),E(this,se,r),this.id=e.id,this.subject=e.subject,this.body=e.body,this.to=e.to,this.isRead=e.isRead,this.isArchived=e.isArchived,this.createdAt=e.createdAt,this.readAt=e.readAt,this.archivedAt=e.archivedAt,this.avatar=e.avatar,this.primaryAction=e.primaryAction,this.secondaryAction=e.secondaryAction,this.channelType=e.channelType,this.tags=e.tags,this.redirect=e.redirect,this.data=e.data,this.workflow=e.workflow}read(){return ti({emitter:l(this,Y),apiService:l(this,se),args:{notification:this}})}unread(){return ii({emitter:l(this,Y),apiService:l(this,se),args:{notification:this}})}archive(){return ri({emitter:l(this,Y),apiService:l(this,se),args:{notification:this}})}unarchive(){return si({emitter:l(this,Y),apiService:l(this,se),args:{notification:this}})}completePrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Xe({emitter:l(this,Y),apiService:l(this,se),args:{notification:this},actionType:"primary"})}completeSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Xe({emitter:l(this,Y),apiService:l(this,se),args:{notification:this},actionType:"secondary"})}revertPrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Je({emitter:l(this,Y),apiService:l(this,se),args:{notification:this},actionType:"primary"})}revertSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Je({emitter:l(this,Y),apiService:l(this,se),args:{notification:this},actionType:"secondary"})}on(e,t){let r=l(this,Y).on(e,t);return()=>{r()}}off(e,t){l(this,Y).off(e,t)}};Y=new WeakMap,se=new WeakMap;var ti=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Qe(t,{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.read.pending",{args:t,data:n});let o=yield e.read(s),a=new j(o,i,e);return i.emit("notification.read.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.read.resolved",{args:t,error:o}),{error:new I("Failed to read notification",o)}}}),ii=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Qe(t,{isRead:!1,readAt:null,isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.unread.pending",{args:t,data:n});let o=yield e.unread(s),a=new j(o,i,e);return i.emit("notification.unread.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unread.resolved",{args:t,error:o}),{error:new I("Failed to unread notification",o)}}}),ri=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Qe(t,{isArchived:!0,archivedAt:new Date().toISOString(),isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.archive.pending",{args:t,data:n});let o=yield e.archive(s),a=new j(o,i,e);return i.emit("notification.archive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.archive.resolved",{args:t,error:o}),{error:new I("Failed to archive notification",o)}}}),si=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Qe(t,{isArchived:!1,archivedAt:null,isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.unarchive.pending",{args:t,data:n});let o=yield e.unarchive(s),a=new j(o,i,e);return i.emit("notification.unarchive.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unarchive.resolved",{args:t,error:o}),{error:new I("Failed to unarchive notification",o)}}}),Xe=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:O(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!0})}:{secondaryAction:O(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!0})},{notificationId:o,optimisticValue:a}=Qe(t,n,{emitter:i,apiService:e});try{i.emit("notification.complete_action.pending",{args:t,data:a});let c=yield e.completeAction({actionType:r,notificationId:o}),u=new j(c,i,e);return i.emit("notification.complete_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.complete_action.resolved",{args:t,error:c}),{error:new I(`Failed to complete ${r} action on the notification`,c)}}}),Je=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:O(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!1})}:{secondaryAction:O(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!1})},{notificationId:o,optimisticValue:a}=Qe(t,n,{emitter:i,apiService:e});try{i.emit("notification.revert_action.pending",{args:t,data:a});let c=yield e.revertAction({actionType:r,notificationId:o}),u=new j(c,i,e);return i.emit("notification.revert_action.resolved",{args:t,data:u}),{data:u}}catch(c){return i.emit("notification.revert_action.resolved",{args:t,error:c}),{error:new I("Failed to fetch notifications",c)}}}),Qe=(i,e,t)=>"notification"in i?{notificationId:i.notification.id,optimisticValue:new j(b(b({},i.notification),e),t.emitter,t.apiService)}:{notificationId:i.notificationId},Vr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new j(O(b({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0}),i,e));return i.emit("notifications.read_all.pending",{args:{tags:r},data:o}),yield e.readAll({tags:r}),i.emit("notifications.read_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.read_all.resolved",{args:{tags:r},error:n}),{error:new I("Failed to read all notifications",n)}}}),jr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(a=>new j(O(b({},a),{isRead:!0,readAt:new Date().toISOString(),isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all.pending",{args:{tags:r},data:o}),yield e.archiveAll({tags:r}),i.emit("notifications.archive_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all.resolved",{args:{tags:r},error:n}),{error:new I("Failed to archive all notifications",n)}}}),Hr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r,read:!0}).map(a=>new j(O(b({},a),{isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all_read.pending",{args:{tags:r},data:o}),yield e.archiveAllRead({tags:r}),i.emit("notifications.archive_all_read.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all_read.resolved",{args:{tags:r},error:n}),{error:new I("Failed to archive all read notifications",n)}}});var Gr=(i,e)=>i===e?!0:!i||!e||i.length!==e.length?!1:i.every((t,r)=>t===e[r]);var gl=["seen","unseen"],yl=["read","unread"],Wi=(i,e)=>Gr(i,e)||!i&&(e==null?void 0:e.length)===0||(i==null?void 0:i.length)===0&&!e,$i=(i,e)=>Wi(i.tags,e.tags)&&i.read===e.read&&i.archived===e.archived;var ce,Ze=class{constructor(){_(this,ce);E(this,ce,new Map)}get(e){return l(this,ce).get(e)}getValues(){return Array.from(l(this,ce).values())}entries(){return Array.from(l(this,ce).entries())}keys(){return Array.from(l(this,ce).keys())}set(e,t){l(this,ce).set(e,t)}remove(e){l(this,ce).delete(e)}clear(){l(this,ce).clear()}};ce=new WeakMap;var zr=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>Object.entries({tags:i,read:e,archived:t,limit:r,offset:s,after:n}).filter(([o,a])=>a!=null&&!(Array.isArray(a)&&a.length===0)).reduce((o,[a,c])=>(o[a]=c,o),{}),Vi=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>JSON.stringify(zr({tags:i,read:e,archived:t,limit:r,offset:s,after:n})),vo=({tags:i,read:e,archived:t})=>JSON.stringify(zr({tags:i,read:e,archived:t})),et=i=>JSON.parse(i),_o=["notification.read.pending","notification.read.resolved","notification.unread.pending","notification.unread.resolved","notification.complete_action.pending","notification.complete_action.resolved","notification.revert_action.pending","notification.revert_action.resolved","notifications.read_all.pending","notifications.read_all.resolved"],Eo=["notification.archive.pending","notification.unarchive.pending","notifications.archive_all.pending","notifications.archive_all_read.pending"],Ne,D,vt=class{constructor({emitter:e}){_(this,Ne);_(this,D);this.updateNotification=(e,t)=>{let r=l(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n[s]=t,l(this,D).set(e,O(b({},r),{notifications:n})),!0};this.removeNotification=(e,t)=>{let r=l(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n.splice(s,1),l(this,D).set(e,O(b({},r),{notifications:n})),!0};this.handleNotificationEvent=({remove:e}={remove:!1})=>({data:t})=>{if(!t)return;let r=Array.isArray(t)?t:[t],s=new Set;l(this,D).keys().forEach(n=>{r.forEach(o=>{let a=!1;e?a=this.removeNotification(n,o):a=this.updateNotification(n,o),a&&s.add(vo(et(n)))})}),s.forEach(n=>{let o=this.getAggregated(et(n));l(this,Ne).emit("notifications.list.updated",{data:o})})};E(this,Ne,e),_o.forEach(t=>{l(this,Ne).on(t,this.handleNotificationEvent())}),Eo.forEach(t=>{l(this,Ne).on(t,this.handleNotificationEvent({remove:!0}))}),E(this,D,new Ze)}getAggregated(e){return l(this,D).keys().filter(r=>{let s=et(r);return $i(s,e)}).map(r=>l(this,D).get(r)).reduce((r,s)=>s?{hasMore:s.hasMore,filter:s.filter,notifications:[...r.notifications,...s.notifications]}:r,{hasMore:!1,filter:{},notifications:[]})}has(e){return l(this,D).get(Vi(e))!==void 0}set(e,t){l(this,D).set(Vi(e),t)}update(e,t){this.set(e,t);let r=this.getAggregated(et(Vi(e)));l(this,Ne).emit("notifications.list.updated",{data:r})}getAll(e){if(this.has(e))return this.getAggregated({tags:e.tags,read:e.read,archived:e.archived})}getUniqueNotifications({tags:e,read:t}){let r=l(this,D).keys(),s=new Map;return r.forEach(n=>{let o=et(n);if(Wi(e,o.tags)){let a=l(this,D).get(n);if(!a)return;a.notifications.filter(c=>typeof t=="undefined"||t===c.isRead).forEach(c=>s.set(c.id,c))}}),Array.from(s.values())}clear(e){l(this,D).keys().forEach(r=>{$i(et(r),e)&&l(this,D).remove(r)})}clearAll(){l(this,D).clear()}};Ne=new WeakMap,D=new WeakMap;var _t,ni=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,_t);this.cache=new vt({emitter:s}),E(this,_t,t)}list(){return g(this,arguments,function*(s={}){var n=s,{limit:t=10}=n,r=Wr(n,["limit"]);return this.callWithSession(()=>g(this,null,function*(){let o=b({limit:t},r);try{let a="useCache"in o?o.useCache:l(this,_t),c=a?this.cache.getAll(o):void 0;if(this._emitter.emit("notifications.list.pending",{args:o,data:c}),!c){let u=yield this._inboxService.fetchNotifications(b({limit:t},r));c={hasMore:u.hasMore,filter:u.filter,notifications:u.data.map(f=>new j(f,this._emitter,this._inboxService))},a&&(this.cache.set(o,c),c=this.cache.getAll(o))}return this._emitter.emit("notifications.list.resolved",{args:o,data:c}),{data:c}}catch(a){return this._emitter.emit("notifications.list.resolved",{args:o,error:a}),{error:new I("Failed to fetch notifications",a)}}}))})}count(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){let r=t&&"filters"in t?t.filters:[b({},t)];try{this._emitter.emit("notifications.count.pending",{args:t});let s=yield this._inboxService.count({filters:r}),n=t&&"filters"in t?{counts:s.data}:s.data[0];return this._emitter.emit("notifications.count.resolved",{args:t,data:n}),{data:n}}catch(s){return this._emitter.emit("notifications.count.resolved",{args:t,error:s}),{error:new I("Failed to count notifications",s)}}}))})}read(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ti({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unread(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ii({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}archive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ri({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unarchive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return si({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}completePrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Xe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}completeSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Xe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}revertPrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Je({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}revertSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Je({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}readAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Vr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return jr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAllRead(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Hr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}clearCache({filter:t}={}){return t?this.cache.clear(t!=null?t:{}):this.cache.clearAll()}};_t=new WeakMap;var Kr=n=>g(void 0,[n],function*({emitter:i,apiService:e,cache:t,useCache:r,args:s}){let{workflowId:o,channels:a}=s;try{i.emit("preference.update.pending",{args:s,data:s.preference?new Ae(O(b({},s.preference),{channels:b(b({},s.preference.channels),a)}),{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0});let c;o?c=yield e.updateWorkflowPreferences({workflowId:o,channels:a}):(bo({emitter:i,apiService:e,cache:t,useCache:r,args:s}),c=yield e.updateGlobalPreferences(a));let u=new Ae(c,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r});return i.emit("preference.update.resolved",{args:s,data:u}),{data:u}}catch(c){return i.emit("preference.update.resolved",{args:s,error:c}),{error:new I("Failed to fetch notifications",c)}}}),bo=({emitter:i,apiService:e,cache:t,useCache:r,args:s})=>{let n=r?t==null?void 0:t.getAll({}):void 0;n==null||n.forEach(o=>{var a;if(o.level==="template"){let c=O(b({},o),{channels:Object.entries(o.channels).reduce((f,[h,d])=>{var S;let x=h;return f[x]=(S=s.channels[x])!=null?S:d,f},{})}),u=s.preference?new Ae(c,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0;u&&i.emit("preference.update.pending",{args:{workflowId:(a=o.workflow)==null?void 0:a.id,channels:u.channels},data:u})}})};var Et,bt,xt,Ct,Ae=class{constructor(e,{emitterInstance:t,inboxServiceInstance:r,cache:s,useCache:n}){_(this,Et);_(this,bt);_(this,xt);_(this,Ct);E(this,Et,t),E(this,bt,r),E(this,xt,s),E(this,Ct,n),this.level=e.level,this.enabled=e.enabled,this.channels=e.channels,this.workflow=e.workflow}update({channels:e,channelPreferences:t}){var r;return Kr({emitter:l(this,Et),apiService:l(this,bt),cache:l(this,xt),useCache:l(this,Ct),args:{workflowId:(r=this.workflow)==null?void 0:r.id,channels:e||t,preference:{level:this.level,enabled:this.enabled,channels:this.channels,workflow:this.workflow}}})}};Et=new WeakMap,bt=new WeakMap,xt=new WeakMap,Ct=new WeakMap;var xo=["preference.update.pending","preference.update.resolved"],Co=({tags:i})=>Object.entries({tags:i}).reduce((e,[t,r])=>(r==null||Array.isArray(r)&&r.length===0||(e[t]=r),e),{}),ji=({tags:i})=>JSON.stringify(Co({tags:i})),tt,ne,oi=class{constructor({emitterInstance:e}){_(this,tt);_(this,ne);this.updatePreference=(e,t)=>{let r=l(this,ne).get(e);if(!r)return!1;let s=r.findIndex(o=>{var a,c;return((a=o.workflow)==null?void 0:a.id)===((c=t.workflow)==null?void 0:c.id)||o.level===t.level&&t.level==="global"});if(s===-1)return!1;let n=[...r];return n[s]=t,l(this,ne).set(e,n),!0};this.handlePreferenceEvent=({data:e})=>{e&&l(this,ne).keys().forEach(t=>{let r=this.updatePreference(t,e),s=l(this,ne).get(t);!r||!s||l(this,tt).emit("preferences.list.updated",{data:s})})};E(this,tt,e),xo.forEach(t=>{l(this,tt).on(t,this.handlePreferenceEvent)}),E(this,ne,new Ze)}has(e){return l(this,ne).get(ji(e))!==void 0}set(e,t){l(this,ne).set(ji(e),t)}getAll(e){if(this.has(e))return l(this,ne).get(ji(e))}clearAll(){l(this,ne).clear()}};tt=new WeakMap,ne=new WeakMap;var Fe,ai=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,Fe);this.cache=new oi({emitterInstance:this._emitter}),E(this,Fe,t)}list(){return g(this,arguments,function*(t={}){return this.callWithSession(()=>g(this,null,function*(){try{let r=l(this,Fe)?this.cache.getAll(t):void 0;return this._emitter.emit("preferences.list.pending",{args:t,data:r}),r||(r=(yield this._inboxService.fetchPreferences(t.tags)).map(n=>new Ae(n,{emitterInstance:this._emitter,inboxServiceInstance:this._inboxService,cache:this.cache,useCache:l(this,Fe)})),l(this,Fe)&&(this.cache.set(t,r),r=this.cache.getAll(t))),this._emitter.emit("preferences.list.resolved",{args:t,data:r}),{data:r}}catch(r){throw this._emitter.emit("preferences.list.resolved",{args:t,error:r}),r}}))})}};Fe=new WeakMap;var Be,St,pe,ci=class{constructor(e,t,r){_(this,Be);_(this,St);_(this,pe);E(this,Be,r),E(this,St,t),E(this,pe,e)}get applicationIdentifier(){return l(this,pe).applicationIdentifier}get subscriberId(){return l(this,pe).subscriberId}initialize(){return g(this,null,function*(){try{let{applicationIdentifier:e,subscriberId:t,subscriberHash:r}=l(this,pe);l(this,Be).emit("session.initialize.pending",{args:l(this,pe)});let s=yield l(this,St).initializeSession({applicationIdentifier:e,subscriberId:t,subscriberHash:r});l(this,Be).emit("session.initialize.resolved",{args:l(this,pe),data:s})}catch(e){l(this,Be).emit("session.initialize.resolved",{args:l(this,pe),error:e})}})}};Be=new WeakMap,St=new WeakMap,pe=new WeakMap;var le=Object.create(null);le.open="0";le.close="1";le.ping="2";le.pong="3";le.message="4";le.upgrade="5";le.noop="6";var wt=Object.create(null);Object.keys(le).forEach(i=>{wt[le[i]]=i});var Nt={type:"error",data:"parser error"};var At=({type:i,data:e},t,r)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?r(t?e:"b"+Yr(e,!0).toString("base64")):r(le[i]+(e||"")),Yr=(i,e)=>Buffer.isBuffer(i)||i instanceof Uint8Array&&!e?i:i instanceof ArrayBuffer?Buffer.from(i):Buffer.from(i.buffer,i.byteOffset,i.byteLength),Hi;function Xr(i,e){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return e(Yr(i.data,!1));At(i,!0,t=>{Hi||(Hi=new TextEncoder),e(Hi.encode(t))})}var kt=(i,e)=>{if(typeof i!="string")return{type:"message",data:Jr(i,e)};let t=i.charAt(0);if(t==="b"){let r=Buffer.from(i.substring(1),"base64");return{type:"message",data:Jr(r,e)}}return wt[t]?i.length>1?{type:wt[t],data:i.substring(1)}:{type:wt[t]}:Nt},Jr=(i,e)=>{switch(e){case"arraybuffer":return i instanceof ArrayBuffer?i:Buffer.isBuffer(i)?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer;case"nodebuffer":default:return Buffer.isBuffer(i)?i:Buffer.from(i)}};var Qr="",Zr=(i,e)=>{let t=i.length,r=new Array(t),s=0;i.forEach((n,o)=>{At(n,!1,a=>{r[o]=a,++s===t&&e(r.join(Qr))})})},es=(i,e)=>{let t=i.split(Qr),r=[];for(let s=0;s<t.length;s++){let n=kt(t[s],e);if(r.push(n),n.type==="error")break}return r};function ts(){return new TransformStream({transform(i,e){Xr(i,t=>{let r=t.length,s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,r)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(r))}i.data&&typeof i.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}var Gi;function li(i){return i.reduce((e,t)=>e+t.length,0)}function fi(i,e){if(i[0].length===e)return i.shift();let t=new Uint8Array(e),r=0;for(let s=0;s<e;s++)t[s]=i[0][r++],r===i[0].length&&(i.shift(),r=0);return i.length&&r<i[0].length&&(i[0]=i[0].slice(r)),t}function is(i,e){Gi||(Gi=new TextDecoder);let t=[],r=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(r===0){if(li(t)<1)break;let c=fi(t,1);n=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(li(t)<2)break;let c=fi(t,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(li(t)<8)break;let c=fi(t,8),u=new DataView(c.buffer,c.byteOffset,c.length),f=u.getUint32(0);if(f>Math.pow(2,21)-1){a.enqueue(Nt);break}s=f*Math.pow(2,32)+u.getUint32(4),r=3}else{if(li(t)<s)break;let c=fi(t,s);a.enqueue(kt(n?c:Gi.decode(c),e)),r=0}if(s===0||s>i){a.enqueue(Nt);break}}}})}var zi=4;function R(i){if(i)return So(i)}function So(i){for(var e in R.prototype)i[e]=R.prototype[e];return i}R.prototype.on=R.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this};R.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this};R.prototype.off=R.prototype.removeListener=R.prototype.removeAllListeners=R.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+i],this};R.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this};R.prototype.emitReserved=R.prototype.emit;R.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};R.prototype.hasListeners=function(i){return!!this.listeners(i).length};var fe=global;function hi(i,...e){return e.reduce((t,r)=>(i.hasOwnProperty(r)&&(t[r]=i[r]),t),{})}var wo=fe.setTimeout,No=fe.clearTimeout;function ve(i,e){e.useNativeTimers?(i.setTimeoutFn=wo.bind(fe),i.clearTimeoutFn=No.bind(fe)):(i.setTimeoutFn=fe.setTimeout.bind(fe),i.clearTimeoutFn=fe.clearTimeout.bind(fe))}var Ao=1.33;function rs(i){return typeof i=="string"?ko(i):Math.ceil((i.byteLength||i.size)*Ao)}function ko(i){let e=0,t=0;for(let r=0,s=i.length;r<s;r++)e=i.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}var ms=z(De(),1);function ds(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function ps(i){let e={},t=i.split("&");for(let r=0,s=t.length;r<s;r++){let n=t[r].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var Jo=(0,ms.default)("engine.io-client:transport"),er=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},_e=class extends R{constructor(e){super(),this.writable=!1,ve(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new er(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):Jo("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=kt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=ds(e);return t.length?"?"+t:""}};var ws=z(De(),1);var _s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),tr=64,Qo={},gs=0,gi=0,ys;function vs(i){let e="";do e=_s[i%tr]+e,i=Math.floor(i/tr);while(i>0);return e}function yi(){let i=vs(+new Date);return i!==ys?(gs=0,ys=i):i+"."+vs(gs++)}for(;gi<tr;gi++)Qo[_s[gi]]=gi;var sr=z(xs(),1),nr=sr.default||sr;function Cs(){return new rr}function ea(i){let e=i.split("; "),t=e[0].indexOf("=");if(t===-1)return;let r=e[0].substring(0,t).trim();if(!r.length)return;let s=e[0].substring(t+1).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));let n={name:r,value:s};for(let o=1;o<e.length;o++){let a=e[o].split("=");if(a.length!==2)continue;let c=a[0].trim(),u=a[1].trim();switch(c){case"Expires":n.expires=new Date(u);break;case"Max-Age":let f=new Date;f.setUTCSeconds(f.getUTCSeconds()+parseInt(u,10)),n.expires=f;break;default:}}return n}var rr=class{constructor(){this.cookies=new Map}parseCookies(e){let t=e.getResponseHeader("set-cookie");t&&t.forEach(r=>{let s=ea(r);s&&this.cookies.set(s.name,s)})}addCookies(e){let t=[];this.cookies.forEach((r,s)=>{var n;((n=r.expires)===null||n===void 0?void 0:n.getTime())<Date.now()?this.cookies.delete(s):t.push(`${s}=${r.value}`)}),t.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",t.join("; ")))}};var X=(0,ws.default)("engine.io-client:polling");function ta(){}var ia=function(){return new nr({xdomain:!1}).responseType!=null}(),vi=class extends _e{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){let r=location.protocol==="https:",s=location.port;s||(s=r?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||s!==e.port}let t=e&&e.forceBase64;this.supportsBinary=ia&&!t,this.opts.withCredentials&&(this.cookieJar=Cs())}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{X("paused"),this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(X("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){X("pre-pause polling complete"),--r||t()})),this.writable||(X("we are currently writing - waiting to pause"),r++,this.once("drain",function(){X("pre-pause writing complete"),--r||t()}))}else t()}poll(){X("polling"),this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){X("polling got data %s",e);let t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};es(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this.poll():X('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{X("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(X("transport open - closing"),e()):(X("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,Zr(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=yi()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Re(this.uri(),e)}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){X("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}},Re=class i extends R{constructor(e,t){super(),ve(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;let t=hi(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let r=this.xhr=new nr(t);try{X("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.opts.extraHeaders[s])}}catch(s){}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{r.setRequestHeader("Accept","*/*")}catch(s){}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},X("xhr data %s",this.data),r.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document!="undefined"&&(this.index=i.requestsCount++,i.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.xhr.onreadystatechange=ta,e)try{this.xhr.abort()}catch(t){}typeof document!="undefined"&&delete i.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Re.requestsCount=0;Re.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Ss);else if(typeof addEventListener=="function"){let i="onpagehide"in fe?"pagehide":"unload";addEventListener(i,Ss,!1)}}function Ss(){for(let i in Re.requests)Re.requests.hasOwnProperty(i)&&Re.requests[i].abort()}var uc=z(Rs(),1),dc=z(pr(),1),pc=z(gr(),1),kn=z(Cr(),1),mc=z(An(),1);var Rn=kn.default;var qt=Rn,ki=!1,Tn="nodebuffer",$e=process.nextTick;var In=z(De(),1);var gc=(0,In.default)("engine.io-client:websocket"),On=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Ri=class extends _e{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,r=On?{}:hi(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=ki&&!On?t?new qt(e,t):new qt(e):new qt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;At(r,this.supportsBinary,n=>{let o={};ki||(r.options&&(o.compress=r.options.compress),this.opts.perMessageDeflate&&(typeof n=="string"?Buffer.byteLength(n):n.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{ki?this.ws.send(n):this.ws.send(n,o)}catch(a){gc("websocket closed before onclose event")}s&&$e(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=yi()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!qt}};var Pn=z(De(),1),Wt=(0,Pn.default)("engine.io-client:webtransport"),Ti=class extends _e{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{Wt("transport closed gracefully"),this.onClose()}).catch(e=>{Wt("transport closed due to %s",e),this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t=is(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=ts();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();let n=()=>{r.read().then(({done:a,value:c})=>{if(a){Wt("session is closed");return}Wt("received chunk: %o",c),this.onPacket(c),n()}).catch(a=>{Wt("an error occurred while reading: %s",a)})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;this.writer.write(r).then(()=>{s&&$e(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}};var wr={websocket:Ri,webtransport:Ti,polling:vi};var yc=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function lt(i){let e=i,t=i.indexOf("["),r=i.indexOf("]");t!=-1&&r!=-1&&(i=i.substring(0,t)+i.substring(t,r).replace(/:/g,";")+i.substring(r,i.length));let s=yc.exec(i||""),n={},o=14;for(;o--;)n[vc[o]]=s[o]||"";return t!=-1&&r!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=_c(n,n.path),n.queryKey=Ec(n,n.query),n}function _c(i,e){let t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Ec(i,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,n){s&&(t[s]=n)}),t}var Ln=z(De(),1);var P=(0,Ln.default)("engine.io-client:socket"),Ve=class i extends R{constructor(e,t={}){super(),this.binaryType=Tn,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=lt(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=lt(t.host).host),ve(this,t),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ps(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){P('creating transport "%s"',e);let t=Object.assign({},this.opts.query);t.EIO=zi,t.transport=e,this.id&&(t.sid=this.id);let r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return P("options: %j",r),new wr[e](r)}open(){let e;if(this.opts.rememberUpgrade&&i.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(t){P("error while creating transport: %s",t),this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){P("setting transport %s",e.name),this.transport&&(P("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){P('probing transport "%s"',e);let t=this.createTransport(e),r=!1;i.priorWebsocketSuccess=!1;let s=()=>{r||(P('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(P('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;i.priorWebsocketSuccess=t.name==="websocket",P('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||this.readyState!=="closed"&&(P("changing transport and sending upgrade packet"),f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{P('probe transport "%s" failed',e);let d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function n(){r||(r=!0,f(),t.close(),t=null)}let o=h=>{let d=new Error("probe error: "+h);d.transport=t.name,n(),P('probe transport "%s" failed because of error: %s',e,h),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function c(){o("socket closed")}function u(h){t&&h.name!==t.name&&(P('"%s" works - aborting "%s"',h.name,t.name),n())}let f=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),this.off("close",c),this.off("upgrading",u)};t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",c),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(P("socket open"),this.readyState="open",i.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){P("starting upgrade probes");let e=0,t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(P('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":let t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else P('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this.getWritablePackets();P("flushing %d packets in socket",e.length),this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){let s=this.writeBuffer[r].data;if(s&&(t+=rs(s)),r>0&&t>this.maxPayload)return P("only send %d out of %d packets",r,this.writeBuffer.length),this.writeBuffer.slice(0,r);t+=2}return P("payload size is %d (max: %d)",t,this.maxPayload),this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),s&&this.once("flush",s),this.flush()}close(){let e=()=>{this.onClose("forced close"),P("socket closing - telling transport to close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){P("socket error %j",e),i.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(P('socket close with reason: "%s"',e),this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],r=0,s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}};Ve.protocol=zi;var Rh=Ve.protocol;var qn=z($t(),1),Mn=(0,qn.default)("socket.io-client:url");function Wn(i,e="",t){let r=i;t=t||typeof location!="undefined"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(Mn("protocol-less url %s",i),typeof t!="undefined"?i=t.protocol+"//"+i:i="https://"+i),Mn("parse %s",i),r=lt(i)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let n=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port+e,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r}var Lr={};ho(Lr,{Decoder:()=>Ir,Encoder:()=>Or,PacketType:()=>C,protocol:()=>zn});var Bc=typeof ArrayBuffer=="function",Uc=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,$n=Object.prototype.toString,Dc=typeof Blob=="function"||typeof Blob!="undefined"&&$n.call(Blob)==="[object BlobConstructor]",Mc=typeof File=="function"||typeof File!="undefined"&&$n.call(File)==="[object FileConstructor]";function jt(i){return Bc&&(i instanceof ArrayBuffer||Uc(i))||Dc&&i instanceof Blob||Mc&&i instanceof File}function Vt(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,r=i.length;t<r;t++)if(Vt(i[t]))return!0;return!1}if(jt(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Vt(i.toJSON(),!0);for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&Vt(i[t]))return!0;return!1}function Vn(i){let e=[],t=i.data,r=i;return r.data=kr(t,e),r.attachments=e.length,{packet:r,buffers:e}}function kr(i,e){if(!i)return i;if(jt(i)){let t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){let t=new Array(i.length);for(let r=0;r<i.length;r++)t[r]=kr(i[r],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){let t={};for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=kr(i[r],e));return t}return i}function jn(i,e){return i.data=Rr(i.data,e),delete i.attachments,i}function Rr(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=Rr(i[t],e);else if(typeof i=="object")for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Rr(i[t],e));return i}var Gn=z(De(),1),Tr=(0,Gn.default)("socket.io-parser"),qc=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],zn=5,C;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(C||(C={}));var Or=class{constructor(e){this.replacer=e}encode(e){return Tr("encoding packet %j",e),(e.type===C.EVENT||e.type===C.ACK)&&Vt(e)?this.encodeAsBinary({type:e.type===C.EVENT?C.BINARY_EVENT:C.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===C.BINARY_EVENT||e.type===C.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),Tr("encoded %j as %s",e,t),t}encodeAsBinary(e){let t=Vn(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}};function Hn(i){return Object.prototype.toString.call(i)==="[object Object]"}var Ir=class i extends R{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let r=t.type===C.BINARY_EVENT;r||t.type===C.BINARY_ACK?(t.type=r?C.EVENT:C.ACK,this.reconstructor=new Pr(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(jt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,r={type:Number(e.charAt(0))};if(C[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===C.BINARY_EVENT||r.type===C.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(n,t)}else r.nsp="/";let s=e.charAt(t+1);if(s!==""&&Number(s)==s){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(i.isPayloadValid(r.type,n))r.data=n;else throw new Error("invalid payload")}return Tr("decoded %s as %j",e,r),r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case C.CONNECT:return Hn(t);case C.DISCONNECT:return t===void 0;case C.CONNECT_ERROR:return typeof t=="string"||Hn(t);case C.EVENT:case C.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&qc.indexOf(t[0])===-1);case C.ACK:case C.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Pr=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=jn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function ee(i,e,t){return i.on(e,t),function(){i.off(e,t)}}var Kn=z($t(),1),U=(0,Kn.default)("socket.io-client:socket"),Wc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ft=class extends R{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[ee(e,"open",this.onopen.bind(this)),ee(e,"packet",this.onpacket.bind(this)),ee(e,"error",this.onerror.bind(this)),ee(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Wc.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let r={type:C.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++;U("emitting packet with ack id %d",o);let a=t.pop();this._registerAckCallback(o,a),r.id=o}let s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)?U("discard packet as the transport is not currently writable"):this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,t){var r;let s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(U("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));U("event with ack id %d has timed out after %d ms",e,s),t.call(this,new Error("operation has timed out"))},s);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,[null,...o])}}emitWithAck(e,...t){let r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,n)=>{t.push((o,a)=>r?o?n(o):s(a):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...n)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(U("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(s)):(U("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(U("draining queue"),!this.connected||this._queue.length===0)return;let t=this._queue[0];if(t.pending&&!e){U("packet [%d] has already been sent and is waiting for an ack",t.id);return}t.pending=!0,t.tryCount++,U("sending packet [%d] (try n\xB0%d)",t.id,t.tryCount),this.flags=t.flags,this.emit.apply(this,t.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){U("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:C.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){U("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case C.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case C.EVENT:case C.BINARY_EVENT:this.onevent(e);break;case C.ACK:case C.BINARY_ACK:this.onack(e);break;case C.DISCONNECT:this.ondisconnect();break;case C.CONNECT_ERROR:this.destroy();let r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){let t=e.data||[];U("emitting event %j",t),e.id!=null&&(U("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,r=!1;return function(...s){r||(r=!0,U("sending ack %j",s),t.packet({type:C.ACK,id:e,data:s}))}}onack(e){let t=this.acks[e.id];typeof t=="function"?(U("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):U("bad ack %s",e.id)}onconnect(e,t){U("socket connected with id %s",e),this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){U("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(U("performing disconnect (%s)",this.nsp),this.packet({type:C.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let r of t)r.apply(this,e.data)}}};function je(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}je.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=Math.floor(e*10)&1?i+t:i-t}return Math.min(i,this.max)|0};je.prototype.reset=function(){this.attempts=0};je.prototype.setMin=function(i){this.ms=i};je.prototype.setMax=function(i){this.max=i};je.prototype.setJitter=function(i){this.jitter=i};var Yn=z($t(),1),H=(0,Yn.default)("socket.io-client:manager"),ht=class extends R{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,ve(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new je({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let s=t.parser||Lr;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(H("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;H("opening %s",this.uri),this.engine=new Ve(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let s=ee(t,"open",function(){r.onopen(),e&&e()}),n=a=>{H("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=ee(t,"error",n);if(this._timeout!==!1){let a=this._timeout;H("connect attempt will timeout after %d",a);let c=this.setTimeoutFn(()=>{H("connect attempt timed out after %d",a),s(),n(new Error("timeout")),t.close()},a);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){H("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(ee(e,"ping",this.onping.bind(this)),ee(e,"data",this.ondata.bind(this)),ee(e,"error",this.onerror.bind(this)),ee(e,"close",this.onclose.bind(this)),ee(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){$e(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){H("error",e),this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new ft(this,e,t),this.nsps[e]=r),r}_destroy(e){let t=Object.keys(this.nsps);for(let r of t)if(this.nsps[r].active){H("socket %s is still active, skipping close",r);return}this._close()}_packet(e){H("writing packet %j",e);let t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){H("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){H("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){H("closed due to %s",e),this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)H("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();H("will wait %dms before reconnect attempt",t),this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(H("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(H("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):(H("reconnect success"),e.onreconnect())}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var Jn=z($t(),1),Xn=(0,Jn.default)("socket.io-client"),Ht={};function Gt(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};let t=Wn(i,e.path||"/socket.io"),r=t.source,s=t.id,n=t.path,o=Ht[s]&&n in Ht[s].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o,c;return a?(Xn("ignoring socket cache for %s",r),c=new ht(r,e)):(Ht[s]||(Xn("new io instance for %s",r),Ht[s]=new ht(r,e)),c=Ht[s]),t.query&&!e.query&&(e.query=t.queryKey),c.socket(t.path,e)}Object.assign(Gt,{Manager:ht,Socket:ft,io:Gt,connect:Gt});var $c="https://ws.novu.co",Qn="notifications.notification_received",Zn="notifications.unseen_count_changed",eo="notifications.unread_count_changed",Vc=({_id:i,content:e,read:t,archived:r,createdAt:s,lastReadDate:n,archivedAt:o,channel:a,subscriber:c,subject:u,avatar:f,cta:h,tags:d,data:x,workflow:S})=>{var y,$,k,V,G,de,zt,Kt,ie,pt;let m={id:(y=c==null?void 0:c._id)!=null?y:"",firstName:c==null?void 0:c.firstName,lastName:c==null?void 0:c.lastName,avatar:c==null?void 0:c.avatar,subscriberId:($=c==null?void 0:c.subscriberId)!=null?$:""},v=(V=(k=h.action)==null?void 0:k.buttons)==null?void 0:V.find(Ge=>Ge.type==="primary"),N=(de=(G=h.action)==null?void 0:G.buttons)==null?void 0:de.find(Ge=>Ge.type==="secondary"),A=(Kt=(zt=h.action)==null?void 0:zt.result)==null?void 0:Kt.type,p=(ie=h.action)==null?void 0:ie.status;return{id:i,subject:u,body:e,to:m,isRead:t,isArchived:r,createdAt:s,readAt:n,archivedAt:o,avatar:f,primaryAction:v&&{label:v.content,isCompleted:A==="primary"&&p==="done",redirect:v.url?{target:v.target,url:v.url}:void 0},secondaryAction:N&&{label:N.content,isCompleted:A==="secondary"&&p==="done",redirect:N.url?{target:N.target,url:N.url}:void 0},channelType:a,tags:d,redirect:(pt=h.data)!=null&&pt.url?{url:h.data.url,target:h.data.target}:void 0,data:x,workflow:S}},ut,ue,te,dt,Fi,Bi,Ui,ge,to,Fr,Br,Li=class extends we{constructor({socketUrl:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,ge);_(this,ut);_(this,ue);_(this,te);_(this,dt);_(this,Fi,({message:t})=>{l(this,ue).emit(Qn,{result:new j(Vc(t),l(this,ue),this._inboxService)})});_(this,Bi,({unseenCount:t})=>{l(this,ue).emit(Zn,{result:t})});_(this,Ui,({unreadCount:t})=>{l(this,ue).emit(eo,{result:t})});E(this,ue,s),E(this,dt,t!=null?t:$c)}onSessionSuccess({token:t}){E(this,ut,t)}isSocketEvent(t){return t===Qn||t===Zn||t===eo}connect(){return g(this,null,function*(){return l(this,ut)?Ke(this,ge,Fr).call(this):this.callWithSession(Ke(this,ge,Fr).bind(this))})}disconnect(){return g(this,null,function*(){return l(this,te)?Ke(this,ge,Br).call(this):this.callWithSession(Ke(this,ge,Br).bind(this))})}};ut=new WeakMap,ue=new WeakMap,te=new WeakMap,dt=new WeakMap,Fi=new WeakMap,Bi=new WeakMap,Ui=new WeakMap,ge=new WeakSet,to=function(){return g(this,null,function*(){var r,s,n;if(l(this,te))return;let t={socketUrl:l(this,dt)};l(this,ue).emit("socket.connect.pending",{args:t}),E(this,te,Gt(l(this,dt),{reconnectionDelayMax:1e4,transports:["websocket"],query:{token:`${l(this,ut)}`}})),l(this,te).on("connect",()=>{l(this,ue).emit("socket.connect.resolved",{args:t})}),l(this,te).on("connect_error",o=>{l(this,ue).emit("socket.connect.resolved",{args:t,error:o})}),(r=l(this,te))==null||r.on("notification_received",l(this,Fi)),(s=l(this,te))==null||s.on("unseen_count_changed",l(this,Bi)),(n=l(this,te))==null||n.on("unread_count_changed",l(this,Ui))})},Fr=function(){return g(this,null,function*(){try{return yield Ke(this,ge,to).call(this),{}}catch(t){return{error:new I("Failed to initialize the socket",t)}}})},Br=function(){return g(this,null,function*(){var t;try{return(t=l(this,te))==null||t.disconnect(),E(this,te,void 0),{}}catch(r){return{error:new I("Failed to disconnect from the socket",r)}}})};var ye,He,Pe,Di=class{constructor(e){_(this,ye);_(this,He);_(this,Pe);var t,r;E(this,Pe,new Zt({apiUrl:e.apiUrl||e.backendUrl,userAgent:e.__userAgent})),E(this,ye,new ei),E(this,He,new ci({applicationIdentifier:e.applicationIdentifier,subscriberId:e.subscriberId,subscriberHash:e.subscriberHash},l(this,Pe),l(this,ye))),l(this,He).initialize(),this.notifications=new ni({useCache:(t=e.useCache)!=null?t:!0,inboxServiceInstance:l(this,Pe),eventEmitterInstance:l(this,ye)}),this.preferences=new ai({useCache:(r=e.useCache)!=null?r:!0,inboxServiceInstance:l(this,Pe),eventEmitterInstance:l(this,ye)}),this.socket=new Li({socketUrl:e.socketUrl,eventEmitterInstance:l(this,ye),inboxServiceInstance:l(this,Pe)}),this.on=(s,n)=>{this.socket.isSocketEvent(s)&&this.socket.connect();let o=l(this,ye).on(s,n);return()=>{o()}},this.off=(s,n)=>{l(this,ye).off(s,n)}}get applicationIdentifier(){return l(this,He).applicationIdentifier}get subscriberId(){return l(this,He).subscriberId}};ye=new WeakMap,He=new WeakMap,Pe=new WeakMap;window.Novu=Di;})();
|
|
14
|
+
`+n),i.push(s+"m+"+Oi.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Oc()+e+" "+i[0]}function Oc(){return W.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ic(...i){return process.stderr.write(Ti.formatWithOptions(W.inspectOpts,...i)+`
|
|
15
|
+
`)}function Pc(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Lc(){return process.env.DEBUG}function Fc(i){i.inspectOpts={};let e=Object.keys(W.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=W.inspectOpts[e[t]]}Oi.exports=Sr()(W);var{formatters:Un}=Oi.exports;Un.o=function(i){return this.inspectOpts.colors=this.useColors,Ti.inspect(i,this.inspectOpts).split(`
|
|
16
|
+
`).map(e=>e.trim()).join(" ")};Un.O=function(i){return this.inspectOpts.colors=this.useColors,Ti.inspect(i,this.inspectOpts)}});var qt=T((Dh,wr)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?wr.exports=Bn():wr.exports=Dn()});var po="v1",mo="https://api.novu.co",go=`${PACKAGE_NAME}@${PACKAGE_VERSION}`,Xt=class{constructor(e={}){let{apiVersion:t=po,apiUrl:r=mo,userAgent:s=go}=e||{};this.apiVersion=t,this.apiUrl=`${r}/${this.apiVersion}`,this.headers={"Novu-API-Version":NOVU_API_VERSION,"Content-Type":"application/json","User-Agent":s}}setAuthorizationToken(e){this.headers.Authorization=`Bearer ${e}`}setHeaders(e){this.headers=b(b({},this.headers),e)}get(e,t,r=!0){return g(this,null,function*(){return this.doFetch({path:e,searchParams:t,options:{method:"GET"},unwrapEnvelope:r})})}post(e,t){return g(this,null,function*(){return this.doFetch({path:e,options:{method:"POST",body:t}})})}patch(e,t){return g(this,null,function*(){return this.doFetch({path:e,options:{method:"PATCH",body:t}})})}delete(e,t){return g(this,null,function*(){return this.doFetch({path:e,options:{method:"DELETE",body:t}})})}doFetch(n){return g(this,arguments,function*({path:e,searchParams:t,options:r,unwrapEnvelope:s=!0}){let o=yo(this.apiUrl,e,t?`?${t.toString()}`:""),c={method:(r==null?void 0:r.method)||"GET",headers:b(b({},this.headers),(r==null?void 0:r.headers)||{}),body:r!=null&&r.body?JSON.stringify(r.body):void 0},a=yield fetch(o,c);if(!a.ok){let f=yield a.json();throw new Error(`${this.headers["User-Agent"]} error. Status: ${a.status}, Message: ${f.message}`)}if(a.status===204)return;let u=yield a.json();return s?u.data:u})}};function yo(...i){return i.reduce((e,t)=>(t&&e.push(t.replace(new RegExp("(?<!https?:)\\/+","g"),"/").replace(/^\/+|\/+$/g,"")),e),[]).join("/").replace(/\/\?/,"?")}var mt="/inbox",ae=`${mt}/notifications`,F,Jt=class{constructor(e={}){this.isSessionInitialized=!1;_(this,F);E(this,F,new Xt(e))}initializeSession(s){return g(this,arguments,function*({applicationIdentifier:e,subscriberHash:t,subscriber:r}){let n=yield l(this,F).post(`${mt}/session`,{applicationIdentifier:e,subscriberHash:t,subscriber:r});return l(this,F).setAuthorizationToken(n.token),this.isSessionInitialized=!0,n})}fetchNotifications({after:e,archived:t,limit:r=10,offset:s,read:n,tags:o}){let c=new URLSearchParams(`limit=${r}`);return e&&c.append("after",e),s&&c.append("offset",`${s}`),o&&o.forEach(a=>c.append("tags[]",a)),n!==void 0&&c.append("read",`${n}`),t!==void 0&&c.append("archived",`${t}`),l(this,F).get(ae,c,!1)}count({filters:e}){return l(this,F).get(`${ae}/count`,new URLSearchParams({filters:JSON.stringify(e)}),!1)}read(e){return l(this,F).patch(`${ae}/${e}/read`)}unread(e){return l(this,F).patch(`${ae}/${e}/unread`)}archive(e){return l(this,F).patch(`${ae}/${e}/archive`)}unarchive(e){return l(this,F).patch(`${ae}/${e}/unarchive`)}readAll({tags:e}){return l(this,F).post(`${ae}/read`,{tags:e})}archiveAll({tags:e}){return l(this,F).post(`${ae}/archive`,{tags:e})}archiveAllRead({tags:e}){return l(this,F).post(`${ae}/read-archive`,{tags:e})}completeAction({actionType:e,notificationId:t}){return l(this,F).patch(`${ae}/${t}/complete`,{actionType:e})}revertAction({actionType:e,notificationId:t}){return l(this,F).patch(`${ae}/${t}/revert`,{actionType:e})}fetchPreferences(e){let t=new URLSearchParams;e&&e.forEach(s=>t.append("tags[]",s));let r=t.size?`?${t.toString()}`:"";return l(this,F).get(`${mt}/preferences${r}`)}updateGlobalPreferences(e){return l(this,F).patch(`${mt}/preferences`,e)}updateWorkflowPreferences({workflowId:e,channels:t}){return l(this,F).patch(`${mt}/preferences/${e}`,t)}};F=new WeakMap;function $r(i){return{all:i=i||new Map,on:function(e,t){var r=i.get(e);r?r.push(t):i.set(e,[t])},off:function(e,t){var r=i.get(e);r&&(t?r.splice(r.indexOf(t)>>>0,1):i.set(e,[]))},emit:function(e,t){var r=i.get(e);r&&r.slice().map(function(s){s(t)}),(r=i.get("*"))&&r.slice().map(function(s){s(e,t)})}}}var Le,Qt=class{constructor(){_(this,Le);E(this,Le,$r())}on(e,t){return l(this,Le).on(e,t),()=>{this.off(e,t)}}off(e,t){l(this,Le).off(e,t)}emit(e,t){l(this,Le).emit(e,t)}};Le=new WeakMap;var I=class extends Error{constructor(e,t){super(e),this.originalError=t}};var Se,Ke,we=class{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){_(this,Se,[]);_(this,Ke);this._emitter=t,this._inboxService=e,this._emitter.on("session.initialize.resolved",({error:r,data:s})=>{s?(this.onSessionSuccess(s),l(this,Se).forEach(c=>g(this,[c],function*({fn:n,resolve:o}){o(yield n())})),E(this,Se,[])):r&&(this.onSessionError(r),E(this,Ke,r),l(this,Se).forEach(({resolve:n})=>{n({error:new I("Failed to initialize session, please contact the support",r)})}),E(this,Se,[]))})}onSessionSuccess(e){}onSessionError(e){}callWithSession(e){return g(this,null,function*(){return this._inboxService.isSessionInitialized?e():l(this,Ke)?Promise.resolve({error:new I("Failed to initialize session, please contact the support",l(this,Ke))}):new Promise((t,r)=>{l(this,Se).push({fn:e,resolve:t,reject:r})})})}};Se=new WeakMap,Ke=new WeakMap;var Y,se,j=class{constructor(e,t,r){_(this,Y);_(this,se);E(this,Y,t),E(this,se,r),this.id=e.id,this.subject=e.subject,this.body=e.body,this.to=e.to,this.isRead=e.isRead,this.isArchived=e.isArchived,this.createdAt=e.createdAt,this.readAt=e.readAt,this.archivedAt=e.archivedAt,this.avatar=e.avatar,this.primaryAction=e.primaryAction,this.secondaryAction=e.secondaryAction,this.channelType=e.channelType,this.tags=e.tags,this.redirect=e.redirect,this.data=e.data,this.workflow=e.workflow}read(){return Zt({emitter:l(this,Y),apiService:l(this,se),args:{notification:this}})}unread(){return ei({emitter:l(this,Y),apiService:l(this,se),args:{notification:this}})}archive(){return ti({emitter:l(this,Y),apiService:l(this,se),args:{notification:this}})}unarchive(){return ii({emitter:l(this,Y),apiService:l(this,se),args:{notification:this}})}completePrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Ye({emitter:l(this,Y),apiService:l(this,se),args:{notification:this},actionType:"primary"})}completeSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Ye({emitter:l(this,Y),apiService:l(this,se),args:{notification:this},actionType:"secondary"})}revertPrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Xe({emitter:l(this,Y),apiService:l(this,se),args:{notification:this},actionType:"primary"})}revertSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Xe({emitter:l(this,Y),apiService:l(this,se),args:{notification:this},actionType:"secondary"})}on(e,t){let r=l(this,Y).on(e,t);return()=>{r()}}off(e,t){l(this,Y).off(e,t)}};Y=new WeakMap,se=new WeakMap;var Zt=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Je(t,{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.read.pending",{args:t,data:n});let o=yield e.read(s),c=new j(o,i,e);return i.emit("notification.read.resolved",{args:t,data:c}),{data:c}}catch(o){return i.emit("notification.read.resolved",{args:t,error:o}),{error:new I("Failed to read notification",o)}}}),ei=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Je(t,{isRead:!1,readAt:null,isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.unread.pending",{args:t,data:n});let o=yield e.unread(s),c=new j(o,i,e);return i.emit("notification.unread.resolved",{args:t,data:c}),{data:c}}catch(o){return i.emit("notification.unread.resolved",{args:t,error:o}),{error:new I("Failed to unread notification",o)}}}),ti=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Je(t,{isArchived:!0,archivedAt:new Date().toISOString(),isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.archive.pending",{args:t,data:n});let o=yield e.archive(s),c=new j(o,i,e);return i.emit("notification.archive.resolved",{args:t,data:c}),{data:c}}catch(o){return i.emit("notification.archive.resolved",{args:t,error:o}),{error:new I("Failed to archive notification",o)}}}),ii=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:s,optimisticValue:n}=Je(t,{isArchived:!1,archivedAt:null,isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.unarchive.pending",{args:t,data:n});let o=yield e.unarchive(s),c=new j(o,i,e);return i.emit("notification.unarchive.resolved",{args:t,data:c}),{data:c}}catch(o){return i.emit("notification.unarchive.resolved",{args:t,error:o}),{error:new I("Failed to unarchive notification",o)}}}),Ye=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:O(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!0})}:{secondaryAction:O(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!0})},{notificationId:o,optimisticValue:c}=Je(t,n,{emitter:i,apiService:e});try{i.emit("notification.complete_action.pending",{args:t,data:c});let a=yield e.completeAction({actionType:r,notificationId:o}),u=new j(a,i,e);return i.emit("notification.complete_action.resolved",{args:t,data:u}),{data:u}}catch(a){return i.emit("notification.complete_action.resolved",{args:t,error:a}),{error:new I(`Failed to complete ${r} action on the notification`,a)}}}),Xe=s=>g(void 0,[s],function*({emitter:i,apiService:e,args:t,actionType:r}){let n=r==="primary"?{primaryAction:O(b({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!1})}:{secondaryAction:O(b({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!1})},{notificationId:o,optimisticValue:c}=Je(t,n,{emitter:i,apiService:e});try{i.emit("notification.revert_action.pending",{args:t,data:c});let a=yield e.revertAction({actionType:r,notificationId:o}),u=new j(a,i,e);return i.emit("notification.revert_action.resolved",{args:t,data:u}),{data:u}}catch(a){return i.emit("notification.revert_action.resolved",{args:t,error:a}),{error:new I("Failed to fetch notifications",a)}}}),Je=(i,e,t)=>"notification"in i?{notificationId:i.notification.id,optimisticValue:new j(b(b({},i.notification),e),t.emitter,t.apiService)}:{notificationId:i.notificationId},Vr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(c=>new j(O(b({},c),{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0}),i,e));return i.emit("notifications.read_all.pending",{args:{tags:r},data:o}),yield e.readAll({tags:r}),i.emit("notifications.read_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.read_all.resolved",{args:{tags:r},error:n}),{error:new I("Failed to read all notifications",n)}}}),jr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r}).map(c=>new j(O(b({},c),{isRead:!0,readAt:new Date().toISOString(),isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all.pending",{args:{tags:r},data:o}),yield e.archiveAll({tags:r}),i.emit("notifications.archive_all.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all.resolved",{args:{tags:r},error:n}),{error:new I("Failed to archive all notifications",n)}}}),Hr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r}){try{let o=t.getUniqueNotifications({tags:r,read:!0}).map(c=>new j(O(b({},c),{isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all_read.pending",{args:{tags:r},data:o}),yield e.archiveAllRead({tags:r}),i.emit("notifications.archive_all_read.resolved",{args:{tags:r},data:o}),{}}catch(n){return i.emit("notifications.archive_all_read.resolved",{args:{tags:r},error:n}),{error:new I("Failed to archive all read notifications",n)}}});var Gr=(i,e)=>i===e?!0:!i||!e||i.length!==e.length?!1:i.every((t,r)=>t===e[r]);var yl=["seen","unseen"],vl=["read","unread"],Mi=(i,e)=>Gr(i,e)||!i&&(e==null?void 0:e.length)===0||(i==null?void 0:i.length)===0&&!e,qi=(i,e)=>Mi(i.tags,e.tags)&&i.read===e.read&&i.archived===e.archived;var ce,Qe=class{constructor(){_(this,ce);E(this,ce,new Map)}get(e){return l(this,ce).get(e)}getValues(){return Array.from(l(this,ce).values())}entries(){return Array.from(l(this,ce).entries())}keys(){return Array.from(l(this,ce).keys())}set(e,t){l(this,ce).set(e,t)}remove(e){l(this,ce).delete(e)}clear(){l(this,ce).clear()}};ce=new WeakMap;var zr=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>Object.entries({tags:i,read:e,archived:t,limit:r,offset:s,after:n}).filter(([o,c])=>c!=null&&!(Array.isArray(c)&&c.length===0)).reduce((o,[c,a])=>(o[c]=a,o),{}),Wi=({tags:i,read:e,archived:t,limit:r,offset:s,after:n})=>JSON.stringify(zr({tags:i,read:e,archived:t,limit:r,offset:s,after:n})),vo=({tags:i,read:e,archived:t})=>JSON.stringify(zr({tags:i,read:e,archived:t})),Ze=i=>JSON.parse(i),_o=["notification.read.pending","notification.read.resolved","notification.unread.pending","notification.unread.resolved","notification.complete_action.pending","notification.complete_action.resolved","notification.revert_action.pending","notification.revert_action.resolved","notifications.read_all.pending","notifications.read_all.resolved"],Eo=["notification.archive.pending","notification.unarchive.pending","notifications.archive_all.pending","notifications.archive_all_read.pending"],Ne,D,gt=class{constructor({emitter:e}){_(this,Ne);_(this,D);this.updateNotification=(e,t)=>{let r=l(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n[s]=t,l(this,D).set(e,O(b({},r),{notifications:n})),!0};this.removeNotification=(e,t)=>{let r=l(this,D).get(e);if(!r)return!1;let s=r.notifications.findIndex(o=>o.id===t.id);if(s===-1)return!1;let n=[...r.notifications];return n.splice(s,1),l(this,D).set(e,O(b({},r),{notifications:n})),!0};this.handleNotificationEvent=({remove:e}={remove:!1})=>({data:t})=>{if(!t)return;let r=Array.isArray(t)?t:[t],s=new Set;l(this,D).keys().forEach(n=>{r.forEach(o=>{let c=!1;e?c=this.removeNotification(n,o):c=this.updateNotification(n,o),c&&s.add(vo(Ze(n)))})}),s.forEach(n=>{let o=this.getAggregated(Ze(n));l(this,Ne).emit("notifications.list.updated",{data:o})})};E(this,Ne,e),_o.forEach(t=>{l(this,Ne).on(t,this.handleNotificationEvent())}),Eo.forEach(t=>{l(this,Ne).on(t,this.handleNotificationEvent({remove:!0}))}),E(this,D,new Qe)}getAggregated(e){return l(this,D).keys().filter(r=>{let s=Ze(r);return qi(s,e)}).map(r=>l(this,D).get(r)).reduce((r,s)=>s?{hasMore:s.hasMore,filter:s.filter,notifications:[...r.notifications,...s.notifications]}:r,{hasMore:!1,filter:{},notifications:[]})}has(e){return l(this,D).get(Wi(e))!==void 0}set(e,t){l(this,D).set(Wi(e),t)}update(e,t){this.set(e,t);let r=this.getAggregated(Ze(Wi(e)));l(this,Ne).emit("notifications.list.updated",{data:r})}getAll(e){if(this.has(e))return this.getAggregated({tags:e.tags,read:e.read,archived:e.archived})}getUniqueNotifications({tags:e,read:t}){let r=l(this,D).keys(),s=new Map;return r.forEach(n=>{let o=Ze(n);if(Mi(e,o.tags)){let c=l(this,D).get(n);if(!c)return;c.notifications.filter(a=>typeof t=="undefined"||t===a.isRead).forEach(a=>s.set(a.id,a))}}),Array.from(s.values())}clear(e){l(this,D).keys().forEach(r=>{qi(Ze(r),e)&&l(this,D).remove(r)})}clearAll(){l(this,D).clear()}};Ne=new WeakMap,D=new WeakMap;var yt,ri=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,yt);this.cache=new gt({emitter:s}),E(this,yt,t)}list(){return g(this,arguments,function*(s={}){var n=s,{limit:t=10}=n,r=Wr(n,["limit"]);return this.callWithSession(()=>g(this,null,function*(){let o=b({limit:t},r);try{let c="useCache"in o?o.useCache:l(this,yt),a=c?this.cache.getAll(o):void 0;if(this._emitter.emit("notifications.list.pending",{args:o,data:a}),!a){let u=yield this._inboxService.fetchNotifications(b({limit:t},r));a={hasMore:u.hasMore,filter:u.filter,notifications:u.data.map(f=>new j(f,this._emitter,this._inboxService))},c&&(this.cache.set(o,a),a=this.cache.getAll(o))}return this._emitter.emit("notifications.list.resolved",{args:o,data:a}),{data:a}}catch(c){return this._emitter.emit("notifications.list.resolved",{args:o,error:c}),{error:new I("Failed to fetch notifications",c)}}}))})}count(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){let r=t&&"filters"in t?t.filters:[b({},t)];try{this._emitter.emit("notifications.count.pending",{args:t});let s=yield this._inboxService.count({filters:r}),n=t&&"filters"in t?{counts:s.data}:s.data[0];return this._emitter.emit("notifications.count.resolved",{args:t,data:n}),{data:n}}catch(s){return this._emitter.emit("notifications.count.resolved",{args:t,error:s}),{error:new I("Failed to count notifications",s)}}}))})}read(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Zt({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unread(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ei({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}archive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ti({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unarchive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ii({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}completePrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Ye({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}completeSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Ye({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}revertPrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Xe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"primary"})}))})}revertSecondary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Xe({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}readAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Vr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAll(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return jr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}archiveAllRead(){return g(this,arguments,function*({tags:t}={}){return this.callWithSession(()=>g(this,null,function*(){return Hr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t})}))})}clearCache({filter:t}={}){return t?this.cache.clear(t!=null?t:{}):this.cache.clearAll()}};yt=new WeakMap;var Kr=n=>g(void 0,[n],function*({emitter:i,apiService:e,cache:t,useCache:r,args:s}){let{workflowId:o,channels:c}=s;try{i.emit("preference.update.pending",{args:s,data:s.preference?new Ae(O(b({},s.preference),{channels:b(b({},s.preference.channels),c)}),{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0});let a;o?a=yield e.updateWorkflowPreferences({workflowId:o,channels:c}):(bo({emitter:i,apiService:e,cache:t,useCache:r,args:s}),a=yield e.updateGlobalPreferences(c));let u=new Ae(a,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r});return i.emit("preference.update.resolved",{args:s,data:u}),{data:u}}catch(a){return i.emit("preference.update.resolved",{args:s,error:a}),{error:new I("Failed to fetch notifications",a)}}}),bo=({emitter:i,apiService:e,cache:t,useCache:r,args:s})=>{let n=r?t==null?void 0:t.getAll({}):void 0;n==null||n.forEach(o=>{var c;if(o.level==="template"){let a=O(b({},o),{channels:Object.entries(o.channels).reduce((f,[h,d])=>{var S;let x=h;return f[x]=(S=s.channels[x])!=null?S:d,f},{})}),u=s.preference?new Ae(a,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0;u&&i.emit("preference.update.pending",{args:{workflowId:(c=o.workflow)==null?void 0:c.id,channels:u.channels},data:u})}})};var vt,_t,Et,bt,Ae=class{constructor(e,{emitterInstance:t,inboxServiceInstance:r,cache:s,useCache:n}){_(this,vt);_(this,_t);_(this,Et);_(this,bt);E(this,vt,t),E(this,_t,r),E(this,Et,s),E(this,bt,n),this.level=e.level,this.enabled=e.enabled,this.channels=e.channels,this.workflow=e.workflow}update({channels:e,channelPreferences:t}){var r;return Kr({emitter:l(this,vt),apiService:l(this,_t),cache:l(this,Et),useCache:l(this,bt),args:{workflowId:(r=this.workflow)==null?void 0:r.id,channels:e||t,preference:{level:this.level,enabled:this.enabled,channels:this.channels,workflow:this.workflow}}})}};vt=new WeakMap,_t=new WeakMap,Et=new WeakMap,bt=new WeakMap;var xo=["preference.update.pending","preference.update.resolved"],Co=({tags:i})=>Object.entries({tags:i}).reduce((e,[t,r])=>(r==null||Array.isArray(r)&&r.length===0||(e[t]=r),e),{}),$i=({tags:i})=>JSON.stringify(Co({tags:i})),et,ne,si=class{constructor({emitterInstance:e}){_(this,et);_(this,ne);this.updatePreference=(e,t)=>{let r=l(this,ne).get(e);if(!r)return!1;let s=r.findIndex(o=>{var c,a;return((c=o.workflow)==null?void 0:c.id)===((a=t.workflow)==null?void 0:a.id)||o.level===t.level&&t.level==="global"});if(s===-1)return!1;let n=[...r];return n[s]=t,l(this,ne).set(e,n),!0};this.handlePreferenceEvent=({data:e})=>{e&&l(this,ne).keys().forEach(t=>{let r=this.updatePreference(t,e),s=l(this,ne).get(t);!r||!s||l(this,et).emit("preferences.list.updated",{data:s})})};E(this,et,e),xo.forEach(t=>{l(this,et).on(t,this.handlePreferenceEvent)}),E(this,ne,new Qe)}has(e){return l(this,ne).get($i(e))!==void 0}set(e,t){l(this,ne).set($i(e),t)}getAll(e){if(this.has(e))return l(this,ne).get($i(e))}clearAll(){l(this,ne).clear()}};et=new WeakMap,ne=new WeakMap;var Fe,ni=class extends we{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,Fe);this.cache=new si({emitterInstance:this._emitter}),E(this,Fe,t)}list(){return g(this,arguments,function*(t={}){return this.callWithSession(()=>g(this,null,function*(){try{let r=l(this,Fe)?this.cache.getAll(t):void 0;return this._emitter.emit("preferences.list.pending",{args:t,data:r}),r||(r=(yield this._inboxService.fetchPreferences(t.tags)).map(n=>new Ae(n,{emitterInstance:this._emitter,inboxServiceInstance:this._inboxService,cache:this.cache,useCache:l(this,Fe)})),l(this,Fe)&&(this.cache.set(t,r),r=this.cache.getAll(t))),this._emitter.emit("preferences.list.resolved",{args:t,data:r}),{data:r}}catch(r){throw this._emitter.emit("preferences.list.resolved",{args:t,error:r}),r}}))})}};Fe=new WeakMap;var Be,xt,pe,oi=class{constructor(e,t,r){_(this,Be);_(this,xt);_(this,pe);E(this,Be,r),E(this,xt,t),E(this,pe,e)}get applicationIdentifier(){return l(this,pe).applicationIdentifier}get subscriberId(){return l(this,pe).subscriber.subscriberId}initialize(){return g(this,null,function*(){try{let{applicationIdentifier:e,subscriberHash:t,subscriber:r}=l(this,pe);l(this,Be).emit("session.initialize.pending",{args:l(this,pe)});let s=yield l(this,xt).initializeSession({applicationIdentifier:e,subscriberHash:t,subscriber:r});l(this,Be).emit("session.initialize.resolved",{args:l(this,pe),data:s})}catch(e){l(this,Be).emit("session.initialize.resolved",{args:l(this,pe),error:e})}})}};Be=new WeakMap,xt=new WeakMap,pe=new WeakMap;var le=Object.create(null);le.open="0";le.close="1";le.ping="2";le.pong="3";le.message="4";le.upgrade="5";le.noop="6";var Ct=Object.create(null);Object.keys(le).forEach(i=>{Ct[le[i]]=i});var St={type:"error",data:"parser error"};var wt=({type:i,data:e},t,r)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?r(t?e:"b"+Yr(e,!0).toString("base64")):r(le[i]+(e||"")),Yr=(i,e)=>Buffer.isBuffer(i)||i instanceof Uint8Array&&!e?i:i instanceof ArrayBuffer?Buffer.from(i):Buffer.from(i.buffer,i.byteOffset,i.byteLength),Vi;function Xr(i,e){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return e(Yr(i.data,!1));wt(i,!0,t=>{Vi||(Vi=new TextEncoder),e(Vi.encode(t))})}var Nt=(i,e)=>{if(typeof i!="string")return{type:"message",data:Jr(i,e)};let t=i.charAt(0);if(t==="b"){let r=Buffer.from(i.substring(1),"base64");return{type:"message",data:Jr(r,e)}}return Ct[t]?i.length>1?{type:Ct[t],data:i.substring(1)}:{type:Ct[t]}:St},Jr=(i,e)=>{switch(e){case"arraybuffer":return i instanceof ArrayBuffer?i:Buffer.isBuffer(i)?i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength):i.buffer;case"nodebuffer":default:return Buffer.isBuffer(i)?i:Buffer.from(i)}};var Qr="",Zr=(i,e)=>{let t=i.length,r=new Array(t),s=0;i.forEach((n,o)=>{wt(n,!1,c=>{r[o]=c,++s===t&&e(r.join(Qr))})})},es=(i,e)=>{let t=i.split(Qr),r=[];for(let s=0;s<t.length;s++){let n=Nt(t[s],e);if(r.push(n),n.type==="error")break}return r};function ts(){return new TransformStream({transform(i,e){Xr(i,t=>{let r=t.length,s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,r)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(r))}i.data&&typeof i.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(t)})}})}var ji;function ai(i){return i.reduce((e,t)=>e+t.length,0)}function ci(i,e){if(i[0].length===e)return i.shift();let t=new Uint8Array(e),r=0;for(let s=0;s<e;s++)t[s]=i[0][r++],r===i[0].length&&(i.shift(),r=0);return i.length&&r<i[0].length&&(i[0]=i[0].slice(r)),t}function is(i,e){ji||(ji=new TextDecoder);let t=[],r=0,s=-1,n=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(r===0){if(ai(t)<1)break;let a=ci(t,1);n=(a[0]&128)===128,s=a[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(ai(t)<2)break;let a=ci(t,2);s=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),r=3}else if(r===2){if(ai(t)<8)break;let a=ci(t,8),u=new DataView(a.buffer,a.byteOffset,a.length),f=u.getUint32(0);if(f>Math.pow(2,21)-1){c.enqueue(St);break}s=f*Math.pow(2,32)+u.getUint32(4),r=3}else{if(ai(t)<s)break;let a=ci(t,s);c.enqueue(Nt(n?a:ji.decode(a),e)),r=0}if(s===0||s>i){c.enqueue(St);break}}}})}var Hi=4;function R(i){if(i)return So(i)}function So(i){for(var e in R.prototype)i[e]=R.prototype[e];return i}R.prototype.on=R.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this};R.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this};R.prototype.off=R.prototype.removeListener=R.prototype.removeAllListeners=R.prototype.removeEventListener=function(i,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+i];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+i],this;for(var r,s=0;s<t.length;s++)if(r=t[s],r===e||r.fn===e){t.splice(s,1);break}return t.length===0&&delete this._callbacks["$"+i],this};R.prototype.emit=function(i){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+i],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(t){t=t.slice(0);for(var r=0,s=t.length;r<s;++r)t[r].apply(this,e)}return this};R.prototype.emitReserved=R.prototype.emit;R.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};R.prototype.hasListeners=function(i){return!!this.listeners(i).length};var fe=global;function li(i,...e){return e.reduce((t,r)=>(i.hasOwnProperty(r)&&(t[r]=i[r]),t),{})}var wo=fe.setTimeout,No=fe.clearTimeout;function ve(i,e){e.useNativeTimers?(i.setTimeoutFn=wo.bind(fe),i.clearTimeoutFn=No.bind(fe)):(i.setTimeoutFn=fe.setTimeout.bind(fe),i.clearTimeoutFn=fe.clearTimeout.bind(fe))}var Ao=1.33;function rs(i){return typeof i=="string"?ko(i):Math.ceil((i.byteLength||i.size)*Ao)}function ko(i){let e=0,t=0;for(let r=0,s=i.length;r<s;r++)e=i.charCodeAt(r),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(r++,t+=4);return t}var ms=z(De(),1);function ds(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function ps(i){let e={},t=i.split("&");for(let r=0,s=t.length;r<s;r++){let n=t[r].split("=");e[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return e}var Jo=(0,ms.default)("engine.io-client:transport"),Qi=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},_e=class extends R{constructor(e){super(),this.writable=!1,ve(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new Qi(e,t,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"?this.write(e):Jo("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=Nt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){let t=ds(e);return t.length?"?"+t:""}};var ws=z(De(),1);var _s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Zi=64,Qo={},gs=0,pi=0,ys;function vs(i){let e="";do e=_s[i%Zi]+e,i=Math.floor(i/Zi);while(i>0);return e}function mi(){let i=vs(+new Date);return i!==ys?(gs=0,ys=i):i+"."+vs(gs++)}for(;pi<Zi;pi++)Qo[_s[pi]]=pi;var ir=z(xs(),1),rr=ir.default||ir;function Cs(){return new tr}function ea(i){let e=i.split("; "),t=e[0].indexOf("=");if(t===-1)return;let r=e[0].substring(0,t).trim();if(!r.length)return;let s=e[0].substring(t+1).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));let n={name:r,value:s};for(let o=1;o<e.length;o++){let c=e[o].split("=");if(c.length!==2)continue;let a=c[0].trim(),u=c[1].trim();switch(a){case"Expires":n.expires=new Date(u);break;case"Max-Age":let f=new Date;f.setUTCSeconds(f.getUTCSeconds()+parseInt(u,10)),n.expires=f;break;default:}}return n}var tr=class{constructor(){this.cookies=new Map}parseCookies(e){let t=e.getResponseHeader("set-cookie");t&&t.forEach(r=>{let s=ea(r);s&&this.cookies.set(s.name,s)})}addCookies(e){let t=[];this.cookies.forEach((r,s)=>{var n;((n=r.expires)===null||n===void 0?void 0:n.getTime())<Date.now()?this.cookies.delete(s):t.push(`${s}=${r.value}`)}),t.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",t.join("; ")))}};var X=(0,ws.default)("engine.io-client:polling");function ta(){}var ia=function(){return new rr({xdomain:!1}).responseType!=null}(),gi=class extends _e{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){let r=location.protocol==="https:",s=location.port;s||(s=r?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||s!==e.port}let t=e&&e.forceBase64;this.supportsBinary=ia&&!t,this.opts.withCredentials&&(this.cookieJar=Cs())}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";let t=()=>{X("paused"),this.readyState="paused",e()};if(this.polling||!this.writable){let r=0;this.polling&&(X("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){X("pre-pause polling complete"),--r||t()})),this.writable||(X("we are currently writing - waiting to pause"),r++,this.once("drain",function(){X("pre-pause writing complete"),--r||t()}))}else t()}poll(){X("polling"),this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){X("polling got data %s",e);let t=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};es(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"?this.poll():X('ignoring poll - transport state "%s"',this.readyState))}doClose(){let e=()=>{X("writing close packet"),this.write([{type:"close"}])};this.readyState==="open"?(X("transport open - closing"),e()):(X("transport not open - deferring close"),this.once("open",e))}write(e){this.writable=!1,Zr(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=mi()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Re(this.uri(),e)}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){X("xhr poll");let e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,r)=>{this.onError("xhr poll error",t,r)}),this.pollXhr=e}},Re=class i extends R{constructor(e,t){super(),ve(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;let t=li(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let r=this.xhr=new rr(t);try{X("xhr open %s: %s",this.method,this.uri),r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this.opts.extraHeaders[s])}}catch(s){}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(s){}try{r.setRequestHeader("Accept","*/*")}catch(s){}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this.opts.cookieJar)===null||s===void 0||s.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},X("xhr data %s",this.data),r.send(this.data)}catch(s){this.setTimeoutFn(()=>{this.onError(s)},0);return}typeof document!="undefined"&&(this.index=i.requestsCount++,i.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.xhr.onreadystatechange=ta,e)try{this.xhr.abort()}catch(t){}typeof document!="undefined"&&delete i.requests[this.index],this.xhr=null}}onLoad(){let e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Re.requestsCount=0;Re.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Ss);else if(typeof addEventListener=="function"){let i="onpagehide"in fe?"pagehide":"unload";addEventListener(i,Ss,!1)}}function Ss(){for(let i in Re.requests)Re.requests.hasOwnProperty(i)&&Re.requests[i].abort()}var uc=z(Rs(),1),dc=z(ur(),1),pc=z(pr(),1),kn=z(br(),1),mc=z(An(),1);var Rn=kn.default;var Dt=Rn,Ni=!1,Tn="nodebuffer",$e=process.nextTick;var In=z(De(),1);var gc=(0,In.default)("engine.io-client:websocket"),On=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Ai=class extends _e{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;let e=this.uri(),t=this.opts.protocols,r=On?{}:li(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=Ni&&!On?t?new Dt(e,t):new Dt(e):new Dt(e,t,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;wt(r,this.supportsBinary,n=>{let o={};Ni||(r.options&&(o.compress=r.options.compress),this.opts.perMessageDeflate&&(typeof n=="string"?Buffer.byteLength(n):n.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{Ni?this.ws.send(n):this.ws.send(n,o)}catch(c){gc("websocket closed before onclose event")}s&&$e(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws!="undefined"&&(this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=mi()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Dt}};var Pn=z(De(),1),Mt=(0,Pn.default)("engine.io-client:webtransport"),ki=class extends _e{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{Mt("transport closed gracefully"),this.onClose()}).catch(e=>{Mt("transport closed due to %s",e),this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t=is(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),s=ts();s.readable.pipeTo(e.writable),this.writer=s.writable.getWriter();let n=()=>{r.read().then(({done:c,value:a})=>{if(c){Mt("session is closed");return}Mt("received chunk: %o",a),this.onPacket(a),n()}).catch(c=>{Mt("an error occurred while reading: %s",c)})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this.writer.write(o).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let r=e[t],s=t===e.length-1;this.writer.write(r).then(()=>{s&&$e(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}};var Cr={websocket:Ai,webtransport:ki,polling:gi};var yc=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ct(i){let e=i,t=i.indexOf("["),r=i.indexOf("]");t!=-1&&r!=-1&&(i=i.substring(0,t)+i.substring(t,r).replace(/:/g,";")+i.substring(r,i.length));let s=yc.exec(i||""),n={},o=14;for(;o--;)n[vc[o]]=s[o]||"";return t!=-1&&r!=-1&&(n.source=e,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=_c(n,n.path),n.queryKey=Ec(n,n.query),n}function _c(i,e){let t=/\/{2,9}/g,r=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Ec(i,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,n){s&&(t[s]=n)}),t}var Ln=z(De(),1);var P=(0,Ln.default)("engine.io-client:socket"),Ve=class i extends R{constructor(e,t={}){super(),this.binaryType=Tn,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=ct(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ct(t.host).host),ve(this,t),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ps(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){P('creating transport "%s"',e);let t=Object.assign({},this.opts.query);t.EIO=Hi,t.transport=e,this.id&&(t.sid=this.id);let r=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return P("options: %j",r),new Cr[e](r)}open(){let e;if(this.opts.rememberUpgrade&&i.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(t){P("error while creating transport: %s",t),this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){P("setting transport %s",e.name),this.transport&&(P("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){P('probing transport "%s"',e);let t=this.createTransport(e),r=!1;i.priorWebsocketSuccess=!1;let s=()=>{r||(P('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(P('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;i.priorWebsocketSuccess=t.name==="websocket",P('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||this.readyState!=="closed"&&(P("changing transport and sending upgrade packet"),f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{P('probe transport "%s" failed',e);let d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function n(){r||(r=!0,f(),t.close(),t=null)}let o=h=>{let d=new Error("probe error: "+h);d.transport=t.name,n(),P('probe transport "%s" failed because of error: %s',e,h),this.emitReserved("upgradeError",d)};function c(){o("transport closed")}function a(){o("socket closed")}function u(h){t&&h.name!==t.name&&(P('"%s" works - aborting "%s"',h.name,t.name),n())}let f=()=>{t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",c),this.off("close",a),this.off("upgrading",u)};t.once("open",s),t.once("error",o),t.once("close",c),this.once("close",a),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(P("socket open"),this.readyState="open",i.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){P("starting upgrade probes");let e=0,t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(P('socket receive: type "%s", data "%s"',e.type,e.data),this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":let t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}else P('packet received with socket readyState "%s"',this.readyState)}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this.getWritablePackets();P("flushing %d packets in socket",e.length),this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let r=0;r<this.writeBuffer.length;r++){let s=this.writeBuffer[r].data;if(s&&(t+=rs(s)),r>0&&t>this.maxPayload)return P("only send %d out of %d packets",r,this.writeBuffer.length),this.writeBuffer.slice(0,r);t+=2}return P("payload size is %d (max: %d)",t,this.maxPayload),this.writeBuffer}write(e,t,r){return this.sendPacket("message",e,t,r),this}send(e,t,r){return this.sendPacket("message",e,t,r),this}sendPacket(e,t,r,s){if(typeof t=="function"&&(s=t,t=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let n={type:e,data:t,options:r};this.emitReserved("packetCreate",n),this.writeBuffer.push(n),s&&this.once("flush",s),this.flush()}close(){let e=()=>{this.onClose("forced close"),P("socket closing - telling transport to close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},r=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}onError(e){P("socket error %j",e),i.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(P('socket close with reason: "%s"',e),this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){let t=[],r=0,s=e.length;for(;r<s;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}};Ve.protocol=Hi;var Th=Ve.protocol;var qn=z(qt(),1),Mn=(0,qn.default)("socket.io-client:url");function Wn(i,e="",t){let r=i;t=t||typeof location!="undefined"&&location,i==null&&(i=t.protocol+"//"+t.host),typeof i=="string"&&(i.charAt(0)==="/"&&(i.charAt(1)==="/"?i=t.protocol+i:i=t.host+i),/^(https?|wss?):\/\//.test(i)||(Mn("protocol-less url %s",i),typeof t!="undefined"?i=t.protocol+"//"+i:i="https://"+i),Mn("parse %s",i),r=ct(i)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let n=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port+e,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r}var Ir={};ho(Ir,{Decoder:()=>Tr,Encoder:()=>Rr,PacketType:()=>C,protocol:()=>zn});var Bc=typeof ArrayBuffer=="function",Uc=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,$n=Object.prototype.toString,Dc=typeof Blob=="function"||typeof Blob!="undefined"&&$n.call(Blob)==="[object BlobConstructor]",Mc=typeof File=="function"||typeof File!="undefined"&&$n.call(File)==="[object FileConstructor]";function $t(i){return Bc&&(i instanceof ArrayBuffer||Uc(i))||Dc&&i instanceof Blob||Mc&&i instanceof File}function Wt(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,r=i.length;t<r;t++)if(Wt(i[t]))return!0;return!1}if($t(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return Wt(i.toJSON(),!0);for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&Wt(i[t]))return!0;return!1}function Vn(i){let e=[],t=i.data,r=i;return r.data=Nr(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Nr(i,e){if(!i)return i;if($t(i)){let t={_placeholder:!0,num:e.length};return e.push(i),t}else if(Array.isArray(i)){let t=new Array(i.length);for(let r=0;r<i.length;r++)t[r]=Nr(i[r],e);return t}else if(typeof i=="object"&&!(i instanceof Date)){let t={};for(let r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=Nr(i[r],e));return t}return i}function jn(i,e){return i.data=Ar(i.data,e),delete i.attachments,i}function Ar(i,e){if(!i)return i;if(i&&i._placeholder===!0){if(typeof i.num=="number"&&i.num>=0&&i.num<e.length)return e[i.num];throw new Error("illegal attachments")}else if(Array.isArray(i))for(let t=0;t<i.length;t++)i[t]=Ar(i[t],e);else if(typeof i=="object")for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Ar(i[t],e));return i}var Gn=z(De(),1),kr=(0,Gn.default)("socket.io-parser"),qc=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],zn=5,C;(function(i){i[i.CONNECT=0]="CONNECT",i[i.DISCONNECT=1]="DISCONNECT",i[i.EVENT=2]="EVENT",i[i.ACK=3]="ACK",i[i.CONNECT_ERROR=4]="CONNECT_ERROR",i[i.BINARY_EVENT=5]="BINARY_EVENT",i[i.BINARY_ACK=6]="BINARY_ACK"})(C||(C={}));var Rr=class{constructor(e){this.replacer=e}encode(e){return kr("encoding packet %j",e),(e.type===C.EVENT||e.type===C.ACK)&&Wt(e)?this.encodeAsBinary({type:e.type===C.EVENT?C.BINARY_EVENT:C.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===C.BINARY_EVENT||e.type===C.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),kr("encoded %j as %s",e,t),t}encodeAsBinary(e){let t=Vn(e),r=this.encodeAsString(t.packet),s=t.buffers;return s.unshift(r),s}};function Hn(i){return Object.prototype.toString.call(i)==="[object Object]"}var Tr=class i extends R{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);let r=t.type===C.BINARY_EVENT;r||t.type===C.BINARY_ACK?(t.type=r?C.EVENT:C.ACK,this.reconstructor=new Or(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if($t(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0,r={type:Number(e.charAt(0))};if(C[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===C.BINARY_EVENT||r.type===C.BINARY_ACK){let n=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(n,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){let n=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(n,t)}else r.nsp="/";let s=e.charAt(t+1);if(s!==""&&Number(s)==s){let n=t+1;for(;++t;){let o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}r.id=Number(e.substring(n,t+1))}if(e.charAt(++t)){let n=this.tryParse(e.substr(t));if(i.isPayloadValid(r.type,n))r.data=n;else throw new Error("invalid payload")}return kr("decoded %s as %j",e,r),r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(t){return!1}}static isPayloadValid(e,t){switch(e){case C.CONNECT:return Hn(t);case C.DISCONNECT:return t===void 0;case C.CONNECT_ERROR:return typeof t=="string"||Hn(t);case C.EVENT:case C.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&qc.indexOf(t[0])===-1);case C.ACK:case C.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Or=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let t=jn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function te(i,e,t){return i.on(e,t),function(){i.off(e,t)}}var Kn=z(qt(),1),U=(0,Kn.default)("socket.io-client:socket"),Wc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),lt=class extends R{constructor(e,t,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[te(e,"open",this.onopen.bind(this)),te(e,"packet",this.onpacket.bind(this)),te(e,"error",this.onerror.bind(this)),te(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Wc.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let r={type:C.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++;U("emitting packet with ack id %d",o);let c=t.pop();this._registerAckCallback(o,c),r.id=o}let s=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!s||!this.connected)?U("discard packet as the transport is not currently writable"):this.connected?(this.notifyOutgoingListeners(r),this.packet(r)):this.sendBuffer.push(r),this.flags={},this}_registerAckCallback(e,t){var r;let s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=t;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(U("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));U("event with ack id %d has timed out after %d ms",e,s),t.call(this,new Error("operation has timed out"))},s);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(n),t.apply(this,[null,...o])}}emitWithAck(e,...t){let r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((s,n)=>{t.push((o,c)=>r?o?n(o):s(c):s(o)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...n)=>r!==this._queue[0]?void 0:(s!==null?r.tryCount>this._opts.retries&&(U("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(s)):(U("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...n)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(U("draining queue"),!this.connected||this._queue.length===0)return;let t=this._queue[0];if(t.pending&&!e){U("packet [%d] has already been sent and is waiting for an ack",t.id);return}t.pending=!0,t.tryCount++,U("sending packet [%d] (try n\xB0%d)",t.id,t.tryCount),this.flags=t.flags,this.emit.apply(this,t.args)}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){U("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:C.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){U("close (%s)",e),this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case C.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case C.EVENT:case C.BINARY_EVENT:this.onevent(e);break;case C.ACK:case C.BINARY_ACK:this.onack(e);break;case C.DISCONNECT:this.ondisconnect();break;case C.CONNECT_ERROR:this.destroy();let r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){let t=e.data||[];U("emitting event %j",t),e.id!=null&&(U("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let r of t)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,r=!1;return function(...s){r||(r=!0,U("sending ack %j",s),t.packet({type:C.ACK,id:e,data:s}))}}onack(e){let t=this.acks[e.id];typeof t=="function"?(U("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):U("bad ack %s",e.id)}onconnect(e,t){U("socket connected with id %s",e),this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){U("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&(U("performing disconnect (%s)",this.nsp),this.packet({type:C.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let r=0;r<t.length;r++)if(e===t[r])return t.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let r of t)r.apply(this,e.data)}}};function je(i){i=i||{},this.ms=i.min||100,this.max=i.max||1e4,this.factor=i.factor||2,this.jitter=i.jitter>0&&i.jitter<=1?i.jitter:0,this.attempts=0}je.prototype.duration=function(){var i=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*i);i=Math.floor(e*10)&1?i+t:i-t}return Math.min(i,this.max)|0};je.prototype.reset=function(){this.attempts=0};je.prototype.setMin=function(i){this.ms=i};je.prototype.setMax=function(i){this.max=i};je.prototype.setJitter=function(i){this.jitter=i};var Yn=z(qt(),1),H=(0,Yn.default)("socket.io-client:manager"),ft=class extends R{constructor(e,t){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,ve(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((r=t.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new je({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let s=t.parser||Ir;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(H("readyState %s",this._readyState),~this._readyState.indexOf("open"))return this;H("opening %s",this.uri),this.engine=new Ve(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let s=te(t,"open",function(){r.onopen(),e&&e()}),n=c=>{H("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=te(t,"error",n);if(this._timeout!==!1){let c=this._timeout;H("connect attempt will timeout after %d",c);let a=this.setTimeoutFn(()=>{H("connect attempt timed out after %d",c),s(),n(new Error("timeout")),t.close()},c);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){H("open"),this.cleanup(),this._readyState="open",this.emitReserved("open");let e=this.engine;this.subs.push(te(e,"ping",this.onping.bind(this)),te(e,"data",this.ondata.bind(this)),te(e,"error",this.onerror.bind(this)),te(e,"close",this.onclose.bind(this)),te(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){$e(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){H("error",e),this.emitReserved("error",e)}socket(e,t){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new lt(this,e,t),this.nsps[e]=r),r}_destroy(e){let t=Object.keys(this.nsps);for(let r of t)if(this.nsps[r].active){H("socket %s is still active, skipping close",r);return}this._close()}_packet(e){H("writing packet %j",e);let t=this.encoder.encode(e);for(let r=0;r<t.length;r++)this.engine.write(t[r],e.options)}cleanup(){H("cleanup"),this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){H("disconnect"),this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){H("closed due to %s",e),this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)H("reconnect failed"),this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let t=this.backoff.duration();H("will wait %dms before reconnect attempt",t),this._reconnecting=!0;let r=this.setTimeoutFn(()=>{e.skipReconnect||(H("attempting reconnect"),this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(H("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):(H("reconnect success"),e.onreconnect())}))},t);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}};var Jn=z(qt(),1),Xn=(0,Jn.default)("socket.io-client"),Vt={};function jt(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};let t=Wn(i,e.path||"/socket.io"),r=t.source,s=t.id,n=t.path,o=Vt[s]&&n in Vt[s].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o,a;return c?(Xn("ignoring socket cache for %s",r),a=new ft(r,e)):(Vt[s]||(Xn("new io instance for %s",r),Vt[s]=new ft(r,e)),a=Vt[s]),t.query&&!e.query&&(e.query=t.queryKey),a.socket(t.path,e)}Object.assign(jt,{Manager:ft,Socket:lt,io:jt,connect:jt});var $c="https://ws.novu.co",Qn="notifications.notification_received",Zn="notifications.unseen_count_changed",eo="notifications.unread_count_changed",Vc=({_id:i,content:e,read:t,archived:r,createdAt:s,lastReadDate:n,archivedAt:o,channel:c,subscriber:a,subject:u,avatar:f,cta:h,tags:d,data:x,workflow:S})=>{var y,$,k,V,G,de,Ht,Gt;let m={id:a==null?void 0:a._id,subscriberId:a==null?void 0:a.subscriberId,firstName:a==null?void 0:a.firstName,lastName:a==null?void 0:a.lastName,avatar:a==null?void 0:a.avatar,locale:a==null?void 0:a.locale,data:a==null?void 0:a.data,timezone:a==null?void 0:a.timezone,email:a==null?void 0:a.email,phone:a==null?void 0:a.phone},v=($=(y=h.action)==null?void 0:y.buttons)==null?void 0:$.find(J=>J.type==="primary"),N=(V=(k=h.action)==null?void 0:k.buttons)==null?void 0:V.find(J=>J.type==="secondary"),A=(de=(G=h.action)==null?void 0:G.result)==null?void 0:de.type,p=(Ht=h.action)==null?void 0:Ht.status;return{id:i,subject:u,body:e,to:m,isRead:t,isArchived:r,createdAt:s,readAt:n,archivedAt:o,avatar:f,primaryAction:v&&{label:v.content,isCompleted:A==="primary"&&p==="done",redirect:v.url?{target:v.target,url:v.url}:void 0},secondaryAction:N&&{label:N.content,isCompleted:A==="secondary"&&p==="done",redirect:N.url?{target:N.target,url:N.url}:void 0},channelType:c,tags:d,redirect:(Gt=h.data)!=null&&Gt.url?{url:h.data.url,target:h.data.target}:void 0,data:x,workflow:S}},ht,ue,ie,ut,Pi,Li,Fi,ge,to,Pr,Lr,Ii=class extends we{constructor({socketUrl:t,inboxServiceInstance:r,eventEmitterInstance:s}){super({eventEmitterInstance:s,inboxServiceInstance:r});_(this,ge);_(this,ht);_(this,ue);_(this,ie);_(this,ut);_(this,Pi,({message:t})=>{l(this,ue).emit(Qn,{result:new j(Vc(t),l(this,ue),this._inboxService)})});_(this,Li,({unseenCount:t})=>{l(this,ue).emit(Zn,{result:t})});_(this,Fi,({unreadCount:t})=>{l(this,ue).emit(eo,{result:t})});E(this,ue,s),E(this,ut,t!=null?t:$c)}onSessionSuccess({token:t}){E(this,ht,t)}isSocketEvent(t){return t===Qn||t===Zn||t===eo}connect(){return g(this,null,function*(){return l(this,ht)?ze(this,ge,Pr).call(this):this.callWithSession(ze(this,ge,Pr).bind(this))})}disconnect(){return g(this,null,function*(){return l(this,ie)?ze(this,ge,Lr).call(this):this.callWithSession(ze(this,ge,Lr).bind(this))})}};ht=new WeakMap,ue=new WeakMap,ie=new WeakMap,ut=new WeakMap,Pi=new WeakMap,Li=new WeakMap,Fi=new WeakMap,ge=new WeakSet,to=function(){return g(this,null,function*(){var r,s,n;if(l(this,ie))return;let t={socketUrl:l(this,ut)};l(this,ue).emit("socket.connect.pending",{args:t}),E(this,ie,jt(l(this,ut),{reconnectionDelayMax:1e4,transports:["websocket"],query:{token:`${l(this,ht)}`}})),l(this,ie).on("connect",()=>{l(this,ue).emit("socket.connect.resolved",{args:t})}),l(this,ie).on("connect_error",o=>{l(this,ue).emit("socket.connect.resolved",{args:t,error:o})}),(r=l(this,ie))==null||r.on("notification_received",l(this,Pi)),(s=l(this,ie))==null||s.on("unseen_count_changed",l(this,Li)),(n=l(this,ie))==null||n.on("unread_count_changed",l(this,Fi))})},Pr=function(){return g(this,null,function*(){try{return yield ze(this,ge,to).call(this),{}}catch(t){return{error:new I("Failed to initialize the socket",t)}}})},Lr=function(){return g(this,null,function*(){var t;try{return(t=l(this,ie))==null||t.disconnect(),E(this,ie,void 0),{}}catch(r){return{error:new I("Failed to disconnect from the socket",r)}}})};var ye,He,Pe,Bi=class{constructor(e){_(this,ye);_(this,He);_(this,Pe);var t,r;E(this,Pe,new Jt({apiUrl:e.apiUrl||e.backendUrl,userAgent:e.__userAgent})),E(this,ye,new Qt),E(this,He,new oi({applicationIdentifier:e.applicationIdentifier,subscriberHash:e.subscriberHash,subscriber:jc(e)},l(this,Pe),l(this,ye))),l(this,He).initialize(),this.notifications=new ri({useCache:(t=e.useCache)!=null?t:!0,inboxServiceInstance:l(this,Pe),eventEmitterInstance:l(this,ye)}),this.preferences=new ni({useCache:(r=e.useCache)!=null?r:!0,inboxServiceInstance:l(this,Pe),eventEmitterInstance:l(this,ye)}),this.socket=new Ii({socketUrl:e.socketUrl,eventEmitterInstance:l(this,ye),inboxServiceInstance:l(this,Pe)}),this.on=(s,n)=>{this.socket.isSocketEvent(s)&&this.socket.connect();let o=l(this,ye).on(s,n);return()=>{o()}},this.off=(s,n)=>{l(this,ye).off(s,n)}}get applicationIdentifier(){return l(this,He).applicationIdentifier}get subscriberId(){return l(this,He).subscriberId}};ye=new WeakMap,He=new WeakMap,Pe=new WeakMap;function jc(i){let e;return i.subscriber?e=typeof i.subscriber=="string"?{subscriberId:i.subscriber}:i.subscriber:e={subscriberId:i.subscriberId},e}window.Novu=Bi;})();
|
|
17
17
|
/*! Bundled license information:
|
|
18
18
|
|
|
19
19
|
xmlhttprequest-ssl/lib/XMLHttpRequest.js:
|