@novu/js 3.5.0 → 3.5.1-nightly.20250610

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/novu.min.js CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";(()=>{var lo=Object.create;var Xt=Object.defineProperty,fo=Object.defineProperties,ho=Object.getOwnPropertyDescriptor,uo=Object.getOwnPropertyDescriptors,po=Object.getOwnPropertyNames,Jt=Object.getOwnPropertySymbols,mo=Object.getPrototypeOf,zi=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable;var Vr=i=>{throw TypeError(i)};var zr=(i,e,t)=>e in i?Xt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,v=(i,e)=>{for(var t in e||(e={}))zi.call(e,t)&&zr(i,t,e[t]);if(Jt)for(var t of Jt(e))$r.call(e,t)&&zr(i,t,e[t]);return i},T=(i,e)=>fo(i,uo(e));var C=(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 Hr=(i,e)=>{var t={};for(var r in i)zi.call(i,r)&&e.indexOf(r)<0&&(t[r]=i[r]);if(i!=null&&Jt)for(var r of Jt(i))e.indexOf(r)<0&&$r.call(i,r)&&(t[r]=i[r]);return t};var I=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),go=(i,e)=>{for(var t in e)Xt(i,t,{get:e[t],enumerable:!0})},yo=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of po(e))!zi.call(i,n)&&n!==t&&Xt(i,n,{get:()=>e[n],enumerable:!(r=ho(e,n))||r.enumerable});return i};var G=(i,e,t)=>(t=i!=null?lo(mo(i)):{},yo(e||!i||!i.__esModule?Xt(t,"default",{value:i,enumerable:!0}):t,i));var $i=(i,e,t)=>e.has(i)||Vr("Cannot "+t);var f=(i,e,t)=>($i(i,e,"read from private field"),t?t.call(i):e.get(i)),b=(i,e,t)=>e.has(i)?Vr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),S=(i,e,t,r)=>($i(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Ye=(i,e,t)=>($i(i,e,"access private method"),t);var g=(i,e,t)=>new Promise((r,n)=>{var s=l=>{try{a(t.next(l))}catch(u){n(u)}},o=l=>{try{a(t.throw(l))}catch(u){n(u)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(i,e)).next())});var Qi=I((gf,ln)=>{"use strict";var rt=1e3,nt=rt*60,st=nt*60,De=st*24,Io=De*7,Po=De*365.25;ln.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Lo(i);if(t==="number"&&isFinite(i))return e.long?Uo(i):Fo(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Lo(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*Po;case"weeks":case"week":case"w":return t*Io;case"days":case"day":case"d":return t*De;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*nt;case"seconds":case"second":case"secs":case"sec":case"s":return t*rt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Fo(i){var e=Math.abs(i);return e>=De?Math.round(i/De)+"d":e>=st?Math.round(i/st)+"h":e>=nt?Math.round(i/nt)+"m":e>=rt?Math.round(i/rt)+"s":i+"ms"}function Uo(i){var e=Math.abs(i);return e>=De?mi(i,e,De,"day"):e>=st?mi(i,e,st,"hour"):e>=nt?mi(i,e,nt,"minute"):e>=rt?mi(i,e,rt,"second"):i+" ms"}function mi(i,e,t,r){var n=e>=t*1.5;return Math.round(i/t)+" "+r+(n?"s":"")}});var Zi=I((yf,fn)=>{"use strict";function Bo(i){t.debug=t,t.default=t,t.coerce=l,t.disable=s,t.enable=n,t.enabled=o,t.humanize=Qi(),t.destroy=u,Object.keys(i).forEach(c=>{t[c]=i[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let h=0;for(let d=0;d<c.length;d++)h=(h<<5)-h+c.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(c){let h,d=null,_,x;function m(...E){if(!m.enabled)return;let k=m,N=Number(new Date),p=N-(h||N);k.diff=p,k.prev=h,k.curr=N,h=N,E[0]=t.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let y=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(R,V)=>{if(R==="%%")return"%";y++;let j=t.formatters[V];if(typeof j=="function"){let de=E[y];R=j.call(k,de),E.splice(y,1),y--}return R}),t.formatArgs.call(k,E),(k.log||t.log).apply(k,E)}return m.namespace=c,m.useColors=t.useColors(),m.color=t.selectColor(c),m.extend=r,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(_!==t.namespaces&&(_=t.namespaces,x=t.enabled(c)),x),set:E=>{d=E}}),typeof t.init=="function"&&t.init(m),m}function r(c,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+c);return d.log=this.log,d}function n(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let h,d=(typeof c=="string"?c:"").split(/[\s,]+/),_=d.length;for(h=0;h<_;h++)d[h]&&(c=d[h].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.slice(1)+"$")):t.names.push(new RegExp("^"+c+"$")))}function s(){let c=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");return t.enable(""),c}function o(c){if(c[c.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(c))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(c))return!0;return!1}function a(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function l(c){return c instanceof Error?c.stack||c.message:c}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=Bo});var hn=I((ee,gi)=>{"use strict";ee.formatArgs=Mo;ee.save=qo;ee.load=Wo;ee.useColors=Do;ee.storage=zo();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 Do(){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 Mo(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+gi.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,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),i.splice(r,0,e)}ee.log=console.debug||console.log||(()=>{});function qo(i){try{i?ee.storage.setItem("debug",i):ee.storage.removeItem("debug")}catch(e){}}function Wo(){let i;try{i=ee.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function zo(){try{return localStorage}catch(i){}}gi.exports=Zi()(ee);var{formatters:$o}=gi.exports;$o.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var dn=I((vf,un)=>{"use strict";un.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),n=e.indexOf("--");return r!==-1&&(n===-1||r<n)}});var ir=I((_f,mn)=>{"use strict";var Vo=C("os"),pn=C("tty"),ae=dn(),{env:q}=process,Te;ae("no-color")||ae("no-colors")||ae("color=false")||ae("color=never")?Te=0:(ae("color")||ae("colors")||ae("color=true")||ae("color=always"))&&(Te=1);"FORCE_COLOR"in q&&(q.FORCE_COLOR==="true"?Te=1:q.FORCE_COLOR==="false"?Te=0:Te=q.FORCE_COLOR.length===0?1:Math.min(parseInt(q.FORCE_COLOR,10),3));function er(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function tr(i,e){if(Te===0)return 0;if(ae("color=16m")||ae("color=full")||ae("color=truecolor"))return 3;if(ae("color=256"))return 2;if(i&&!e&&Te===void 0)return 0;let t=Te||0;if(q.TERM==="dumb")return t;if(process.platform==="win32"){let r=Vo.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in q)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in q)||q.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(q.TEAMCITY_VERSION)?1:0;if(q.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in q){let r=parseInt((q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(q.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(q.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(q.TERM)||"COLORTERM"in q?1:t}function Ho(i){let e=tr(i,i&&i.isTTY);return er(e)}mn.exports={supportsColor:Ho,stdout:er(tr(!0,pn.isatty(1))),stderr:er(tr(!0,pn.isatty(2)))}});var yn=I((W,vi)=>{"use strict";var jo=C("tty"),yi=C("util");W.init=Zo;W.log=Jo;W.formatArgs=Ko;W.save=Xo;W.load=Qo;W.useColors=Go;W.destroy=yi.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=ir();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,(n,s)=>s.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 Go(){return"colors"in W.inspectOpts?!!W.inspectOpts.colors:jo.isatty(process.stderr.fd)}function Ko(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${n};1m${e} \x1B[0m`;i[0]=s+i[0].split(`
1
+ "use strict";(()=>{var ho=Object.create;var Qt=Object.defineProperty,uo=Object.defineProperties,po=Object.getOwnPropertyDescriptor,mo=Object.getOwnPropertyDescriptors,go=Object.getOwnPropertyNames,Xt=Object.getOwnPropertySymbols,yo=Object.getPrototypeOf,$i=Object.prototype.hasOwnProperty,Vr=Object.prototype.propertyIsEnumerable;var Hr=i=>{throw TypeError(i)};var $r=(i,e,t)=>e in i?Qt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,v=(i,e)=>{for(var t in e||(e={}))$i.call(e,t)&&$r(i,t,e[t]);if(Xt)for(var t of Xt(e))Vr.call(e,t)&&$r(i,t,e[t]);return i},T=(i,e)=>uo(i,mo(e));var C=(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 jr=(i,e)=>{var t={};for(var r in i)$i.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&&Vr.call(i,r)&&(t[r]=i[r]);return t};var I=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),vo=(i,e)=>{for(var t in e)Qt(i,t,{get:e[t],enumerable:!0})},_o=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of go(e))!$i.call(i,n)&&n!==t&&Qt(i,n,{get:()=>e[n],enumerable:!(r=po(e,n))||r.enumerable});return i};var G=(i,e,t)=>(t=i!=null?ho(yo(i)):{},_o(e||!i||!i.__esModule?Qt(t,"default",{value:i,enumerable:!0}):t,i));var Vi=(i,e,t)=>e.has(i)||Hr("Cannot "+t);var f=(i,e,t)=>(Vi(i,e,"read from private field"),t?t.call(i):e.get(i)),E=(i,e,t)=>e.has(i)?Hr("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),b=(i,e,t,r)=>(Vi(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Ye=(i,e,t)=>(Vi(i,e,"access private method"),t);var g=(i,e,t)=>new Promise((r,n)=>{var s=l=>{try{a(t.next(l))}catch(h){n(h)}},o=l=>{try{a(t.throw(l))}catch(h){n(h)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(i,e)).next())});var Zi=I((yf,fn)=>{"use strict";var rt=1e3,nt=rt*60,st=nt*60,Me=st*24,Lo=Me*7,Fo=Me*365.25;fn.exports=function(i,e){e=e||{};var t=typeof i;if(t==="string"&&i.length>0)return Uo(i);if(t==="number"&&isFinite(i))return e.long?Do(i):Bo(i);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function Uo(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*Fo;case"weeks":case"week":case"w":return t*Lo;case"days":case"day":case"d":return t*Me;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*nt;case"seconds":case"second":case"secs":case"sec":case"s":return t*rt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function Bo(i){var e=Math.abs(i);return e>=Me?Math.round(i/Me)+"d":e>=st?Math.round(i/st)+"h":e>=nt?Math.round(i/nt)+"m":e>=rt?Math.round(i/rt)+"s":i+"ms"}function Do(i){var e=Math.abs(i);return e>=Me?gi(i,e,Me,"day"):e>=st?gi(i,e,st,"hour"):e>=nt?gi(i,e,nt,"minute"):e>=rt?gi(i,e,rt,"second"):i+" ms"}function gi(i,e,t,r){var n=e>=t*1.5;return Math.round(i/t)+" "+r+(n?"s":"")}});var er=I((vf,hn)=>{"use strict";function Mo(i){t.debug=t,t.default=t,t.coerce=l,t.disable=s,t.enable=n,t.enabled=o,t.humanize=Zi(),t.destroy=h,Object.keys(i).forEach(c=>{t[c]=i[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let u=0;for(let d=0;d<c.length;d++)u=(u<<5)-u+c.charCodeAt(d),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(c){let u,d=null,_,x;function m(...S){if(!m.enabled)return;let k=m,N=Number(new Date),p=N-(u||N);k.diff=p,k.prev=u,k.curr=N,u=N,S[0]=t.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let y=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(R,V)=>{if(R==="%%")return"%";y++;let j=t.formatters[V];if(typeof j=="function"){let pe=S[y];R=j.call(k,pe),S.splice(y,1),y--}return R}),t.formatArgs.call(k,S),(k.log||t.log).apply(k,S)}return m.namespace=c,m.useColors=t.useColors(),m.color=t.selectColor(c),m.extend=r,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(_!==t.namespaces&&(_=t.namespaces,x=t.enabled(c)),x),set:S=>{d=S}}),typeof t.init=="function"&&t.init(m),m}function r(c,u){let d=t(this.namespace+(typeof u=="undefined"?":":u)+c);return d.log=this.log,d}function n(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let u,d=(typeof c=="string"?c:"").split(/[\s,]+/),_=d.length;for(u=0;u<_;u++)d[u]&&(c=d[u].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.slice(1)+"$")):t.names.push(new RegExp("^"+c+"$")))}function s(){let c=[...t.names.map(a),...t.skips.map(a).map(u=>"-"+u)].join(",");return t.enable(""),c}function o(c){if(c[c.length-1]==="*")return!0;let u,d;for(u=0,d=t.skips.length;u<d;u++)if(t.skips[u].test(c))return!1;for(u=0,d=t.names.length;u<d;u++)if(t.names[u].test(c))return!0;return!1}function a(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function l(c){return c instanceof Error?c.stack||c.message:c}function h(){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}hn.exports=Mo});var un=I((ee,yi)=>{"use strict";ee.formatArgs=Wo;ee.save=zo;ee.load=$o;ee.useColors=qo;ee.storage=Vo();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 qo(){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 Wo(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+yi.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,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),i.splice(r,0,e)}ee.log=console.debug||console.log||(()=>{});function zo(i){try{i?ee.storage.setItem("debug",i):ee.storage.removeItem("debug")}catch(e){}}function $o(){let i;try{i=ee.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Vo(){try{return localStorage}catch(i){}}yi.exports=er()(ee);var{formatters:Ho}=yi.exports;Ho.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var pn=I((_f,dn)=>{"use strict";dn.exports=(i,e=process.argv)=>{let t=i.startsWith("-")?"":i.length===1?"-":"--",r=e.indexOf(t+i),n=e.indexOf("--");return r!==-1&&(n===-1||r<n)}});var rr=I((Ef,gn)=>{"use strict";var jo=C("os"),mn=C("tty"),ae=pn(),{env:q}=process,Oe;ae("no-color")||ae("no-colors")||ae("color=false")||ae("color=never")?Oe=0:(ae("color")||ae("colors")||ae("color=true")||ae("color=always"))&&(Oe=1);"FORCE_COLOR"in q&&(q.FORCE_COLOR==="true"?Oe=1:q.FORCE_COLOR==="false"?Oe=0:Oe=q.FORCE_COLOR.length===0?1:Math.min(parseInt(q.FORCE_COLOR,10),3));function tr(i){return i===0?!1:{level:i,hasBasic:!0,has256:i>=2,has16m:i>=3}}function ir(i,e){if(Oe===0)return 0;if(ae("color=16m")||ae("color=full")||ae("color=truecolor"))return 3;if(ae("color=256"))return 2;if(i&&!e&&Oe===void 0)return 0;let t=Oe||0;if(q.TERM==="dumb")return t;if(process.platform==="win32"){let r=jo.release().split(".");return Number(r[0])>=10&&Number(r[2])>=10586?Number(r[2])>=14931?3:2:1}if("CI"in q)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(r=>r in q)||q.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(q.TEAMCITY_VERSION)?1:0;if(q.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in q){let r=parseInt((q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(q.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(q.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(q.TERM)||"COLORTERM"in q?1:t}function Go(i){let e=ir(i,i&&i.isTTY);return tr(e)}gn.exports={supportsColor:Go,stdout:tr(ir(!0,mn.isatty(1))),stderr:tr(ir(!0,mn.isatty(2)))}});var vn=I((W,_i)=>{"use strict";var Ko=C("tty"),vi=C("util");W.init=ta;W.log=Qo;W.formatArgs=Jo;W.save=Zo;W.load=ea;W.useColors=Yo;W.destroy=vi.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=rr();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,(n,s)=>s.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 Yo(){return"colors"in W.inspectOpts?!!W.inspectOpts.colors:Ko.isatty(process.stderr.fd)}function Jo(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${n};1m${e} \x1B[0m`;i[0]=s+i[0].split(`
2
2
  `).join(`
3
- `+s),i.push(n+"m+"+vi.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Yo()+e+" "+i[0]}function Yo(){return W.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Jo(...i){return process.stderr.write(yi.formatWithOptions(W.inspectOpts,...i)+`
4
- `)}function Xo(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Qo(){return process.env.DEBUG}function Zo(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]]}vi.exports=Zi()(W);var{formatters:gn}=vi.exports;gn.o=function(i){return this.inspectOpts.colors=this.useColors,yi.inspect(i,this.inspectOpts).split(`
5
- `).map(e=>e.trim()).join(" ")};gn.O=function(i){return this.inspectOpts.colors=this.useColors,yi.inspect(i,this.inspectOpts)}});var Me=I((Ef,rr)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?rr.exports=hn():rr.exports=yn()});var An=I((kf,Nn)=>{"use strict";var ot=C("fs"),Cn=C("url"),ia=C("child_process").spawn;Nn.exports=or;or.XMLHttpRequest=or;function or(i){"use strict";i=i||{};var e=this,t=C("http"),r=C("https"),n,s,o={},a=!1,l={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},u=Object.assign({},l),c=["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,_=!1,x=!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 E=function(p){return a||p&&c.indexOf(p.toLowerCase())===-1},k=function(p){return p&&h.indexOf(p)===-1};this.open=function(p,y,$,R,V){if(this.abort(),_=!1,x=!1,!k(p))throw new Error("SecurityError: Request method not allowed");o={method:p,url:y.toString(),async:typeof $!="boolean"?!0:$,user:R||null,password:V||null},N(this.OPENED)},this.setDisableHeaderCheck=function(p){a=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(!E(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&&s.headers[p.toLowerCase()]&&!_?s.headers[p.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||_)return"";var p="";for(var y in s.headers)y!=="set-cookie"&&y!=="set-cookie2"&&(p+=y+": "+s.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,R=Cn.parse(o.url),V;switch(R.protocol){case"https:":y=!0;case"http:":V=R.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)ot.readFile(unescape(R.pathname),"utf8",function(oe,Ke){oe?e.handleError(oe,oe.errno||-1):(e.status=200,e.responseText=Ke,N(e.DONE))});else try{this.responseText=ot.readFileSync(unescape(R.pathname),"utf8"),this.status=200,N(e.DONE)}catch(oe){this.handleError(oe,oe.errno||-1)}return}var j=R.port||(y?443:80),de=R.pathname+(R.search?R.search:"");if(u.Host=V,y&&j===443||j===80||(u.Host+=":"+R.port),o.user){typeof o.password=="undefined"&&(o.password="");var Gt=new Buffer(o.user+":"+o.password);u.Authorization="Basic "+Gt.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,se={host:V,port:j,path:de,method:o.method,headers:u,agent:Kt};if(y&&(se.pfx=i.pfx,se.key=i.key,se.passphrase=i.passphrase,se.cert=i.cert,se.ca=i.ca,se.ciphers=i.ciphers,se.rejectUnauthorized=i.rejectUnauthorized!==!1),_=!1,o.async){var mt=y?r.request:t.request;d=!0,e.dispatchEvent("readystatechange");var Ge=function(oe){if(s=oe,s.statusCode===302||s.statusCode===303||s.statusCode===307){o.url=s.headers.location;var Ke=Cn.parse(o.url);V=Ke.hostname;var Ce={hostname:Ke.hostname,port:Ke.port,path:Ke.path,method:s.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),n=mt(Ce,Ge).on("error",Wr),n.end();return}s&&s.setEncoding&&s.setEncoding("utf8"),N(e.HEADERS_RECEIVED),e.status=s.statusCode,s.on("data",function(Yt){Yt&&(e.responseText+=Yt),d&&N(e.LOADING)}),s.on("end",function(){d&&(d=!1,N(e.DONE))}),s.on("error",function(Yt){e.handleError(Yt)})},Wr=function(oe){e.handleError(oe)};n=mt(se,Ge).on("error",Wr),i.autoUnref&&n.on("socket",oe=>{oe.unref()}),p&&n.write(p),n.end(),e.dispatchEvent("loadstart")}else{var gt=".node-xmlhttprequest-content-"+process.pid,yt=".node-xmlhttprequest-sync-"+process.pid;ot.writeFileSync(yt,"","utf8");for(var oo="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(y?"s":"")+".request;var options = "+JSON.stringify(se)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+gt+"', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');fs.unlinkSync('"+yt+"');});response.on('error', function(error) {fs.writeFileSync('"+gt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+yt+"');});}).on('error', function(error) {fs.writeFileSync('"+gt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+yt+"');});"+(p?"req.write('"+JSON.stringify(p).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",ao=ia(process.argv[0],["-e",oo]),Kc;ot.existsSync(yt););if(e.responseText=ot.readFileSync(gt,"utf8"),ao.stdin.end(),ot.unlinkSync(gt),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var co=e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,"");e.handleError(co,503)}else e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1"),e.responseText=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"),N(e.DONE)}},this.handleError=function(p,y){this.status=y||0,this.statusText=p,this.responseText=p.stack,_=!0,N(this.DONE)},this.abort=function(){n&&(n.abort(),n=null),u=Object.assign({},l),this.responseText="",this.responseXML="",_=x=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||d)&&this.readyState!==this.DONE&&(d=!1,N(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 N=function(p){if(!(e.readyState===p||e.readyState===e.UNSENT&&x)&&(e.readyState=p,(o.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let y;x?y="abort":_?y="error":y="load",e.dispatchEvent(y),e.dispatchEvent("loadend")}}}});var Ln=I((Df,Pn)=>{"use strict";var{Duplex:oa}=C("stream");function On(i){i.emit("close")}function aa(){!this.destroyed&&this._writableState.finished&&this.destroy()}function In(i){this.removeListener("error",In),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function ca(i,e){let t=!0,r=new oa(T(v({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return i.on("message",function(s,o){let a=!o&&r._readableState.objectMode?s.toString():s;r.push(a)||i.pause()}),i.once("error",function(s){r.destroyed||(t=!1,r.destroy(s))}),i.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(n,s){if(i.readyState===i.CLOSED){s(n),process.nextTick(On,r);return}let o=!1;i.once("error",function(l){o=!0,s(l)}),i.once("close",function(){o||s(n),process.nextTick(On,r)}),t&&i.terminate()},r._final=function(n){if(i.readyState===i.CONNECTING){i.once("open",function(){r._final(n)});return}i._socket!==null&&(i._socket._writableState.finished?(n(),r._readableState.endEmitted&&r.destroy()):(i._socket.once("finish",function(){n()}),i.close()))},r._read=function(){i.isPaused&&i.resume()},r._write=function(n,s,o){if(i.readyState===i.CONNECTING){i.once("open",function(){r._write(n,s,o)});return}i.send(n,o)},r.on("end",aa),r.on("error",In),r}Pn.exports=ca});var Ie=I((qf,Fn)=>{"use strict";Fn.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=I((Wf,Si)=>{"use strict";var{EMPTY_BUFFER:la}=Ie();function fa(i,e){if(i.length===0)return la;if(i.length===1)return i[0];let t=Buffer.allocUnsafe(e),r=0;for(let n=0;n<i.length;n++){let s=i[n];t.set(s,r),r+=s.length}return r<e?t.slice(0,r):t}function Un(i,e,t,r,n){for(let s=0;s<n;s++)t[r+s]=i[s]^e[s&3]}function Bn(i,e){for(let t=0;t<i.length;t++)i[t]^=e[t&3]}function ha(i){return i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}function fr(i){if(fr.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),fr.readOnly=!1),e}Si.exports={concat:fa,mask:Un,toArrayBuffer:ha,toBuffer:fr,unmask:Bn};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=C("bufferutil");Si.exports.mask=function(e,t,r,n,s){s<48?Un(e,t,r,n,s):i.mask(e,t,r,n,s)},Si.exports.unmask=function(e,t){e.length<32?Bn(e,t):i.unmask(e,t)}}catch(i){}});var qn=I((zf,Mn)=>{"use strict";var Dn=Symbol("kDone"),hr=Symbol("kRun"),ur=class{constructor(e){this[Dn]=()=>{this.pending--,this[hr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[hr]()}[hr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Dn])}}};Mn.exports=ur});var It=I(($f,Vn)=>{"use strict";var Tt=C("zlib"),Wn=Rt(),ua=qn(),{kStatusCode:zn}=Ie(),da=Buffer.from([0,0,255,255]),Ci=Symbol("permessage-deflate"),Se=Symbol("total-length"),Ot=Symbol("callback"),Pe=Symbol("buffers"),wi=Symbol("error"),xi,dr=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,!xi){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;xi=new ua(n)}}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(n=>!(t.serverNoContextTakeover===!1&&n.server_no_context_takeover||n.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>n.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!n.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 n=t[r];if(n.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(n=n[0],r==="client_max_window_bits"){if(n!==!0){let s=+n;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${n}`);n=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${n}`)}else if(r==="server_max_window_bits"){let s=+n;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${n}`);n=s}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(n!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${n}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=n})}),e}decompress(e,t,r){xi.add(n=>{this._decompress(e,t,(s,o)=>{n(),r(s,o)})})}compress(e,t,r){xi.add(n=>{this._compress(e,t,(s,o)=>{n(),r(s,o)})})}_decompress(e,t,r){let n=this._isServer?"client":"server";if(!this._inflate){let s=`${n}_max_window_bits`,o=typeof this.params[s]!="number"?Tt.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Tt.createInflateRaw(T(v({},this._options.zlibInflateOptions),{windowBits:o})),this._inflate[Ci]=this,this._inflate[Se]=0,this._inflate[Pe]=[],this._inflate.on("error",ma),this._inflate.on("data",$n)}this._inflate[Ot]=r,this._inflate.write(e),t&&this._inflate.write(da),this._inflate.flush(()=>{let s=this._inflate[wi];if(s){this._inflate.close(),this._inflate=null,r(s);return}let o=Wn.concat(this._inflate[Pe],this._inflate[Se]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Se]=0,this._inflate[Pe]=[],t&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let n=this._isServer?"server":"client";if(!this._deflate){let s=`${n}_max_window_bits`,o=typeof this.params[s]!="number"?Tt.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Tt.createDeflateRaw(T(v({},this._options.zlibDeflateOptions),{windowBits:o})),this._deflate[Se]=0,this._deflate[Pe]=[],this._deflate.on("data",pa)}this._deflate[Ot]=r,this._deflate.write(e),this._deflate.flush(Tt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=Wn.concat(this._deflate[Pe],this._deflate[Se]);t&&(s=s.slice(0,s.length-4)),this._deflate[Ot]=null,this._deflate[Se]=0,this._deflate[Pe]=[],t&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),r(null,s)})}};Vn.exports=dr;function pa(i){this[Pe].push(i),this[Se]+=i.length}function $n(i){if(this[Se]+=i.length,this[Ci]._maxPayload<1||this[Se]<=this[Ci]._maxPayload){this[Pe].push(i);return}this[wi]=new RangeError("Max payload size exceeded"),this[wi].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[wi][zn]=1009,this.removeListener("data",$n),this.reset()}function ma(i){this[Ci]._inflate=null,i[zn]=1007,this[Ot](i)}});var Pt=I((Hf,pr)=>{"use strict";var ga=[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 ya(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function Hn(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}pr.exports={isValidStatusCode:ya,isValidUTF8:Hn,tokenChars:ga};if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=C("utf-8-validate");pr.exports.isValidUTF8=function(e){return e.length<150?Hn(e):i(e)}}catch(i){}});var vr=I((jf,Qn)=>{"use strict";var{Writable:va}=C("stream"),jn=It(),{BINARY_TYPES:_a,EMPTY_BUFFER:Gn,kStatusCode:Ea,kWebSocket:ba}=Ie(),{concat:mr,toArrayBuffer:Sa,unmask:xa}=Rt(),{isValidStatusCode:wa,isValidUTF8:Kn}=Pt(),Lt=0,Yn=1,Jn=2,Xn=3,gr=4,Ca=5,yr=class extends va{constructor(e={}){super(),this._binaryType=e.binaryType||_a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[ba]=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],n=t.length-e;e>=r.length?t.set(this._buffers.shift(),n):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),n),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 Yn:t=this.getPayloadLength16();break;case Jn:t=this.getPayloadLength64();break;case Xn:this.getMask();break;case gr: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[jn.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=Yn;else if(this._payloadLength===127)this._state=Jn;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=Xn:this._state=gr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=gr}getData(e){let t=Gn;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]&&xa(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=Ca,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[jn.extensionName].decompress(e,this._fin,(n,s)=>{if(n)return t(n);if(s.length){if(this._messageLength+=s.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(s)}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=mr(t,e):this._binaryType==="arraybuffer"?r=Sa(mr(t,e)):r=t,this.emit("message",r,!0)}else{let r=mr(t,e);if(!this._skipUTF8Validation&&!Kn(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,Gn),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(!wa(t))return B(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let r=e.slice(2);if(!this._skipUTF8Validation&&!Kn(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}};Qn.exports=yr;function B(i,e,t,r,n){let s=new i(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(s,B),s.code=n,s[Ea]=r,s}});var Er=I((Yf,ts)=>{"use strict";var Gf=C("net"),Kf=C("tls"),{randomFillSync:Na}=C("crypto"),Zn=It(),{EMPTY_BUFFER:Aa}=Ie(),{isValidStatusCode:ka}=Pt(),{mask:es,toBuffer:at}=Rt(),he=Symbol("kByteLength"),Ra=Buffer.alloc(4),_r=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,n=!1,s=2,o=!1;t.mask&&(r=t.maskBuffer||Ra,t.generateMask?t.generateMask(r):Na(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,s=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,n=t.mask&&t.readOnly&&!o);let l=a;a>=65536?(s+=8,l=127):a>125&&(s+=2,l=126);let u=Buffer.allocUnsafe(n?a+s:s);return u[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(u[0]|=64),u[1]=l,l===126?u.writeUInt16BE(a,2):l===127&&(u[2]=u[3]=0,u.writeUIntBE(a,4,6)),t.mask?(u[1]|=128,u[s-4]=r[0],u[s-3]=r[1],u[s-2]=r[2],u[s-1]=r[3],o?[u,e]:n?(es(e,r,u,s,a),[u]):(es(e,r,e,0,a),[u,e])):[u,e]}close(e,t,r,n){let s;if(e===void 0)s=Aa;else{if(typeof e!="number"||!ka(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let a=Buffer.byteLength(t);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+a),s.writeUInt16BE(e,0),typeof t=="string"?s.write(t,2):s.set(t,2)}}let o={[he]:s.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,s,!1,o,n]):this.sendFrame(i.frame(s,o),n)}ping(e,t,r){let n,s;if(typeof e=="string"?(n=Buffer.byteLength(e),s=!1):(e=at(e),n=e.length,s=at.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:n,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}pong(e,t,r){let n,s;if(typeof e=="string"?(n=Buffer.byteLength(e),s=!1):(e=at(e),n=e.length,s=at.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[he]:n,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}send(e,t,r){let n=this._extensions[Zn.extensionName],s=t.binary?2:1,o=t.compress,a,l;if(typeof e=="string"?(a=Buffer.byteLength(e),l=!1):(e=at(e),a=e.length,l=at.readOnly),this._firstFragment?(this._firstFragment=!1,o&&n&&n.params[n._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=a>=n._threshold),this._compress=o):(o=!1,s=0),t.fin&&(this._firstFragment=!0),n){let u={[he]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:l,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:s,readOnly:l,rsv1:!1}),r)}dispatch(e,t,r,n){if(!t){this.sendFrame(i.frame(e,r),n);return}let s=this._extensions[Zn.extensionName];this._bufferedBytes+=r[he],this._deflating=!0,s.compress(e,r.fin,(o,a)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");typeof n=="function"&&n(l);for(let u=0;u<this._queue.length;u++){let c=this._queue[u],h=c[c.length-1];typeof h=="function"&&h(l)}return}this._bufferedBytes-=r[he],this._deflating=!1,r.readOnly=!1,this.sendFrame(i.frame(a,r),n),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)}};ts.exports=_r});var fs=I((Jf,ls)=>{"use strict";var{kForOnEventAttribute:Ft,kListener:br}=Ie(),is=Symbol("kCode"),rs=Symbol("kData"),ns=Symbol("kError"),ss=Symbol("kMessage"),os=Symbol("kReason"),ct=Symbol("kTarget"),as=Symbol("kType"),cs=Symbol("kWasClean"),xe=class{constructor(e){this[ct]=null,this[as]=e}get target(){return this[ct]}get type(){return this[as]}};Object.defineProperty(xe.prototype,"target",{enumerable:!0});Object.defineProperty(xe.prototype,"type",{enumerable:!0});var qe=class extends xe{constructor(e,t={}){super(e),this[is]=t.code===void 0?0:t.code,this[os]=t.reason===void 0?"":t.reason,this[cs]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[is]}get reason(){return this[os]}get wasClean(){return this[cs]}};Object.defineProperty(qe.prototype,"code",{enumerable:!0});Object.defineProperty(qe.prototype,"reason",{enumerable:!0});Object.defineProperty(qe.prototype,"wasClean",{enumerable:!0});var lt=class extends xe{constructor(e,t={}){super(e),this[ns]=t.error===void 0?null:t.error,this[ss]=t.message===void 0?"":t.message}get error(){return this[ns]}get message(){return this[ss]}};Object.defineProperty(lt.prototype,"error",{enumerable:!0});Object.defineProperty(lt.prototype,"message",{enumerable:!0});var Ut=class extends xe{constructor(e,t={}){super(e),this[rs]=t.data===void 0?null:t.data}get data(){return this[rs]}};Object.defineProperty(Ut.prototype,"data",{enumerable:!0});var Ta={addEventListener(i,e,t={}){for(let n of this.listeners(i))if(!t[Ft]&&n[br]===e&&!n[Ft])return;let r;if(i==="message")r=function(s,o){let a=new Ut("message",{data:o?s:s.toString()});a[ct]=this,Ni(e,this,a)};else if(i==="close")r=function(s,o){let a=new qe("close",{code:s,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[ct]=this,Ni(e,this,a)};else if(i==="error")r=function(s){let o=new lt("error",{error:s,message:s.message});o[ct]=this,Ni(e,this,o)};else if(i==="open")r=function(){let s=new xe("open");s[ct]=this,Ni(e,this,s)};else return;r[Ft]=!!t[Ft],r[br]=e,t.once?this.once(i,r):this.on(i,r)},removeEventListener(i,e){for(let t of this.listeners(i))if(t[br]===e&&!t[Ft]){this.removeListener(i,t);break}}};ls.exports={CloseEvent:qe,ErrorEvent:lt,Event:xe,EventTarget:Ta,MessageEvent:Ut};function Ni(i,e,t){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,t):i.call(e,t)}});var Sr=I((Xf,hs)=>{"use strict";var{tokenChars:Bt}=Pt();function ge(i,e,t){i[e]===void 0?i[e]=[t]:i[e].push(t)}function Oa(i){let e=Object.create(null),t=Object.create(null),r=!1,n=!1,s=!1,o,a,l=-1,u=-1,c=-1,h=0;for(;h<i.length;h++)if(u=i.charCodeAt(h),o===void 0)if(c===-1&&Bt[u]===1)l===-1&&(l=h);else if(h!==0&&(u===32||u===9))c===-1&&l!==-1&&(c=h);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let _=i.slice(l,c);u===44?(ge(e,_,t),t=Object.create(null)):o=_,l=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===void 0)if(c===-1&&Bt[u]===1)l===-1&&(l=h);else if(u===32||u===9)c===-1&&l!==-1&&(c=h);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h),ge(t,i.slice(l,c),!0),u===44&&(ge(e,o,t),t=Object.create(null),o=void 0),l=c=-1}else if(u===61&&l!==-1&&c===-1)a=i.slice(l,h),l=c=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(n){if(Bt[u]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);l===-1?l=h:r||(r=!0),n=!1}else if(s)if(Bt[u]===1)l===-1&&(l=h);else if(u===34&&l!==-1)s=!1,c=h;else if(u===92)n=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(u===34&&i.charCodeAt(h-1)===61)s=!0;else if(c===-1&&Bt[u]===1)l===-1&&(l=h);else if(l!==-1&&(u===32||u===9))c===-1&&(c=h);else if(u===59||u===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let _=i.slice(l,c);r&&(_=_.replace(/\\/g,""),r=!1),ge(t,a,_),u===44&&(ge(e,o,t),t=Object.create(null),o=void 0),a=void 0,l=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(l===-1||s||u===32||u===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=h);let d=i.slice(l,c);return o===void 0?ge(e,d,t):(a===void 0?ge(t,d,!0):r?ge(t,a,d.replace(/\\/g,"")):ge(t,a,d),ge(e,o,t)),e}function Ia(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(n=>{let s=r[n];return Array.isArray(s)||(s=[s]),s.map(o=>o===!0?n:`${n}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}hs.exports={format:Ia,parse:Oa}});var Ar=I((Zf,Ss)=>{"use strict";var Pa=C("events"),La=C("https"),Fa=C("http"),ps=C("net"),Ua=C("tls"),{randomBytes:Ba,createHash:Da}=C("crypto"),{Readable:Qf}=C("stream"),{URL:xr}=C("url"),Le=It(),Ma=vr(),qa=Er(),{BINARY_TYPES:us,EMPTY_BUFFER:Ai,GUID:Wa,kForOnEventAttribute:wr,kListener:za,kStatusCode:$a,kWebSocket:Y,NOOP:ms}=Ie(),{EventTarget:{addEventListener:Va,removeEventListener:Ha}}=fs(),{format:ja,parse:Ga}=Sr(),{toBuffer:Ka}=Rt(),Ya=30*1e3,gs=Symbol("kAborted"),Cr=[8,13],we=["CONNECTING","OPEN","CLOSING","CLOSED"],Ja=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,F=class i extends Pa{constructor(e,t,r){super(),this._binaryType=us[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Ai,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]),ys(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){us.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 n=new Ma({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new qa(e,this._extensions,r.generateMask),this._receiver=n,this._socket=e,n[Y]=this,e[Y]=this,n.on("conclude",Za),n.on("drain",ec),n.on("error",tc),n.on("message",ic),n.on("ping",rc),n.on("pong",nc),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",_s),e.on("data",Ri),e.on("end",Es),e.on("error",bs),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[Le.extensionName]&&this._extensions[Le.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 te(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),Ya)}}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){Nr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||Ai,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){Nr(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||Ai,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){Nr(this,e,r);return}let n=v({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},t);this._extensions[Le.extensionName]||(n.compress=!1),this._sender.send(e||Ai,n,r)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return te(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(F,"CONNECTING",{enumerable:!0,value:we.indexOf("CONNECTING")});Object.defineProperty(F.prototype,"CONNECTING",{enumerable:!0,value:we.indexOf("CONNECTING")});Object.defineProperty(F,"OPEN",{enumerable:!0,value:we.indexOf("OPEN")});Object.defineProperty(F.prototype,"OPEN",{enumerable:!0,value:we.indexOf("OPEN")});Object.defineProperty(F,"CLOSING",{enumerable:!0,value:we.indexOf("CLOSING")});Object.defineProperty(F.prototype,"CLOSING",{enumerable:!0,value:we.indexOf("CLOSING")});Object.defineProperty(F,"CLOSED",{enumerable:!0,value:we.indexOf("CLOSED")});Object.defineProperty(F.prototype,"CLOSED",{enumerable:!0,value:we.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(F.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(F.prototype,`on${i}`,{enumerable:!0,get(){for(let e of this.listeners(i))if(e[wr])return e[za];return null},set(e){for(let t of this.listeners(i))if(t[wr]){this.removeListener(i,t);break}typeof e=="function"&&this.addEventListener(i,e,{[wr]:!0})}})});F.prototype.addEventListener=Va;F.prototype.removeEventListener=Ha;Ss.exports=F;function ys(i,e,t,r){let n=T(v({protocolVersion:Cr[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(!Cr.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${Cr.join(", ")})`);let s;if(e instanceof xr)s=e,i._url=e.href;else{try{s=new xr(e)}catch(m){throw new SyntaxError(`Invalid URL: ${e}`)}i._url=e}let o=s.protocol==="wss:",a=s.protocol==="ws+unix:",l;if(s.protocol!=="ws:"&&!o&&!a?l=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:a&&!s.pathname?l="The URL's pathname is empty":s.hash&&(l="The URL contains a fragment identifier"),l){let m=new SyntaxError(l);if(i._redirects===0)throw m;ki(i,m);return}let u=o?443:80,c=Ba(16).toString("base64"),h=o?La.request:Fa.request,d=new Set,_;if(n.createConnection=o?Qa:Xa,n.defaultPort=n.defaultPort||u,n.port=s.port||u,n.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,n.headers=T(v({},n.headers),{"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"}),n.path=s.pathname+s.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(_=new Le(n.perMessageDeflate!==!0?n.perMessageDeflate:{},!1,n.maxPayload),n.headers["Sec-WebSocket-Extensions"]=ja({[Le.extensionName]:_.offer()})),t.length){for(let m of t){if(typeof m!="string"||!Ja.test(m)||d.has(m))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(m)}n.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(n.origin&&(n.protocolVersion<13?n.headers["Sec-WebSocket-Origin"]=n.origin:n.headers.Origin=n.origin),(s.username||s.password)&&(n.auth=`${s.username}:${s.password}`),a){let m=n.path.split(":");n.socketPath=m[0],n.path=m[1]}let x;if(n.followRedirects){if(i._redirects===0){i._originalIpc=a,i._originalSecure=o,i._originalHostOrSocketPath=a?n.socketPath:s.host;let m=r&&r.headers;if(r=T(v({},r),{headers:{}}),m)for(let[E,k]of Object.entries(m))r.headers[E.toLowerCase()]=k}else if(i.listenerCount("redirect")===0){let m=a?i._originalIpc?n.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:s.host===i._originalHostOrSocketPath;(!m||i._originalSecure&&!o)&&(delete n.headers.authorization,delete n.headers.cookie,m||delete n.headers.host,n.auth=void 0)}n.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(n.auth).toString("base64")),x=i._req=h(n),i._redirects&&i.emit("redirect",i.url,x)}else x=i._req=h(n);n.timeout&&x.on("timeout",()=>{te(i,x,"Opening handshake has timed out")}),x.on("error",m=>{x===null||x[gs]||(x=i._req=null,ki(i,m))}),x.on("response",m=>{let E=m.headers.location,k=m.statusCode;if(E&&n.followRedirects&&k>=300&&k<400){if(++i._redirects>n.maxRedirects){te(i,x,"Maximum redirects exceeded");return}x.abort();let N;try{N=new xr(E,e)}catch(p){let y=new SyntaxError(`Invalid URL: ${E}`);ki(i,y);return}ys(i,N,t,r)}else i.emit("unexpected-response",x,m)||te(i,x,`Unexpected server response: ${m.statusCode}`)}),x.on("upgrade",(m,E,k)=>{if(i.emit("upgrade",m),i.readyState!==F.CONNECTING)return;if(x=i._req=null,m.headers.upgrade.toLowerCase()!=="websocket"){te(i,E,"Invalid Upgrade header");return}let N=Da("sha1").update(c+Wa).digest("base64");if(m.headers["sec-websocket-accept"]!==N){te(i,E,"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){te(i,E,y);return}p&&(i._protocol=p);let $=m.headers["sec-websocket-extensions"];if($!==void 0){if(!_){te(i,E,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let R;try{R=Ga($)}catch(j){te(i,E,"Invalid Sec-WebSocket-Extensions header");return}let V=Object.keys(R);if(V.length!==1||V[0]!==Le.extensionName){te(i,E,"Server indicated an extension that was not requested");return}try{_.accept(R[Le.extensionName])}catch(j){te(i,E,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[Le.extensionName]=_}i.setSocket(E,k,{generateMask:n.generateMask,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})}),x.end()}function ki(i,e){i._readyState=F.CLOSING,i.emit("error",e),i.emitClose()}function Xa(i){return i.path=i.socketPath,ps.connect(i)}function Qa(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=ps.isIP(i.host)?"":i.host),Ua.connect(i)}function te(i,e,t){i._readyState=F.CLOSING;let r=new Error(t);Error.captureStackTrace(r,te),e.setHeader?(e[gs]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(ki,i,r)):(e.destroy(r),e.once("error",i.emit.bind(i,"error")),e.once("close",i.emitClose.bind(i)))}function Nr(i,e,t){if(e){let r=Ka(e).length;i._socket?i._sender._bufferedBytes+=r:i._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${i.readyState} (${we[i.readyState]})`);t(r)}}function Za(i,e){let t=this[Y];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=i,t._socket[Y]!==void 0&&(t._socket.removeListener("data",Ri),process.nextTick(vs,t._socket),i===1005?t.close():t.close(i,e))}function ec(){let i=this[Y];i.isPaused||i._socket.resume()}function tc(i){let e=this[Y];e._socket[Y]!==void 0&&(e._socket.removeListener("data",Ri),process.nextTick(vs,e._socket),e.close(i[$a])),e.emit("error",i)}function ds(){this[Y].emitClose()}function ic(i,e){this[Y].emit("message",i,e)}function rc(i){let e=this[Y];e.pong(i,!e._isServer,ms),e.emit("ping",i)}function nc(i){this[Y].emit("pong",i)}function vs(i){i.resume()}function _s(){let i=this[Y];this.removeListener("close",_s),this.removeListener("data",Ri),this.removeListener("end",Es),i._readyState=F.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[Y]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",ds),i._receiver.on("finish",ds))}function Ri(i){this[Y]._receiver.write(i)||this.pause()}function Es(){let i=this[Y];i._readyState=F.CLOSING,i._receiver.end(),this.end()}function bs(){let i=this[Y];this.removeListener("error",bs),this.on("error",ms),i&&(i._readyState=F.CLOSING,this.destroy())}});var ws=I((th,xs)=>{"use strict";var{tokenChars:sc}=Pt();function oc(i){let e=new Set,t=-1,r=-1,n=0;for(n;n<i.length;n++){let o=i.charCodeAt(n);if(r===-1&&sc[o]===1)t===-1&&(t=n);else if(n!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=n);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${n}`);r===-1&&(r=n);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 ${n}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let s=i.slice(t,n);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return e.add(s),e}xs.exports={parse:oc}});var Os=I((sh,Ts)=>{"use strict";var ac=C("events"),Ti=C("http"),ih=C("https"),rh=C("net"),nh=C("tls"),{createHash:cc}=C("crypto"),Cs=Sr(),We=It(),lc=ws(),fc=Ar(),{GUID:hc,kWebSocket:uc}=Ie(),dc=/^[+/0-9A-Za-z]{22}==$/,Ns=0,As=1,Rs=2,kr=class extends ac{constructor(e,t){if(super(),e=v({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:fc},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=Ti.createServer((r,n)=>{let s=Ti.STATUS_CODES[426];n.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),n.end(s)}),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=pc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(n,s,o)=>{this.handleUpgrade(n,s,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Ns}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===Rs){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!==As)if(this._state=As,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,n){t.on("error",ks);let s=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){ze(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){ze(this,e,t,400,"Invalid Upgrade header");return}if(!s||!dc.test(s)){ze(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){ze(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"],l=new Set;if(a!==void 0)try{l=lc.parse(a)}catch(h){ze(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let u=e.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&u!==void 0){let h=new We(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let d=Cs.parse(u);d[We.extensionName]&&(h.accept(d[We.extensionName]),c[We.extensionName]=h)}catch(d){ze(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,m)=>{if(!d)return Mt(t,_||401,x,m);this.completeUpgrade(c,s,l,e,t,r,n)});return}if(!this.options.verifyClient(h))return Mt(t,401)}this.completeUpgrade(c,s,l,e,t,r,n)}completeUpgrade(e,t,r,n,s,o,a){if(!s.readable||!s.writable)return s.destroy();if(s[uc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Ns)return Mt(s,503);let u=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${cc("sha1").update(t+hc).digest("base64")}`],c=new this.options.WebSocket(null);if(r.size){let h=this.options.handleProtocols?this.options.handleProtocols(r,n):r.values().next().value;h&&(u.push(`Sec-WebSocket-Protocol: ${h}`),c._protocol=h)}if(e[We.extensionName]){let h=e[We.extensionName].params,d=Cs.format({[We.extensionName]:[h]});u.push(`Sec-WebSocket-Extensions: ${d}`),c._extensions=e}this.emit("headers",u,n),s.write(u.concat(`\r
3
+ `+s),i.push(n+"m+"+_i.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Xo()+e+" "+i[0]}function Xo(){return W.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Qo(...i){return process.stderr.write(vi.formatWithOptions(W.inspectOpts,...i)+`
4
+ `)}function Zo(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function ea(){return process.env.DEBUG}function ta(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]]}_i.exports=er()(W);var{formatters:yn}=_i.exports;yn.o=function(i){return this.inspectOpts.colors=this.useColors,vi.inspect(i,this.inspectOpts).split(`
5
+ `).map(e=>e.trim()).join(" ")};yn.O=function(i){return this.inspectOpts.colors=this.useColors,vi.inspect(i,this.inspectOpts)}});var qe=I((bf,nr)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?nr.exports=un():nr.exports=vn()});var kn=I((Rf,An)=>{"use strict";var ot=C("fs"),Nn=C("url"),na=C("child_process").spawn;An.exports=ar;ar.XMLHttpRequest=ar;function ar(i){"use strict";i=i||{};var e=this,t=C("http"),r=C("https"),n,s,o={},a=!1,l={"User-Agent":"node-XMLHttpRequest",Accept:"*/*"},h=Object.assign({},l),c=["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"],u=["TRACE","TRACK","CONNECT"],d=!1,_=!1,x=!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 S=function(p){return a||p&&c.indexOf(p.toLowerCase())===-1},k=function(p){return p&&u.indexOf(p)===-1};this.open=function(p,y,$,R,V){if(this.abort(),_=!1,x=!1,!k(p))throw new Error("SecurityError: Request method not allowed");o={method:p,url:y.toString(),async:typeof $!="boolean"?!0:$,user:R||null,password:V||null},N(this.OPENED)},this.setDisableHeaderCheck=function(p){a=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(!S(p))return console.warn('Refused to set unsafe header "'+p+'"'),!1;if(d)throw new Error("INVALID_STATE_ERR: send flag is true");return h[p]=y,!0},this.getResponseHeader=function(p){return typeof p=="string"&&this.readyState>this.OPENED&&s.headers[p.toLowerCase()]&&!_?s.headers[p.toLowerCase()]:null},this.getAllResponseHeaders=function(){if(this.readyState<this.HEADERS_RECEIVED||_)return"";var p="";for(var y in s.headers)y!=="set-cookie"&&y!=="set-cookie2"&&(p+=y+": "+s.headers[y]+`\r
6
+ `);return p.substr(0,p.length-2)},this.getRequestHeader=function(p){return typeof p=="string"&&h[p]?h[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,R=Nn.parse(o.url),V;switch(R.protocol){case"https:":y=!0;case"http:":V=R.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)ot.readFile(unescape(R.pathname),"utf8",function(oe,Ke){oe?e.handleError(oe,oe.errno||-1):(e.status=200,e.responseText=Ke,N(e.DONE))});else try{this.responseText=ot.readFileSync(unescape(R.pathname),"utf8"),this.status=200,N(e.DONE)}catch(oe){this.handleError(oe,oe.errno||-1)}return}var j=R.port||(y?443:80),pe=R.pathname+(R.search?R.search:"");if(h.Host=V,y&&j===443||j===80||(h.Host+=":"+R.port),o.user){typeof o.password=="undefined"&&(o.password="");var Kt=new Buffer(o.user+":"+o.password);h.Authorization="Basic "+Kt.toString("base64")}o.method==="GET"||o.method==="HEAD"?p=null:p?(h["Content-Length"]=Buffer.isBuffer(p)?p.length:Buffer.byteLength(p),h["Content-Type"]||(h["Content-Type"]="text/plain;charset=UTF-8")):o.method==="POST"&&(h["Content-Length"]=0);var Yt=i.agent||!1,se={host:V,port:j,path:pe,method:o.method,headers:h,agent:Yt};if(y&&(se.pfx=i.pfx,se.key=i.key,se.passphrase=i.passphrase,se.cert=i.cert,se.ca=i.ca,se.ciphers=i.ciphers,se.rejectUnauthorized=i.rejectUnauthorized!==!1),_=!1,o.async){var gt=y?r.request:t.request;d=!0,e.dispatchEvent("readystatechange");var Ge=function(oe){if(s=oe,s.statusCode===302||s.statusCode===303||s.statusCode===307){o.url=s.headers.location;var Ke=Nn.parse(o.url);V=Ke.hostname;var Ne={hostname:Ke.hostname,port:Ke.port,path:Ke.path,method:s.statusCode===303?"GET":o.method,headers:h};y&&(Ne.pfx=i.pfx,Ne.key=i.key,Ne.passphrase=i.passphrase,Ne.cert=i.cert,Ne.ca=i.ca,Ne.ciphers=i.ciphers,Ne.rejectUnauthorized=i.rejectUnauthorized!==!1),n=gt(Ne,Ge).on("error",zr),n.end();return}s&&s.setEncoding&&s.setEncoding("utf8"),N(e.HEADERS_RECEIVED),e.status=s.statusCode,s.on("data",function(Jt){Jt&&(e.responseText+=Jt),d&&N(e.LOADING)}),s.on("end",function(){d&&(d=!1,N(e.DONE))}),s.on("error",function(Jt){e.handleError(Jt)})},zr=function(oe){e.handleError(oe)};n=gt(se,Ge).on("error",zr),i.autoUnref&&n.on("socket",oe=>{oe.unref()}),p&&n.write(p),n.end(),e.dispatchEvent("loadstart")}else{var yt=".node-xmlhttprequest-content-"+process.pid,vt=".node-xmlhttprequest-sync-"+process.pid;ot.writeFileSync(vt,"","utf8");for(var co="var http = require('http'), https = require('https'), fs = require('fs');var doRequest = http"+(y?"s":"")+".request;var options = "+JSON.stringify(se)+";var responseText = '';var req = doRequest(options, function(response) {response.setEncoding('utf8');response.on('data', function(chunk) { responseText += chunk;});response.on('end', function() {fs.writeFileSync('"+yt+"', 'NODE-XMLHTTPREQUEST-STATUS:' + response.statusCode + ',' + responseText, 'utf8');fs.unlinkSync('"+vt+"');});response.on('error', function(error) {fs.writeFileSync('"+yt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+vt+"');});}).on('error', function(error) {fs.writeFileSync('"+yt+"', 'NODE-XMLHTTPREQUEST-ERROR:' + JSON.stringify(error), 'utf8');fs.unlinkSync('"+vt+"');});"+(p?"req.write('"+JSON.stringify(p).slice(1,-1).replace(/'/g,"\\'")+"');":"")+"req.end();",lo=na(process.argv[0],["-e",co]),Yc;ot.existsSync(vt););if(e.responseText=ot.readFileSync(yt,"utf8"),lo.stdin.end(),ot.unlinkSync(yt),e.responseText.match(/^NODE-XMLHTTPREQUEST-ERROR:/)){var fo=e.responseText.replace(/^NODE-XMLHTTPREQUEST-ERROR:/,"");e.handleError(fo,503)}else e.status=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:([0-9]*),.*/,"$1"),e.responseText=e.responseText.replace(/^NODE-XMLHTTPREQUEST-STATUS:[0-9]*,(.*)/,"$1"),N(e.DONE)}},this.handleError=function(p,y){this.status=y||0,this.statusText=p,this.responseText=p.stack,_=!0,N(this.DONE)},this.abort=function(){n&&(n.abort(),n=null),h=Object.assign({},l),this.responseText="",this.responseXML="",_=x=!0,this.readyState!==this.UNSENT&&(this.readyState!==this.OPENED||d)&&this.readyState!==this.DONE&&(d=!1,N(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 N=function(p){if(!(e.readyState===p||e.readyState===e.UNSENT&&x)&&(e.readyState=p,(o.async||e.readyState<e.OPENED||e.readyState===e.DONE)&&e.dispatchEvent("readystatechange"),e.readyState===e.DONE)){let y;x?y="abort":_?y="error":y="load",e.dispatchEvent(y),e.dispatchEvent("loadend")}}}});var Fn=I((Mf,Ln)=>{"use strict";var{Duplex:ca}=C("stream");function In(i){i.emit("close")}function la(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Pn(i){this.removeListener("error",Pn),this.destroy(),this.listenerCount("error")===0&&this.emit("error",i)}function fa(i,e){let t=!0,r=new ca(T(v({},e),{autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1}));return i.on("message",function(s,o){let a=!o&&r._readableState.objectMode?s.toString():s;r.push(a)||i.pause()}),i.once("error",function(s){r.destroyed||(t=!1,r.destroy(s))}),i.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(n,s){if(i.readyState===i.CLOSED){s(n),process.nextTick(In,r);return}let o=!1;i.once("error",function(l){o=!0,s(l)}),i.once("close",function(){o||s(n),process.nextTick(In,r)}),t&&i.terminate()},r._final=function(n){if(i.readyState===i.CONNECTING){i.once("open",function(){r._final(n)});return}i._socket!==null&&(i._socket._writableState.finished?(n(),r._readableState.endEmitted&&r.destroy()):(i._socket.once("finish",function(){n()}),i.close()))},r._read=function(){i.isPaused&&i.resume()},r._write=function(n,s,o){if(i.readyState===i.CONNECTING){i.once("open",function(){r._write(n,s,o)});return}i.send(n,o)},r.on("end",la),r.on("error",Pn),r}Ln.exports=fa});var Pe=I((Wf,Un)=>{"use strict";Un.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 Tt=I((zf,xi)=>{"use strict";var{EMPTY_BUFFER:ha}=Pe();function ua(i,e){if(i.length===0)return ha;if(i.length===1)return i[0];let t=Buffer.allocUnsafe(e),r=0;for(let n=0;n<i.length;n++){let s=i[n];t.set(s,r),r+=s.length}return r<e?t.slice(0,r):t}function Bn(i,e,t,r,n){for(let s=0;s<n;s++)t[r+s]=i[s]^e[s&3]}function Dn(i,e){for(let t=0;t<i.length;t++)i[t]^=e[t&3]}function da(i){return i.byteLength===i.buffer.byteLength?i.buffer:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength)}function hr(i){if(hr.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),hr.readOnly=!1),e}xi.exports={concat:ua,mask:Bn,toArrayBuffer:da,toBuffer:hr,unmask:Dn};if(!process.env.WS_NO_BUFFER_UTIL)try{let i=C("bufferutil");xi.exports.mask=function(e,t,r,n,s){s<48?Bn(e,t,r,n,s):i.mask(e,t,r,n,s)},xi.exports.unmask=function(e,t){e.length<32?Dn(e,t):i.unmask(e,t)}}catch(i){}});var Wn=I(($f,qn)=>{"use strict";var Mn=Symbol("kDone"),ur=Symbol("kRun"),dr=class{constructor(e){this[Mn]=()=>{this.pending--,this[ur]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ur]()}[ur](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Mn])}}};qn.exports=dr});var Pt=I((Vf,Hn)=>{"use strict";var Ot=C("zlib"),zn=Tt(),pa=Wn(),{kStatusCode:$n}=Pe(),ma=Buffer.from([0,0,255,255]),Ni=Symbol("permessage-deflate"),Se=Symbol("total-length"),It=Symbol("callback"),Le=Symbol("buffers"),Ci=Symbol("error"),wi,pr=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,!wi){let n=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;wi=new pa(n)}}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[It];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(n=>!(t.serverNoContextTakeover===!1&&n.server_no_context_takeover||n.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>n.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!n.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 n=t[r];if(n.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(n=n[0],r==="client_max_window_bits"){if(n!==!0){let s=+n;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${n}`);n=s}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${n}`)}else if(r==="server_max_window_bits"){let s=+n;if(!Number.isInteger(s)||s<8||s>15)throw new TypeError(`Invalid value for parameter "${r}": ${n}`);n=s}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(n!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${n}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=n})}),e}decompress(e,t,r){wi.add(n=>{this._decompress(e,t,(s,o)=>{n(),r(s,o)})})}compress(e,t,r){wi.add(n=>{this._compress(e,t,(s,o)=>{n(),r(s,o)})})}_decompress(e,t,r){let n=this._isServer?"client":"server";if(!this._inflate){let s=`${n}_max_window_bits`,o=typeof this.params[s]!="number"?Ot.Z_DEFAULT_WINDOWBITS:this.params[s];this._inflate=Ot.createInflateRaw(T(v({},this._options.zlibInflateOptions),{windowBits:o})),this._inflate[Ni]=this,this._inflate[Se]=0,this._inflate[Le]=[],this._inflate.on("error",ya),this._inflate.on("data",Vn)}this._inflate[It]=r,this._inflate.write(e),t&&this._inflate.write(ma),this._inflate.flush(()=>{let s=this._inflate[Ci];if(s){this._inflate.close(),this._inflate=null,r(s);return}let o=zn.concat(this._inflate[Le],this._inflate[Se]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Se]=0,this._inflate[Le]=[],t&&this.params[`${n}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){let n=this._isServer?"server":"client";if(!this._deflate){let s=`${n}_max_window_bits`,o=typeof this.params[s]!="number"?Ot.Z_DEFAULT_WINDOWBITS:this.params[s];this._deflate=Ot.createDeflateRaw(T(v({},this._options.zlibDeflateOptions),{windowBits:o})),this._deflate[Se]=0,this._deflate[Le]=[],this._deflate.on("data",ga)}this._deflate[It]=r,this._deflate.write(e),this._deflate.flush(Ot.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let s=zn.concat(this._deflate[Le],this._deflate[Se]);t&&(s=s.slice(0,s.length-4)),this._deflate[It]=null,this._deflate[Se]=0,this._deflate[Le]=[],t&&this.params[`${n}_no_context_takeover`]&&this._deflate.reset(),r(null,s)})}};Hn.exports=pr;function ga(i){this[Le].push(i),this[Se]+=i.length}function Vn(i){if(this[Se]+=i.length,this[Ni]._maxPayload<1||this[Se]<=this[Ni]._maxPayload){this[Le].push(i);return}this[Ci]=new RangeError("Max payload size exceeded"),this[Ci].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ci][$n]=1009,this.removeListener("data",Vn),this.reset()}function ya(i){this[Ni]._inflate=null,i[$n]=1007,this[It](i)}});var Lt=I((jf,mr)=>{"use strict";var va=[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 _a(i){return i>=1e3&&i<=1014&&i!==1004&&i!==1005&&i!==1006||i>=3e3&&i<=4999}function jn(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}mr.exports={isValidStatusCode:_a,isValidUTF8:jn,tokenChars:va};if(!process.env.WS_NO_UTF_8_VALIDATE)try{let i=C("utf-8-validate");mr.exports.isValidUTF8=function(e){return e.length<150?jn(e):i(e)}}catch(i){}});var _r=I((Gf,Zn)=>{"use strict";var{Writable:Ea}=C("stream"),Gn=Pt(),{BINARY_TYPES:ba,EMPTY_BUFFER:Kn,kStatusCode:Sa,kWebSocket:xa}=Pe(),{concat:gr,toArrayBuffer:wa,unmask:Ca}=Tt(),{isValidStatusCode:Na,isValidUTF8:Yn}=Lt(),Ft=0,Jn=1,Xn=2,Qn=3,yr=4,Aa=5,vr=class extends Ea{constructor(e={}){super(),this._binaryType=e.binaryType||ba[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[xa]=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=Ft,this._loop=!1}_write(e,t,r){if(this._opcode===8&&this._state==Ft)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],n=t.length-e;e>=r.length?t.set(this._buffers.shift(),n):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),n),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 Ft:t=this.getInfo();break;case Jn:t=this.getPayloadLength16();break;case Xn:t=this.getPayloadLength64();break;case Qn:this.getMask();break;case yr: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[Gn.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=Jn;else if(this._payloadLength===127)this._state=Xn;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=Qn:this._state=yr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=yr}getData(e){let t=Kn;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]&&Ca(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=Aa,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[Gn.extensionName].decompress(e,this._fin,(n,s)=>{if(n)return t(n);if(s.length){if(this._messageLength+=s.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(s)}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=gr(t,e):this._binaryType==="arraybuffer"?r=wa(gr(t,e)):r=t,this.emit("message",r,!0)}else{let r=gr(t,e);if(!this._skipUTF8Validation&&!Yn(r))return this._loop=!1,B(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=Ft}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,Kn),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(!Na(t))return B(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");let r=e.slice(2);if(!this._skipUTF8Validation&&!Yn(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=Ft}};Zn.exports=vr;function B(i,e,t,r,n){let s=new i(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(s,B),s.code=n,s[Sa]=r,s}});var br=I((Jf,is)=>{"use strict";var Kf=C("net"),Yf=C("tls"),{randomFillSync:ka}=C("crypto"),es=Pt(),{EMPTY_BUFFER:Ra}=Pe(),{isValidStatusCode:Ta}=Lt(),{mask:ts,toBuffer:at}=Tt(),ue=Symbol("kByteLength"),Oa=Buffer.alloc(4),Er=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,n=!1,s=2,o=!1;t.mask&&(r=t.maskBuffer||Oa,t.generateMask?t.generateMask(r):ka(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,s=6);let a;typeof e=="string"?(!t.mask||o)&&t[ue]!==void 0?a=t[ue]:(e=Buffer.from(e),a=e.length):(a=e.length,n=t.mask&&t.readOnly&&!o);let l=a;a>=65536?(s+=8,l=127):a>125&&(s+=2,l=126);let h=Buffer.allocUnsafe(n?a+s:s);return h[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(h[0]|=64),h[1]=l,l===126?h.writeUInt16BE(a,2):l===127&&(h[2]=h[3]=0,h.writeUIntBE(a,4,6)),t.mask?(h[1]|=128,h[s-4]=r[0],h[s-3]=r[1],h[s-2]=r[2],h[s-1]=r[3],o?[h,e]:n?(ts(e,r,h,s,a),[h]):(ts(e,r,e,0,a),[h,e])):[h,e]}close(e,t,r,n){let s;if(e===void 0)s=Ra;else{if(typeof e!="number"||!Ta(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)s=Buffer.allocUnsafe(2),s.writeUInt16BE(e,0);else{let a=Buffer.byteLength(t);if(a>123)throw new RangeError("The message must not be greater than 123 bytes");s=Buffer.allocUnsafe(2+a),s.writeUInt16BE(e,0),typeof t=="string"?s.write(t,2):s.set(t,2)}}let o={[ue]:s.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,s,!1,o,n]):this.sendFrame(i.frame(s,o),n)}ping(e,t,r){let n,s;if(typeof e=="string"?(n=Buffer.byteLength(e),s=!1):(e=at(e),n=e.length,s=at.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[ue]:n,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:s,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}pong(e,t,r){let n,s;if(typeof e=="string"?(n=Buffer.byteLength(e),s=!1):(e=at(e),n=e.length,s=at.readOnly),n>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[ue]:n,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:s,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(i.frame(e,o),r)}send(e,t,r){let n=this._extensions[es.extensionName],s=t.binary?2:1,o=t.compress,a,l;if(typeof e=="string"?(a=Buffer.byteLength(e),l=!1):(e=at(e),a=e.length,l=at.readOnly),this._firstFragment?(this._firstFragment=!1,o&&n&&n.params[n._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=a>=n._threshold),this._compress=o):(o=!1,s=0),t.fin&&(this._firstFragment=!0),n){let h={[ue]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:l,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,h,r]):this.dispatch(e,this._compress,h,r)}else this.sendFrame(i.frame(e,{[ue]:a,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:s,readOnly:l,rsv1:!1}),r)}dispatch(e,t,r,n){if(!t){this.sendFrame(i.frame(e,r),n);return}let s=this._extensions[es.extensionName];this._bufferedBytes+=r[ue],this._deflating=!0,s.compress(e,r.fin,(o,a)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");typeof n=="function"&&n(l);for(let h=0;h<this._queue.length;h++){let c=this._queue[h],u=c[c.length-1];typeof u=="function"&&u(l)}return}this._bufferedBytes-=r[ue],this._deflating=!1,r.readOnly=!1,this.sendFrame(i.frame(a,r),n),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][ue],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][ue],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)}};is.exports=Er});var hs=I((Xf,fs)=>{"use strict";var{kForOnEventAttribute:Ut,kListener:Sr}=Pe(),rs=Symbol("kCode"),ns=Symbol("kData"),ss=Symbol("kError"),os=Symbol("kMessage"),as=Symbol("kReason"),ct=Symbol("kTarget"),cs=Symbol("kType"),ls=Symbol("kWasClean"),xe=class{constructor(e){this[ct]=null,this[cs]=e}get target(){return this[ct]}get type(){return this[cs]}};Object.defineProperty(xe.prototype,"target",{enumerable:!0});Object.defineProperty(xe.prototype,"type",{enumerable:!0});var We=class extends xe{constructor(e,t={}){super(e),this[rs]=t.code===void 0?0:t.code,this[as]=t.reason===void 0?"":t.reason,this[ls]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[rs]}get reason(){return this[as]}get wasClean(){return this[ls]}};Object.defineProperty(We.prototype,"code",{enumerable:!0});Object.defineProperty(We.prototype,"reason",{enumerable:!0});Object.defineProperty(We.prototype,"wasClean",{enumerable:!0});var lt=class extends xe{constructor(e,t={}){super(e),this[ss]=t.error===void 0?null:t.error,this[os]=t.message===void 0?"":t.message}get error(){return this[ss]}get message(){return this[os]}};Object.defineProperty(lt.prototype,"error",{enumerable:!0});Object.defineProperty(lt.prototype,"message",{enumerable:!0});var Bt=class extends xe{constructor(e,t={}){super(e),this[ns]=t.data===void 0?null:t.data}get data(){return this[ns]}};Object.defineProperty(Bt.prototype,"data",{enumerable:!0});var Ia={addEventListener(i,e,t={}){for(let n of this.listeners(i))if(!t[Ut]&&n[Sr]===e&&!n[Ut])return;let r;if(i==="message")r=function(s,o){let a=new Bt("message",{data:o?s:s.toString()});a[ct]=this,Ai(e,this,a)};else if(i==="close")r=function(s,o){let a=new We("close",{code:s,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});a[ct]=this,Ai(e,this,a)};else if(i==="error")r=function(s){let o=new lt("error",{error:s,message:s.message});o[ct]=this,Ai(e,this,o)};else if(i==="open")r=function(){let s=new xe("open");s[ct]=this,Ai(e,this,s)};else return;r[Ut]=!!t[Ut],r[Sr]=e,t.once?this.once(i,r):this.on(i,r)},removeEventListener(i,e){for(let t of this.listeners(i))if(t[Sr]===e&&!t[Ut]){this.removeListener(i,t);break}}};fs.exports={CloseEvent:We,ErrorEvent:lt,Event:xe,EventTarget:Ia,MessageEvent:Bt};function Ai(i,e,t){typeof i=="object"&&i.handleEvent?i.handleEvent.call(i,t):i.call(e,t)}});var xr=I((Qf,us)=>{"use strict";var{tokenChars:Dt}=Lt();function ge(i,e,t){i[e]===void 0?i[e]=[t]:i[e].push(t)}function Pa(i){let e=Object.create(null),t=Object.create(null),r=!1,n=!1,s=!1,o,a,l=-1,h=-1,c=-1,u=0;for(;u<i.length;u++)if(h=i.charCodeAt(u),o===void 0)if(c===-1&&Dt[h]===1)l===-1&&(l=u);else if(u!==0&&(h===32||h===9))c===-1&&l!==-1&&(c=u);else if(h===59||h===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${u}`);c===-1&&(c=u);let _=i.slice(l,c);h===44?(ge(e,_,t),t=Object.create(null)):o=_,l=c=-1}else throw new SyntaxError(`Unexpected character at index ${u}`);else if(a===void 0)if(c===-1&&Dt[h]===1)l===-1&&(l=u);else if(h===32||h===9)c===-1&&l!==-1&&(c=u);else if(h===59||h===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${u}`);c===-1&&(c=u),ge(t,i.slice(l,c),!0),h===44&&(ge(e,o,t),t=Object.create(null),o=void 0),l=c=-1}else if(h===61&&l!==-1&&c===-1)a=i.slice(l,u),l=c=-1;else throw new SyntaxError(`Unexpected character at index ${u}`);else if(n){if(Dt[h]!==1)throw new SyntaxError(`Unexpected character at index ${u}`);l===-1?l=u:r||(r=!0),n=!1}else if(s)if(Dt[h]===1)l===-1&&(l=u);else if(h===34&&l!==-1)s=!1,c=u;else if(h===92)n=!0;else throw new SyntaxError(`Unexpected character at index ${u}`);else if(h===34&&i.charCodeAt(u-1)===61)s=!0;else if(c===-1&&Dt[h]===1)l===-1&&(l=u);else if(l!==-1&&(h===32||h===9))c===-1&&(c=u);else if(h===59||h===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${u}`);c===-1&&(c=u);let _=i.slice(l,c);r&&(_=_.replace(/\\/g,""),r=!1),ge(t,a,_),h===44&&(ge(e,o,t),t=Object.create(null),o=void 0),a=void 0,l=c=-1}else throw new SyntaxError(`Unexpected character at index ${u}`);if(l===-1||s||h===32||h===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=u);let d=i.slice(l,c);return o===void 0?ge(e,d,t):(a===void 0?ge(t,d,!0):r?ge(t,a,d.replace(/\\/g,"")):ge(t,a,d),ge(e,o,t)),e}function La(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(n=>{let s=r[n];return Array.isArray(s)||(s=[s]),s.map(o=>o===!0?n:`${n}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}us.exports={format:La,parse:Pa}});var kr=I((eh,xs)=>{"use strict";var Fa=C("events"),Ua=C("https"),Ba=C("http"),ms=C("net"),Da=C("tls"),{randomBytes:Ma,createHash:qa}=C("crypto"),{Readable:Zf}=C("stream"),{URL:wr}=C("url"),Fe=Pt(),Wa=_r(),za=br(),{BINARY_TYPES:ds,EMPTY_BUFFER:ki,GUID:$a,kForOnEventAttribute:Cr,kListener:Va,kStatusCode:Ha,kWebSocket:Y,NOOP:gs}=Pe(),{EventTarget:{addEventListener:ja,removeEventListener:Ga}}=hs(),{format:Ka,parse:Ya}=xr(),{toBuffer:Ja}=Tt(),Xa=30*1e3,ys=Symbol("kAborted"),Nr=[8,13],we=["CONNECTING","OPEN","CLOSING","CLOSED"],Qa=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,F=class i extends Fa{constructor(e,t,r){super(),this._binaryType=ds[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=ki,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]),vs(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){ds.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 n=new Wa({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new za(e,this._extensions,r.generateMask),this._receiver=n,this._socket=e,n[Y]=this,e[Y]=this,n.on("conclude",tc),n.on("drain",ic),n.on("error",rc),n.on("message",nc),n.on("ping",sc),n.on("pong",oc),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",Es),e.on("data",Ti),e.on("end",bs),e.on("error",Ss),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[Fe.extensionName]&&this._extensions[Fe.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 te(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),Xa)}}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){Ar(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||ki,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){Ar(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||ki,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){Ar(this,e,r);return}let n=v({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},t);this._extensions[Fe.extensionName]||(n.compress=!1),this._sender.send(e||ki,n,r)}terminate(){if(this.readyState!==i.CLOSED){if(this.readyState===i.CONNECTING)return te(this,this._req,"WebSocket was closed before the connection was established");this._socket&&(this._readyState=i.CLOSING,this._socket.destroy())}}};Object.defineProperty(F,"CONNECTING",{enumerable:!0,value:we.indexOf("CONNECTING")});Object.defineProperty(F.prototype,"CONNECTING",{enumerable:!0,value:we.indexOf("CONNECTING")});Object.defineProperty(F,"OPEN",{enumerable:!0,value:we.indexOf("OPEN")});Object.defineProperty(F.prototype,"OPEN",{enumerable:!0,value:we.indexOf("OPEN")});Object.defineProperty(F,"CLOSING",{enumerable:!0,value:we.indexOf("CLOSING")});Object.defineProperty(F.prototype,"CLOSING",{enumerable:!0,value:we.indexOf("CLOSING")});Object.defineProperty(F,"CLOSED",{enumerable:!0,value:we.indexOf("CLOSED")});Object.defineProperty(F.prototype,"CLOSED",{enumerable:!0,value:we.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(i=>{Object.defineProperty(F.prototype,i,{enumerable:!0})});["open","error","close","message"].forEach(i=>{Object.defineProperty(F.prototype,`on${i}`,{enumerable:!0,get(){for(let e of this.listeners(i))if(e[Cr])return e[Va];return null},set(e){for(let t of this.listeners(i))if(t[Cr]){this.removeListener(i,t);break}typeof e=="function"&&this.addEventListener(i,e,{[Cr]:!0})}})});F.prototype.addEventListener=ja;F.prototype.removeEventListener=Ga;xs.exports=F;function vs(i,e,t,r){let n=T(v({protocolVersion:Nr[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(!Nr.includes(n.protocolVersion))throw new RangeError(`Unsupported protocol version: ${n.protocolVersion} (supported versions: ${Nr.join(", ")})`);let s;if(e instanceof wr)s=e,i._url=e.href;else{try{s=new wr(e)}catch(m){throw new SyntaxError(`Invalid URL: ${e}`)}i._url=e}let o=s.protocol==="wss:",a=s.protocol==="ws+unix:",l;if(s.protocol!=="ws:"&&!o&&!a?l=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:a&&!s.pathname?l="The URL's pathname is empty":s.hash&&(l="The URL contains a fragment identifier"),l){let m=new SyntaxError(l);if(i._redirects===0)throw m;Ri(i,m);return}let h=o?443:80,c=Ma(16).toString("base64"),u=o?Ua.request:Ba.request,d=new Set,_;if(n.createConnection=o?ec:Za,n.defaultPort=n.defaultPort||h,n.port=s.port||h,n.host=s.hostname.startsWith("[")?s.hostname.slice(1,-1):s.hostname,n.headers=T(v({},n.headers),{"Sec-WebSocket-Version":n.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"}),n.path=s.pathname+s.search,n.timeout=n.handshakeTimeout,n.perMessageDeflate&&(_=new Fe(n.perMessageDeflate!==!0?n.perMessageDeflate:{},!1,n.maxPayload),n.headers["Sec-WebSocket-Extensions"]=Ka({[Fe.extensionName]:_.offer()})),t.length){for(let m of t){if(typeof m!="string"||!Qa.test(m)||d.has(m))throw new SyntaxError("An invalid or duplicated subprotocol was specified");d.add(m)}n.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(n.origin&&(n.protocolVersion<13?n.headers["Sec-WebSocket-Origin"]=n.origin:n.headers.Origin=n.origin),(s.username||s.password)&&(n.auth=`${s.username}:${s.password}`),a){let m=n.path.split(":");n.socketPath=m[0],n.path=m[1]}let x;if(n.followRedirects){if(i._redirects===0){i._originalIpc=a,i._originalSecure=o,i._originalHostOrSocketPath=a?n.socketPath:s.host;let m=r&&r.headers;if(r=T(v({},r),{headers:{}}),m)for(let[S,k]of Object.entries(m))r.headers[S.toLowerCase()]=k}else if(i.listenerCount("redirect")===0){let m=a?i._originalIpc?n.socketPath===i._originalHostOrSocketPath:!1:i._originalIpc?!1:s.host===i._originalHostOrSocketPath;(!m||i._originalSecure&&!o)&&(delete n.headers.authorization,delete n.headers.cookie,m||delete n.headers.host,n.auth=void 0)}n.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(n.auth).toString("base64")),x=i._req=u(n),i._redirects&&i.emit("redirect",i.url,x)}else x=i._req=u(n);n.timeout&&x.on("timeout",()=>{te(i,x,"Opening handshake has timed out")}),x.on("error",m=>{x===null||x[ys]||(x=i._req=null,Ri(i,m))}),x.on("response",m=>{let S=m.headers.location,k=m.statusCode;if(S&&n.followRedirects&&k>=300&&k<400){if(++i._redirects>n.maxRedirects){te(i,x,"Maximum redirects exceeded");return}x.abort();let N;try{N=new wr(S,e)}catch(p){let y=new SyntaxError(`Invalid URL: ${S}`);Ri(i,y);return}vs(i,N,t,r)}else i.emit("unexpected-response",x,m)||te(i,x,`Unexpected server response: ${m.statusCode}`)}),x.on("upgrade",(m,S,k)=>{if(i.emit("upgrade",m),i.readyState!==F.CONNECTING)return;if(x=i._req=null,m.headers.upgrade.toLowerCase()!=="websocket"){te(i,S,"Invalid Upgrade header");return}let N=qa("sha1").update(c+$a).digest("base64");if(m.headers["sec-websocket-accept"]!==N){te(i,S,"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){te(i,S,y);return}p&&(i._protocol=p);let $=m.headers["sec-websocket-extensions"];if($!==void 0){if(!_){te(i,S,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let R;try{R=Ya($)}catch(j){te(i,S,"Invalid Sec-WebSocket-Extensions header");return}let V=Object.keys(R);if(V.length!==1||V[0]!==Fe.extensionName){te(i,S,"Server indicated an extension that was not requested");return}try{_.accept(R[Fe.extensionName])}catch(j){te(i,S,"Invalid Sec-WebSocket-Extensions header");return}i._extensions[Fe.extensionName]=_}i.setSocket(S,k,{generateMask:n.generateMask,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation})}),x.end()}function Ri(i,e){i._readyState=F.CLOSING,i.emit("error",e),i.emitClose()}function Za(i){return i.path=i.socketPath,ms.connect(i)}function ec(i){return i.path=void 0,!i.servername&&i.servername!==""&&(i.servername=ms.isIP(i.host)?"":i.host),Da.connect(i)}function te(i,e,t){i._readyState=F.CLOSING;let r=new Error(t);Error.captureStackTrace(r,te),e.setHeader?(e[ys]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Ri,i,r)):(e.destroy(r),e.once("error",i.emit.bind(i,"error")),e.once("close",i.emitClose.bind(i)))}function Ar(i,e,t){if(e){let r=Ja(e).length;i._socket?i._sender._bufferedBytes+=r:i._bufferedAmount+=r}if(t){let r=new Error(`WebSocket is not open: readyState ${i.readyState} (${we[i.readyState]})`);t(r)}}function tc(i,e){let t=this[Y];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=i,t._socket[Y]!==void 0&&(t._socket.removeListener("data",Ti),process.nextTick(_s,t._socket),i===1005?t.close():t.close(i,e))}function ic(){let i=this[Y];i.isPaused||i._socket.resume()}function rc(i){let e=this[Y];e._socket[Y]!==void 0&&(e._socket.removeListener("data",Ti),process.nextTick(_s,e._socket),e.close(i[Ha])),e.emit("error",i)}function ps(){this[Y].emitClose()}function nc(i,e){this[Y].emit("message",i,e)}function sc(i){let e=this[Y];e.pong(i,!e._isServer,gs),e.emit("ping",i)}function oc(i){this[Y].emit("pong",i)}function _s(i){i.resume()}function Es(){let i=this[Y];this.removeListener("close",Es),this.removeListener("data",Ti),this.removeListener("end",bs),i._readyState=F.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[Y]=void 0,clearTimeout(i._closeTimer),i._receiver._writableState.finished||i._receiver._writableState.errorEmitted?i.emitClose():(i._receiver.on("error",ps),i._receiver.on("finish",ps))}function Ti(i){this[Y]._receiver.write(i)||this.pause()}function bs(){let i=this[Y];i._readyState=F.CLOSING,i._receiver.end(),this.end()}function Ss(){let i=this[Y];this.removeListener("error",Ss),this.on("error",gs),i&&(i._readyState=F.CLOSING,this.destroy())}});var Cs=I((ih,ws)=>{"use strict";var{tokenChars:ac}=Lt();function cc(i){let e=new Set,t=-1,r=-1,n=0;for(n;n<i.length;n++){let o=i.charCodeAt(n);if(r===-1&&ac[o]===1)t===-1&&(t=n);else if(n!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=n);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${n}`);r===-1&&(r=n);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 ${n}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let s=i.slice(t,n);if(e.has(s))throw new SyntaxError(`The "${s}" subprotocol is duplicated`);return e.add(s),e}ws.exports={parse:cc}});var Is=I((oh,Os)=>{"use strict";var lc=C("events"),Oi=C("http"),rh=C("https"),nh=C("net"),sh=C("tls"),{createHash:fc}=C("crypto"),Ns=xr(),ze=Pt(),hc=Cs(),uc=kr(),{GUID:dc,kWebSocket:pc}=Pe(),mc=/^[+/0-9A-Za-z]{22}==$/,As=0,ks=1,Ts=2,Rr=class extends lc{constructor(e,t){if(super(),e=v({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:uc},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=Oi.createServer((r,n)=>{let s=Oi.STATUS_CODES[426];n.writeHead(426,{"Content-Length":s.length,"Content-Type":"text/plain"}),n.end(s)}),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=gc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(n,s,o)=>{this.handleUpgrade(n,s,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=As}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===Ts){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Mt,this);return}if(e&&this.once("close",e),this._state!==ks)if(this._state=ks,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(Mt,this):process.nextTick(Mt,this);else{let t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{Mt(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,n){t.on("error",Rs);let s=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){$e(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){$e(this,e,t,400,"Invalid Upgrade header");return}if(!s||!mc.test(s)){$e(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){$e(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){qt(t,400);return}let a=e.headers["sec-websocket-protocol"],l=new Set;if(a!==void 0)try{l=hc.parse(a)}catch(u){$e(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}let h=e.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&h!==void 0){let u=new ze(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let d=Ns.parse(h);d[ze.extensionName]&&(u.accept(d[ze.extensionName]),c[ze.extensionName]=u)}catch(d){$e(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let u={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(u,(d,_,x,m)=>{if(!d)return qt(t,_||401,x,m);this.completeUpgrade(c,s,l,e,t,r,n)});return}if(!this.options.verifyClient(u))return qt(t,401)}this.completeUpgrade(c,s,l,e,t,r,n)}completeUpgrade(e,t,r,n,s,o,a){if(!s.readable||!s.writable)return s.destroy();if(s[pc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>As)return qt(s,503);let h=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${fc("sha1").update(t+dc).digest("base64")}`],c=new this.options.WebSocket(null);if(r.size){let u=this.options.handleProtocols?this.options.handleProtocols(r,n):r.values().next().value;u&&(h.push(`Sec-WebSocket-Protocol: ${u}`),c._protocol=u)}if(e[ze.extensionName]){let u=e[ze.extensionName].params,d=Ns.format({[ze.extensionName]:[u]});h.push(`Sec-WebSocket-Extensions: ${d}`),c._extensions=e}this.emit("headers",h,n),s.write(h.concat(`\r
7
7
  `).join(`\r
8
- `)),s.removeListener("error",ks),c.setSocket(s,o,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Dt,this)})),a(c,n)}};Ts.exports=kr;function pc(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 Dt(i){i._state=Rs,i.emit("close")}function ks(){this.destroy()}function Mt(i,e,t,r){t=t||Ti.STATUS_CODES[e],r=v({Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t)},r),i.once("finish",i.destroy),i.end(`HTTP/1.1 ${e} ${Ti.STATUS_CODES[e]}\r
8
+ `)),s.removeListener("error",Rs),c.setSocket(s,o,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Mt,this)})),a(c,n)}};Os.exports=Rr;function gc(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 Mt(i){i._state=Ts,i.emit("close")}function Rs(){this.destroy()}function qt(i,e,t,r){t=t||Oi.STATUS_CODES[e],r=v({Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t)},r),i.once("finish",i.destroy),i.end(`HTTP/1.1 ${e} ${Oi.STATUS_CODES[e]}\r
9
9
  `+Object.keys(r).map(n=>`${n}: ${r[n]}`).join(`\r
10
10
  `)+`\r
11
11
  \r
12
- `+t)}function ze(i,e,t,r,n){if(i.listenerCount("wsClientError")){let s=new Error(n);Error.captureStackTrace(s,ze),i.emit("wsClientError",s,t,e)}else Mt(t,r,n)}});var Tr=I((Wh,Ms)=>{"use strict";function wc(i){t.debug=t,t.default=t,t.coerce=l,t.disable=s,t.enable=n,t.enabled=o,t.humanize=Qi(),t.destroy=u,Object.keys(i).forEach(c=>{t[c]=i[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let h=0;for(let d=0;d<c.length;d++)h=(h<<5)-h+c.charCodeAt(d),h|=0;return t.colors[Math.abs(h)%t.colors.length]}t.selectColor=e;function t(c){let h,d=null,_,x;function m(...E){if(!m.enabled)return;let k=m,N=Number(new Date),p=N-(h||N);k.diff=p,k.prev=h,k.curr=N,h=N,E[0]=t.coerce(E[0]),typeof E[0]!="string"&&E.unshift("%O");let y=0;E[0]=E[0].replace(/%([a-zA-Z%])/g,(R,V)=>{if(R==="%%")return"%";y++;let j=t.formatters[V];if(typeof j=="function"){let de=E[y];R=j.call(k,de),E.splice(y,1),y--}return R}),t.formatArgs.call(k,E),(k.log||t.log).apply(k,E)}return m.namespace=c,m.useColors=t.useColors(),m.color=t.selectColor(c),m.extend=r,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(_!==t.namespaces&&(_=t.namespaces,x=t.enabled(c)),x),set:E=>{d=E}}),typeof t.init=="function"&&t.init(m),m}function r(c,h){let d=t(this.namespace+(typeof h=="undefined"?":":h)+c);return d.log=this.log,d}function n(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let h,d=(typeof c=="string"?c:"").split(/[\s,]+/),_=d.length;for(h=0;h<_;h++)d[h]&&(c=d[h].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.slice(1)+"$")):t.names.push(new RegExp("^"+c+"$")))}function s(){let c=[...t.names.map(a),...t.skips.map(a).map(h=>"-"+h)].join(",");return t.enable(""),c}function o(c){if(c[c.length-1]==="*")return!0;let h,d;for(h=0,d=t.skips.length;h<d;h++)if(t.skips[h].test(c))return!1;for(h=0,d=t.names.length;h<d;h++)if(t.names[h].test(c))return!0;return!1}function a(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function l(c){return c instanceof Error?c.stack||c.message:c}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}Ms.exports=wc});var qs=I((ie,Li)=>{"use strict";ie.formatArgs=Nc;ie.save=Ac;ie.load=kc;ie.useColors=Cc;ie.storage=Rc();ie.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`."))}})();ie.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 Cc(){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 Nc(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+Li.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,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),i.splice(r,0,e)}ie.log=console.debug||console.log||(()=>{});function Ac(i){try{i?ie.storage.setItem("debug",i):ie.storage.removeItem("debug")}catch(e){}}function kc(){let i;try{i=ie.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Rc(){try{return localStorage}catch(i){}}Li.exports=Tr()(ie);var{formatters:Tc}=Li.exports;Tc.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var zs=I((z,Ui)=>{"use strict";var Oc=C("tty"),Fi=C("util");z.init=Dc;z.log=Fc;z.formatArgs=Pc;z.save=Uc;z.load=Bc;z.useColors=Ic;z.destroy=Fi.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");z.colors=[6,2,3,4,5,1];try{let i=ir();i&&(i.stderr||i).level>=2&&(z.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){}z.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,s)=>s.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 Ic(){return"colors"in z.inspectOpts?!!z.inspectOpts.colors:Oc.isatty(process.stderr.fd)}function Pc(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${n};1m${e} \x1B[0m`;i[0]=s+i[0].split(`
12
+ `+t)}function $e(i,e,t,r,n){if(i.listenerCount("wsClientError")){let s=new Error(n);Error.captureStackTrace(s,$e),i.emit("wsClientError",s,t,e)}else qt(t,r,n)}});var Or=I((zh,qs)=>{"use strict";function Nc(i){t.debug=t,t.default=t,t.coerce=l,t.disable=s,t.enable=n,t.enabled=o,t.humanize=Zi(),t.destroy=h,Object.keys(i).forEach(c=>{t[c]=i[c]}),t.names=[],t.skips=[],t.formatters={};function e(c){let u=0;for(let d=0;d<c.length;d++)u=(u<<5)-u+c.charCodeAt(d),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(c){let u,d=null,_,x;function m(...S){if(!m.enabled)return;let k=m,N=Number(new Date),p=N-(u||N);k.diff=p,k.prev=u,k.curr=N,u=N,S[0]=t.coerce(S[0]),typeof S[0]!="string"&&S.unshift("%O");let y=0;S[0]=S[0].replace(/%([a-zA-Z%])/g,(R,V)=>{if(R==="%%")return"%";y++;let j=t.formatters[V];if(typeof j=="function"){let pe=S[y];R=j.call(k,pe),S.splice(y,1),y--}return R}),t.formatArgs.call(k,S),(k.log||t.log).apply(k,S)}return m.namespace=c,m.useColors=t.useColors(),m.color=t.selectColor(c),m.extend=r,m.destroy=t.destroy,Object.defineProperty(m,"enabled",{enumerable:!0,configurable:!1,get:()=>d!==null?d:(_!==t.namespaces&&(_=t.namespaces,x=t.enabled(c)),x),set:S=>{d=S}}),typeof t.init=="function"&&t.init(m),m}function r(c,u){let d=t(this.namespace+(typeof u=="undefined"?":":u)+c);return d.log=this.log,d}function n(c){t.save(c),t.namespaces=c,t.names=[],t.skips=[];let u,d=(typeof c=="string"?c:"").split(/[\s,]+/),_=d.length;for(u=0;u<_;u++)d[u]&&(c=d[u].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.slice(1)+"$")):t.names.push(new RegExp("^"+c+"$")))}function s(){let c=[...t.names.map(a),...t.skips.map(a).map(u=>"-"+u)].join(",");return t.enable(""),c}function o(c){if(c[c.length-1]==="*")return!0;let u,d;for(u=0,d=t.skips.length;u<d;u++)if(t.skips[u].test(c))return!1;for(u=0,d=t.names.length;u<d;u++)if(t.names[u].test(c))return!0;return!1}function a(c){return c.toString().substring(2,c.toString().length-2).replace(/\.\*\?$/,"*")}function l(c){return c instanceof Error?c.stack||c.message:c}function h(){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}qs.exports=Nc});var Ws=I((ie,Fi)=>{"use strict";ie.formatArgs=kc;ie.save=Rc;ie.load=Tc;ie.useColors=Ac;ie.storage=Oc();ie.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`."))}})();ie.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 Ac(){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 kc(i){if(i[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+i[0]+(this.useColors?"%c ":" ")+"+"+Fi.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,n=>{n!=="%%"&&(t++,n==="%c"&&(r=t))}),i.splice(r,0,e)}ie.log=console.debug||console.log||(()=>{});function Rc(i){try{i?ie.storage.setItem("debug",i):ie.storage.removeItem("debug")}catch(e){}}function Tc(){let i;try{i=ie.storage.getItem("debug")}catch(e){}return!i&&typeof process!="undefined"&&"env"in process&&(i=process.env.DEBUG),i}function Oc(){try{return localStorage}catch(i){}}Fi.exports=Or()(ie);var{formatters:Ic}=Fi.exports;Ic.j=function(i){try{return JSON.stringify(i)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var $s=I((z,Bi)=>{"use strict";var Pc=C("tty"),Ui=C("util");z.init=qc;z.log=Bc;z.formatArgs=Fc;z.save=Dc;z.load=Mc;z.useColors=Lc;z.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`.");z.colors=[6,2,3,4,5,1];try{let i=rr();i&&(i.stderr||i).level>=2&&(z.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){}z.inspectOpts=Object.keys(process.env).filter(i=>/^debug_/i.test(i)).reduce((i,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(n,s)=>s.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 Lc(){return"colors"in z.inspectOpts?!!z.inspectOpts.colors:Pc.isatty(process.stderr.fd)}function Fc(i){let{namespace:e,useColors:t}=this;if(t){let r=this.color,n="\x1B[3"+(r<8?r:"8;5;"+r),s=` ${n};1m${e} \x1B[0m`;i[0]=s+i[0].split(`
13
13
  `).join(`
14
- `+s),i.push(n+"m+"+Ui.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Lc()+e+" "+i[0]}function Lc(){return z.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Fc(...i){return process.stderr.write(Fi.formatWithOptions(z.inspectOpts,...i)+`
15
- `)}function Uc(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Bc(){return process.env.DEBUG}function Dc(i){i.inspectOpts={};let e=Object.keys(z.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=z.inspectOpts[e[t]]}Ui.exports=Tr()(z);var{formatters:Ws}=Ui.exports;Ws.o=function(i){return this.inspectOpts.colors=this.useColors,Fi.inspect(i,this.inspectOpts).split(`
16
- `).map(e=>e.trim()).join(" ")};Ws.O=function(i){return this.inspectOpts.colors=this.useColors,Fi.inspect(i,this.inspectOpts)}});var zt=I((zh,Or)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Or.exports=qs():Or.exports=zs()});var vo="v1",_o=`${PACKAGE_NAME}@${PACKAGE_VERSION}`,Qt=class{constructor(e={}){this.DEFAULT_BACKEND_URL=typeof window!="undefined"&&window.NOVU_LOCAL_BACKEND_URL||"https://api.novu.co";let{apiVersion:t=vo,apiUrl:r=this.DEFAULT_BACKEND_URL,userAgent:n=_o,headers:s={}}=e||{};this.apiVersion=t,this.apiUrl=`${r}/${t}`,this.headers=v({"Novu-API-Version":NOVU_API_VERSION,"Content-Type":"application/json","User-Agent":n},s)}setAuthorizationToken(e){this.headers.Authorization=`Bearer ${e}`}setKeylessHeader(e){var r;let t=e||typeof window!="undefined"&&((r=window.localStorage)==null?void 0:r.getItem("novu_keyless_application_identifier"));!t||!t.startsWith("pk_keyless_")||(this.headers["Novu-Application-Identifier"]=t)}setHeaders(e){this.headers=v(v({},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,r){return g(this,null,function*(){return this.doFetch({path:e,options:{method:"POST",body:t,headers:r==null?void 0:r.headers}})})}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(s){return g(this,arguments,function*({path:e,searchParams:t,options:r,unwrapEnvelope:n=!0}){let o=Eo(this.apiUrl,e,t?`?${t.toString()}`:""),a={method:(r==null?void 0:r.method)||"GET",headers:v(v({},this.headers),(r==null?void 0:r.headers)||{}),body:r!=null&&r.body?JSON.stringify(r.body):void 0},l=yield fetch(o,a);if(!l.ok){let c=yield l.json();throw new Error(`${this.headers["User-Agent"]} error. Status: ${l.status}, Message: ${c.message}`)}if(l.status===204)return;let u=yield l.json();return n?u.data:u})}};function Eo(...i){return i.reduce((e,t)=>(t&&e.push(t.replace(new RegExp("(?<!https?:)\\/+","g"),"/").replace(/^\/+|\/+$/g,"")),e),[]).join("/").replace(/\/\?/,"?")}var Je="/inbox",Q=`${Je}/notifications`,P,Zt=class{constructor(e={}){this.isSessionInitialized=!1;b(this,P);S(this,P,new Qt(e))}initializeSession(n){return g(this,arguments,function*({applicationIdentifier:e,subscriberHash:t,subscriber:r}){let s=yield f(this,P).post(`${Je}/session`,{applicationIdentifier:e,subscriberHash:t,subscriber:r});return f(this,P).setAuthorizationToken(s.token),f(this,P).setKeylessHeader(s.applicationIdentifier),this.isSessionInitialized=!0,s})}fetchNotifications({after:e,archived:t,limit:r=10,offset:n,read:s,tags:o,snoozed:a,data:l}){let u=new URLSearchParams(`limit=${r}`);return e&&u.append("after",e),n&&u.append("offset",`${n}`),o&&o.forEach(c=>u.append("tags[]",c)),s!==void 0&&u.append("read",`${s}`),t!==void 0&&u.append("archived",`${t}`),a!==void 0&&u.append("snoozed",`${a}`),l!==void 0&&u.append("data",JSON.stringify(l)),f(this,P).get(Q,u,!1)}count({filters:e}){return f(this,P).get(`${Q}/count`,new URLSearchParams({filters:JSON.stringify(e)}),!1)}read(e){return f(this,P).patch(`${Q}/${e}/read`)}unread(e){return f(this,P).patch(`${Q}/${e}/unread`)}archive(e){return f(this,P).patch(`${Q}/${e}/archive`)}unarchive(e){return f(this,P).patch(`${Q}/${e}/unarchive`)}snooze(e,t){return f(this,P).patch(`${Q}/${e}/snooze`,{snoozeUntil:t})}unsnooze(e){return f(this,P).patch(`${Q}/${e}/unsnooze`)}readAll({tags:e,data:t}){return f(this,P).post(`${Q}/read`,{tags:e,data:t?JSON.stringify(t):void 0})}archiveAll({tags:e,data:t}){return f(this,P).post(`${Q}/archive`,{tags:e,data:t?JSON.stringify(t):void 0})}archiveAllRead({tags:e,data:t}){return f(this,P).post(`${Q}/read-archive`,{tags:e,data:t?JSON.stringify(t):void 0})}completeAction({actionType:e,notificationId:t}){return f(this,P).patch(`${Q}/${t}/complete`,{actionType:e})}revertAction({actionType:e,notificationId:t}){return f(this,P).patch(`${Q}/${t}/revert`,{actionType:e})}fetchPreferences(e){let t=new URLSearchParams;e&&e.forEach(n=>t.append("tags[]",n));let r=t.size?`?${t.toString()}`:"";return f(this,P).get(`${Je}/preferences${r}`)}bulkUpdatePreferences(e){return f(this,P).patch(`${Je}/preferences/bulk`,{preferences:e})}updateGlobalPreferences(e){return f(this,P).patch(`${Je}/preferences`,e)}updateWorkflowPreferences({workflowId:e,channels:t}){return f(this,P).patch(`${Je}/preferences/${e}`,t)}triggerHelloWorldEvent(){let e={name:"hello-world",to:{subscriberId:"keyless-subscriber-id"},payload:{subject:"Novu Keyless Environment",body:"You're using a keyless demo environment. For full access to Novu features and cloud integration, obtain your API key.",primaryActionText:"Obtain API Key",primaryActionUrl:"https://go.novu.co/keyless",secondaryActionText:"Explore Documentation",secondaryActionUrl:"https://go.novu.co/keyless-docs"}};return f(this,P).post("/inbox/events",e)}};P=new WeakMap;function jr(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(n){n(t)}),(r=i.get("*"))&&r.slice().map(function(n){n(e,t)})}}}var Ue,ei=class{constructor(){b(this,Ue);S(this,Ue,jr())}on(e,t){return f(this,Ue).on(e,t),()=>{this.off(e,t)}}off(e,t){f(this,Ue).off(e,t)}emit(e,t){f(this,Ue).emit(e,t)}};Ue=new WeakMap;var A=class extends Error{constructor(e,t){super(e),this.originalError=t}};var Ne,Xe,Ae=class{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){b(this,Ne,[]);b(this,Xe);this._emitter=t,this._inboxService=e,this._emitter.on("session.initialize.resolved",({error:r,data:n})=>{n?(this.onSessionSuccess(n),f(this,Ne).forEach(a=>g(this,[a],function*({fn:s,resolve:o}){o(yield s())})),S(this,Ne,[])):r&&(this.onSessionError(r),S(this,Xe,r),f(this,Ne).forEach(({resolve:s})=>{s({error:new A("Failed to initialize session, please contact the support",r)})}),S(this,Ne,[]))})}onSessionSuccess(e){}onSessionError(e){}callWithSession(e){return g(this,null,function*(){return this._inboxService.isSessionInitialized?e():f(this,Xe)?Promise.resolve({error:new A("Failed to initialize session, please contact the support",f(this,Xe))}):new Promise((t,r)=>{f(this,Ne).push({fn:e,resolve:t,reject:r})})})}};Ne=new WeakMap,Xe=new WeakMap;var K,J,U=class{constructor(e,t,r){b(this,K);b(this,J);S(this,K,t),S(this,J,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.isSnoozed=e.isSnoozed,this.snoozedUntil=e.snoozedUntil,this.deliveredAt=e.deliveredAt,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:f(this,K),apiService:f(this,J),args:{notification:this}})}unread(){return ii({emitter:f(this,K),apiService:f(this,J),args:{notification:this}})}archive(){return ri({emitter:f(this,K),apiService:f(this,J),args:{notification:this}})}unarchive(){return ni({emitter:f(this,K),apiService:f(this,J),args:{notification:this}})}snooze(e){return si({emitter:f(this,K),apiService:f(this,J),args:{notification:this,snoozeUntil:e}})}unsnooze(){return oi({emitter:f(this,K),apiService:f(this,J),args:{notification:this}})}completePrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Qe({emitter:f(this,K),apiService:f(this,J),args:{notification:this},actionType:"primary"})}completeSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Qe({emitter:f(this,K),apiService:f(this,J),args:{notification:this},actionType:"secondary"})}revertPrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Ze({emitter:f(this,K),apiService:f(this,J),args:{notification:this},actionType:"primary"})}revertSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Ze({emitter:f(this,K),apiService:f(this,J),args:{notification:this},actionType:"secondary"})}on(e,t){let r=f(this,K).on(e,t);return()=>{r()}}off(e,t){f(this,K).off(e,t)}};K=new WeakMap,J=new WeakMap;var ti=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=ke(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:s});let o=yield e.read(n),a=new U(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 A("Failed to read notification",o)}}}),ii=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=ke(t,{isRead:!1,readAt:null,isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.unread.pending",{args:t,data:s});let o=yield e.unread(n),a=new U(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 A("Failed to unread notification",o)}}}),ri=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=ke(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:s});let o=yield e.archive(n),a=new U(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 A("Failed to archive notification",o)}}}),ni=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=ke(t,{isArchived:!1,archivedAt:null,isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.unarchive.pending",{args:t,data:s});let o=yield e.unarchive(n),a=new U(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 A("Failed to unarchive notification",o)}}}),si=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=ke(t,{isSnoozed:!0,snoozedUntil:t.snoozeUntil},{emitter:i,apiService:e});try{i.emit("notification.snooze.pending",{args:t,data:s});let o=yield e.snooze(n,t.snoozeUntil),a=new U(o,i,e);return i.emit("notification.snooze.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.snooze.resolved",{args:t,error:o}),{error:new A("Failed to snooze notification",o)}}}),oi=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=ke(t,{isSnoozed:!1,snoozedUntil:null},{emitter:i,apiService:e});try{i.emit("notification.unsnooze.pending",{args:t,data:s});let o=yield e.unsnooze(n),a=new U(o,i,e);return i.emit("notification.unsnooze.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unsnooze.resolved",{args:t,error:o}),{error:new A("Failed to unsnooze notification",o)}}}),Qe=n=>g(void 0,[n],function*({emitter:i,apiService:e,args:t,actionType:r}){let s=r==="primary"?{primaryAction:T(v({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!0})}:{secondaryAction:T(v({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!0})},{notificationId:o,optimisticValue:a}=ke(t,s,{emitter:i,apiService:e});try{i.emit("notification.complete_action.pending",{args:t,data:a});let l=yield e.completeAction({actionType:r,notificationId:o}),u=new U(l,i,e);return i.emit("notification.complete_action.resolved",{args:t,data:u}),{data:u}}catch(l){return i.emit("notification.complete_action.resolved",{args:t,error:l}),{error:new A(`Failed to complete ${r} action on the notification`,l)}}}),Ze=n=>g(void 0,[n],function*({emitter:i,apiService:e,args:t,actionType:r}){let s=r==="primary"?{primaryAction:T(v({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!1})}:{secondaryAction:T(v({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!1})},{notificationId:o,optimisticValue:a}=ke(t,s,{emitter:i,apiService:e});try{i.emit("notification.revert_action.pending",{args:t,data:a});let l=yield e.revertAction({actionType:r,notificationId:o}),u=new U(l,i,e);return i.emit("notification.revert_action.resolved",{args:t,data:u}),{data:u}}catch(l){return i.emit("notification.revert_action.resolved",{args:t,error:l}),{error:new A("Failed to fetch notifications",l)}}}),ke=(i,e,t)=>"notification"in i?{notificationId:i.notification.id,optimisticValue:new U(v(v({},i.notification),e),t.emitter,t.apiService)}:{notificationId:i.notificationId},Gr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r,data:n}){try{let a=t.getUniqueNotifications({tags:r,data:n}).map(l=>new U(T(v({},l),{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0}),i,e));return i.emit("notifications.read_all.pending",{args:{tags:r,data:n},data:a}),yield e.readAll({tags:r,data:n}),i.emit("notifications.read_all.resolved",{args:{tags:r,data:n},data:a}),{}}catch(o){return i.emit("notifications.read_all.resolved",{args:{tags:r,data:n},error:o}),{error:new A("Failed to read all notifications",o)}}}),Kr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r,data:n}){try{let a=t.getUniqueNotifications({tags:r,data:n}).map(l=>new U(T(v({},l),{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:n},data:a}),yield e.archiveAll({tags:r,data:n}),i.emit("notifications.archive_all.resolved",{args:{tags:r,data:n},data:a}),{}}catch(o){return i.emit("notifications.archive_all.resolved",{args:{tags:r,data:n},error:o}),{error:new A("Failed to archive all notifications",o)}}}),Yr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r,data:n}){try{let a=t.getUniqueNotifications({tags:r,data:n,read:!0}).map(l=>new U(T(v({},l),{isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all_read.pending",{args:{tags:r,data:n},data:a}),yield e.archiveAllRead({tags:r,data:n}),i.emit("notifications.archive_all_read.resolved",{args:{tags:r,data:n},data:a}),{}}catch(o){return i.emit("notifications.archive_all_read.resolved",{args:{tags:r,data:n},error:o}),{error:new A("Failed to archive all read notifications",o)}}});var Jr=(i,e)=>i===e?!0:!i||!e||i.length!==e.length?!1:i.every((t,r)=>t===e[r]);var El=["seen","unseen"],bl=["read","unread"],Vi=(i,e)=>Jr(i,e)||!i&&(e==null?void 0:e.length)===0||(i==null?void 0:i.length)===0&&!e,Hi=(i,e)=>{if(!i&&!e)return!0;if(!i||!e)return!1;try{return JSON.stringify(i)===JSON.stringify(e)}catch(t){return!1}},ji=(i,e)=>Hi(i.data,e.data)&&Vi(i.tags,e.tags)&&i.read===e.read&&i.archived===e.archived&&i.snoozed===e.snoozed;var ce,et=class{constructor(){b(this,ce);S(this,ce,new Map)}get(e){return f(this,ce).get(e)}getValues(){return Array.from(f(this,ce).values())}entries(){return Array.from(f(this,ce).entries())}keys(){return Array.from(f(this,ce).keys())}set(e,t){f(this,ce).set(e,t)}remove(e){f(this,ce).delete(e)}clear(){f(this,ce).clear()}};ce=new WeakMap;var Xr=({tags:i,data:e,read:t,archived:r,snoozed:n,limit:s,offset:o,after:a})=>Object.entries({tags:i,data:e,read:t,archived:r,snoozed:n,limit:s,offset:o,after:a}).filter(([l,u])=>u!=null&&!(Array.isArray(u)&&u.length===0)).reduce((l,[u,c])=>(l[u]=c,l),{}),Gi=({tags:i,data:e,read:t,archived:r,snoozed:n,limit:s,offset:o,after:a})=>JSON.stringify(Xr({tags:i,data:e,read:t,archived:r,snoozed:n,limit:s,offset:o,after:a})),bo=({tags:i,data:e,read:t,archived:r,snoozed:n})=>JSON.stringify(Xr({tags:i,data:e,read:t,archived:r,snoozed:n})),tt=i=>JSON.parse(i),So=["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"],xo=["notification.archive.pending","notification.unarchive.pending","notification.snooze.pending","notification.unsnooze.pending","notifications.archive_all.pending","notifications.archive_all_read.pending"],Re,M,vt=class{constructor({emitter:e}){b(this,Re);b(this,M);this.updateNotification=(e,t)=>{let r=f(this,M).get(e);if(!r)return!1;let n=r.notifications.findIndex(o=>o.id===t.id);if(n===-1)return!1;let s=[...r.notifications];return s[n]=t,f(this,M).set(e,T(v({},r),{notifications:s})),!0};this.removeNotification=(e,t)=>{let r=f(this,M).get(e);if(!r)return!1;let n=r.notifications.findIndex(o=>o.id===t.id);if(n===-1)return!1;let s=[...r.notifications];return s.splice(n,1),f(this,M).set(e,T(v({},r),{notifications:s})),!0};this.handleNotificationEvent=({remove:e}={remove:!1})=>({data:t})=>{if(!t)return;let r=Array.isArray(t)?t:[t],n=new Set;f(this,M).keys().forEach(s=>{r.forEach(o=>{let a=!1;e?a=this.removeNotification(s,o):a=this.updateNotification(s,o),a&&n.add(bo(tt(s)))})}),n.forEach(s=>{let o=this.getAggregated(tt(s));f(this,Re).emit("notifications.list.updated",{data:o})})};S(this,Re,e),So.forEach(t=>{f(this,Re).on(t,this.handleNotificationEvent())}),xo.forEach(t=>{f(this,Re).on(t,this.handleNotificationEvent({remove:!0}))}),S(this,M,new et)}getAggregated(e){return f(this,M).keys().filter(r=>{let n=tt(r);return ji(n,e)}).map(r=>f(this,M).get(r)).reduce((r,n)=>n?{hasMore:n.hasMore,filter:n.filter,notifications:[...r.notifications,...n.notifications]}:r,{hasMore:!1,filter:{},notifications:[]})}has(e){return f(this,M).get(Gi(e))!==void 0}set(e,t){f(this,M).set(Gi(e),t)}update(e,t){this.set(e,t);let r=this.getAggregated(tt(Gi(e)));f(this,Re).emit("notifications.list.updated",{data:r})}getAll(e){if(this.has(e))return this.getAggregated({tags:e.tags,data:e.data,read:e.read,snoozed:e.snoozed,archived:e.archived})}getUniqueNotifications({tags:e,read:t,data:r}){let n=f(this,M).keys(),s=new Map;return n.forEach(o=>{let a=tt(o);if(Vi(e,a.tags)&&Hi(r,a.data)){let l=f(this,M).get(o);if(!l)return;l.notifications.filter(u=>typeof t=="undefined"||t===u.isRead).forEach(u=>s.set(u.id,u))}}),Array.from(s.values())}clear(e){f(this,M).keys().forEach(r=>{ji(tt(r),e)&&f(this,M).remove(r)})}clearAll(){f(this,M).clear()}};Re=new WeakMap,M=new WeakMap;var _t,ai=class extends Ae{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:n}){super({eventEmitterInstance:n,inboxServiceInstance:r});b(this,_t);this.cache=new vt({emitter:n}),S(this,_t,t)}list(){return g(this,arguments,function*(n={}){var s=n,{limit:t=10}=s,r=Hr(s,["limit"]);return this.callWithSession(()=>g(this,null,function*(){let o=v({limit:t},r);try{let a="useCache"in o?o.useCache:f(this,_t),l=a?this.cache.getAll(o):void 0;if(this._emitter.emit("notifications.list.pending",{args:o,data:l}),!l){let u=yield this._inboxService.fetchNotifications(v({limit:t},r));l={hasMore:u.hasMore,filter:u.filter,notifications:u.data.map(c=>new U(c,this._emitter,this._inboxService))},a&&(this.cache.set(o,l),l=this.cache.getAll(o))}return this._emitter.emit("notifications.list.resolved",{args:o,data:l}),{data:l}}catch(a){return this._emitter.emit("notifications.list.resolved",{args:o,error:a}),{error:new A("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:[v({},t)];try{this._emitter.emit("notifications.count.pending",{args:t});let n=yield this._inboxService.count({filters:r}),s=t&&"filters"in t?{counts:n.data}:n.data[0];return this._emitter.emit("notifications.count.resolved",{args:t,data:s}),{data:s}}catch(n){return this._emitter.emit("notifications.count.resolved",{args:t,error:n}),{error:new A("Failed to count notifications",n)}}}))})}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 ni({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}snooze(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return si({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unsnooze(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return oi({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}completePrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Qe({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 Qe({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 Ze({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 Ze({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}readAll(){return g(this,arguments,function*({tags:t,data:r}={}){return this.callWithSession(()=>g(this,null,function*(){return Gr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t,data:r})}))})}archiveAll(){return g(this,arguments,function*({tags:t,data:r}={}){return this.callWithSession(()=>g(this,null,function*(){return Kr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t,data:r})}))})}archiveAllRead(){return g(this,arguments,function*({tags:t,data:r}={}){return this.callWithSession(()=>g(this,null,function*(){return Yr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t,data:r})}))})}clearCache({filter:t}={}){return t?this.cache.clear(t!=null?t:{}):this.cache.clearAll()}triggerHelloWorldEvent(){return g(this,null,function*(){return this._inboxService.triggerHelloWorldEvent()})}};_t=new WeakMap;var ci=s=>g(void 0,[s],function*({emitter:i,apiService:e,cache:t,useCache:r,args:n}){var l;let{channels:o}=n,a="workflowId"in n?n.workflowId:(l=n.preference.workflow)==null?void 0:l.id;try{i.emit("preference.update.pending",{args:n,data:"preference"in n?new pe(T(v({},n.preference),{channels:v(v({},n.preference.channels),o)}),{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0});let u;a?u=yield e.updateWorkflowPreferences({workflowId:a,channels:o}):(wo({emitter:i,apiService:e,cache:t,useCache:r,args:n}),u=yield e.updateGlobalPreferences(o));let c=new pe(u,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r});return i.emit("preference.update.resolved",{args:n,data:c}),{data:c}}catch(u){return i.emit("preference.update.resolved",{args:n,error:u}),{error:new A("Failed to update preference",u)}}}),Qr=s=>g(void 0,[s],function*({emitter:i,apiService:e,cache:t,useCache:r,args:n}){if(n.find(a=>"preference"in a&&a.preference.level==="global"))return{error:new A("Global preference is not supported in bulk update","")};try{let a=n.map(h=>"preference"in h?new pe(T(v({},h.preference),{channels:v(v({},h.preference.channels),h.channels)}),{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0).filter(h=>h!==void 0);i.emit("preferences.bulk_update.pending",{args:n,data:a});let l=n.map(h=>{var d,_,x,m;return v({workflowId:"workflowId"in h?h.workflowId:(m=(x=(d=h.preference.workflow)==null?void 0:d.id)!=null?x:(_=h.preference.workflow)==null?void 0:_.identifier)!=null?m:""},h.channels)}),c=(yield e.bulkUpdatePreferences(l)).map(h=>new pe(h,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}));return i.emit("preferences.bulk_update.resolved",{args:n,data:c}),{data:c}}catch(a){return i.emit("preferences.bulk_update.resolved",{args:n,error:a}),{error:new A("Failed to bulk update preferences",a)}}}),wo=({emitter:i,apiService:e,cache:t,useCache:r,args:n})=>{let s=r?t==null?void 0:t.getAll({}):void 0;s==null||s.forEach(o=>{var a,l;if(o.level==="template"){let u=T(v({},o),{channels:Object.entries(o.channels).reduce((h,[d,_])=>{var m;let x=d;return h[x]=(m=n.channels[x])!=null?m:_,h},{})}),c="preference"in n?new pe(u,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0;c&&i.emit("preference.update.pending",{args:{workflowId:(l=(a=o.workflow)==null?void 0:a.id)!=null?l:"",channels:c.channels},data:c})}})};var Et,bt,St,xt,pe=class{constructor(e,{emitterInstance:t,inboxServiceInstance:r,cache:n,useCache:s}){b(this,Et);b(this,bt);b(this,St);b(this,xt);S(this,Et,t),S(this,bt,r),S(this,St,n),S(this,xt,s),this.level=e.level,this.enabled=e.enabled,this.channels=e.channels,this.workflow=e.workflow}update({channels:e,channelPreferences:t}){var r;return ci({emitter:f(this,Et),apiService:f(this,bt),cache:f(this,St),useCache:f(this,xt),args:{workflowId:(r=this.workflow)==null?void 0:r.id,channels:e||t,preference:this}})}};Et=new WeakMap,bt=new WeakMap,St=new WeakMap,xt=new WeakMap;var Co=["preference.update.pending","preference.update.resolved","preferences.bulk_update.pending","preferences.bulk_update.resolved"],No=({tags:i})=>Object.entries({tags:i}).reduce((e,[t,r])=>(r==null||Array.isArray(r)&&r.length===0||(e[t]=r),e),{}),Ki=({tags:i})=>JSON.stringify(No({tags:i})),it,Z,li=class{constructor({emitterInstance:e}){b(this,it);b(this,Z);this.updatePreference=(e,t)=>{let r=f(this,Z).get(e);if(!r)return!1;let n=r.findIndex(o=>{var a,l;return((a=o.workflow)==null?void 0:a.id)===((l=t.workflow)==null?void 0:l.id)||o.level===t.level&&t.level==="global"});if(n===-1)return!1;let s=[...r];return s[n]=t,f(this,Z).set(e,s),!0};this.handlePreferenceEvent=({data:e})=>{if(!e)return;let t=Array.isArray(e)?e:[e],r=new Set;f(this,Z).keys().forEach(n=>{t.forEach(s=>{let o=this.updatePreference(n,s),a=f(this,Z).get(n);!o||!a||r.add(n)})}),r.forEach(n=>{var s;f(this,it).emit("preferences.list.updated",{data:(s=f(this,Z).get(n))!=null?s:[]})})};S(this,it,e),Co.forEach(t=>{f(this,it).on(t,this.handlePreferenceEvent)}),S(this,Z,new et)}has(e){return f(this,Z).get(Ki(e))!==void 0}set(e,t){f(this,Z).set(Ki(e),t)}getAll(e){if(this.has(e))return f(this,Z).get(Ki(e))}clearAll(){f(this,Z).clear()}};it=new WeakMap,Z=new WeakMap;var _e,fi=class extends Ae{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:n}){super({eventEmitterInstance:n,inboxServiceInstance:r});b(this,_e);this.cache=new li({emitterInstance:this._emitter}),S(this,_e,t)}list(){return g(this,arguments,function*(t={}){return this.callWithSession(()=>g(this,null,function*(){try{let r=f(this,_e)?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(s=>new pe(s,{emitterInstance:this._emitter,inboxServiceInstance:this._inboxService,cache:this.cache,useCache:f(this,_e)})),f(this,_e)&&(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}}))})}update(t){return g(this,null,function*(){return this.callWithSession(()=>ci({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,useCache:f(this,_e),args:t}))})}bulkUpdate(t){return g(this,null,function*(){return this.callWithSession(()=>Qr({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,useCache:f(this,_e),args:t}))})}};_e=new WeakMap;var Be,wt,me,hi=class{constructor(e,t,r){b(this,Be);b(this,wt);b(this,me);S(this,Be,r),S(this,wt,t),S(this,me,e)}get applicationIdentifier(){return f(this,me).applicationIdentifier}get subscriberId(){var e;return(e=f(this,me).subscriber)==null?void 0:e.subscriberId}handleApplicationIdentifier(e,t){if(typeof window=="undefined"||!window.localStorage)return null;let r="novu_keyless_application_identifier";switch(e){case"get":return window.localStorage.getItem(r);case"store":return t&&window.localStorage.setItem(r,t),null;case"delete":return window.localStorage.removeItem(r),null;default:return null}}initialize(){return g(this,null,function*(){var e,t;try{let{subscriber:r,subscriberHash:n,applicationIdentifier:s}=f(this,me),o=s;if(o)this.handleApplicationIdentifier("delete");else{let l=this.handleApplicationIdentifier("get");l&&(o=l)}f(this,Be).emit("session.initialize.pending",{args:f(this,me)});let a=yield f(this,wt).initializeSession({applicationIdentifier:o,subscriberHash:n,subscriber:r});(e=a==null?void 0:a.applicationIdentifier)!=null&&e.startsWith("pk_keyless_")&&this.handleApplicationIdentifier("store",a.applicationIdentifier),(t=a==null?void 0:a.applicationIdentifier)!=null&&t.startsWith("pk_keyless_")||this.handleApplicationIdentifier("delete"),f(this,Be).emit("session.initialize.resolved",{args:f(this,me),data:a})}catch(r){f(this,Be).emit("session.initialize.resolved",{args:f(this,me),error:r})}})}};Be=new WeakMap,wt=new WeakMap,me=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 Nt={type:"error",data:"parser error"};var At=({type:i,data:e},t,r)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?r(t?e:"b"+Zr(e,!0).toString("base64")):r(le[i]+(e||"")),Zr=(i,e)=>Buffer.isBuffer(i)||i instanceof Uint8Array&&!e?i:i instanceof ArrayBuffer?Buffer.from(i):Buffer.from(i.buffer,i.byteOffset,i.byteLength),Yi;function en(i,e){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return e(Zr(i.data,!1));At(i,!0,t=>{Yi||(Yi=new TextEncoder),e(Yi.encode(t))})}var kt=(i,e)=>{if(typeof i!="string")return{type:"message",data:tn(i,e)};let t=i.charAt(0);if(t==="b"){let r=Buffer.from(i.substring(1),"base64");return{type:"message",data:tn(r,e)}}return Ct[t]?i.length>1?{type:Ct[t],data:i.substring(1)}:{type:Ct[t]}:Nt},tn=(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 rn="",nn=(i,e)=>{let t=i.length,r=new Array(t),n=0;i.forEach((s,o)=>{At(s,!1,a=>{r[o]=a,++n===t&&e(r.join(rn))})})},sn=(i,e)=>{let t=i.split(rn),r=[];for(let n=0;n<t.length;n++){let s=kt(t[n],e);if(r.push(s),s.type==="error")break}return r};function on(){return new TransformStream({transform(i,e){en(i,t=>{let r=t.length,n;if(r<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,r);else if(r<65536){n=new Uint8Array(3);let s=new DataView(n.buffer);s.setUint8(0,126),s.setUint16(1,r)}else{n=new Uint8Array(9);let s=new DataView(n.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(r))}i.data&&typeof i.data!="string"&&(n[0]|=128),e.enqueue(n),e.enqueue(t)})}})}var Ji;function ui(i){return i.reduce((e,t)=>e+t.length,0)}function di(i,e){if(i[0].length===e)return i.shift();let t=new Uint8Array(e),r=0;for(let n=0;n<e;n++)t[n]=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 an(i,e){Ji||(Ji=new TextDecoder);let t=[],r=0,n=-1,s=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(r===0){if(ui(t)<1)break;let l=di(t,1);s=(l[0]&128)===128,n=l[0]&127,n<126?r=3:n===126?r=1:r=2}else if(r===1){if(ui(t)<2)break;let l=di(t,2);n=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),r=3}else if(r===2){if(ui(t)<8)break;let l=di(t,8),u=new DataView(l.buffer,l.byteOffset,l.length),c=u.getUint32(0);if(c>Math.pow(2,21)-1){a.enqueue(Nt);break}n=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(ui(t)<n)break;let l=di(t,n);a.enqueue(kt(s?l:Ji.decode(l),e)),r=0}if(n===0||n>i){a.enqueue(Nt);break}}}})}var Xi=4;function O(i){if(i)return Ao(i)}function Ao(i){for(var e in O.prototype)i[e]=O.prototype[e];return i}O.prototype.on=O.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this};O.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this};O.prototype.off=O.prototype.removeListener=O.prototype.removeAllListeners=O.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,n=0;n<t.length;n++)if(r=t[n],r===e||r.fn===e){t.splice(n,1);break}return t.length===0&&delete this._callbacks["$"+i],this};O.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,n=t.length;r<n;++r)t[r].apply(this,e)}return this};O.prototype.emitReserved=O.prototype.emit;O.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};O.prototype.hasListeners=function(i){return!!this.listeners(i).length};var fe=global;function pi(i,...e){return e.reduce((t,r)=>(i.hasOwnProperty(r)&&(t[r]=i[r]),t),{})}var ko=fe.setTimeout,Ro=fe.clearTimeout;function Ee(i,e){e.useNativeTimers?(i.setTimeoutFn=ko.bind(fe),i.clearTimeoutFn=Ro.bind(fe)):(i.setTimeoutFn=fe.setTimeout.bind(fe),i.clearTimeoutFn=fe.clearTimeout.bind(fe))}var To=1.33;function cn(i){return typeof i=="string"?Oo(i):Math.ceil((i.byteLength||i.size)*To)}function Oo(i){let e=0,t=0;for(let r=0,n=i.length;r<n;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 En=G(Me(),1);function vn(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function _n(i){let e={},t=i.split("&");for(let r=0,n=t.length;r<n;r++){let s=t[r].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}var ea=(0,En.default)("engine.io-client:transport"),nr=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},be=class extends O{constructor(e){super(),this.writable=!1,Ee(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new nr(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):ea("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=vn(e);return t.length?"?"+t:""}};var Tn=G(Me(),1);var wn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),sr=64,ta={},bn=0,_i=0,Sn;function xn(i){let e="";do e=wn[i%sr]+e,i=Math.floor(i/sr);while(i>0);return e}function Ei(){let i=xn(+new Date);return i!==Sn?(bn=0,Sn=i):i+"."+xn(bn++)}for(;_i<sr;_i++)ta[wn[_i]]=_i;var cr=G(An(),1),lr=cr.default||cr;function kn(){return new ar}function ra(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 n=e[0].substring(t+1).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));let s={name:r,value:n};for(let o=1;o<e.length;o++){let a=e[o].split("=");if(a.length!==2)continue;let l=a[0].trim(),u=a[1].trim();switch(l){case"Expires":s.expires=new Date(u);break;case"Max-Age":let c=new Date;c.setUTCSeconds(c.getUTCSeconds()+parseInt(u,10)),s.expires=c;break;default:}}return s}var ar=class{constructor(){this.cookies=new Map}parseCookies(e){let t=e.getResponseHeader("set-cookie");t&&t.forEach(r=>{let n=ra(r);n&&this.cookies.set(n.name,n)})}addCookies(e){let t=[];this.cookies.forEach((r,n)=>{var s;((s=r.expires)===null||s===void 0?void 0:s.getTime())<Date.now()?this.cookies.delete(n):t.push(`${n}=${r.value}`)}),t.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",t.join("; ")))}};var X=(0,Tn.default)("engine.io-client:polling");function na(){}var sa=function(){return new lr({xdomain:!1}).responseType!=null}(),bi=class extends be{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){let r=location.protocol==="https:",n=location.port;n||(n=r?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||n!==e.port}let t=e&&e.forceBase64;this.supportsBinary=sa&&!t,this.opts.withCredentials&&(this.cookieJar=kn())}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)};sn(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,nn(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]=Ei()),!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 Oe(this.uri(),e)}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(n,s)=>{this.onError("xhr post error",n,s)})}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}},Oe=class i extends O{constructor(e,t){super(),Ee(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=pi(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let r=this.xhr=new lr(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 n in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this.opts.extraHeaders[n])}}catch(n){}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(n){}try{r.setRequestHeader("Accept","*/*")}catch(n){}(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 n;r.readyState===3&&((n=this.opts.cookieJar)===null||n===void 0||n.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(n){this.setTimeoutFn(()=>{this.onError(n)},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=na,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()}};Oe.requestsCount=0;Oe.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Rn);else if(typeof addEventListener=="function"){let i="onpagehide"in fe?"pagehide":"unload";addEventListener(i,Rn,!1)}}function Rn(){for(let i in Oe.requests)Oe.requests.hasOwnProperty(i)&&Oe.requests[i].abort()}var mc=G(Ln(),1),gc=G(vr(),1),yc=G(Er(),1),Is=G(Ar(),1),vc=G(Os(),1);var Ps=Is.default;var qt=Ps,Oi=!1,Ls="nodebuffer",$e=process.nextTick;var Us=G(Me(),1);var _c=(0,Us.default)("engine.io-client:websocket"),Fs=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Ii=class extends be{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=Fs?{}:pi(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=Oi&&!Fs?t?new qt(e,t):new qt(e):new qt(e,t,r)}catch(n){return this.emitReserved("error",n)}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],n=t===e.length-1;At(r,this.supportsBinary,s=>{let o={};Oi||(r.options&&(o.compress=r.options.compress),this.opts.perMessageDeflate&&(typeof s=="string"?Buffer.byteLength(s):s.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{Oi?this.ws.send(s):this.ws.send(s,o)}catch(a){_c("websocket closed before onclose event")}n&&$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]=Ei()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!qt}};var Bs=G(Me(),1),Wt=(0,Bs.default)("engine.io-client:webtransport"),Pi=class extends be{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=an(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),n=on();n.readable.pipeTo(e.writable),this.writer=n.writable.getWriter();let s=()=>{r.read().then(({done:a,value:l})=>{if(a){Wt("session is closed");return}Wt("received chunk: %o",l),this.onPacket(l),s()}).catch(a=>{Wt("an error occurred while reading: %s",a)})};s();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],n=t===e.length-1;this.writer.write(r).then(()=>{n&&$e(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}};var Rr={websocket:Ii,webtransport:Pi,polling:bi};var Ec=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,bc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ft(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 n=Ec.exec(i||""),s={},o=14;for(;o--;)s[bc[o]]=n[o]||"";return t!=-1&&r!=-1&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=Sc(s,s.path),s.queryKey=xc(s,s.query),s}function Sc(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 xc(i,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,n,s){n&&(t[n]=s)}),t}var Ds=G(Me(),1);var L=(0,Ds.default)("engine.io-client:socket"),Ve=class i extends O{constructor(e,t={}){super(),this.binaryType=Ls,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=ft(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=ft(t.host).host),Ee(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=_n(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){L('creating transport "%s"',e);let t=Object.assign({},this.opts.query);t.EIO=Xi,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 L("options: %j",r),new Rr[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){L("error while creating transport: %s",t),this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){L("setting transport %s",e.name),this.transport&&(L("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){L('probing transport "%s"',e);let t=this.createTransport(e),r=!1;i.priorWebsocketSuccess=!1;let n=()=>{r||(L('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(L('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;i.priorWebsocketSuccess=t.name==="websocket",L('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||this.readyState!=="closed"&&(L("changing transport and sending upgrade packet"),c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{L('probe transport "%s" failed',e);let d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function s(){r||(r=!0,c(),t.close(),t=null)}let o=h=>{let d=new Error("probe error: "+h);d.transport=t.name,s(),L('probe transport "%s" failed because of error: %s',e,h),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function l(){o("socket closed")}function u(h){t&&h.name!==t.name&&(L('"%s" works - aborting "%s"',h.name,t.name),s())}let c=()=>{t.removeListener("open",n),t.removeListener("error",o),t.removeListener("close",a),this.off("close",l),this.off("upgrading",u)};t.once("open",n),t.once("error",o),t.once("close",a),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(L("socket open"),this.readyState="open",i.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){L("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(L('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 L('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();L("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 n=this.writeBuffer[r].data;if(n&&(t+=cn(n)),r>0&&t>this.maxPayload)return L("only send %d out of %d packets",r,this.writeBuffer.length),this.writeBuffer.slice(0,r);t+=2}return L("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,n){if(typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let s={type:e,data:t,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this.onClose("forced close"),L("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){L("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")&&(L('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,n=e.length;for(;r<n;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}};Ve.protocol=Xi;var Lh=Ve.protocol;var Vs=G(zt(),1),$s=(0,Vs.default)("socket.io-client:url");function Hs(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)||($s("protocol-less url %s",i),typeof t!="undefined"?i=t.protocol+"//"+i:i="https://"+i),$s("parse %s",i),r=ft(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 s=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+e,r.href=r.protocol+"://"+s+(t&&t.port===r.port?"":":"+r.port),r}var Dr={};go(Dr,{Decoder:()=>Ur,Encoder:()=>Fr,PacketType:()=>w,protocol:()=>Xs});var Mc=typeof ArrayBuffer=="function",qc=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,js=Object.prototype.toString,Wc=typeof Blob=="function"||typeof Blob!="undefined"&&js.call(Blob)==="[object BlobConstructor]",zc=typeof File=="function"||typeof File!="undefined"&&js.call(File)==="[object FileConstructor]";function Vt(i){return Mc&&(i instanceof ArrayBuffer||qc(i))||Wc&&i instanceof Blob||zc&&i instanceof File}function $t(i,e){if(!i||typeof i!="object")return!1;if(Array.isArray(i)){for(let t=0,r=i.length;t<r;t++)if($t(i[t]))return!0;return!1}if(Vt(i))return!0;if(i.toJSON&&typeof i.toJSON=="function"&&arguments.length===1)return $t(i.toJSON(),!0);for(let t in i)if(Object.prototype.hasOwnProperty.call(i,t)&&$t(i[t]))return!0;return!1}function Gs(i){let e=[],t=i.data,r=i;return r.data=Ir(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Ir(i,e){if(!i)return i;if(Vt(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]=Ir(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]=Ir(i[r],e));return t}return i}function Ks(i,e){return i.data=Pr(i.data,e),delete i.attachments,i}function Pr(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]=Pr(i[t],e);else if(typeof i=="object")for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Pr(i[t],e));return i}var Js=G(Me(),1),Lr=(0,Js.default)("socket.io-parser"),$c=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Xs=5,w;(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"})(w||(w={}));var Fr=class{constructor(e){this.replacer=e}encode(e){return Lr("encoding packet %j",e),(e.type===w.EVENT||e.type===w.ACK)&&$t(e)?this.encodeAsBinary({type:e.type===w.EVENT?w.BINARY_EVENT:w.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===w.BINARY_EVENT||e.type===w.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)),Lr("encoded %j as %s",e,t),t}encodeAsBinary(e){let t=Gs(e),r=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(r),n}};function Ys(i){return Object.prototype.toString.call(i)==="[object Object]"}var Ur=class i extends O{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===w.BINARY_EVENT;r||t.type===w.BINARY_ACK?(t.type=r?w.EVENT:w.ACK,this.reconstructor=new Br(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Vt(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(w[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===w.BINARY_EVENT||r.type===w.BINARY_ACK){let s=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(s,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){let s=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(s,t)}else r.nsp="/";let n=e.charAt(t+1);if(n!==""&&Number(n)==n){let s=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(s,t+1))}if(e.charAt(++t)){let s=this.tryParse(e.substr(t));if(i.isPayloadValid(r.type,s))r.data=s;else throw new Error("invalid payload")}return Lr("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 w.CONNECT:return Ys(t);case w.DISCONNECT:return t===void 0;case w.CONNECT_ERROR:return typeof t=="string"||Ys(t);case w.EVENT:case w.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&$c.indexOf(t[0])===-1);case w.ACK:case w.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Br=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=Ks(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function re(i,e,t){return i.on(e,t),function(){i.off(e,t)}}var Qs=G(zt(),1),D=(0,Qs.default)("socket.io-client:socket"),Vc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ht=class extends O{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=[re(e,"open",this.onopen.bind(this)),re(e,"packet",this.onpacket.bind(this)),re(e,"error",this.onerror.bind(this)),re(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(Vc.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:w.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++;D("emitting packet with ack id %d",o);let a=t.pop();this._registerAckCallback(o,a),r.id=o}let n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)?D("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 n=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(D("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));D("event with ack id %d has timed out after %d ms",e,n),t.call(this,new Error("operation has timed out"))},n);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(s),t.apply(this,[null,...o])}}emitWithAck(e,...t){let r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((n,s)=>{t.push((o,a)=>r?o?s(o):n(a):n(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((n,...s)=>r!==this._queue[0]?void 0:(n!==null?r.tryCount>this._opts.retries&&(D("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(n)):(D("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...s)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(D("draining queue"),!this.connected||this._queue.length===0)return;let t=this._queue[0];if(t.pending&&!e){D("packet [%d] has already been sent and is waiting for an ack",t.id);return}t.pending=!0,t.tryCount++,D("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(){D("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:w.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){D("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 w.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 w.EVENT:case w.BINARY_EVENT:this.onevent(e);break;case w.ACK:case w.BINARY_ACK:this.onack(e);break;case w.DISCONNECT:this.ondisconnect();break;case w.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||[];D("emitting event %j",t),e.id!=null&&(D("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(...n){r||(r=!0,D("sending ack %j",n),t.packet({type:w.ACK,id:e,data:n}))}}onack(e){let t=this.acks[e.id];typeof t=="function"?(D("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):D("bad ack %s",e.id)}onconnect(e,t){D("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(){D("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&&(D("performing disconnect (%s)",this.nsp),this.packet({type:w.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 He(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}He.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};He.prototype.reset=function(){this.attempts=0};He.prototype.setMin=function(i){this.ms=i};He.prototype.setMax=function(i){this.max=i};He.prototype.setJitter=function(i){this.jitter=i};var Zs=G(zt(),1),H=(0,Zs.default)("socket.io-client:manager"),ut=class extends O{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,Ee(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 He({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;let n=t.parser||Dr;this.encoder=new n.Encoder,this.decoder=new n.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 n=re(t,"open",function(){r.onopen(),e&&e()}),s=a=>{H("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=re(t,"error",s);if(this._timeout!==!1){let a=this._timeout;H("connect attempt will timeout after %d",a);let l=this.setTimeoutFn(()=>{H("connect attempt timed out after %d",a),n(),s(new Error("timeout")),t.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(n),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(re(e,"ping",this.onping.bind(this)),re(e,"data",this.ondata.bind(this)),re(e,"error",this.onerror.bind(this)),re(e,"close",this.onclose.bind(this)),re(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 ht(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(n=>{n?(H("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):(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 to=G(zt(),1),eo=(0,to.default)("socket.io-client"),Ht={};function jt(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};let t=Hs(i,e.path||"/socket.io"),r=t.source,n=t.id,s=t.path,o=Ht[n]&&s in Ht[n].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o,l;return a?(eo("ignoring socket cache for %s",r),l=new ut(r,e)):(Ht[n]||(eo("new io instance for %s",r),Ht[n]=new ut(r,e)),l=Ht[n]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(jt,{Manager:ut,Socket:ht,io:jt,connect:jt});var Hc="https://ws.novu.co",io="notifications.notification_received",ro="notifications.unseen_count_changed",no="notifications.unread_count_changed",jc=({_id:i,content:e,read:t,archived:r,snoozedUntil:n,deliveredAt:s,createdAt:o,lastReadDate:a,archivedAt:l,channel:u,subscriber:c,subject:h,avatar:d,cta:_,tags:x,data:m,workflow:E})=>{var R,V,j,de,Gt,Kt,se,mt;let k={id:c==null?void 0:c._id,subscriberId:c==null?void 0:c.subscriberId,firstName:c==null?void 0:c.firstName,lastName:c==null?void 0:c.lastName,avatar:c==null?void 0:c.avatar,locale:c==null?void 0:c.locale,data:c==null?void 0:c.data,timezone:c==null?void 0:c.timezone,email:c==null?void 0:c.email,phone:c==null?void 0:c.phone},N=(V=(R=_.action)==null?void 0:R.buttons)==null?void 0:V.find(Ge=>Ge.type==="primary"),p=(de=(j=_.action)==null?void 0:j.buttons)==null?void 0:de.find(Ge=>Ge.type==="secondary"),y=(Kt=(Gt=_.action)==null?void 0:Gt.result)==null?void 0:Kt.type,$=(se=_.action)==null?void 0:se.status;return T(v(v({id:i,subject:h,body:e,to:k,isRead:t,isArchived:r,isSnoozed:!!n},s&&{deliveredAt:s}),n&&{snoozedUntil:n}),{createdAt:o,readAt:a,archivedAt:l,avatar:d,primaryAction:N&&{label:N.content,isCompleted:y==="primary"&&$==="done",redirect:N.url?{target:N.target,url:N.url}:void 0},secondaryAction:p&&{label:p.content,isCompleted:y==="secondary"&&$==="done",redirect:p.url?{target:p.target,url:p.url}:void 0},channelType:u,tags:x,redirect:(mt=_.data)!=null&&mt.url?{url:_.data.url,target:_.data.target}:void 0,data:m,workflow:E})},dt,ue,ne,pt,Di,Mi,qi,ye,so,Mr,qr,Bi=class extends Ae{constructor({socketUrl:t,inboxServiceInstance:r,eventEmitterInstance:n}){super({eventEmitterInstance:n,inboxServiceInstance:r});b(this,ye);b(this,dt);b(this,ue);b(this,ne);b(this,pt);b(this,Di,({message:t})=>{f(this,ue).emit(io,{result:new U(jc(t),f(this,ue),this._inboxService)})});b(this,Mi,({unseenCount:t})=>{f(this,ue).emit(ro,{result:t})});b(this,qi,({unreadCount:t})=>{f(this,ue).emit(no,{result:t})});S(this,ue,n),S(this,pt,t!=null?t:Hc)}onSessionSuccess({token:t}){S(this,dt,t)}isSocketEvent(t){return t===io||t===ro||t===no}connect(){return g(this,null,function*(){return f(this,dt)?Ye(this,ye,Mr).call(this):this.callWithSession(Ye(this,ye,Mr).bind(this))})}disconnect(){return g(this,null,function*(){return f(this,ne)?Ye(this,ye,qr).call(this):this.callWithSession(Ye(this,ye,qr).bind(this))})}};dt=new WeakMap,ue=new WeakMap,ne=new WeakMap,pt=new WeakMap,Di=new WeakMap,Mi=new WeakMap,qi=new WeakMap,ye=new WeakSet,so=function(){return g(this,null,function*(){var r,n,s;if(f(this,ne))return;let t={socketUrl:f(this,pt)};f(this,ue).emit("socket.connect.pending",{args:t}),S(this,ne,jt(f(this,pt),{reconnectionDelayMax:1e4,transports:["websocket"],query:{token:`${f(this,dt)}`}})),f(this,ne).on("connect",()=>{f(this,ue).emit("socket.connect.resolved",{args:t})}),f(this,ne).on("connect_error",o=>{f(this,ue).emit("socket.connect.resolved",{args:t,error:o})}),(r=f(this,ne))==null||r.on("notification_received",f(this,Di)),(n=f(this,ne))==null||n.on("unseen_count_changed",f(this,Mi)),(s=f(this,ne))==null||s.on("unread_count_changed",f(this,qi))})},Mr=function(){return g(this,null,function*(){try{return yield Ye(this,ye,so).call(this),{}}catch(t){return{error:new A("Failed to initialize the socket",t)}}})},qr=function(){return g(this,null,function*(){var t;try{return(t=f(this,ne))==null||t.disconnect(),S(this,ne,void 0),{}}catch(r){return{error:new A("Failed to disconnect from the socket",r)}}})};var ve,je,Fe,Wi=class{constructor(e){b(this,ve);b(this,je);b(this,Fe);var t,r;S(this,Fe,new Zt({apiUrl:e.apiUrl||e.backendUrl,userAgent:e.__userAgent})),S(this,ve,new ei),S(this,je,new hi(e.applicationIdentifier?{applicationIdentifier:e.applicationIdentifier,subscriberHash:e.subscriberHash,subscriber:Gc(e)}:{},f(this,Fe),f(this,ve))),f(this,je).initialize(),this.notifications=new ai({useCache:(t=e.useCache)!=null?t:!0,inboxServiceInstance:f(this,Fe),eventEmitterInstance:f(this,ve)}),this.preferences=new fi({useCache:(r=e.useCache)!=null?r:!0,inboxServiceInstance:f(this,Fe),eventEmitterInstance:f(this,ve)}),this.socket=new Bi({socketUrl:e.socketUrl,eventEmitterInstance:f(this,ve),inboxServiceInstance:f(this,Fe)}),this.on=(n,s)=>{this.socket.isSocketEvent(n)&&this.socket.connect();let o=f(this,ve).on(n,s);return()=>{o()}},this.off=(n,s)=>{f(this,ve).off(n,s)}}get applicationIdentifier(){return f(this,je).applicationIdentifier}get subscriberId(){return f(this,je).subscriberId}};ve=new WeakMap,je=new WeakMap,Fe=new WeakMap;function Gc(i){return i.subscriber?typeof i.subscriber=="string"?{subscriberId:i.subscriber}:i.subscriber:i.subscriberId?{subscriberId:i.subscriberId}:{subscriberId:""}}window.Novu=Wi;})();
14
+ `+s),i.push(n+"m+"+Bi.exports.humanize(this.diff)+"\x1B[0m")}else i[0]=Uc()+e+" "+i[0]}function Uc(){return z.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Bc(...i){return process.stderr.write(Ui.formatWithOptions(z.inspectOpts,...i)+`
15
+ `)}function Dc(i){i?process.env.DEBUG=i:delete process.env.DEBUG}function Mc(){return process.env.DEBUG}function qc(i){i.inspectOpts={};let e=Object.keys(z.inspectOpts);for(let t=0;t<e.length;t++)i.inspectOpts[e[t]]=z.inspectOpts[e[t]]}Bi.exports=Or()(z);var{formatters:zs}=Bi.exports;zs.o=function(i){return this.inspectOpts.colors=this.useColors,Ui.inspect(i,this.inspectOpts).split(`
16
+ `).map(e=>e.trim()).join(" ")};zs.O=function(i){return this.inspectOpts.colors=this.useColors,Ui.inspect(i,this.inspectOpts)}});var $t=I(($h,Ir)=>{"use strict";typeof process=="undefined"||process.type==="renderer"||process.browser===!0||process.__nwjs?Ir.exports=Ws():Ir.exports=$s()});var Eo="v1",bo=`${PACKAGE_NAME}@${PACKAGE_VERSION}`,Zt=class{constructor(e={}){this.DEFAULT_BACKEND_URL=typeof window!="undefined"&&window.NOVU_LOCAL_BACKEND_URL||"https://api.novu.co";let{apiVersion:t=Eo,apiUrl:r=this.DEFAULT_BACKEND_URL,userAgent:n=bo,headers:s={}}=e||{};this.apiVersion=t,this.apiUrl=`${r}/${t}`,this.headers=v({"Novu-API-Version":NOVU_API_VERSION,"Content-Type":"application/json","User-Agent":n},s)}setAuthorizationToken(e){this.headers.Authorization=`Bearer ${e}`}setKeylessHeader(e){var r;let t=e||typeof window!="undefined"&&((r=window.localStorage)==null?void 0:r.getItem("novu_keyless_application_identifier"));!t||!t.startsWith("pk_keyless_")||(this.headers["Novu-Application-Identifier"]=t)}setHeaders(e){this.headers=v(v({},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,r){return g(this,null,function*(){return this.doFetch({path:e,options:{method:"POST",body:t,headers:r==null?void 0:r.headers}})})}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(s){return g(this,arguments,function*({path:e,searchParams:t,options:r,unwrapEnvelope:n=!0}){let o=So(this.apiUrl,e,t?`?${t.toString()}`:""),a={method:(r==null?void 0:r.method)||"GET",headers:v(v({},this.headers),(r==null?void 0:r.headers)||{}),body:r!=null&&r.body?JSON.stringify(r.body):void 0},l=yield fetch(o,a);if(!l.ok){let c=yield l.json();throw new Error(`${this.headers["User-Agent"]} error. Status: ${l.status}, Message: ${c.message}`)}if(l.status===204)return;let h=yield l.json();return n?h.data:h})}};function So(...i){return i.reduce((e,t)=>(t&&e.push(t.replace(new RegExp("(?<!https?:)\\/+","g"),"/").replace(/^\/+|\/+$/g,"")),e),[]).join("/").replace(/\/\?/,"?")}var Je="/inbox",Q=`${Je}/notifications`,P,ei=class{constructor(e={}){this.isSessionInitialized=!1;E(this,P);b(this,P,new Zt(e))}initializeSession(n){return g(this,arguments,function*({applicationIdentifier:e,subscriberHash:t,subscriber:r}){let s=yield f(this,P).post(`${Je}/session`,{applicationIdentifier:e,subscriberHash:t,subscriber:r});return f(this,P).setAuthorizationToken(s.token),f(this,P).setKeylessHeader(s.applicationIdentifier),this.isSessionInitialized=!0,s})}fetchNotifications({after:e,archived:t,limit:r=10,offset:n,read:s,tags:o,snoozed:a,data:l}){let h=new URLSearchParams(`limit=${r}`);return e&&h.append("after",e),n&&h.append("offset",`${n}`),o&&o.forEach(c=>h.append("tags[]",c)),s!==void 0&&h.append("read",`${s}`),t!==void 0&&h.append("archived",`${t}`),a!==void 0&&h.append("snoozed",`${a}`),l!==void 0&&h.append("data",JSON.stringify(l)),f(this,P).get(Q,h,!1)}count({filters:e}){return f(this,P).get(`${Q}/count`,new URLSearchParams({filters:JSON.stringify(e)}),!1)}read(e){return f(this,P).patch(`${Q}/${e}/read`)}unread(e){return f(this,P).patch(`${Q}/${e}/unread`)}archive(e){return f(this,P).patch(`${Q}/${e}/archive`)}unarchive(e){return f(this,P).patch(`${Q}/${e}/unarchive`)}snooze(e,t){return f(this,P).patch(`${Q}/${e}/snooze`,{snoozeUntil:t})}unsnooze(e){return f(this,P).patch(`${Q}/${e}/unsnooze`)}readAll({tags:e,data:t}){return f(this,P).post(`${Q}/read`,{tags:e,data:t?JSON.stringify(t):void 0})}archiveAll({tags:e,data:t}){return f(this,P).post(`${Q}/archive`,{tags:e,data:t?JSON.stringify(t):void 0})}archiveAllRead({tags:e,data:t}){return f(this,P).post(`${Q}/read-archive`,{tags:e,data:t?JSON.stringify(t):void 0})}completeAction({actionType:e,notificationId:t}){return f(this,P).patch(`${Q}/${t}/complete`,{actionType:e})}revertAction({actionType:e,notificationId:t}){return f(this,P).patch(`${Q}/${t}/revert`,{actionType:e})}fetchPreferences(e){let t=new URLSearchParams;e&&e.forEach(n=>t.append("tags[]",n));let r=t.size?`?${t.toString()}`:"";return f(this,P).get(`${Je}/preferences${r}`)}bulkUpdatePreferences(e){return f(this,P).patch(`${Je}/preferences/bulk`,{preferences:e})}updateGlobalPreferences(e){return f(this,P).patch(`${Je}/preferences`,e)}updateWorkflowPreferences({workflowId:e,channels:t}){return f(this,P).patch(`${Je}/preferences/${e}`,t)}triggerHelloWorldEvent(){let e={name:"hello-world",to:{subscriberId:"keyless-subscriber-id"},payload:{subject:"Novu Keyless Environment",body:"You're using a keyless demo environment. For full access to Novu features and cloud integration, obtain your API key.",primaryActionText:"Obtain API Key",primaryActionUrl:"https://go.novu.co/keyless",secondaryActionText:"Explore Documentation",secondaryActionUrl:"https://go.novu.co/keyless-docs"}};return f(this,P).post("/inbox/events",e)}};P=new WeakMap;function Gr(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(n){n(t)}),(r=i.get("*"))&&r.slice().map(function(n){n(e,t)})}}}var Be,ti=class{constructor(){E(this,Be);b(this,Be,Gr())}on(e,t){return f(this,Be).on(e,t),()=>{this.off(e,t)}}off(e,t){f(this,Be).off(e,t)}emit(e,t){f(this,Be).emit(e,t)}};Be=new WeakMap;var A=class extends Error{constructor(e,t){super(e),this.originalError=t}};var Ae,Xe,ke=class{constructor({inboxServiceInstance:e,eventEmitterInstance:t}){E(this,Ae,[]);E(this,Xe);this._emitter=t,this._inboxService=e,this._emitter.on("session.initialize.resolved",({error:r,data:n})=>{n?(this.onSessionSuccess(n),f(this,Ae).forEach(a=>g(this,[a],function*({fn:s,resolve:o}){o(yield s())})),b(this,Ae,[])):r&&(this.onSessionError(r),b(this,Xe,r),f(this,Ae).forEach(({resolve:s})=>{s({error:new A("Failed to initialize session, please contact the support",r)})}),b(this,Ae,[]))})}onSessionSuccess(e){}onSessionError(e){}callWithSession(e){return g(this,null,function*(){return this._inboxService.isSessionInitialized?e():f(this,Xe)?Promise.resolve({error:new A("Failed to initialize session, please contact the support",f(this,Xe))}):new Promise((t,r)=>{f(this,Ae).push({fn:e,resolve:t,reject:r})})})}};Ae=new WeakMap,Xe=new WeakMap;var K,J,U=class{constructor(e,t,r){E(this,K);E(this,J);b(this,K,t),b(this,J,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.isSnoozed=e.isSnoozed,this.snoozedUntil=e.snoozedUntil,this.deliveredAt=e.deliveredAt,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 ii({emitter:f(this,K),apiService:f(this,J),args:{notification:this}})}unread(){return ri({emitter:f(this,K),apiService:f(this,J),args:{notification:this}})}archive(){return ni({emitter:f(this,K),apiService:f(this,J),args:{notification:this}})}unarchive(){return si({emitter:f(this,K),apiService:f(this,J),args:{notification:this}})}snooze(e){return oi({emitter:f(this,K),apiService:f(this,J),args:{notification:this,snoozeUntil:e}})}unsnooze(){return ai({emitter:f(this,K),apiService:f(this,J),args:{notification:this}})}completePrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Qe({emitter:f(this,K),apiService:f(this,J),args:{notification:this},actionType:"primary"})}completeSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Qe({emitter:f(this,K),apiService:f(this,J),args:{notification:this},actionType:"secondary"})}revertPrimary(){if(!this.primaryAction)throw new Error("Primary action is not available");return Ze({emitter:f(this,K),apiService:f(this,J),args:{notification:this},actionType:"primary"})}revertSecondary(){if(!this.primaryAction)throw new Error("Secondary action is not available");return Ze({emitter:f(this,K),apiService:f(this,J),args:{notification:this},actionType:"secondary"})}on(e,t){let r=f(this,K).on(e,t);return()=>{r()}}off(e,t){f(this,K).off(e,t)}};K=new WeakMap,J=new WeakMap;var ii=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=Re(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:s});let o=yield e.read(n),a=new U(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 A("Failed to read notification",o)}}}),ri=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=Re(t,{isRead:!1,readAt:null,isArchived:!1,archivedAt:void 0},{emitter:i,apiService:e});try{i.emit("notification.unread.pending",{args:t,data:s});let o=yield e.unread(n),a=new U(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 A("Failed to unread notification",o)}}}),ni=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=Re(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:s});let o=yield e.archive(n),a=new U(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 A("Failed to archive notification",o)}}}),si=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=Re(t,{isArchived:!1,archivedAt:null,isRead:!0,readAt:new Date().toISOString()},{emitter:i,apiService:e});try{i.emit("notification.unarchive.pending",{args:t,data:s});let o=yield e.unarchive(n),a=new U(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 A("Failed to unarchive notification",o)}}}),oi=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=Re(t,{isSnoozed:!0,snoozedUntil:t.snoozeUntil},{emitter:i,apiService:e});try{i.emit("notification.snooze.pending",{args:t,data:s});let o=yield e.snooze(n,t.snoozeUntil),a=new U(o,i,e);return i.emit("notification.snooze.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.snooze.resolved",{args:t,error:o}),{error:new A("Failed to snooze notification",o)}}}),ai=r=>g(void 0,[r],function*({emitter:i,apiService:e,args:t}){let{notificationId:n,optimisticValue:s}=Re(t,{isSnoozed:!1,snoozedUntil:null},{emitter:i,apiService:e});try{i.emit("notification.unsnooze.pending",{args:t,data:s});let o=yield e.unsnooze(n),a=new U(o,i,e);return i.emit("notification.unsnooze.resolved",{args:t,data:a}),{data:a}}catch(o){return i.emit("notification.unsnooze.resolved",{args:t,error:o}),{error:new A("Failed to unsnooze notification",o)}}}),Qe=n=>g(void 0,[n],function*({emitter:i,apiService:e,args:t,actionType:r}){let s=r==="primary"?{primaryAction:T(v({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!0})}:{secondaryAction:T(v({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!0})},{notificationId:o,optimisticValue:a}=Re(t,s,{emitter:i,apiService:e});try{i.emit("notification.complete_action.pending",{args:t,data:a});let l=yield e.completeAction({actionType:r,notificationId:o}),h=new U(l,i,e);return i.emit("notification.complete_action.resolved",{args:t,data:h}),{data:h}}catch(l){return i.emit("notification.complete_action.resolved",{args:t,error:l}),{error:new A(`Failed to complete ${r} action on the notification`,l)}}}),Ze=n=>g(void 0,[n],function*({emitter:i,apiService:e,args:t,actionType:r}){let s=r==="primary"?{primaryAction:T(v({},"notification"in t?t.notification.primaryAction:{}),{isCompleted:!1})}:{secondaryAction:T(v({},"notification"in t?t.notification.secondaryAction:{}),{isCompleted:!1})},{notificationId:o,optimisticValue:a}=Re(t,s,{emitter:i,apiService:e});try{i.emit("notification.revert_action.pending",{args:t,data:a});let l=yield e.revertAction({actionType:r,notificationId:o}),h=new U(l,i,e);return i.emit("notification.revert_action.resolved",{args:t,data:h}),{data:h}}catch(l){return i.emit("notification.revert_action.resolved",{args:t,error:l}),{error:new A("Failed to fetch notifications",l)}}}),Re=(i,e,t)=>"notification"in i?{notificationId:i.notification.id,optimisticValue:new U(v(v({},i.notification),e),t.emitter,t.apiService)}:{notificationId:i.notificationId},Kr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r,data:n}){try{let a=t.getUniqueNotifications({tags:r,data:n}).map(l=>new U(T(v({},l),{isRead:!0,readAt:new Date().toISOString(),isArchived:!1,archivedAt:void 0}),i,e));return i.emit("notifications.read_all.pending",{args:{tags:r,data:n},data:a}),yield e.readAll({tags:r,data:n}),i.emit("notifications.read_all.resolved",{args:{tags:r,data:n},data:a}),{}}catch(o){return i.emit("notifications.read_all.resolved",{args:{tags:r,data:n},error:o}),{error:new A("Failed to read all notifications",o)}}}),Yr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r,data:n}){try{let a=t.getUniqueNotifications({tags:r,data:n}).map(l=>new U(T(v({},l),{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:n},data:a}),yield e.archiveAll({tags:r,data:n}),i.emit("notifications.archive_all.resolved",{args:{tags:r,data:n},data:a}),{}}catch(o){return i.emit("notifications.archive_all.resolved",{args:{tags:r,data:n},error:o}),{error:new A("Failed to archive all notifications",o)}}}),Jr=s=>g(void 0,[s],function*({emitter:i,inboxService:e,notificationsCache:t,tags:r,data:n}){try{let a=t.getUniqueNotifications({tags:r,data:n,read:!0}).map(l=>new U(T(v({},l),{isArchived:!0,archivedAt:new Date().toISOString()}),i,e));return i.emit("notifications.archive_all_read.pending",{args:{tags:r,data:n},data:a}),yield e.archiveAllRead({tags:r,data:n}),i.emit("notifications.archive_all_read.resolved",{args:{tags:r,data:n},data:a}),{}}catch(o){return i.emit("notifications.archive_all_read.resolved",{args:{tags:r,data:n},error:o}),{error:new A("Failed to archive all read notifications",o)}}});var Xr=(i,e)=>i===e?!0:!i||!e||i.length!==e.length?!1:i.every((t,r)=>t===e[r]);var bl=["seen","unseen"],Sl=["read","unread"],Hi=(i,e)=>Xr(i,e)||!i&&(e==null?void 0:e.length)===0||(i==null?void 0:i.length)===0&&!e,ji=(i,e)=>{if(!i&&!e)return!0;if(!i||!e)return!1;try{return JSON.stringify(i)===JSON.stringify(e)}catch(t){return!1}},Gi=(i,e)=>ji(i.data,e.data)&&Hi(i.tags,e.tags)&&i.read===e.read&&i.archived===e.archived&&i.snoozed===e.snoozed;var ce,et=class{constructor(){E(this,ce);b(this,ce,new Map)}get(e){return f(this,ce).get(e)}getValues(){return Array.from(f(this,ce).values())}entries(){return Array.from(f(this,ce).entries())}keys(){return Array.from(f(this,ce).keys())}set(e,t){f(this,ce).set(e,t)}remove(e){f(this,ce).delete(e)}clear(){f(this,ce).clear()}};ce=new WeakMap;var Qr=({tags:i,data:e,read:t,archived:r,snoozed:n,limit:s,offset:o,after:a})=>Object.entries({tags:i,data:e,read:t,archived:r,snoozed:n,limit:s,offset:o,after:a}).filter(([l,h])=>h!=null&&!(Array.isArray(h)&&h.length===0)).reduce((l,[h,c])=>(l[h]=c,l),{}),Ki=({tags:i,data:e,read:t,archived:r,snoozed:n,limit:s,offset:o,after:a})=>JSON.stringify(Qr({tags:i,data:e,read:t,archived:r,snoozed:n,limit:s,offset:o,after:a})),xo=({tags:i,data:e,read:t,archived:r,snoozed:n})=>JSON.stringify(Qr({tags:i,data:e,read:t,archived:r,snoozed:n})),tt=i=>JSON.parse(i),wo=["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"],Co=["notification.archive.pending","notification.unarchive.pending","notification.snooze.pending","notification.unsnooze.pending","notifications.archive_all.pending","notifications.archive_all_read.pending"],Te,M,_t=class{constructor({emitter:e}){E(this,Te);E(this,M);this.updateNotification=(e,t)=>{let r=f(this,M).get(e);if(!r)return!1;let n=r.notifications.findIndex(o=>o.id===t.id);if(n===-1)return!1;let s=[...r.notifications];return s[n]=t,f(this,M).set(e,T(v({},r),{notifications:s})),!0};this.removeNotification=(e,t)=>{let r=f(this,M).get(e);if(!r)return!1;let n=r.notifications.findIndex(o=>o.id===t.id);if(n===-1)return!1;let s=[...r.notifications];return s.splice(n,1),f(this,M).set(e,T(v({},r),{notifications:s})),!0};this.handleNotificationEvent=({remove:e}={remove:!1})=>({data:t})=>{if(!t)return;let r=Array.isArray(t)?t:[t],n=new Set;f(this,M).keys().forEach(s=>{r.forEach(o=>{let a=!1;e?a=this.removeNotification(s,o):a=this.updateNotification(s,o),a&&n.add(xo(tt(s)))})}),n.forEach(s=>{let o=this.getAggregated(tt(s));f(this,Te).emit("notifications.list.updated",{data:o})})};b(this,Te,e),wo.forEach(t=>{f(this,Te).on(t,this.handleNotificationEvent())}),Co.forEach(t=>{f(this,Te).on(t,this.handleNotificationEvent({remove:!0}))}),b(this,M,new et)}getAggregated(e){return f(this,M).keys().filter(r=>{let n=tt(r);return Gi(n,e)}).map(r=>f(this,M).get(r)).reduce((r,n)=>n?{hasMore:n.hasMore,filter:n.filter,notifications:[...r.notifications,...n.notifications]}:r,{hasMore:!1,filter:{},notifications:[]})}has(e){return f(this,M).get(Ki(e))!==void 0}set(e,t){f(this,M).set(Ki(e),t)}update(e,t){this.set(e,t);let r=this.getAggregated(tt(Ki(e)));f(this,Te).emit("notifications.list.updated",{data:r})}getAll(e){if(this.has(e))return this.getAggregated({tags:e.tags,data:e.data,read:e.read,snoozed:e.snoozed,archived:e.archived})}getUniqueNotifications({tags:e,read:t,data:r}){let n=f(this,M).keys(),s=new Map;return n.forEach(o=>{let a=tt(o);if(Hi(e,a.tags)&&ji(r,a.data)){let l=f(this,M).get(o);if(!l)return;l.notifications.filter(h=>typeof t=="undefined"||t===h.isRead).forEach(h=>s.set(h.id,h))}}),Array.from(s.values())}clear(e){f(this,M).keys().forEach(r=>{Gi(tt(r),e)&&f(this,M).remove(r)})}clearAll(){f(this,M).clear()}};Te=new WeakMap,M=new WeakMap;var Et,ci=class extends ke{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:n}){super({eventEmitterInstance:n,inboxServiceInstance:r});E(this,Et);this.cache=new _t({emitter:n}),b(this,Et,t)}list(){return g(this,arguments,function*(n={}){var s=n,{limit:t=10}=s,r=jr(s,["limit"]);return this.callWithSession(()=>g(this,null,function*(){let o=v({limit:t},r);try{let a="useCache"in o?o.useCache:f(this,Et),l=a?this.cache.getAll(o):void 0;if(this._emitter.emit("notifications.list.pending",{args:o,data:l}),!l){let h=yield this._inboxService.fetchNotifications(v({limit:t},r));l={hasMore:h.hasMore,filter:h.filter,notifications:h.data.map(c=>new U(c,this._emitter,this._inboxService))},a&&(this.cache.set(o,l),l=this.cache.getAll(o))}return this._emitter.emit("notifications.list.resolved",{args:o,data:l}),{data:l}}catch(a){return this._emitter.emit("notifications.list.resolved",{args:o,error:a}),{error:new A("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:[v({},t)];try{this._emitter.emit("notifications.count.pending",{args:t});let n=yield this._inboxService.count({filters:r}),s=t&&"filters"in t?{counts:n.data}:n.data[0];return this._emitter.emit("notifications.count.resolved",{args:t,data:s}),{data:s}}catch(n){return this._emitter.emit("notifications.count.resolved",{args:t,error:n}),{error:new A("Failed to count notifications",n)}}}))})}read(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ii({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unread(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ri({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}archive(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ni({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})}))})}snooze(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return oi({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}unsnooze(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return ai({emitter:this._emitter,apiService:this._inboxService,args:t})}))})}completePrimary(t){return g(this,null,function*(){return this.callWithSession(()=>g(this,null,function*(){return Qe({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 Qe({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 Ze({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 Ze({emitter:this._emitter,apiService:this._inboxService,args:t,actionType:"secondary"})}))})}readAll(){return g(this,arguments,function*({tags:t,data:r}={}){return this.callWithSession(()=>g(this,null,function*(){return Kr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t,data:r})}))})}archiveAll(){return g(this,arguments,function*({tags:t,data:r}={}){return this.callWithSession(()=>g(this,null,function*(){return Yr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t,data:r})}))})}archiveAllRead(){return g(this,arguments,function*({tags:t,data:r}={}){return this.callWithSession(()=>g(this,null,function*(){return Jr({emitter:this._emitter,inboxService:this._inboxService,notificationsCache:this.cache,tags:t,data:r})}))})}clearCache({filter:t}={}){return t?this.cache.clear(t!=null?t:{}):this.cache.clearAll()}triggerHelloWorldEvent(){return g(this,null,function*(){return this._inboxService.triggerHelloWorldEvent()})}};Et=new WeakMap;var li=s=>g(void 0,[s],function*({emitter:i,apiService:e,cache:t,useCache:r,args:n}){var l;let{channels:o}=n,a="workflowId"in n?n.workflowId:(l=n.preference.workflow)==null?void 0:l.id;try{i.emit("preference.update.pending",{args:n,data:"preference"in n?new me(T(v({},n.preference),{channels:v(v({},n.preference.channels),o)}),{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0});let h;a?h=yield e.updateWorkflowPreferences({workflowId:a,channels:o}):(No({emitter:i,apiService:e,cache:t,useCache:r,args:n}),h=yield e.updateGlobalPreferences(o));let c=new me(h,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r});return i.emit("preference.update.resolved",{args:n,data:c}),{data:c}}catch(h){return i.emit("preference.update.resolved",{args:n,error:h}),{error:new A("Failed to update preference",h)}}}),Zr=s=>g(void 0,[s],function*({emitter:i,apiService:e,cache:t,useCache:r,args:n}){if(n.find(a=>"preference"in a&&a.preference.level==="global"))return{error:new A("Global preference is not supported in bulk update","")};try{let a=n.map(u=>"preference"in u?new me(T(v({},u.preference),{channels:v(v({},u.preference.channels),u.channels)}),{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0).filter(u=>u!==void 0);i.emit("preferences.bulk_update.pending",{args:n,data:a});let l=n.map(u=>{var d,_,x,m;return v({workflowId:"workflowId"in u?u.workflowId:(m=(x=(d=u.preference.workflow)==null?void 0:d.id)!=null?x:(_=u.preference.workflow)==null?void 0:_.identifier)!=null?m:""},u.channels)}),c=(yield e.bulkUpdatePreferences(l)).map(u=>new me(u,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}));return i.emit("preferences.bulk_update.resolved",{args:n,data:c}),{data:c}}catch(a){return i.emit("preferences.bulk_update.resolved",{args:n,error:a}),{error:new A("Failed to bulk update preferences",a)}}}),No=({emitter:i,apiService:e,cache:t,useCache:r,args:n})=>{let s=r?t==null?void 0:t.getAll({}):void 0;s==null||s.forEach(o=>{var a,l;if(o.level==="template"){let h=T(v({},o),{channels:Object.entries(o.channels).reduce((u,[d,_])=>{var m;let x=d;return u[x]=(m=n.channels[x])!=null?m:_,u},{})}),c="preference"in n?new me(h,{emitterInstance:i,inboxServiceInstance:e,cache:t,useCache:r}):void 0;c&&i.emit("preference.update.pending",{args:{workflowId:(l=(a=o.workflow)==null?void 0:a.id)!=null?l:"",channels:c.channels},data:c})}})};var bt,St,xt,wt,me=class{constructor(e,{emitterInstance:t,inboxServiceInstance:r,cache:n,useCache:s}){E(this,bt);E(this,St);E(this,xt);E(this,wt);b(this,bt,t),b(this,St,r),b(this,xt,n),b(this,wt,s),this.level=e.level,this.enabled=e.enabled,this.channels=e.channels,this.workflow=e.workflow}update({channels:e,channelPreferences:t}){var r;return li({emitter:f(this,bt),apiService:f(this,St),cache:f(this,xt),useCache:f(this,wt),args:{workflowId:(r=this.workflow)==null?void 0:r.id,channels:e||t,preference:this}})}};bt=new WeakMap,St=new WeakMap,xt=new WeakMap,wt=new WeakMap;var Ao=["preference.update.pending","preference.update.resolved","preferences.bulk_update.pending","preferences.bulk_update.resolved"],ko=({tags:i})=>Object.entries({tags:i}).reduce((e,[t,r])=>(r==null||Array.isArray(r)&&r.length===0||(e[t]=r),e),{}),Yi=({tags:i})=>JSON.stringify(ko({tags:i})),it,Z,fi=class{constructor({emitterInstance:e}){E(this,it);E(this,Z);this.updatePreference=(e,t)=>{let r=f(this,Z).get(e);if(!r)return!1;let n=r.findIndex(o=>{var a,l;return((a=o.workflow)==null?void 0:a.id)===((l=t.workflow)==null?void 0:l.id)||o.level===t.level&&t.level==="global"});if(n===-1)return!1;let s=[...r];return s[n]=t,f(this,Z).set(e,s),!0};this.handlePreferenceEvent=({data:e})=>{if(!e)return;let t=Array.isArray(e)?e:[e],r=new Set;f(this,Z).keys().forEach(n=>{t.forEach(s=>{let o=this.updatePreference(n,s),a=f(this,Z).get(n);!o||!a||r.add(n)})}),r.forEach(n=>{var s;f(this,it).emit("preferences.list.updated",{data:(s=f(this,Z).get(n))!=null?s:[]})})};b(this,it,e),Ao.forEach(t=>{f(this,it).on(t,this.handlePreferenceEvent)}),b(this,Z,new et)}has(e){return f(this,Z).get(Yi(e))!==void 0}set(e,t){f(this,Z).set(Yi(e),t)}getAll(e){if(this.has(e))return f(this,Z).get(Yi(e))}clearAll(){f(this,Z).clear()}};it=new WeakMap,Z=new WeakMap;var _e,hi=class extends ke{constructor({useCache:t,inboxServiceInstance:r,eventEmitterInstance:n}){super({eventEmitterInstance:n,inboxServiceInstance:r});E(this,_e);this.cache=new fi({emitterInstance:this._emitter}),b(this,_e,t)}list(){return g(this,arguments,function*(t={}){return this.callWithSession(()=>g(this,null,function*(){try{let r=f(this,_e)?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(s=>new me(s,{emitterInstance:this._emitter,inboxServiceInstance:this._inboxService,cache:this.cache,useCache:f(this,_e)})),f(this,_e)&&(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}}))})}update(t){return g(this,null,function*(){return this.callWithSession(()=>li({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,useCache:f(this,_e),args:t}))})}bulkUpdate(t){return g(this,null,function*(){return this.callWithSession(()=>Zr({emitter:this._emitter,apiService:this._inboxService,cache:this.cache,useCache:f(this,_e),args:t}))})}};_e=new WeakMap;var De,Ct,le,ui=class{constructor(e,t,r){E(this,De);E(this,Ct);E(this,le);b(this,De,r),b(this,Ct,t),b(this,le,e)}get applicationIdentifier(){return f(this,le).applicationIdentifier}get subscriberId(){var e;return(e=f(this,le).subscriber)==null?void 0:e.subscriberId}handleApplicationIdentifier(e,t){if(typeof window=="undefined"||!window.localStorage)return null;let r="novu_keyless_application_identifier";switch(e){case"get":return window.localStorage.getItem(r);case"store":return t&&window.localStorage.setItem(r,t),null;case"delete":return window.localStorage.removeItem(r),null;default:return null}}initialize(e){return g(this,null,function*(){var t,r;try{e&&b(this,le,e);let{subscriber:n,subscriberHash:s,applicationIdentifier:o}=f(this,le),a=o;if(a)this.handleApplicationIdentifier("delete");else{let h=this.handleApplicationIdentifier("get");h&&(a=h)}f(this,De).emit("session.initialize.pending",{args:f(this,le)});let l=yield f(this,Ct).initializeSession({applicationIdentifier:a,subscriberHash:s,subscriber:n});(t=l==null?void 0:l.applicationIdentifier)!=null&&t.startsWith("pk_keyless_")&&this.handleApplicationIdentifier("store",l.applicationIdentifier),(r=l==null?void 0:l.applicationIdentifier)!=null&&r.startsWith("pk_keyless_")||this.handleApplicationIdentifier("delete"),f(this,De).emit("session.initialize.resolved",{args:f(this,le),data:l})}catch(n){f(this,De).emit("session.initialize.resolved",{args:f(this,le),error:n})}})}};De=new WeakMap,Ct=new WeakMap,le=new WeakMap;var fe=Object.create(null);fe.open="0";fe.close="1";fe.ping="2";fe.pong="3";fe.message="4";fe.upgrade="5";fe.noop="6";var Nt=Object.create(null);Object.keys(fe).forEach(i=>{Nt[fe[i]]=i});var At={type:"error",data:"parser error"};var kt=({type:i,data:e},t,r)=>e instanceof ArrayBuffer||ArrayBuffer.isView(e)?r(t?e:"b"+en(e,!0).toString("base64")):r(fe[i]+(e||"")),en=(i,e)=>Buffer.isBuffer(i)||i instanceof Uint8Array&&!e?i:i instanceof ArrayBuffer?Buffer.from(i):Buffer.from(i.buffer,i.byteOffset,i.byteLength),Ji;function tn(i,e){if(i.data instanceof ArrayBuffer||ArrayBuffer.isView(i.data))return e(en(i.data,!1));kt(i,!0,t=>{Ji||(Ji=new TextEncoder),e(Ji.encode(t))})}var Rt=(i,e)=>{if(typeof i!="string")return{type:"message",data:rn(i,e)};let t=i.charAt(0);if(t==="b"){let r=Buffer.from(i.substring(1),"base64");return{type:"message",data:rn(r,e)}}return Nt[t]?i.length>1?{type:Nt[t],data:i.substring(1)}:{type:Nt[t]}:At},rn=(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 nn="",sn=(i,e)=>{let t=i.length,r=new Array(t),n=0;i.forEach((s,o)=>{kt(s,!1,a=>{r[o]=a,++n===t&&e(r.join(nn))})})},on=(i,e)=>{let t=i.split(nn),r=[];for(let n=0;n<t.length;n++){let s=Rt(t[n],e);if(r.push(s),s.type==="error")break}return r};function an(){return new TransformStream({transform(i,e){tn(i,t=>{let r=t.length,n;if(r<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,r);else if(r<65536){n=new Uint8Array(3);let s=new DataView(n.buffer);s.setUint8(0,126),s.setUint16(1,r)}else{n=new Uint8Array(9);let s=new DataView(n.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(r))}i.data&&typeof i.data!="string"&&(n[0]|=128),e.enqueue(n),e.enqueue(t)})}})}var Xi;function di(i){return i.reduce((e,t)=>e+t.length,0)}function pi(i,e){if(i[0].length===e)return i.shift();let t=new Uint8Array(e),r=0;for(let n=0;n<e;n++)t[n]=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 cn(i,e){Xi||(Xi=new TextDecoder);let t=[],r=0,n=-1,s=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(r===0){if(di(t)<1)break;let l=pi(t,1);s=(l[0]&128)===128,n=l[0]&127,n<126?r=3:n===126?r=1:r=2}else if(r===1){if(di(t)<2)break;let l=pi(t,2);n=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),r=3}else if(r===2){if(di(t)<8)break;let l=pi(t,8),h=new DataView(l.buffer,l.byteOffset,l.length),c=h.getUint32(0);if(c>Math.pow(2,21)-1){a.enqueue(At);break}n=c*Math.pow(2,32)+h.getUint32(4),r=3}else{if(di(t)<n)break;let l=pi(t,n);a.enqueue(Rt(s?l:Xi.decode(l),e)),r=0}if(n===0||n>i){a.enqueue(At);break}}}})}var Qi=4;function O(i){if(i)return Ro(i)}function Ro(i){for(var e in O.prototype)i[e]=O.prototype[e];return i}O.prototype.on=O.prototype.addEventListener=function(i,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+i]=this._callbacks["$"+i]||[]).push(e),this};O.prototype.once=function(i,e){function t(){this.off(i,t),e.apply(this,arguments)}return t.fn=e,this.on(i,t),this};O.prototype.off=O.prototype.removeListener=O.prototype.removeAllListeners=O.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,n=0;n<t.length;n++)if(r=t[n],r===e||r.fn===e){t.splice(n,1);break}return t.length===0&&delete this._callbacks["$"+i],this};O.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,n=t.length;r<n;++r)t[r].apply(this,e)}return this};O.prototype.emitReserved=O.prototype.emit;O.prototype.listeners=function(i){return this._callbacks=this._callbacks||{},this._callbacks["$"+i]||[]};O.prototype.hasListeners=function(i){return!!this.listeners(i).length};var he=global;function mi(i,...e){return e.reduce((t,r)=>(i.hasOwnProperty(r)&&(t[r]=i[r]),t),{})}var To=he.setTimeout,Oo=he.clearTimeout;function Ee(i,e){e.useNativeTimers?(i.setTimeoutFn=To.bind(he),i.clearTimeoutFn=Oo.bind(he)):(i.setTimeoutFn=he.setTimeout.bind(he),i.clearTimeoutFn=he.clearTimeout.bind(he))}var Io=1.33;function ln(i){return typeof i=="string"?Po(i):Math.ceil((i.byteLength||i.size)*Io)}function Po(i){let e=0,t=0;for(let r=0,n=i.length;r<n;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 bn=G(qe(),1);function _n(i){let e="";for(let t in i)i.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(i[t]));return e}function En(i){let e={},t=i.split("&");for(let r=0,n=t.length;r<n;r++){let s=t[r].split("=");e[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return e}var ia=(0,bn.default)("engine.io-client:transport"),sr=class extends Error{constructor(e,t,r){super(e),this.description=t,this.context=r,this.type="TransportError"}},be=class extends O{constructor(e){super(),this.writable=!1,Ee(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,r){return super.emitReserved("error",new sr(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):ia("transport is not open, discarding packets")}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){let t=Rt(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=_n(e);return t.length?"?"+t:""}};var On=G(qe(),1);var Cn="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),or=64,ra={},Sn=0,Ei=0,xn;function wn(i){let e="";do e=Cn[i%or]+e,i=Math.floor(i/or);while(i>0);return e}function bi(){let i=wn(+new Date);return i!==xn?(Sn=0,xn=i):i+"."+wn(Sn++)}for(;Ei<or;Ei++)ra[Cn[Ei]]=Ei;var lr=G(kn(),1),fr=lr.default||lr;function Rn(){return new cr}function sa(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 n=e[0].substring(t+1).trim();n.charCodeAt(0)===34&&(n=n.slice(1,-1));let s={name:r,value:n};for(let o=1;o<e.length;o++){let a=e[o].split("=");if(a.length!==2)continue;let l=a[0].trim(),h=a[1].trim();switch(l){case"Expires":s.expires=new Date(h);break;case"Max-Age":let c=new Date;c.setUTCSeconds(c.getUTCSeconds()+parseInt(h,10)),s.expires=c;break;default:}}return s}var cr=class{constructor(){this.cookies=new Map}parseCookies(e){let t=e.getResponseHeader("set-cookie");t&&t.forEach(r=>{let n=sa(r);n&&this.cookies.set(n.name,n)})}addCookies(e){let t=[];this.cookies.forEach((r,n)=>{var s;((s=r.expires)===null||s===void 0?void 0:s.getTime())<Date.now()?this.cookies.delete(n):t.push(`${n}=${r.value}`)}),t.length&&(e.setDisableHeaderCheck(!0),e.setRequestHeader("cookie",t.join("; ")))}};var X=(0,On.default)("engine.io-client:polling");function oa(){}var aa=function(){return new fr({xdomain:!1}).responseType!=null}(),Si=class extends be{constructor(e){if(super(e),this.polling=!1,typeof location!="undefined"){let r=location.protocol==="https:",n=location.port;n||(n=r?"443":"80"),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||n!==e.port}let t=e&&e.forceBase64;this.supportsBinary=aa&&!t,this.opts.withCredentials&&(this.cookieJar=Rn())}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)};on(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,sn(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]=bi()),!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 Ie(this.uri(),e)}doWrite(e,t){let r=this.request({method:"POST",data:e});r.on("success",t),r.on("error",(n,s)=>{this.onError("xhr post error",n,s)})}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}},Ie=class i extends O{constructor(e,t){super(),Ee(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=mi(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;let r=this.xhr=new fr(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 n in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(n)&&r.setRequestHeader(n,this.opts.extraHeaders[n])}}catch(n){}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(n){}try{r.setRequestHeader("Accept","*/*")}catch(n){}(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 n;r.readyState===3&&((n=this.opts.cookieJar)===null||n===void 0||n.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(n){this.setTimeoutFn(()=>{this.onError(n)},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=oa,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()}};Ie.requestsCount=0;Ie.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Tn);else if(typeof addEventListener=="function"){let i="onpagehide"in he?"pagehide":"unload";addEventListener(i,Tn,!1)}}function Tn(){for(let i in Ie.requests)Ie.requests.hasOwnProperty(i)&&Ie.requests[i].abort()}var yc=G(Fn(),1),vc=G(_r(),1),_c=G(br(),1),Ps=G(kr(),1),Ec=G(Is(),1);var Ls=Ps.default;var Wt=Ls,Ii=!1,Fs="nodebuffer",Ve=process.nextTick;var Bs=G(qe(),1);var bc=(0,Bs.default)("engine.io-client:websocket"),Us=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Pi=class extends be{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=Us?{}:mi(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=Ii&&!Us?t?new Wt(e,t):new Wt(e):new Wt(e,t,r)}catch(n){return this.emitReserved("error",n)}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],n=t===e.length-1;kt(r,this.supportsBinary,s=>{let o={};Ii||(r.options&&(o.compress=r.options.compress),this.opts.perMessageDeflate&&(typeof s=="string"?Buffer.byteLength(s):s.length)<this.opts.perMessageDeflate.threshold&&(o.compress=!1));try{Ii?this.ws.send(s):this.ws.send(s,o)}catch(a){bc("websocket closed before onclose event")}n&&Ve(()=>{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]=bi()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Wt}};var Ds=G(qe(),1),zt=(0,Ds.default)("engine.io-client:webtransport"),Li=class extends be{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{zt("transport closed gracefully"),this.onClose()}).catch(e=>{zt("transport closed due to %s",e),this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{let t=cn(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(t).getReader(),n=an();n.readable.pipeTo(e.writable),this.writer=n.writable.getWriter();let s=()=>{r.read().then(({done:a,value:l})=>{if(a){zt("session is closed");return}zt("received chunk: %o",l),this.onPacket(l),s()}).catch(a=>{zt("an error occurred while reading: %s",a)})};s();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],n=t===e.length-1;this.writer.write(r).then(()=>{n&&Ve(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}};var Tr={websocket:Pi,webtransport:Li,polling:Si};var Sc=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,xc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ft(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 n=Sc.exec(i||""),s={},o=14;for(;o--;)s[xc[o]]=n[o]||"";return t!=-1&&r!=-1&&(s.source=e,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=wc(s,s.path),s.queryKey=Cc(s,s.query),s}function wc(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 Cc(i,e){let t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,n,s){n&&(t[n]=s)}),t}var Ms=G(qe(),1);var L=(0,Ms.default)("engine.io-client:socket"),He=class i extends O{constructor(e,t={}){super(),this.binaryType=Fs,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=ft(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=ft(t.host).host),Ee(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=En(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){L('creating transport "%s"',e);let t=Object.assign({},this.opts.query);t.EIO=Qi,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 L("options: %j",r),new Tr[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){L("error while creating transport: %s",t),this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){L("setting transport %s",e.name),this.transport&&(L("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){L('probing transport "%s"',e);let t=this.createTransport(e),r=!1;i.priorWebsocketSuccess=!1;let n=()=>{r||(L('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",u=>{if(!r)if(u.type==="pong"&&u.data==="probe"){if(L('probe transport "%s" pong',e),this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;i.priorWebsocketSuccess=t.name==="websocket",L('pausing current transport "%s"',this.transport.name),this.transport.pause(()=>{r||this.readyState!=="closed"&&(L("changing transport and sending upgrade packet"),c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{L('probe transport "%s" failed',e);let d=new Error("probe error");d.transport=t.name,this.emitReserved("upgradeError",d)}}))};function s(){r||(r=!0,c(),t.close(),t=null)}let o=u=>{let d=new Error("probe error: "+u);d.transport=t.name,s(),L('probe transport "%s" failed because of error: %s',e,u),this.emitReserved("upgradeError",d)};function a(){o("transport closed")}function l(){o("socket closed")}function h(u){t&&u.name!==t.name&&(L('"%s" works - aborting "%s"',u.name,t.name),s())}let c=()=>{t.removeListener("open",n),t.removeListener("error",o),t.removeListener("close",a),this.off("close",l),this.off("upgrading",h)};t.once("open",n),t.once("error",o),t.once("close",a),this.once("close",l),this.once("upgrading",h),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||t.open()},200):t.open()}onOpen(){if(L("socket open"),this.readyState="open",i.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){L("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(L('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 L('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();L("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 n=this.writeBuffer[r].data;if(n&&(t+=ln(n)),r>0&&t>this.maxPayload)return L("only send %d out of %d packets",r,this.writeBuffer.length),this.writeBuffer.slice(0,r);t+=2}return L("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,n){if(typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let s={type:e,data:t,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this.onClose("forced close"),L("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){L("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")&&(L('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,n=e.length;for(;r<n;r++)~this.transports.indexOf(e[r])&&t.push(e[r]);return t}};He.protocol=Qi;var Fh=He.protocol;var Hs=G($t(),1),Vs=(0,Hs.default)("socket.io-client:url");function js(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)||(Vs("protocol-less url %s",i),typeof t!="undefined"?i=t.protocol+"//"+i:i="https://"+i),Vs("parse %s",i),r=ft(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 s=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+e,r.href=r.protocol+"://"+s+(t&&t.port===r.port?"":":"+r.port),r}var Mr={};vo(Mr,{Decoder:()=>Br,Encoder:()=>Ur,PacketType:()=>w,protocol:()=>Qs});var Wc=typeof ArrayBuffer=="function",zc=i=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(i):i.buffer instanceof ArrayBuffer,Gs=Object.prototype.toString,$c=typeof Blob=="function"||typeof Blob!="undefined"&&Gs.call(Blob)==="[object BlobConstructor]",Vc=typeof File=="function"||typeof File!="undefined"&&Gs.call(File)==="[object FileConstructor]";function Ht(i){return Wc&&(i instanceof ArrayBuffer||zc(i))||$c&&i instanceof Blob||Vc&&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(Ht(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 Ks(i){let e=[],t=i.data,r=i;return r.data=Pr(t,e),r.attachments=e.length,{packet:r,buffers:e}}function Pr(i,e){if(!i)return i;if(Ht(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]=Pr(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]=Pr(i[r],e));return t}return i}function Ys(i,e){return i.data=Lr(i.data,e),delete i.attachments,i}function Lr(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]=Lr(i[t],e);else if(typeof i=="object")for(let t in i)Object.prototype.hasOwnProperty.call(i,t)&&(i[t]=Lr(i[t],e));return i}var Xs=G(qe(),1),Fr=(0,Xs.default)("socket.io-parser"),Hc=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Qs=5,w;(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"})(w||(w={}));var Ur=class{constructor(e){this.replacer=e}encode(e){return Fr("encoding packet %j",e),(e.type===w.EVENT||e.type===w.ACK)&&Vt(e)?this.encodeAsBinary({type:e.type===w.EVENT?w.BINARY_EVENT:w.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===w.BINARY_EVENT||e.type===w.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)),Fr("encoded %j as %s",e,t),t}encodeAsBinary(e){let t=Ks(e),r=this.encodeAsString(t.packet),n=t.buffers;return n.unshift(r),n}};function Js(i){return Object.prototype.toString.call(i)==="[object Object]"}var Br=class i extends O{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===w.BINARY_EVENT;r||t.type===w.BINARY_ACK?(t.type=r?w.EVENT:w.ACK,this.reconstructor=new Dr(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Ht(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(w[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===w.BINARY_EVENT||r.type===w.BINARY_ACK){let s=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);let o=e.substring(s,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(e.charAt(t+1)==="/"){let s=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););r.nsp=e.substring(s,t)}else r.nsp="/";let n=e.charAt(t+1);if(n!==""&&Number(n)==n){let s=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(s,t+1))}if(e.charAt(++t)){let s=this.tryParse(e.substr(t));if(i.isPayloadValid(r.type,s))r.data=s;else throw new Error("invalid payload")}return Fr("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 w.CONNECT:return Js(t);case w.DISCONNECT:return t===void 0;case w.CONNECT_ERROR:return typeof t=="string"||Js(t);case w.EVENT:case w.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Hc.indexOf(t[0])===-1);case w.ACK:case w.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},Dr=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=Ys(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function re(i,e,t){return i.on(e,t),function(){i.off(e,t)}}var Zs=G($t(),1),D=(0,Zs.default)("socket.io-client:socket"),jc=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ht=class extends O{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=[re(e,"open",this.onopen.bind(this)),re(e,"packet",this.onpacket.bind(this)),re(e,"error",this.onerror.bind(this)),re(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(jc.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:w.EVENT,data:t};if(r.options={},r.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){let o=this.ids++;D("emitting packet with ack id %d",o);let a=t.pop();this._registerAckCallback(o,a),r.id=o}let n=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!n||!this.connected)?D("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 n=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let s=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===e&&(D("removing packet with ack id %d from the buffer",e),this.sendBuffer.splice(o,1));D("event with ack id %d has timed out after %d ms",e,n),t.call(this,new Error("operation has timed out"))},n);this.acks[e]=(...o)=>{this.io.clearTimeoutFn(s),t.apply(this,[null,...o])}}emitWithAck(e,...t){let r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((n,s)=>{t.push((o,a)=>r?o?s(o):n(a):n(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((n,...s)=>r!==this._queue[0]?void 0:(n!==null?r.tryCount>this._opts.retries&&(D("packet [%d] is discarded after %d tries",r.id,r.tryCount),this._queue.shift(),t&&t(n)):(D("packet [%d] was successfully sent",r.id),this._queue.shift(),t&&t(null,...s)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(D("draining queue"),!this.connected||this._queue.length===0)return;let t=this._queue[0];if(t.pending&&!e){D("packet [%d] has already been sent and is waiting for an ack",t.id);return}t.pending=!0,t.tryCount++,D("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(){D("transport is open - connecting"),typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:w.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){D("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 w.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 w.EVENT:case w.BINARY_EVENT:this.onevent(e);break;case w.ACK:case w.BINARY_ACK:this.onack(e);break;case w.DISCONNECT:this.ondisconnect();break;case w.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||[];D("emitting event %j",t),e.id!=null&&(D("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(...n){r||(r=!0,D("sending ack %j",n),t.packet({type:w.ACK,id:e,data:n}))}}onack(e){let t=this.acks[e.id];typeof t=="function"?(D("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):D("bad ack %s",e.id)}onconnect(e,t){D("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(){D("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&&(D("performing disconnect (%s)",this.nsp),this.packet({type:w.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 eo=G($t(),1),H=(0,eo.default)("socket.io-client:manager"),ut=class extends O{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,Ee(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 n=t.parser||Mr;this.encoder=new n.Encoder,this.decoder=new n.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 He(this.uri,this.opts);let t=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let n=re(t,"open",function(){r.onopen(),e&&e()}),s=a=>{H("error"),this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=re(t,"error",s);if(this._timeout!==!1){let a=this._timeout;H("connect attempt will timeout after %d",a);let l=this.setTimeoutFn(()=>{H("connect attempt timed out after %d",a),n(),s(new Error("timeout")),t.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(n),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(re(e,"ping",this.onping.bind(this)),re(e,"data",this.ondata.bind(this)),re(e,"error",this.onerror.bind(this)),re(e,"close",this.onclose.bind(this)),re(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){Ve(()=>{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 ht(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(n=>{n?(H("reconnect attempt error"),e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",n)):(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 io=G($t(),1),to=(0,io.default)("socket.io-client"),jt={};function Gt(i,e){typeof i=="object"&&(e=i,i=void 0),e=e||{};let t=js(i,e.path||"/socket.io"),r=t.source,n=t.id,s=t.path,o=jt[n]&&s in jt[n].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o,l;return a?(to("ignoring socket cache for %s",r),l=new ut(r,e)):(jt[n]||(to("new io instance for %s",r),jt[n]=new ut(r,e)),l=jt[n]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(Gt,{Manager:ut,Socket:ht,io:Gt,connect:Gt});var Gc="https://ws.novu.co",ro="notifications.notification_received",no="notifications.unseen_count_changed",so="notifications.unread_count_changed",Kc=({_id:i,content:e,read:t,archived:r,snoozedUntil:n,deliveredAt:s,createdAt:o,lastReadDate:a,archivedAt:l,channel:h,subscriber:c,subject:u,avatar:d,cta:_,tags:x,data:m,workflow:S})=>{var R,V,j,pe,Kt,Yt,se,gt;let k={id:c==null?void 0:c._id,subscriberId:c==null?void 0:c.subscriberId,firstName:c==null?void 0:c.firstName,lastName:c==null?void 0:c.lastName,avatar:c==null?void 0:c.avatar,locale:c==null?void 0:c.locale,data:c==null?void 0:c.data,timezone:c==null?void 0:c.timezone,email:c==null?void 0:c.email,phone:c==null?void 0:c.phone},N=(V=(R=_.action)==null?void 0:R.buttons)==null?void 0:V.find(Ge=>Ge.type==="primary"),p=(pe=(j=_.action)==null?void 0:j.buttons)==null?void 0:pe.find(Ge=>Ge.type==="secondary"),y=(Yt=(Kt=_.action)==null?void 0:Kt.result)==null?void 0:Yt.type,$=(se=_.action)==null?void 0:se.status;return T(v(v({id:i,subject:u,body:e,to:k,isRead:t,isArchived:r,isSnoozed:!!n},s&&{deliveredAt:s}),n&&{snoozedUntil:n}),{createdAt:o,readAt:a,archivedAt:l,avatar:d,primaryAction:N&&{label:N.content,isCompleted:y==="primary"&&$==="done",redirect:N.url?{target:N.target,url:N.url}:void 0},secondaryAction:p&&{label:p.content,isCompleted:y==="secondary"&&$==="done",redirect:p.url?{target:p.target,url:p.url}:void 0},channelType:h,tags:x,redirect:(gt=_.data)!=null&&gt.url?{url:_.data.url,target:_.data.target}:void 0,data:m,workflow:S})},dt,de,ne,pt,Mi,qi,Wi,ye,oo,qr,Wr,Di=class extends ke{constructor({socketUrl:t,inboxServiceInstance:r,eventEmitterInstance:n}){super({eventEmitterInstance:n,inboxServiceInstance:r});E(this,ye);E(this,dt);E(this,de);E(this,ne);E(this,pt);E(this,Mi,({message:t})=>{f(this,de).emit(ro,{result:new U(Kc(t),f(this,de),this._inboxService)})});E(this,qi,({unseenCount:t})=>{f(this,de).emit(no,{result:t})});E(this,Wi,({unreadCount:t})=>{f(this,de).emit(so,{result:t})});b(this,de,n),b(this,pt,t!=null?t:Gc)}onSessionSuccess({token:t}){b(this,dt,t)}isSocketEvent(t){return t===ro||t===no||t===so}connect(){return g(this,null,function*(){return f(this,dt)?Ye(this,ye,qr).call(this):this.callWithSession(Ye(this,ye,qr).bind(this))})}disconnect(){return g(this,null,function*(){return f(this,ne)?Ye(this,ye,Wr).call(this):this.callWithSession(Ye(this,ye,Wr).bind(this))})}};dt=new WeakMap,de=new WeakMap,ne=new WeakMap,pt=new WeakMap,Mi=new WeakMap,qi=new WeakMap,Wi=new WeakMap,ye=new WeakSet,oo=function(){return g(this,null,function*(){var r,n,s;if(f(this,ne))return;let t={socketUrl:f(this,pt)};f(this,de).emit("socket.connect.pending",{args:t}),b(this,ne,Gt(f(this,pt),{reconnectionDelayMax:1e4,transports:["websocket"],query:{token:`${f(this,dt)}`}})),f(this,ne).on("connect",()=>{f(this,de).emit("socket.connect.resolved",{args:t})}),f(this,ne).on("connect_error",o=>{f(this,de).emit("socket.connect.resolved",{args:t,error:o})}),(r=f(this,ne))==null||r.on("notification_received",f(this,Mi)),(n=f(this,ne))==null||n.on("unseen_count_changed",f(this,qi)),(s=f(this,ne))==null||s.on("unread_count_changed",f(this,Wi))})},qr=function(){return g(this,null,function*(){try{return yield Ye(this,ye,oo).call(this),{}}catch(t){return{error:new A("Failed to initialize the socket",t)}}})},Wr=function(){return g(this,null,function*(){var t;try{return(t=f(this,ne))==null||t.disconnect(),b(this,ne,void 0),{}}catch(r){return{error:new A("Failed to disconnect from the socket",r)}}})};var ve,Ce,Ue,mt,zi=class{constructor(e){E(this,ve);E(this,Ce);E(this,Ue);E(this,mt);var r,n;b(this,Ue,new ei({apiUrl:e.apiUrl||e.backendUrl,userAgent:e.__userAgent})),b(this,ve,new ti),b(this,Ce,new ui({applicationIdentifier:e.applicationIdentifier||"",subscriberHash:e.subscriberHash,subscriber:ao(e)},f(this,Ue),f(this,ve)));let t=ao(e);b(this,mt,t.subscriberId),f(this,Ce).initialize(),this.notifications=new ci({useCache:(r=e.useCache)!=null?r:!0,inboxServiceInstance:f(this,Ue),eventEmitterInstance:f(this,ve)}),this.preferences=new hi({useCache:(n=e.useCache)!=null?n:!0,inboxServiceInstance:f(this,Ue),eventEmitterInstance:f(this,ve)}),this.socket=new Di({socketUrl:e.socketUrl,eventEmitterInstance:f(this,ve),inboxServiceInstance:f(this,Ue)}),this.on=(s,o)=>{this.socket.isSocketEvent(s)&&this.socket.connect();let a=f(this,ve).on(s,o);return()=>{a()}},this.off=(s,o)=>{f(this,ve).off(s,o)}}get applicationIdentifier(){return f(this,Ce).applicationIdentifier}get subscriberId(){return f(this,Ce).subscriberId}changeSubscriber(e){return g(this,null,function*(){f(this,mt)!==e.subscriber.subscriberId&&(yield f(this,Ce).initialize({applicationIdentifier:f(this,Ce).applicationIdentifier||"",subscriberHash:e.subscriberHash,subscriber:e.subscriber}),b(this,mt,e.subscriber.subscriberId))})}};ve=new WeakMap,Ce=new WeakMap,Ue=new WeakMap,mt=new WeakMap;function ao(i){return i.subscriber?typeof i.subscriber=="string"?{subscriberId:i.subscriber}:i.subscriber:i.subscriberId?{subscriberId:i.subscriberId}:{subscriberId:""}}window.Novu=zi;})();
17
17
  /*! Bundled license information:
18
18
 
19
19
  xmlhttprequest-ssl/lib/XMLHttpRequest.js: