@streamlayer/sdk-web 0.28.14 → 0.28.16

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.
Files changed (3) hide show
  1. package/lib/cjs/index.js +13 -13
  2. package/lib/es/index.js +1418 -1323
  3. package/package.json +10 -10
package/lib/cjs/index.js CHANGED
@@ -1,19 +1,19 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ve=require("@streamlayer/sl-eslib/interactive/interactive.common_pb");require("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb");const ae=require("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb"),Ne=require("nanostores");require("@nanostores/logger");require("microdiff");const Yt=require("@connectrpc/connect"),$n=require("@connectrpc/connect-web"),Dn=require("@nanostores/query"),jn=require("@streamlayer/sl-eslib/sports/events/events_connect"),_t=require("@streamlayer/sl-eslib/sdkSettings/client/client_connect"),Gr=require("@streamlayer/sl-eslib/users/users_connect"),Mn=require("pino"),Se=require("@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect"),zr=require("@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_connect");require("@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_pb");var Kr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _={},Hr={},Ct={};Ct.byteLength=Gn;Ct.toByteArray=Kn;Ct.fromByteArray=Jn;var we=[],oe=[],qn=typeof Uint8Array<"u"?Uint8Array:Array,Nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var qe=0,Qn=Nt.length;qe<Qn;++qe)we[qe]=Nt[qe],oe[Nt.charCodeAt(qe)]=qe;oe["-".charCodeAt(0)]=62;oe["_".charCodeAt(0)]=63;function Wr(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var o=r===e?0:4-r%4;return[r,o]}function Gn(t){var e=Wr(t),r=e[0],o=e[1];return(r+o)*3/4-o}function zn(t,e,r){return(e+r)*3/4-r}function Kn(t){var e,r=Wr(t),o=r[0],s=r[1],u=new qn(zn(t,o,s)),f=0,l=s>0?o-4:o,p;for(p=0;p<l;p+=4)e=oe[t.charCodeAt(p)]<<18|oe[t.charCodeAt(p+1)]<<12|oe[t.charCodeAt(p+2)]<<6|oe[t.charCodeAt(p+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=e&255;return s===2&&(e=oe[t.charCodeAt(p)]<<2|oe[t.charCodeAt(p+1)]>>4,u[f++]=e&255),s===1&&(e=oe[t.charCodeAt(p)]<<10|oe[t.charCodeAt(p+1)]<<4|oe[t.charCodeAt(p+2)]>>2,u[f++]=e>>8&255,u[f++]=e&255),u}function Hn(t){return we[t>>18&63]+we[t>>12&63]+we[t>>6&63]+we[t&63]}function Wn(t,e,r){for(var o,s=[],u=e;u<r;u+=3)o=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(t[u+2]&255),s.push(Hn(o));return s.join("")}function Jn(t){for(var e,r=t.length,o=r%3,s=[],u=16383,f=0,l=r-o;f<l;f+=u)s.push(Wn(t,f,f+u>l?l:f+u));return o===1?(e=t[r-1],s.push(we[e>>2]+we[e<<4&63]+"==")):o===2&&(e=(t[r-2]<<8)+t[r-1],s.push(we[e>>10]+we[e>>4&63]+we[e<<2&63]+"=")),s.join("")}var lr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */lr.read=function(t,e,r,o,s){var u,f,l=s*8-o-1,p=(1<<l)-1,A=p>>1,g=-7,w=r?s-1:0,E=r?-1:1,T=t[e+w];for(w+=E,u=T&(1<<-g)-1,T>>=-g,g+=l;g>0;u=u*256+t[e+w],w+=E,g-=8);for(f=u&(1<<-g)-1,u>>=-g,g+=o;g>0;f=f*256+t[e+w],w+=E,g-=8);if(u===0)u=1-A;else{if(u===p)return f?NaN:(T?-1:1)*(1/0);f=f+Math.pow(2,o),u=u-A}return(T?-1:1)*f*Math.pow(2,u-o)};lr.write=function(t,e,r,o,s,u){var f,l,p,A=u*8-s-1,g=(1<<A)-1,w=g>>1,E=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=o?0:u-1,P=o?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,f=g):(f=Math.floor(Math.log(e)/Math.LN2),e*(p=Math.pow(2,-f))<1&&(f--,p*=2),f+w>=1?e+=E/p:e+=E*Math.pow(2,1-w),e*p>=2&&(f++,p/=2),f+w>=g?(l=0,f=g):f+w>=1?(l=(e*p-1)*Math.pow(2,s),f=f+w):(l=e*Math.pow(2,w-1)*Math.pow(2,s),f=0));s>=8;t[r+T]=l&255,T+=P,l/=256,s-=8);for(f=f<<s|l,A+=s;A>0;t[r+T]=f&255,T+=P,f/=256,A-=8);t[r+T-P]|=N*128};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ve=require("@streamlayer/sl-eslib/interactive/interactive.common_pb");require("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb");const ue=require("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb"),Ne=require("nanostores");require("@nanostores/logger");require("microdiff");const Yt=require("@connectrpc/connect"),Dn=require("@connectrpc/connect-web"),Mn=require("@nanostores/query"),Vn=require("@streamlayer/sl-eslib/sports/events/events_connect"),_t=require("@streamlayer/sl-eslib/sdkSettings/client/client_connect"),Kr=require("@streamlayer/sl-eslib/users/users_connect"),qn=require("pino"),Se=require("@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect"),Hr=require("@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_connect");require("@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_pb");var Wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var O={},Jr={},Ct={};Ct.byteLength=Kn;Ct.toByteArray=Wn;Ct.fromByteArray=Xn;var we=[],se=[],Gn=typeof Uint8Array<"u"?Uint8Array:Array,Nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var qe=0,zn=Nt.length;qe<zn;++qe)we[qe]=Nt[qe],se[Nt.charCodeAt(qe)]=qe;se["-".charCodeAt(0)]=62;se["_".charCodeAt(0)]=63;function Yr(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var o=r===e?0:4-r%4;return[r,o]}function Kn(t){var e=Yr(t),r=e[0],o=e[1];return(r+o)*3/4-o}function Hn(t,e,r){return(e+r)*3/4-r}function Wn(t){var e,r=Yr(t),o=r[0],s=r[1],u=new Gn(Hn(t,o,s)),f=0,l=s>0?o-4:o,d;for(d=0;d<l;d+=4)e=se[t.charCodeAt(d)]<<18|se[t.charCodeAt(d+1)]<<12|se[t.charCodeAt(d+2)]<<6|se[t.charCodeAt(d+3)],u[f++]=e>>16&255,u[f++]=e>>8&255,u[f++]=e&255;return s===2&&(e=se[t.charCodeAt(d)]<<2|se[t.charCodeAt(d+1)]>>4,u[f++]=e&255),s===1&&(e=se[t.charCodeAt(d)]<<10|se[t.charCodeAt(d+1)]<<4|se[t.charCodeAt(d+2)]>>2,u[f++]=e>>8&255,u[f++]=e&255),u}function Jn(t){return we[t>>18&63]+we[t>>12&63]+we[t>>6&63]+we[t&63]}function Yn(t,e,r){for(var o,s=[],u=e;u<r;u+=3)o=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(t[u+2]&255),s.push(Jn(o));return s.join("")}function Xn(t){for(var e,r=t.length,o=r%3,s=[],u=16383,f=0,l=r-o;f<l;f+=u)s.push(Yn(t,f,f+u>l?l:f+u));return o===1?(e=t[r-1],s.push(we[e>>2]+we[e<<4&63]+"==")):o===2&&(e=(t[r-2]<<8)+t[r-1],s.push(we[e>>10]+we[e>>4&63]+we[e<<2&63]+"=")),s.join("")}var lr={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */lr.read=function(t,e,r,o,s){var u,f,l=s*8-o-1,d=(1<<l)-1,S=d>>1,g=-7,b=r?s-1:0,E=r?-1:1,T=t[e+b];for(b+=E,u=T&(1<<-g)-1,T>>=-g,g+=l;g>0;u=u*256+t[e+b],b+=E,g-=8);for(f=u&(1<<-g)-1,u>>=-g,g+=o;g>0;f=f*256+t[e+b],b+=E,g-=8);if(u===0)u=1-S;else{if(u===d)return f?NaN:(T?-1:1)*(1/0);f=f+Math.pow(2,o),u=u-S}return(T?-1:1)*f*Math.pow(2,u-o)};lr.write=function(t,e,r,o,s,u){var f,l,d,S=u*8-s-1,g=(1<<S)-1,b=g>>1,E=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,T=o?0:u-1,N=o?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,f=g):(f=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-f))<1&&(f--,d*=2),f+b>=1?e+=E/d:e+=E*Math.pow(2,1-b),e*d>=2&&(f++,d/=2),f+b>=g?(l=0,f=g):f+b>=1?(l=(e*d-1)*Math.pow(2,s),f=f+b):(l=e*Math.pow(2,b-1)*Math.pow(2,s),f=0));s>=8;t[r+T]=l&255,T+=N,l/=256,s-=8);for(f=f<<s|l,S+=s;S>0;t[r+T]=f&255,T+=N,f/=256,S-=8);t[r+T-N]|=P*128};/*!
2
2
  * The buffer module from node.js, for the browser.
3
3
  *
4
4
  * @author Feross Aboukhadijeh <https://feross.org>
5
5
  * @license MIT
6
- */(function(t){const e=Ct,r=lr,o=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=X,t.INSPECT_MAX_BYTES=50;const s=2147483647;t.kMaxLength=s,l.TYPED_ARRAY_SUPPORT=u(),!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function u(){try{const a=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(a,n),a.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function f(a){if(a>s)throw new RangeError('The value "'+a+'" is invalid for option "size"');const n=new Uint8Array(a);return Object.setPrototypeOf(n,l.prototype),n}function l(a,n,i){if(typeof a=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(a)}return p(a,n,i)}l.poolSize=8192;function p(a,n,i){if(typeof a=="string")return E(a,n);if(ArrayBuffer.isView(a))return P(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a);if(ge(a,ArrayBuffer)||a&&ge(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ge(a,SharedArrayBuffer)||a&&ge(a.buffer,SharedArrayBuffer)))return N(a,n,i);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const c=a.valueOf&&a.valueOf();if(c!=null&&c!==a)return l.from(c,n,i);const h=G(a);if(h)return h;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return l.from(a[Symbol.toPrimitive]("string"),n,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a)}l.from=function(a,n,i){return p(a,n,i)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function A(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function g(a,n,i){return A(a),a<=0?f(a):n!==void 0?typeof i=="string"?f(a).fill(n,i):f(a).fill(n):f(a)}l.alloc=function(a,n,i){return g(a,n,i)};function w(a){return A(a),f(a<0?0:z(a)|0)}l.allocUnsafe=function(a){return w(a)},l.allocUnsafeSlow=function(a){return w(a)};function E(a,n){if((typeof n!="string"||n==="")&&(n="utf8"),!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);const i=pe(a,n)|0;let c=f(i);const h=c.write(a,n);return h!==i&&(c=c.slice(0,h)),c}function T(a){const n=a.length<0?0:z(a.length)|0,i=f(n);for(let c=0;c<n;c+=1)i[c]=a[c]&255;return i}function P(a){if(ge(a,Uint8Array)){const n=new Uint8Array(a);return N(n.buffer,n.byteOffset,n.byteLength)}return T(a)}function N(a,n,i){if(n<0||a.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<n+(i||0))throw new RangeError('"length" is outside of buffer bounds');let c;return n===void 0&&i===void 0?c=new Uint8Array(a):i===void 0?c=new Uint8Array(a,n):c=new Uint8Array(a,n,i),Object.setPrototypeOf(c,l.prototype),c}function G(a){if(l.isBuffer(a)){const n=z(a.length)|0,i=f(n);return i.length===0||a.copy(i,0,0,n),i}if(a.length!==void 0)return typeof a.length!="number"||Rt(a.length)?f(0):T(a);if(a.type==="Buffer"&&Array.isArray(a.data))return T(a.data)}function z(a){if(a>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return a|0}function X(a){return+a!=a&&(a=0),l.alloc(+a)}l.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==l.prototype},l.compare=function(n,i){if(ge(n,Uint8Array)&&(n=l.from(n,n.offset,n.byteLength)),ge(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),!l.isBuffer(n)||!l.isBuffer(i))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===i)return 0;let c=n.length,h=i.length;for(let y=0,m=Math.min(c,h);y<m;++y)if(n[y]!==i[y]){c=n[y],h=i[y];break}return c<h?-1:h<c?1:0},l.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(n,i){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return l.alloc(0);let c;if(i===void 0)for(i=0,c=0;c<n.length;++c)i+=n[c].length;const h=l.allocUnsafe(i);let y=0;for(c=0;c<n.length;++c){let m=n[c];if(ge(m,Uint8Array))y+m.length>h.length?(l.isBuffer(m)||(m=l.from(m)),m.copy(h,y)):Uint8Array.prototype.set.call(h,m,y);else if(l.isBuffer(m))m.copy(h,y);else throw new TypeError('"list" argument must be an Array of Buffers');y+=m.length}return h};function pe(a,n){if(l.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||ge(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof a);const i=a.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&i===0)return 0;let h=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return ot(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return dt(a).length;default:if(h)return c?-1:ot(a).length;n=(""+n).toLowerCase(),h=!0}}l.byteLength=pe;function te(a,n,i){let c=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,n>>>=0,i<=n))return"";for(a||(a="utf8");;)switch(a){case"hex":return fe(this,n,i);case"utf8":case"utf-8":return le(this,n,i);case"ascii":return it(this,n,i);case"latin1":case"binary":return ke(this,n,i);case"base64":return nt(this,n,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pe(this,n,i);default:if(c)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function B(a,n,i){const c=a[n];a[n]=a[i],a[i]=c}l.prototype.swap16=function(){const n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let i=0;i<n;i+=2)B(this,i,i+1);return this},l.prototype.swap32=function(){const n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let i=0;i<n;i+=4)B(this,i,i+3),B(this,i+1,i+2);return this},l.prototype.swap64=function(){const n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let i=0;i<n;i+=8)B(this,i,i+7),B(this,i+1,i+6),B(this,i+2,i+5),B(this,i+3,i+4);return this},l.prototype.toString=function(){const n=this.length;return n===0?"":arguments.length===0?le(this,0,n):te.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(n){if(!l.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:l.compare(this,n)===0},l.prototype.inspect=function(){let n="";const i=t.INSPECT_MAX_BYTES;return n=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(n+=" ... "),"<Buffer "+n+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(n,i,c,h,y){if(ge(n,Uint8Array)&&(n=l.from(n,n.offset,n.byteLength)),!l.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(i===void 0&&(i=0),c===void 0&&(c=n?n.length:0),h===void 0&&(h=0),y===void 0&&(y=this.length),i<0||c>n.length||h<0||y>this.length)throw new RangeError("out of range index");if(h>=y&&i>=c)return 0;if(h>=y)return-1;if(i>=c)return 1;if(i>>>=0,c>>>=0,h>>>=0,y>>>=0,this===n)return 0;let m=y-h,C=c-i;const q=Math.min(m,C),M=this.slice(h,y),Q=n.slice(i,c);for(let D=0;D<q;++D)if(M[D]!==Q[D]){m=M[D],C=Q[D];break}return m<C?-1:C<m?1:0};function j(a,n,i,c,h){if(a.length===0)return-1;if(typeof i=="string"?(c=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,Rt(i)&&(i=h?0:a.length-1),i<0&&(i=a.length+i),i>=a.length){if(h)return-1;i=a.length-1}else if(i<0)if(h)i=0;else return-1;if(typeof n=="string"&&(n=l.from(n,c)),l.isBuffer(n))return n.length===0?-1:O(a,n,i,c,h);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?h?Uint8Array.prototype.indexOf.call(a,n,i):Uint8Array.prototype.lastIndexOf.call(a,n,i):O(a,[n],i,c,h);throw new TypeError("val must be string, number or Buffer")}function O(a,n,i,c,h){let y=1,m=a.length,C=n.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(a.length<2||n.length<2)return-1;y=2,m/=2,C/=2,i/=2}function q(Q,D){return y===1?Q[D]:Q.readUInt16BE(D*y)}let M;if(h){let Q=-1;for(M=i;M<m;M++)if(q(a,M)===q(n,Q===-1?0:M-Q)){if(Q===-1&&(Q=M),M-Q+1===C)return Q*y}else Q!==-1&&(M-=M-Q),Q=-1}else for(i+C>m&&(i=m-C),M=i;M>=0;M--){let Q=!0;for(let D=0;D<C;D++)if(q(a,M+D)!==q(n,D)){Q=!1;break}if(Q)return M}return-1}l.prototype.includes=function(n,i,c){return this.indexOf(n,i,c)!==-1},l.prototype.indexOf=function(n,i,c){return j(this,n,i,c,!0)},l.prototype.lastIndexOf=function(n,i,c){return j(this,n,i,c,!1)};function re(a,n,i,c){i=Number(i)||0;const h=a.length-i;c?(c=Number(c),c>h&&(c=h)):c=h;const y=n.length;c>y/2&&(c=y/2);let m;for(m=0;m<c;++m){const C=parseInt(n.substr(m*2,2),16);if(Rt(C))return m;a[i+m]=C}return m}function ne(a,n,i,c){return st(ot(n,a.length-i),a,i,c)}function Oe(a,n,i,c){return st(Pt(n),a,i,c)}function Ae(a,n,i,c){return st(dt(n),a,i,c)}function ce(a,n,i,c){return st(v(n,a.length-i),a,i,c)}l.prototype.write=function(n,i,c,h){if(i===void 0)h="utf8",c=this.length,i=0;else if(c===void 0&&typeof i=="string")h=i,c=this.length,i=0;else if(isFinite(i))i=i>>>0,isFinite(c)?(c=c>>>0,h===void 0&&(h="utf8")):(h=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const y=this.length-i;if((c===void 0||c>y)&&(c=y),n.length>0&&(c<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");h||(h="utf8");let m=!1;for(;;)switch(h){case"hex":return re(this,n,i,c);case"utf8":case"utf-8":return ne(this,n,i,c);case"ascii":case"latin1":case"binary":return Oe(this,n,i,c);case"base64":return Ae(this,n,i,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ce(this,n,i,c);default:if(m)throw new TypeError("Unknown encoding: "+h);h=(""+h).toLowerCase(),m=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function nt(a,n,i){return n===0&&i===a.length?e.fromByteArray(a):e.fromByteArray(a.slice(n,i))}function le(a,n,i){i=Math.min(a.length,i);const c=[];let h=n;for(;h<i;){const y=a[h];let m=null,C=y>239?4:y>223?3:y>191?2:1;if(h+C<=i){let q,M,Q,D;switch(C){case 1:y<128&&(m=y);break;case 2:q=a[h+1],(q&192)===128&&(D=(y&31)<<6|q&63,D>127&&(m=D));break;case 3:q=a[h+1],M=a[h+2],(q&192)===128&&(M&192)===128&&(D=(y&15)<<12|(q&63)<<6|M&63,D>2047&&(D<55296||D>57343)&&(m=D));break;case 4:q=a[h+1],M=a[h+2],Q=a[h+3],(q&192)===128&&(M&192)===128&&(Q&192)===128&&(D=(y&15)<<18|(q&63)<<12|(M&63)<<6|Q&63,D>65535&&D<1114112&&(m=D))}}m===null?(m=65533,C=1):m>65535&&(m-=65536,c.push(m>>>10&1023|55296),m=56320|m&1023),c.push(m),h+=C}return Be(c)}const xe=4096;function Be(a){const n=a.length;if(n<=xe)return String.fromCharCode.apply(String,a);let i="",c=0;for(;c<n;)i+=String.fromCharCode.apply(String,a.slice(c,c+=xe));return i}function it(a,n,i){let c="";i=Math.min(a.length,i);for(let h=n;h<i;++h)c+=String.fromCharCode(a[h]&127);return c}function ke(a,n,i){let c="";i=Math.min(a.length,i);for(let h=n;h<i;++h)c+=String.fromCharCode(a[h]);return c}function fe(a,n,i){const c=a.length;(!n||n<0)&&(n=0),(!i||i<0||i>c)&&(i=c);let h="";for(let y=n;y<i;++y)h+=Ln[a[y]];return h}function Pe(a,n,i){const c=a.slice(n,i);let h="";for(let y=0;y<c.length-1;y+=2)h+=String.fromCharCode(c[y]+c[y+1]*256);return h}l.prototype.slice=function(n,i){const c=this.length;n=~~n,i=i===void 0?c:~~i,n<0?(n+=c,n<0&&(n=0)):n>c&&(n=c),i<0?(i+=c,i<0&&(i=0)):i>c&&(i=c),i<n&&(i=n);const h=this.subarray(n,i);return Object.setPrototypeOf(h,l.prototype),h};function V(a,n,i){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+n>i)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(n,i,c){n=n>>>0,i=i>>>0,c||V(n,i,this.length);let h=this[n],y=1,m=0;for(;++m<i&&(y*=256);)h+=this[n+m]*y;return h},l.prototype.readUintBE=l.prototype.readUIntBE=function(n,i,c){n=n>>>0,i=i>>>0,c||V(n,i,this.length);let h=this[n+--i],y=1;for(;i>0&&(y*=256);)h+=this[n+--i]*y;return h},l.prototype.readUint8=l.prototype.readUInt8=function(n,i){return n=n>>>0,i||V(n,1,this.length),this[n]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(n,i){return n=n>>>0,i||V(n,2,this.length),this[n]|this[n+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(n,i){return n=n>>>0,i||V(n,2,this.length),this[n]<<8|this[n+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(n,i){return n=n>>>0,i||V(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(n,i){return n=n>>>0,i||V(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},l.prototype.readBigUInt64LE=Re(function(n){n=n>>>0,he(n,"offset");const i=this[n],c=this[n+7];(i===void 0||c===void 0)&&ie(n,this.length-8);const h=i+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24,y=this[++n]+this[++n]*2**8+this[++n]*2**16+c*2**24;return BigInt(h)+(BigInt(y)<<BigInt(32))}),l.prototype.readBigUInt64BE=Re(function(n){n=n>>>0,he(n,"offset");const i=this[n],c=this[n+7];(i===void 0||c===void 0)&&ie(n,this.length-8);const h=i*2**24+this[++n]*2**16+this[++n]*2**8+this[++n],y=this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+c;return(BigInt(h)<<BigInt(32))+BigInt(y)}),l.prototype.readIntLE=function(n,i,c){n=n>>>0,i=i>>>0,c||V(n,i,this.length);let h=this[n],y=1,m=0;for(;++m<i&&(y*=256);)h+=this[n+m]*y;return y*=128,h>=y&&(h-=Math.pow(2,8*i)),h},l.prototype.readIntBE=function(n,i,c){n=n>>>0,i=i>>>0,c||V(n,i,this.length);let h=i,y=1,m=this[n+--h];for(;h>0&&(y*=256);)m+=this[n+--h]*y;return y*=128,m>=y&&(m-=Math.pow(2,8*i)),m},l.prototype.readInt8=function(n,i){return n=n>>>0,i||V(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},l.prototype.readInt16LE=function(n,i){n=n>>>0,i||V(n,2,this.length);const c=this[n]|this[n+1]<<8;return c&32768?c|4294901760:c},l.prototype.readInt16BE=function(n,i){n=n>>>0,i||V(n,2,this.length);const c=this[n+1]|this[n]<<8;return c&32768?c|4294901760:c},l.prototype.readInt32LE=function(n,i){return n=n>>>0,i||V(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},l.prototype.readInt32BE=function(n,i){return n=n>>>0,i||V(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},l.prototype.readBigInt64LE=Re(function(n){n=n>>>0,he(n,"offset");const i=this[n],c=this[n+7];(i===void 0||c===void 0)&&ie(n,this.length-8);const h=this[n+4]+this[n+5]*2**8+this[n+6]*2**16+(c<<24);return(BigInt(h)<<BigInt(32))+BigInt(i+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24)}),l.prototype.readBigInt64BE=Re(function(n){n=n>>>0,he(n,"offset");const i=this[n],c=this[n+7];(i===void 0||c===void 0)&&ie(n,this.length-8);const h=(i<<24)+this[++n]*2**16+this[++n]*2**8+this[++n];return(BigInt(h)<<BigInt(32))+BigInt(this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+c)}),l.prototype.readFloatLE=function(n,i){return n=n>>>0,i||V(n,4,this.length),r.read(this,n,!0,23,4)},l.prototype.readFloatBE=function(n,i){return n=n>>>0,i||V(n,4,this.length),r.read(this,n,!1,23,4)},l.prototype.readDoubleLE=function(n,i){return n=n>>>0,i||V(n,8,this.length),r.read(this,n,!0,52,8)},l.prototype.readDoubleBE=function(n,i){return n=n>>>0,i||V(n,8,this.length),r.read(this,n,!1,52,8)};function d(a,n,i,c,h,y){if(!l.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>h||n<y)throw new RangeError('"value" argument is out of bounds');if(i+c>a.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(n,i,c,h){if(n=+n,i=i>>>0,c=c>>>0,!h){const C=Math.pow(2,8*c)-1;d(this,n,i,c,C,0)}let y=1,m=0;for(this[i]=n&255;++m<c&&(y*=256);)this[i+m]=n/y&255;return i+c},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(n,i,c,h){if(n=+n,i=i>>>0,c=c>>>0,!h){const C=Math.pow(2,8*c)-1;d(this,n,i,c,C,0)}let y=c-1,m=1;for(this[i+y]=n&255;--y>=0&&(m*=256);)this[i+y]=n/m&255;return i+c},l.prototype.writeUint8=l.prototype.writeUInt8=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,1,255,0),this[i]=n&255,i+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,2,65535,0),this[i]=n&255,this[i+1]=n>>>8,i+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,2,65535,0),this[i]=n>>>8,this[i+1]=n&255,i+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,4,4294967295,0),this[i+3]=n>>>24,this[i+2]=n>>>16,this[i+1]=n>>>8,this[i]=n&255,i+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,4,4294967295,0),this[i]=n>>>24,this[i+1]=n>>>16,this[i+2]=n>>>8,this[i+3]=n&255,i+4};function b(a,n,i,c,h){ye(n,c,h,a,i,7);let y=Number(n&BigInt(4294967295));a[i++]=y,y=y>>8,a[i++]=y,y=y>>8,a[i++]=y,y=y>>8,a[i++]=y;let m=Number(n>>BigInt(32)&BigInt(4294967295));return a[i++]=m,m=m>>8,a[i++]=m,m=m>>8,a[i++]=m,m=m>>8,a[i++]=m,i}function S(a,n,i,c,h){ye(n,c,h,a,i,7);let y=Number(n&BigInt(4294967295));a[i+7]=y,y=y>>8,a[i+6]=y,y=y>>8,a[i+5]=y,y=y>>8,a[i+4]=y;let m=Number(n>>BigInt(32)&BigInt(4294967295));return a[i+3]=m,m=m>>8,a[i+2]=m,m=m>>8,a[i+1]=m,m=m>>8,a[i]=m,i+8}l.prototype.writeBigUInt64LE=Re(function(n,i=0){return b(this,n,i,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Re(function(n,i=0){return S(this,n,i,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(n,i,c,h){if(n=+n,i=i>>>0,!h){const q=Math.pow(2,8*c-1);d(this,n,i,c,q-1,-q)}let y=0,m=1,C=0;for(this[i]=n&255;++y<c&&(m*=256);)n<0&&C===0&&this[i+y-1]!==0&&(C=1),this[i+y]=(n/m>>0)-C&255;return i+c},l.prototype.writeIntBE=function(n,i,c,h){if(n=+n,i=i>>>0,!h){const q=Math.pow(2,8*c-1);d(this,n,i,c,q-1,-q)}let y=c-1,m=1,C=0;for(this[i+y]=n&255;--y>=0&&(m*=256);)n<0&&C===0&&this[i+y+1]!==0&&(C=1),this[i+y]=(n/m>>0)-C&255;return i+c},l.prototype.writeInt8=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,1,127,-128),n<0&&(n=255+n+1),this[i]=n&255,i+1},l.prototype.writeInt16LE=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,2,32767,-32768),this[i]=n&255,this[i+1]=n>>>8,i+2},l.prototype.writeInt16BE=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,2,32767,-32768),this[i]=n>>>8,this[i+1]=n&255,i+2},l.prototype.writeInt32LE=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,4,2147483647,-2147483648),this[i]=n&255,this[i+1]=n>>>8,this[i+2]=n>>>16,this[i+3]=n>>>24,i+4},l.prototype.writeInt32BE=function(n,i,c){return n=+n,i=i>>>0,c||d(this,n,i,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[i]=n>>>24,this[i+1]=n>>>16,this[i+2]=n>>>8,this[i+3]=n&255,i+4},l.prototype.writeBigInt64LE=Re(function(n,i=0){return b(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Re(function(n,i=0){return S(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function I(a,n,i,c,h,y){if(i+c>a.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function R(a,n,i,c,h){return n=+n,i=i>>>0,h||I(a,n,i,4),r.write(a,n,i,c,23,4),i+4}l.prototype.writeFloatLE=function(n,i,c){return R(this,n,i,!0,c)},l.prototype.writeFloatBE=function(n,i,c){return R(this,n,i,!1,c)};function L(a,n,i,c,h){return n=+n,i=i>>>0,h||I(a,n,i,8),r.write(a,n,i,c,52,8),i+8}l.prototype.writeDoubleLE=function(n,i,c){return L(this,n,i,!0,c)},l.prototype.writeDoubleBE=function(n,i,c){return L(this,n,i,!1,c)},l.prototype.copy=function(n,i,c,h){if(!l.isBuffer(n))throw new TypeError("argument should be a Buffer");if(c||(c=0),!h&&h!==0&&(h=this.length),i>=n.length&&(i=n.length),i||(i=0),h>0&&h<c&&(h=c),h===c||n.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("sourceEnd out of bounds");h>this.length&&(h=this.length),n.length-i<h-c&&(h=n.length-i+c);const y=h-c;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(i,c,h):Uint8Array.prototype.set.call(n,this.subarray(c,h),i),y},l.prototype.fill=function(n,i,c,h){if(typeof n=="string"){if(typeof i=="string"?(h=i,i=0,c=this.length):typeof c=="string"&&(h=c,c=this.length),h!==void 0&&typeof h!="string")throw new TypeError("encoding must be a string");if(typeof h=="string"&&!l.isEncoding(h))throw new TypeError("Unknown encoding: "+h);if(n.length===1){const m=n.charCodeAt(0);(h==="utf8"&&m<128||h==="latin1")&&(n=m)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(i<0||this.length<i||this.length<c)throw new RangeError("Out of range index");if(c<=i)return this;i=i>>>0,c=c===void 0?this.length:c>>>0,n||(n=0);let y;if(typeof n=="number")for(y=i;y<c;++y)this[y]=n;else{const m=l.isBuffer(n)?n:l.from(n,h),C=m.length;if(C===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(y=0;y<c-i;++y)this[y+i]=m[y%C]}return this};const F={};function x(a,n,i){F[a]=class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:n.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${a}]`,this.stack,delete this.name}get code(){return a}set code(h){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:h,writable:!0})}toString(){return`${this.name} [${a}]: ${this.message}`}}}x("ERR_BUFFER_OUT_OF_BOUNDS",function(a){return a?`${a} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),x("ERR_INVALID_ARG_TYPE",function(a,n){return`The "${a}" argument must be of type number. Received type ${typeof n}`},TypeError),x("ERR_OUT_OF_RANGE",function(a,n,i){let c=`The value of "${a}" is out of range.`,h=i;return Number.isInteger(i)&&Math.abs(i)>2**32?h=U(String(i)):typeof i=="bigint"&&(h=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(h=U(h)),h+="n"),c+=` It must be ${n}. Received ${h}`,c},RangeError);function U(a){let n="",i=a.length;const c=a[0]==="-"?1:0;for(;i>=c+4;i-=3)n=`_${a.slice(i-3,i)}${n}`;return`${a.slice(0,i)}${n}`}function Y(a,n,i){he(n,"offset"),(a[n]===void 0||a[n+i]===void 0)&&ie(n,a.length-(i+1))}function ye(a,n,i,c,h,y){if(a>i||a<n){const m=typeof n=="bigint"?"n":"";let C;throw y>3?n===0||n===BigInt(0)?C=`>= 0${m} and < 2${m} ** ${(y+1)*8}${m}`:C=`>= -(2${m} ** ${(y+1)*8-1}${m}) and < 2 ** ${(y+1)*8-1}${m}`:C=`>= ${n}${m} and <= ${i}${m}`,new F.ERR_OUT_OF_RANGE("value",C,a)}Y(c,h,y)}function he(a,n){if(typeof a!="number")throw new F.ERR_INVALID_ARG_TYPE(n,"number",a)}function ie(a,n,i){throw Math.floor(a)!==a?(he(a,i),new F.ERR_OUT_OF_RANGE(i||"offset","an integer",a)):n<0?new F.ERR_BUFFER_OUT_OF_BOUNDS:new F.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${n}`,a)}const Ve=/[^+/0-9A-Za-z-_]/g;function ht(a){if(a=a.split("=")[0],a=a.trim().replace(Ve,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function ot(a,n){n=n||1/0;let i;const c=a.length;let h=null;const y=[];for(let m=0;m<c;++m){if(i=a.charCodeAt(m),i>55295&&i<57344){if(!h){if(i>56319){(n-=3)>-1&&y.push(239,191,189);continue}else if(m+1===c){(n-=3)>-1&&y.push(239,191,189);continue}h=i;continue}if(i<56320){(n-=3)>-1&&y.push(239,191,189),h=i;continue}i=(h-55296<<10|i-56320)+65536}else h&&(n-=3)>-1&&y.push(239,191,189);if(h=null,i<128){if((n-=1)<0)break;y.push(i)}else if(i<2048){if((n-=2)<0)break;y.push(i>>6|192,i&63|128)}else if(i<65536){if((n-=3)<0)break;y.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((n-=4)<0)break;y.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return y}function Pt(a){const n=[];for(let i=0;i<a.length;++i)n.push(a.charCodeAt(i)&255);return n}function v(a,n){let i,c,h;const y=[];for(let m=0;m<a.length&&!((n-=2)<0);++m)i=a.charCodeAt(m),c=i>>8,h=i%256,y.push(h),y.push(c);return y}function dt(a){return e.toByteArray(ht(a))}function st(a,n,i,c){let h;for(h=0;h<c&&!(h+i>=n.length||h>=a.length);++h)n[h+i]=a[h];return h}function ge(a,n){return a instanceof n||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===n.name}function Rt(a){return a!==a}const Ln=function(){const a="0123456789abcdef",n=new Array(256);for(let i=0;i<16;++i){const c=i*16;for(let h=0;h<16;++h)n[c+h]=a[i]+a[h]}return n}();function Re(a){return typeof BigInt>"u"?Un:a}function Un(){throw new Error("BigInt not supported")}})(Hr);var Jr={exports:{}},K=Jr.exports={},me,be;function Xt(){throw new Error("setTimeout has not been defined")}function Zt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?me=setTimeout:me=Xt}catch{me=Xt}try{typeof clearTimeout=="function"?be=clearTimeout:be=Zt}catch{be=Zt}})();function Yr(t){if(me===setTimeout)return setTimeout(t,0);if((me===Xt||!me)&&setTimeout)return me=setTimeout,setTimeout(t,0);try{return me(t,0)}catch{try{return me.call(null,t,0)}catch{return me.call(this,t,0)}}}function Yn(t){if(be===clearTimeout)return clearTimeout(t);if((be===Zt||!be)&&clearTimeout)return be=clearTimeout,clearTimeout(t);try{return be(t)}catch{try{return be.call(null,t)}catch{return be.call(this,t)}}}var _e=[],We=!1,Ue,pt=-1;function Xn(){!We||!Ue||(We=!1,Ue.length?_e=Ue.concat(_e):pt=-1,_e.length&&Xr())}function Xr(){if(!We){var t=Yr(Xn);We=!0;for(var e=_e.length;e;){for(Ue=_e,_e=[];++pt<e;)Ue&&Ue[pt].run();pt=-1,e=_e.length}Ue=null,We=!1,Yn(t)}}K.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];_e.push(new Zr(t,e)),_e.length===1&&!We&&Yr(Xr)};function Zr(t,e){this.fun=t,this.array=e}Zr.prototype.run=function(){this.fun.apply(null,this.array)};K.title="browser";K.browser=!0;K.env={};K.argv=[];K.version="";K.versions={};function Ce(){}K.on=Ce;K.addListener=Ce;K.once=Ce;K.off=Ce;K.removeListener=Ce;K.removeAllListeners=Ce;K.emit=Ce;K.prependListener=Ce;K.prependOnceListener=Ce;K.listeners=function(t){return[]};K.binding=function(t){throw new Error("process.binding is not supported")};K.cwd=function(){return"/"};K.chdir=function(t){throw new Error("process.chdir is not supported")};K.umask=function(){return 0};var Zn=Jr.exports;(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Hr,r=Zn,o=f=>f&&f.__esModule?f:{default:f},s=o(r),u=globalThis||void 0||self;Object.defineProperty(t,"Buffer",{enumerable:!0,get:()=>e.Buffer}),Object.defineProperty(t,"process",{enumerable:!0,get:()=>s.default}),t.global=u})(_);class ei{}window.slStore=Object.create(null);class Ot{store;name;constructor(e,r){this.store=e,this.name=r}getStore(){return this.store}}const ti=t=>{const e=Object.keys(t);return Ne.computed(e.map(r=>t[r].getStore()),(...r)=>Object.fromEntries(e.map((o,s)=>[o,r[s]])))};class ut extends Ot{getValues=()=>this.getStore().get();getValue=e=>this.getStore().get()[e];setValue=(e,r)=>this.getStore().setKey(e,r);subscribe=(...e)=>this.getStore().subscribe(...e);unsubscribe=()=>this.getStore().off()}const $e=t=>Ne.map(t);var Fe;(function(t){t.ORGANIZATION="ORGANIZATION",t.STREAM="STREAM"})(Fe||(Fe={}));const ri={[ae.SdkOverlayType.BETTING]:"betting",[ae.SdkOverlayType.GAMES]:"games",[ae.SdkOverlayType.PUBLIC_CHAT]:"publicChat",[ae.SdkOverlayType.TWITTER]:"twitter"};var De;(function(t){t.Ready="ready",t.Suspended="suspended"})(De||(De={}));class fr{status;source;config;settings;listeners=new Set;settingsKey;constructor({settings:e,...r},o){this.settingsKey=ri[r.type],this.status=Ne.atom(De.Suspended),this.config=new ut($e(r),`feature:config:${this.settingsKey}`),this.settingsKey!==void 0&&e?.overlaySettings.case===this.settingsKey?this.settings=new ut($e(e.overlaySettings.value),`feature:settings:${this.settingsKey}`):this.settings=new ut($e({}),`feature:settings:${this.settingsKey}`),this.source=o}get featureConfig(){return this.config.getStore()}get featureSettings(){return this.settings.getStore()}registerEventListener(e){this.listeners.add(e)}enable=()=>{this.status.set(De.Ready)};disable=()=>{this.status.set(De.Suspended)};setFeatureConfig=({settings:e,...r})=>{let o;for(o in r)this.config.setValue(o,r[o]);if(e?.overlaySettings.case===this.settingsKey){const s=e.overlaySettings.value;if(s!==void 0){let u;for(u in s)console.log(u,s[u]),s[u]!==0&&s[u]!==""&&this.settings.setValue(u,s[u])}}};update=(e,r)=>{this.source===Fe.STREAM&&r===Fe.ORGANIZATION||(this.setFeatureConfig(e),this.source=r)};fireEvent(e){for(const r of this.listeners.values())try{r.onEvent(e)}catch(o){console.error(o)}}}class ue extends Ot{getValue=()=>this.getStore().get();getValues(){throw new Error("not implemented")}setValue=e=>this.getStore().set(e);subscribe=e=>this.getStore().subscribe(e);unsubscribe=()=>this.getStore().off();listen(e){return this.getStore().listen(e)}get(){return this.getStore().get()}}const ee=t=>Ne.atom(t),ni=(t,e)=>Ne.computed(t,e);class de extends Ot{atomStore;constructor(e,r,o){super(e,`api:${r}`),this.atomStore=Ne.atom(),o&&e.subscribe(s=>{this.atomStore.set(o(s))})}getAtomStore=()=>this.atomStore;getValue=async()=>{const e=this.getStore();if(e.value===void 0)throw new Error("no store");return await e.value.promise,e.get().data};getValues=()=>{throw new Error("not implemented")};setValue=e=>this.getStore().set({loading:!1,data:e?.data});subscribe=e=>this.getStore().subscribe(e);unsubscribe=()=>{throw new Error("not implemented")};invalidate=()=>{this.store.invalidate()};listen=e=>this.getStore().listen(e);get(){throw new Error("not implemented")}key=()=>this.getStore().key;off=()=>this.getStore().off()}async function*ii(t,e){for await(const r of e){t.response.message=r,t.received_at=Date.now();const o={type:"__GRPC_DEVTOOLS_EXTENSION__",data:t};window.postMessage(o),yield r}}const oi=()=>t=>async e=>{const r={name:e.url,request:{},response:{}};r.request.header=Object.fromEntries(e.header.entries()),r.sent_at=Date.now();try{const o=await t(e);if(r.received_at=Date.now(),r.stream=o.stream,r.response.header=Object.fromEntries(o.header.entries()),r.response.trailer=Object.fromEntries(o.trailer.entries()),o.stream)return{...o,message:ii(r,o.message)};{r.request.message=e.message,r.response.message=o.message,r.latency=r.received_at-r.sent_at;const s={type:"__GRPC_DEVTOOLS_EXTENSION__",data:r};window.postMessage(s)}return o}catch(o){r.received_at=Date.now(),r.request.message=e.message,r.response.trailer={"grpc-status":o.code,"grpc-message":o.rawMessage},r.response.message=o.rawMessage,r.latency=r.received_at-r.sent_at;const s={type:"__GRPC_DEVTOOLS_EXTENSION__",data:r};throw window.postMessage(s),o}};window.dispatchEvent(new CustomEvent("grpc_devtools_loaded"));var Ee;(function(t){t.Init="init",t.Ready="ready",t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected",t.Failed="failed",t.Reconnecting="reconnecting"})(Ee||(Ee={}));class si{params;stream;method;name;headers;listeners;state;store;constructor(e,r,o,s){const u={status:Ee.Init,ts:new Date,log:[]};this.state=new ut($e(u),`subscription:${s.name}:state`),this.name=s.name,this.headers=e,this.listeners=new Map,this.params=o,this.method=r,s.withStore&&(this.store=new ue(ee(null),`subscription:${s.name}:store`)),"subscribe"in o&&typeof o.subscribe=="function"&&o.subscribe(()=>{this.reconnect()}),this.updateState(Ee.Ready)}updateState=e=>{this.state.setValue("status",e),this.state.setValue("ts",new Date),this.addStateLog(`status => ${e}`)};addStateLog=e=>{const r=this.state.getStore().get().log;this.state.setValue("log",[...r,`${new Date().toLocaleString()}: ${e}`])};addListener=(e,r)=>this.listeners.has(e)?(this.addStateLog(`listener '${e}' not added`),!1):(this.listeners.set(e,r),this.addStateLog(`listener '${e}' added`),!0);removeListener=e=>{this.listeners.delete(e),this.addStateLog(`listener '${e}' removed`)};connect=()=>{this.updateState(Ee.Connecting),this.stream&&(this.addStateLog("disconnect prev connection"),this.stream());const e="get"in this.params&&typeof this.params.get=="function"?this.params.get():this.params;this.stream=this.method(e,this.onData,this.onStreamError,{headers:this.headers.getValues()}),this.updateState(Ee.Connected)};disconnect=()=>{this.stream&&this.stream(),this.listeners.clear(),this.updateState(Ee.Disconnected)};reconnect=()=>{this.updateState(Ee.Reconnecting),this.connect()};getStore=()=>this.store?.getStore();onData=e=>{this.addStateLog(`received data => ${JSON.stringify(e)}`),this.store&&this.store.setValue(e);for(const[,r]of this.listeners)r(e);this.addStateLog(`data routed to ${this.listeners.size} listeners`)};onStreamError=e=>{e!==void 0&&(e.code!==Yt.Code.Canceled&&e.rawMessage!=="[canceled] BodyStreamBuffer was aborted"?(this.updateState(Ee.Failed),this.state.setValue("error",e)):this.disconnect())}}class ai{toJsonOptions={emitDefaultValues:!1,enumAsInteger:!0,useProtoFieldName:!1};transport;nanoquery;host;interceptors=[];$headers;clients;callbackClients;subscriptions;constructor(e){this.host=e,this.$headers=new ut($e({"sl-device-id":_.process?.env?.NX_DEVICE_ID||"sdk-web-dev"}),"transport:headers"),this.initInterceptors(),this.clients=new Map,this.callbackClients=new Map,this.subscriptions=new Map;const[r,o,s]=Dn.nanoquery();this.nanoquery={createFetcherStore:r,createMutatorStore:o,utils:s},this.transport=$n.createGrpcWebTransport({baseUrl:e,interceptors:this.interceptors,useBinaryFormat:!0})}addSubscription=(e,r,o)=>{const s=this.subscriptions.get(r);if(s)return s;const u=new si(this.$headers,e,r,o);return this.subscriptions.set(r,u),u};removeSubscription=e=>{e.disconnect(),this.subscriptions.delete(e.params)};disconnect=()=>{for(const[e,r]of this.subscriptions)r.disconnect(),this.subscriptions.delete(e)};registerInterceptor=e=>{this.interceptors.push(e)};removeInterceptor=e=>{this.interceptors=this.interceptors.filter(r=>r!==e)};getClient=e=>{const r=e.typeName;if(this.clients.has(r))return this.clients.get(r);const o=Yt.createPromiseClient(e,this.transport);return this.clients.set(r,o),o};getCallbackClient=e=>{const r=e.typeName;if(this.callbackClients.has(r))return this.callbackClients.get(r);const o=Yt.createCallbackClient(e,this.transport);return this.callbackClients.set(r,o),o};createPromiseClient=(e,{params:r=[],method:o})=>{const s=this.getClient(e),u=e.methods[o].name,f=[e.typeName,u.charAt(0).toLowerCase()+u.slice(1),...Array.isArray(r)?r:[r]],l=[e.typeName,u.charAt(0).toLowerCase()+u.slice(1)];return{client:s,queryKey:f,queryKeyStr:l.join("")}};createCallbackClient=e=>({client:this.getCallbackClient(e)});setSdkKey=e=>{this.$headers.setValue("sdk",e)};setAuth=(e,r)=>{this.$headers.setValue("authorization",e),this.$headers.setValue("sl-user-id",r)};setHeader=(e,r)=>this.$headers.setValue(e,r);getHeader=e=>this.$headers.getValue(e);getHeaders=()=>this.$headers.getValues();initInterceptors=()=>{if(this.interceptors.length!==0)return;const e=r=>o=>{const s=this.$headers.getValues();for(const u in s)o.header.set(u,s[u]);return r(o)};this.interceptors.push(e),this.interceptors.push(oi())}}const ui=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(jn.Events,{method:"retrieveEventId",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>{if(!f||typeof f!="string")return"";try{return(await r.retrieveEventId({id:f})).data?.id||""}catch{return""}}})},ci=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(_t.Client,{method:"getStream",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.getStream({id:f})).data?.attributes:void 0})},li=(t,e)=>{const{queryKey:r,client:o}=e.createPromiseClient(Gr.Users,{method:"me",params:[t]});return e.nanoquery.createFetcherStore(r,{fetcher:()=>o.me({})})},fi=t=>{const{client:e}=t.createPromiseClient(Gr.Users,{method:"bypassAuth"});return({userKey:r,schema:o,init:s})=>e.bypassAuth({userKey:r,schema:o,init:s})},hi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(_t.Client,{method:"get",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>(await r.get({})).data?.attributes})},di=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(_t.Client,{method:"getOrganization",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>{const s=await r.getOrganization({});return s.data?{...s.data.attributes,id:s.data.id}:void 0}})},pi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(_t.Client,{method:"getOrganizationAdvertising",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>(await r.getOrganizationAdvertising({})).data?.attributes})},yi=(t,e,r)=>{t.transport=new ai(e.host),t.sdk.host=t.transport.host,t.transport.setSdkKey(e.sdkKey),r()};class hr{delimiter=":";prefix;constructor(e="main"){this.prefix=`sl-sdk${this.delimiter}${e}`}clear=()=>{for(const e in window.localStorage)e.startsWith(this.prefix)&&window.localStorage.removeItem(e)};generateKey=e=>`${this.prefix}${this.delimiter}${e.join(this.delimiter)}`;write=(...e)=>{const r=e.pop()||"";window.localStorage.setItem(this.generateKey(e),r)};read=(...e)=>{const r=window.localStorage.getItem(this.generateKey(e));return r===null?void 0:r};remove=(...e)=>{window.localStorage.removeItem(this.generateKey(e))}}var Ie;(function(t){t.SCHEMA="schema",t.EXTERNAL_TOKEN="eToken",t.TOKEN="token"})(Ie||(Ie={}));class Ke extends hr{constructor(){super("user")}setSchema=e=>{this.write(Ie.SCHEMA,e)};getSchema=()=>this.read(Ie.SCHEMA);setToken=e=>{this.write(Ie.TOKEN,e)};getToken=()=>this.read(Ie.TOKEN);setExternalToken=e=>{this.write(Ie.EXTERNAL_TOKEN,e)};getExternalToken=()=>this.read(Ie.EXTERNAL_TOKEN);removeToken=()=>{this.remove(Ie.TOKEN)}}var Te;(function(t){t.DISABLED="disabled",t.INITIALIZATION="initialization",t.READY="ready",t.FAILED="failed",t.SUSPENDED="suspended"})(Te||(Te={}));const gi=t=>{const e=new Ke,r=new ue(ee(e.getExternalToken()),"userKey"),o=new ue(ee(e.getToken()),"userToken"),s=new de(li(o.getStore(),t),"user",f=>f?.data?.data?.id),u=new de(hi(o.getStore(),t),"userSettings");return{userKey:r,userToken:o,user:s,userSettings:u}},mi=t=>{const e=new ue(ee(void 0),"providerStreamId"),r=new de(ui(e.getStore(),t),"slStreamId",s=>s?.data),o=new de(ci(r.getAtomStore(),t),"streamSettings");return r.getAtomStore().listen(s=>{(s===""||s===void 0)&&o.getStore().mutate(void 0)}),{providerStreamId:e,slStreamId:r,streamSettings:o}},bi=t=>{const e=new ue(ee(void 0),"enabled"),r=new ue(ee(Te.DISABLED),"status"),o=new de(di(e.getStore(),t),"organizationSettings",l=>l?.data?.id),s=new de(pi(o.getAtomStore(),t),"organizationAdvertising"),u=gi(t),f=mi(t);return{enabled:e,status:r,providerStreamId:f.providerStreamId,slStreamId:f.slStreamId,streamSettings:f.streamSettings,user:u.user,userKey:u.userKey,userToken:u.userToken,userSettings:u.userSettings,organizationSettings:o,organizationAdvertising:s}};class wi extends Ot{stores;constructor(e){const r=bi(e),o=ti(r);super(o,"core"),this.stores=r}getValue(){throw new Error("Not implemented")}getValues(){return this.stores}setValue(){throw new Error("Not implemented")}subscribe=e=>{let r;for(r in this.stores){const o=e[r];r in e&&o!==void 0&&this.stores[r].subscribe(e[r])}};unsubscribe=()=>this.getStore().off()}class vi extends ei{$coreStore;transport;bypassLogin;constructor(e,r){super(),this.$coreStore=e,this.transport=r,this.bypassLogin=fi(this.transport),this.connect()}me=async()=>(this.$coreStore.getValues().user.invalidate(),(await this.$coreStore.getValues().user.getValue())?.data);login=async(e,r)=>{this.$coreStore.getValues().userKey.setValue(r);const o=await this.bypassLogin({schema:e,userKey:r,init:!1}),s=o.meta?.jwt,u=o.data?.id;if(!s||!u)throw new Error("internal: token missing");return this.$coreStore.getValues().user.getStore().mutate(o),this.saveUser(s,u),s};isAuthenticated=()=>this.me();logout=()=>{this.$coreStore.getValues().user.setValue(),this.$coreStore.getValues().userKey.setValue(),this.$coreStore.getValues().userToken.setValue(),this.transport.setAuth("",""),new Ke().clear()};softLogout=()=>{const e=new Ke;this.$coreStore.getValues().user.setValue(),this.$coreStore.getValues().userToken.setValue(),this.transport.setAuth("",""),e.setToken(""),this.reLogin()};reLogin=()=>{const e=new Ke,r=e.getToken(),o=e.getExternalToken();if(this.$coreStore.getValues().userKey.setValue(o),this.$coreStore.getValues().userToken.setValue(r),r)return this.saveUser(r,""),this.me().then(s=>{if(console.log("user",s),s?.id){const u=s.id;this.saveUser(r,u)}});if(o&&!r){const s=e.getSchema();s&&o&&this.login(s,o).catch(()=>{this.logout()})}};saveUser=(e,r)=>{this.transport.setAuth(e,r),this.$coreStore.getValues().userToken.setValue(e),new Ke().setToken(e)};connect=()=>{this.transport.registerInterceptor(e=>async r=>{try{return await e(r)}catch(o){throw o.code&&(o.code===7||o.code===16)&&this.transport.getHeader("authorization")&&this.softLogout(),o}})}}const at=new Ke,Si=(t,e,r)=>{t.auth=new vi(t.store,t.transport),t.stores.status.listen(o=>{o===Te.READY&&t.auth.reLogin()}),t.sdk.authorizationBypass=async(o,s)=>{at.getSchema()===o&&at.getExternalToken()===s&&t.transport.getHeader("authorization")||(await t.auth.login(o,s),at.setSchema(o),at.setExternalToken(s))},t.sdk.logout=()=>{t.auth.logout(),at.clear()},t.sdk.getUserStore=()=>t.stores.user.getStore(),t.sdk.isUserAuthorized=()=>t.auth.isAuthenticated(),r()},Ai=(t,e,r)=>{t.store=new wi(t.transport),t.stores=t.store.getValues(),t.sdk.enabled=t.stores.enabled.getStore(),t.sdk.status=t.stores.status.getStore(),t.sdk.sdkStore=t.store.getStore(),t.sdk.organizationStore=()=>t.stores.organizationSettings.getStore(),t.storeUnsubscribe=()=>{t.store.unsubscribe()},r()},Ei=(t,e,r)=>{t.sdk=Object.create(null),t.sdk.initializeApp=async()=>{if(t.stores.enabled.get()==="on")return{enabled:!0};t.storeSubscribe(),t.stores.enabled.setValue("on"),t.stores.status.setValue(Te.INITIALIZATION);try{const o=await t.stores.organizationSettings.getValue();return o?(t.stores.status.setValue(Te.READY),{enabled:!!o}):(t.stores.status.setValue(Te.FAILED),{err:"failed"})}catch(o){return t.stores.enabled.setValue(),t.stores.status.setValue(Te.FAILED),{err:`${o}`}}},t.sdk.disableApp=()=>{t.stores.enabled.get()==="on"&&(t.stores.enabled.setValue(),t.stores.status.setValue(Te.DISABLED),t.storeUnsubscribe())},t.sdk.createEventSession=o=>{t.stores.providerStreamId.setValue(o)},r()},Ii=Mn.pino({level:"trace"}),en=(t,e)=>Ii.child({name:t},e),Fi=(t,e,r)=>{const{client:o,queryKey:s}=r.createPromiseClient(zr.Leaderboard,{method:"summary",params:[t,e]});return r.nanoquery.createFetcherStore(s,{fetcher:async(u,f,l,p)=>(await o.summary({eventId:l,userId:p})).data?.attributes})},Ti=t=>{const{client:e}=t.createPromiseClient(zr.Leaderboard,{method:"list"});return r=>e.list(r)},_i=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Se.Feed,{method:"get",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>(await r.get({eventId:f})).data?.attributes})},Ci=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Se.Feed,{method:"syncQuestion",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.syncQuestion({filter:{eventId:f}})).data?.attributes:void 0})},Oi=(t,e)=>{const{client:r}=e.createCallbackClient(Se.Feed),o=Ne.atom({eventId:t.get()||"",feedId:""});return t.subscribe((u="")=>{o.set({eventId:u,feedId:""})}),e.addSubscription(r.subscription,o,{name:"feedSubscription"})},xi=(t,e)=>{const{client:r}=e.createCallbackClient(Se.Feed);return e.addSubscription(r.questionSubscription,{questionId:t},{name:"questionSubscription"})},tn=async(t,e)=>{const{client:r}=e.createPromiseClient(Se.Feed,{method:"questionByUser",params:[t]});return(await r.questionByUser({questionId:t})).data?.attributes?.question},Bi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Se.Feed,{method:"list",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.list({eventId:f})).data:[]})},ki=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Se.Feed,{method:"insightHistory",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.insightHistory({eventId:f})).data?.map(({attributes:p})=>p):void 0})},Pi=(t,e,r)=>{const o=Ne.computed([e,r],(f,l)=>{if(f&&l.data)return l.data.find(p=>p.id===f)}),s=$e({data:void 0,loading:void 0,error:void 0});return o.subscribe(async f=>{if(f&&f.type==="question"){s.setKey("loading",!0);const l=await tn(f.id,t);s.set({data:l,loading:!1});return}s.set({data:void 0,loading:!1})}),{$store:o,$extendedStore:s,updateExtendedQuestion:f=>{s.set({data:f})}}},rn=t=>(t.gamification||(t.gamification=new Ri(t)),t.gamification);class Ri{slStreamId;organizationId;userId;openedQuestionId;openedQuestion;activeQuestionId;feedList;moderationId;moderation;feedSubscription;questionSubscription;notifications;log;constructor(e){if(e.gamification)throw new Error("GamificationBackground Singleton error");this.log=en("gamification-background"),this.slStreamId=e.stores.slStreamId.getAtomStore(),this.organizationId=e.stores.organizationSettings.getAtomStore(),this.userId=e.stores.user.getAtomStore(),this.moderationId=new ue(ee(void 0),"moderationId").getStore(),this.openedQuestionId=new ue(ee(void 0),"openedQuestionId").getStore(),this.notifications=e.notifications,this.moderation=new de(_i(this.slStreamId,e.transport),"gamification:moderation"),this.feedList=new de(Bi(this.slStreamId,e.transport),"gamification:feedList"),this.activeQuestionId=new de(Ci(this.slStreamId,e.transport),"gamification:activeQuestionId"),this.openedQuestion=Pi(e.transport,this.openedQuestionId,this.feedList.getStore()),this.openedQuestionId.listen(r=>{this.log.debug({questionId:r},"received question"),r?(this.questionSubscription=xi(r,e.transport),this.questionSubscription.addListener("feed-subscription-opened-question",o=>{window.requestAnimationFrame(()=>{this.openedQuestion.updateExtendedQuestion(o.data?.attributes?.question)})}),this.questionSubscription.connect()):(this.log.info("cleanup on close question"),this.questionSubscription!==void 0&&(e.transport.removeSubscription(this.questionSubscription),this.questionSubscription=void 0))}),this.feedSubscription=Oi(this.slStreamId,e.transport),this.feedSubscription.addListener("feed-subscription-active-question",r=>{window.requestAnimationFrame(()=>{const o=this.activeQuestionId.getStore();o&&o.mutate(r.data?.attributes)})})}getCurrentSessionId=e=>{const r=e.eventId||this.slStreamId.get()||"",o=e.userId||this.userId.get()||"",s=e.organizationId||this.organizationId.get()||"",u=e.entity||"",f=e.prefix||"";return[s,r,o,f,u].join(":")};disconnect=()=>{this.feedSubscription?.disconnect()};openQuestion=e=>{this.openedQuestionId.set(e),this.notifications.markAsViewed(this.getCurrentSessionId({prefix:"notification",entity:e}))};closeQuestion=e=>{this.openedQuestionId.set(void 0),e&&this.notifications.markAsViewed(this.getCurrentSessionId({prefix:"notification",entity:e}))}}class Ni{notificationsList;notifications;store;timeouts;waitingQueue;activeQueue;options;logger;constructor(e){this.options=e,this.logger=en("notifications"),this.store=new Map,this.timeouts=new Map,this.waitingQueue=new Set,this.activeQueue=new Set,this.notifications=new ue(ee(new Map),"notifications-queue"),this.notificationsList=ni(this.notifications.getStore(),r=>r?[...r.values()]:[])}addToQueue=e=>{if(this.store.has(e.id)){this.logger.debug({notification:e},"skip existed notification: %o");return}const r=e.close,o=e.action;this.store.set(e.id,{...e,close:(...s)=>{r&&r(...s),this.closeNotification(e.id)},action:(...s)=>{o&&o(...s),this.closeNotification(e.id)}}),this.waitingQueue.add(e.id),this.logger.debug({notification:e},"notification added to waiting queue"),this.tickWaitingQueue()};tickWaitingQueue=()=>{if(this.activeQueue.size<this.options.concurrency){const[e]=this.waitingQueue;if(!e)return;this.activeQueue.add(e),this.waitingQueue.delete(e),this.logger.debug({job:e},"waiting queue tick"),this.tickActiveQueue(e)}else this.logger.debug({queueSize:this.activeQueue.size,concurrency:this.options.concurrency},"waiting queue tick skipped")};tickActiveQueue=e=>{if(!e)return;const r=this.store.get(e);if(!r){this.logger.debug({notificationId:e},"active queue tick skipped, notification not exist");return}const o=setTimeout(()=>{const s=e,u=new Map(this.notifications.getValue());u.set(r.id,r),this.notifications.setValue(u);const f=setTimeout(()=>{this.logger.debug({notificationId:s},"notification hiding by autoHideDuration"),this.closeNotification(s)},r.autoHideDuration||5e3);this.timeouts.set(s,f),this.logger.debug({notificationId:s,queue:[...u.values()]},"notification displayed")},r.delay||0);this.timeouts.set(e,o),this.logger.debug({notificationId:e},"active queue tick completed"),this.tickWaitingQueue()};closeNotification=e=>{const r=new Map(this.notifications.getValue()),o=r.get(e);if(o){o.hiding=!0,this.notifications.setValue(r);const s=setTimeout(()=>{const u=new Map(this.notifications.getValue());u.delete(e),this.notifications.setValue(u);const f=this.timeouts.get(e);f!==void 0&&(clearTimeout(f),this.timeouts.delete(e)),this.logger.debug({notificationId:e},"notification hidden")},this.options.animationDelay||0);this.timeouts.set(e,s)}this.store.delete(e),this.activeQueue.delete(e),this.waitingQueue.delete(e),this.tickWaitingQueue(),this.logger.debug({notificationId:e},"notification hiding")}}var vt;(function(t){t.OPENED="opened"})(vt||(vt={}));class Li extends hr{constructor(){super("notification")}setOpened=e=>{this.write(vt.OPENED,e,"true")};isOpened=e=>this.read(vt.OPENED,e);clearNotification=()=>{this.clear()}}var Je;(function(t){t[t.ONBOARDING=1]="ONBOARDING",t[t.QUESTION=2]="QUESTION"})(Je||(Je={}));class Ui{queue;storage;constructor(e={}){this.storage=new Li,this.queue=new Ni({concurrency:1,animationDelay:300,...e})}add=e=>{this.storage.isOpened(e.id)||this.queue.addToQueue(e)};close=e=>{this.queue.closeNotification(e),this.markAsViewed(e)};getQueueStore=()=>this.queue.notificationsList;markAsViewed=e=>{this.storage.setOpened(e)}}const $i=(t,e,r)=>{t.notifications=new Ui,t.addNotification=t.notifications.add,t.sdk.getNotificationsStore=()=>t.notifications.getQueueStore(),r()},Di=(t,e)=>{const{client:r}=t.createPromiseClient(Se.Feed,{method:"submitAnswer"});return r.submitAnswer({data:e})},ji=(t,e)=>{const{client:r}=t.createPromiseClient(Se.Feed,{method:"submitInplay"});return r.submitInplay({data:{eventId:+e}})},Mi=(t,e)=>{const{client:r}=t.createPromiseClient(Se.Feed,{method:"skipQuestion"});return r.skipQuestion({data:{id:e}})};var St;(function(t){t.ONBOARDING="onboarding"})(St||(St={}));class Vi extends hr{constructor(){super("gamification")}saveOnboardingStatus=({userId:e,eventId:r,organizationId:o},s)=>{this.write(St.ONBOARDING,o,e,r,s)};getOnboardingStatus=({userId:e,eventId:r,organizationId:o})=>this.read(St.ONBOARDING,o,e,r)}const Er={pageSize:10},qi=(t,e,r)=>{const o=ee({pageSize:r?.pageSize||Er.pageSize,page:0}),s=$e({data:[],loading:void 0,error:void 0}),u=Ti(t),f=async A=>{if(A){s.setKey("loading",!0);const g={eventId:A,pagination:{page:0,pageSize:r?.pageSize||Er.pageSize}},w=await u(g);s.set({data:w.data.map(E=>E.attributes),loading:!1}),o.set(g.pagination)}};e.listen(f);const l=()=>{f(e.get())};return o.listen(async A=>{const g=e.get(),w=s.get().data?.length||0;if(A.page>0&&g&&w>=A.page*A.pageSize){s.setKey("loading",!0);const T=await u({eventId:g,pagination:A}),P=s.get().data||[];s.set({data:[...P,...T.data.map(N=>N.attributes)],loading:!1})}}),{$store:s,fetchMore:()=>{const A=o.get();o.set({...A,page:A.page+1})},invalidate:l}},Qi=new Set([ve.QuestionType.POLL,ve.QuestionType.PREDICTION,ve.QuestionType.TRIVIA]);var Z;(function(t){t.Unset="unset",t.Required="required",t.Optional="optional",t.Completed="completed",t.Disabled="disabled",t.Unavailable="unavailable"})(Z||(Z={}));class Gi extends fr{userSummary;feedList;leaderboardId;leaderboardList;onboardingStatus;openedQuestion;openedUser;notifications;transport;closeFeature;openFeature;background;storage;constructor(e,r,o){super(e,r),this.background=rn(o),this.storage=new Vi,this.userSummary=new de(Fi(this.background.slStreamId,this.background.userId,o.transport),"gamification:userSummary"),this.feedList=this.background.feedList,this.openedUser=ee(void 0),this.leaderboardId=new ue(ee(this.settings.getValue("pinnedLeaderboardId")),"pinnedLeaderboardId").getStore(),this.onboardingStatus=new ue(ee(Z.Unset),"onboardingStatus").getStore(),this.notifications=o.notifications,this.transport=o.transport,this.closeFeature=o.sdk.closeFeature,this.openFeature=()=>o.sdk.openFeature(ae.SdkOverlayType.GAMES),this.openedQuestion=this.background.openedQuestion,this.leaderboardList=qi(this.transport,this.background.slStreamId),this.onboardingStatus.subscribe(s=>{(s===Z.Optional||Z.Required)&&this.showOnboardingInApp()}),this.status.subscribe(s=>{s===De.Ready?(this.notifications.close(this.background.getCurrentSessionId({prefix:"onboarding"})),this.connect(o.transport)):this.disconnect()}),this.onboardingStatus.subscribe(s=>{s&&this.background.activeQuestionId.invalidate()}),this.background.activeQuestionId.listen(s=>{s&&s.data&&this.onboardingStatus.get()&&s.data.question?.id!==void 0&&s.data.question.notification!==void 0&&s.data.moderation?.bypassNotifications?.inAppSilence!==ve.SilenceSetting.ON&&Qi.has(s.data.question.type)&&s.data.question.status===ve.QuestionStatus.ACTIVE&&this.notifications.add({type:Je.QUESTION,action:()=>s.data?.question&&this.openQuestion(s.data.question.id),close:()=>s.data?.question&&this.closeQuestion(s.data.question.id),autoHideDuration:+(s.data.moderation?.question?.appearance?.autoHideInterval||"1000"),id:this.background.getCurrentSessionId({prefix:"notification",entity:s.data.question.id}),data:{title:s.data.question.notification.title,color:s.data.question.notification.indicatorColor,icon:s.data.question.notification.image,imageMode:s.data.question.notification.imageMode,imagePosition:s.data.question.notification.imagePosition}})}),this.onboardingProcess(),this.background.userId.subscribe(s=>{s&&this.onboardingProcess()}),this.background.moderation.subscribe(s=>{s.data&&this.onboardingProcess()})}onboardingProcess=async()=>{const e=this.background.userId.get();if(!e)return;this.storage.getOnboardingStatus({userId:e,organizationId:this.background.organizationId.get()||"",eventId:this.background.slStreamId.get()||""})===Z.Completed&&this.onboardingStatus.set(Z.Completed);const o=await this.background.moderation.getValue();if(this.onboardingStatus.get()===Z.Completed)return;const s=!!(o?.options?.onboardingEnabled&&this.featureSettings.get().inplayGame?.onboarding?.completed),u=!!this.featureSettings.get().inplayGame?.titleCard?.optIn;s?u?this.onboardingStatus.set(Z.Required):this.onboardingStatus.set(Z.Optional):u?this.onboardingStatus.set(Z.Unavailable):this.onboardingStatus.set(Z.Disabled)};showOnboardingInApp=()=>{const{inplayGame:e}=this.featureSettings.get();if(!e)return;const{titleCard:r,overview:o}=e;this.notifications.add({type:Je.ONBOARDING,id:this.background.getCurrentSessionId({prefix:"onboarding"}),action:this.openFeature,close:this.closeFeature,autoHideDuration:1e5,data:{header:r?.header,title:r?.title,subtitle:r?.subtitle,graphicBg:r?.appearance?.graphic,icon:r?.media?.icon,sponsorLogo:r?.media?.sponsorLogo,primaryColor:o?.appearance?.primaryColor}})};connect=e=>{this.userSummary.invalidate(),this.leaderboardList.invalidate(),this.feedList.invalidate(),this.background.feedSubscription.addListener("feed-subscription-prediction-close",r=>{window.requestAnimationFrame(async()=>{const o=r.data?.attributes?.question;if(!o)return;const{status:s,type:u,id:f}=o;if(s===ve.QuestionStatus.RESOLVED&&u===ve.QuestionType.PREDICTION){const l=this.background.getCurrentSessionId({prefix:`notification-id:${f}`}),A=(await tn(f,e))?.answers.find(({correct:g})=>g);this.notifications.add({type:Je.ONBOARDING,action:()=>this.openQuestion(f),close:()=>this.closeQuestion(f),autoHideDuration:5e3,id:l,data:{title:A?.youVoted?`Congratulations! You answered correctly! You won ${A.points} pts!`:`Better luck next time! Correct: ${A?.text}!`}})}})}),this.background.feedSubscription.addListener("feed-subscription-questions-list",()=>{window.requestAnimationFrame(()=>{this.feedList?.invalidate()})})};disconnect=()=>{this.background.feedSubscription.removeListener("feed-subscription-questions-list")};submitInplay=async()=>{const e=this.background.slStreamId.get();e&&(await ji(this.transport,e),this.onboardingStatus.set(Z.Completed),this.storage.saveOnboardingStatus({organizationId:this.background.organizationId.get()||"",userId:this.background.userId.get()||"",eventId:e},Z.Completed))};submitAnswer=async(e,r)=>{await Di(this.transport,{questionId:e,answerId:r}),this.feedList?.invalidate()};skipQuestion=async e=>{await Mi(this.transport,e),this.feedList?.invalidate()};openQuestion=e=>(this.openFeature(),this.background.openQuestion(e));closeQuestion=e=>this.background.closeQuestion(e);openUser=e=>{const r=this.leaderboardList.$store.get().data?.find(o=>o.userId===e);this.openedUser.set(r)};closeUser=()=>{this.openedUser.set(void 0)}}class zi extends fr{insights;closeFeature;openFeature;openedInsight;notifications;transport;background;constructor(e,r,o){super(e,r),this.background=rn(o),this.notifications=o.notifications,this.transport=o.transport,this.closeFeature=o.sdk.closeFeature,this.openFeature=()=>o.sdk.openFeature(ae.SdkOverlayType.HIGHLIGHTS),this.status.subscribe(s=>{s===De.Ready?this.connect():this.disconnect()}),this.background.activeQuestionId.listen(s=>{s?.data?.question?.id&&s?.data?.question?.notification&&s.data.moderation?.bypassNotifications?.inAppSilence!==ve.SilenceSetting.ON&&s.data.question.type===ve.QuestionType.FACTOID&&s.data.question.status===ve.QuestionStatus.ACTIVE&&this.notifications.add({type:Je.QUESTION,action:()=>s.data?.question&&this.openHighlight(s.data.question.id),close:()=>s.data?.question&&this.closeHighlight(s.data.question.id),autoHideDuration:+(s.data.moderation?.question?.appearance?.autoHideInterval||"1000"),id:this.background.getCurrentSessionId({prefix:"notification",entity:s.data.question.id}),data:{title:s.data.question.notification.title,color:s.data.question.notification.indicatorColor,icon:s.data.question.notification.image,imageMode:s.data.question.notification.imageMode,imagePosition:s.data.question.notification.imagePosition}})}),this.openedInsight=this.background.openedQuestion}connect=()=>{this.insights?this.insights.invalidate():this.insights=new de(ki(this.background.slStreamId,this.transport),"gamification:insights"),this.background.feedSubscription.addListener("feed-subscription-insights-list",()=>{window.requestAnimationFrame(()=>{this.insights?.invalidate()})})};disconnect=()=>{this.background.feedSubscription.removeListener("feed-subscription-insights-list")};openHighlight=e=>(this.openFeature(),this.background.openQuestion(e));closeHighlight=e=>this.background.closeQuestion(e)}ae.SdkOverlayType.GAMES+"",ae.SdkOverlayType.HIGHLIGHTS+"";class Ki extends fr{constructor(e,r){super(e,r)}}const Hi=(t,e,r)=>t.type===ae.SdkOverlayType.GAMES?new Gi(t,e,r):t.type===ae.SdkOverlayType.HIGHLIGHTS?new zi(t,e,r):new Ki(t,e),Wi=(t,e,r)=>{t.features=new Map,t.activeFeature=new ue(ee(ae.SdkOverlayType.UNSET),"activeFeature"),t.sdk.getFeatures=()=>t.features,t.sdk.getFeature=o=>t.features.get(o),t.sdk.getActiveFeature=()=>t.activeFeature.getStore(),t.sdk.openFeature=o=>{t.activeFeature.setValue(o)},t.sdk.closeFeature=()=>{t.activeFeature.setValue(ae.SdkOverlayType.UNSET)},t.initFeature=(o,s=Fe.ORGANIZATION)=>{const u=Hi(o,s,t);t.features.set(o.type,u)},t.updateFeature=(o,s)=>{t.features.get(o.type)?.update(o,s)},t.destroyFeature=o=>{t.features.delete(o.type)},t.reinitializeFeatures=async()=>{const o=await t.stores.organizationSettings.getValue();t.features.clear();for(const s of o?.overlays||[])t.initFeature(s,Fe.ORGANIZATION)},t.stores.providerStreamId.listen(o=>{o||t.reinitializeFeatures()}),t.storeSubscribe=()=>{const o=(u,f)=>{if(f?.overlays){u===Fe.STREAM&&t.features.clear();for(const l of f.overlays)l.sdkEnable===!0&&(t.features.has(l.type)?t.updateFeature(l,u):t.initFeature(l,u))}},s={organizationSettings:u=>{if(u.data)try{o(Fe.ORGANIZATION,u.data)}catch(f){console.log(f)}},streamSettings:u=>{if(u.data)try{o(Fe.STREAM,u.data)}catch(f){console.log(f)}}};t.store.subscribe(s)},r()};var dr={exports:{}},pr={exports:{}};function Ji(t){var e=new t,r=e;function o(){var u=e;return u.next?e=u.next:(e=new t,r=e),u.next=null,u}function s(u){r.next=u,r=u}return{get:o,release:s}}var Yi=Ji,Xi=Yi;function nn(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),r<1)throw new Error("fastqueue concurrency must be greater than 1");var o=Xi(Zi),s=null,u=null,f=0,l=null,p={push:N,drain:se,saturated:se,pause:g,paused:!1,concurrency:r,running:A,resume:T,idle:P,length:w,getQueue:E,unshift:G,empty:se,kill:X,killAndDrain:pe,error:te};return p;function A(){return f}function g(){p.paused=!0}function w(){for(var B=s,j=0;B;)B=B.next,j++;return j}function E(){for(var B=s,j=[];B;)j.push(B.value),B=B.next;return j}function T(){if(p.paused){p.paused=!1;for(var B=0;B<p.concurrency;B++)f++,z()}}function P(){return f===0&&p.length()===0}function N(B,j){var O=o.get();O.context=t,O.release=z,O.value=B,O.callback=j||se,O.errorHandler=l,f===p.concurrency||p.paused?u?(u.next=O,u=O):(s=O,u=O,p.saturated()):(f++,e.call(t,O.value,O.worked))}function G(B,j){var O=o.get();O.context=t,O.release=z,O.value=B,O.callback=j||se,f===p.concurrency||p.paused?s?(O.next=s,s=O):(s=O,u=O,p.saturated()):(f++,e.call(t,O.value,O.worked))}function z(B){B&&o.release(B);var j=s;j?p.paused?f--:(u===s&&(u=null),s=j.next,j.next=null,e.call(t,j.value,j.worked),u===null&&p.empty()):--f===0&&p.drain()}function X(){s=null,u=null,p.drain=se}function pe(){s=null,u=null,p.drain(),p.drain=se}function te(B){l=B}}function se(){}function Zi(){this.value=null,this.callback=se,this.next=null,this.release=se,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,o){var s=t.callback,u=t.errorHandler,f=t.value;t.value=null,t.callback=se,t.errorHandler&&u(r,f),s.call(t.context,r,o),t.release(t)}}function eo(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function o(g,w){e.call(this,g).then(function(E){w(null,E)},w)}var s=nn(t,o,r),u=s.push,f=s.unshift;return s.push=l,s.unshift=p,s.drained=A,s;function l(g){var w=new Promise(function(E,T){u(g,function(P,N){if(P){T(P);return}E(N)})});return w.catch(se),w}function p(g){var w=new Promise(function(E,T){f(g,function(P,N){if(P){T(P);return}E(N)})});return w.catch(se),w}function A(){if(s.idle())return new Promise(function(E){E()});var g=s.drain,w=new Promise(function(E){s.drain=function(){g(),E()}});return w}}pr.exports=nn;pr.exports.promise=eo;var on=pr.exports,yr={exports:{}},Ye=typeof Reflect=="object"?Reflect:null,Ir=Ye&&typeof Ye.apply=="function"?Ye.apply:function(e,r,o){return Function.prototype.apply.call(e,r,o)},yt;Ye&&typeof Ye.ownKeys=="function"?yt=Ye.ownKeys:Object.getOwnPropertySymbols?yt=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:yt=function(e){return Object.getOwnPropertyNames(e)};function to(t){console&&console.warn&&console.warn(t)}var sn=Number.isNaN||function(e){return e!==e};function $(){$.init.call(this)}yr.exports=$;yr.exports.once=oo;$.EventEmitter=$;$.prototype._events=void 0;$.prototype._eventsCount=0;$.prototype._maxListeners=void 0;var Fr=10;function xt(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty($,"defaultMaxListeners",{enumerable:!0,get:function(){return Fr},set:function(t){if(typeof t!="number"||t<0||sn(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Fr=t}});$.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};$.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||sn(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function an(t){return t._maxListeners===void 0?$.defaultMaxListeners:t._maxListeners}$.prototype.getMaxListeners=function(){return an(this)};$.prototype.emit=function(e){for(var r=[],o=1;o<arguments.length;o++)r.push(arguments[o]);var s=e==="error",u=this._events;if(u!==void 0)s=s&&u.error===void 0;else if(!s)return!1;if(s){var f;if(r.length>0&&(f=r[0]),f instanceof Error)throw f;var l=new Error("Unhandled error."+(f?" ("+f.message+")":""));throw l.context=f,l}var p=u[e];if(p===void 0)return!1;if(typeof p=="function")Ir(p,this,r);else for(var A=p.length,g=hn(p,A),o=0;o<A;++o)Ir(g[o],this,r);return!0};function un(t,e,r,o){var s,u,f;if(xt(r),u=t._events,u===void 0?(u=t._events=Object.create(null),t._eventsCount=0):(u.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),u=t._events),f=u[e]),f===void 0)f=u[e]=r,++t._eventsCount;else if(typeof f=="function"?f=u[e]=o?[r,f]:[f,r]:o?f.unshift(r):f.push(r),s=an(t),s>0&&f.length>s&&!f.warned){f.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+f.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=f.length,to(l)}return t}$.prototype.addListener=function(e,r){return un(this,e,r,!1)};$.prototype.on=$.prototype.addListener;$.prototype.prependListener=function(e,r){return un(this,e,r,!0)};function ro(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function cn(t,e,r){var o={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=ro.bind(o);return s.listener=r,o.wrapFn=s,s}$.prototype.once=function(e,r){return xt(r),this.on(e,cn(this,e,r)),this};$.prototype.prependOnceListener=function(e,r){return xt(r),this.prependListener(e,cn(this,e,r)),this};$.prototype.removeListener=function(e,r){var o,s,u,f,l;if(xt(r),s=this._events,s===void 0)return this;if(o=s[e],o===void 0)return this;if(o===r||o.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,o.listener||r));else if(typeof o!="function"){for(u=-1,f=o.length-1;f>=0;f--)if(o[f]===r||o[f].listener===r){l=o[f].listener,u=f;break}if(u<0)return this;u===0?o.shift():no(o,u),o.length===1&&(s[e]=o[0]),s.removeListener!==void 0&&this.emit("removeListener",e,l||r)}return this};$.prototype.off=$.prototype.removeListener;$.prototype.removeAllListeners=function(e){var r,o,s;if(o=this._events,o===void 0)return this;if(o.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):o[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete o[e]),this;if(arguments.length===0){var u=Object.keys(o),f;for(s=0;s<u.length;++s)f=u[s],f!=="removeListener"&&this.removeAllListeners(f);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=o[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(s=r.length-1;s>=0;s--)this.removeListener(e,r[s]);return this};function ln(t,e,r){var o=t._events;if(o===void 0)return[];var s=o[e];return s===void 0?[]:typeof s=="function"?r?[s.listener||s]:[s]:r?io(s):hn(s,s.length)}$.prototype.listeners=function(e){return ln(this,e,!0)};$.prototype.rawListeners=function(e){return ln(this,e,!1)};$.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):fn.call(t,e)};$.prototype.listenerCount=fn;function fn(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}$.prototype.eventNames=function(){return this._eventsCount>0?yt(this._events):[]};function hn(t,e){for(var r=new Array(e),o=0;o<e;++o)r[o]=t[o];return r}function no(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function io(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function oo(t,e){return new Promise(function(r,o){function s(f){t.removeListener(e,u),o(f)}function u(){typeof t.removeListener=="function"&&t.removeListener("error",s),r([].slice.call(arguments))}dn(t,e,u,{once:!0}),e!=="error"&&so(t,s,{once:!0})})}function so(t,e,r){typeof t.on=="function"&&dn(t,"error",e,r)}function dn(t,e,r,o){if(typeof t.on=="function")o.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function s(u){o.once&&t.removeEventListener(e,s),r(u)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var pn=yr.exports,Bt={},yn={},gn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),o=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var s=42;e[r]=s;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var u=Object.getOwnPropertySymbols(e);if(u.length!==1||u[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(e,r);if(f.value!==s||f.enumerable!==!0)return!1}return!0},ao=gn,gr=function(){return ao()&&!!Symbol.toStringTag},Tr=typeof Symbol<"u"&&Symbol,uo=gn,co=function(){return typeof Tr!="function"||typeof Symbol!="function"||typeof Tr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:uo()},_r={foo:{}},lo=Object,fo=function(){return{__proto__:_r}.foo===_r.foo&&!({__proto__:null}instanceof lo)},ho="Function.prototype.bind called on incompatible ",po=Object.prototype.toString,yo=Math.max,go="[object Function]",Cr=function(e,r){for(var o=[],s=0;s<e.length;s+=1)o[s]=e[s];for(var u=0;u<r.length;u+=1)o[u+e.length]=r[u];return o},mo=function(e,r){for(var o=[],s=r||0,u=0;s<e.length;s+=1,u+=1)o[u]=e[s];return o},bo=function(t,e){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=e);return r},wo=function(e){var r=this;if(typeof r!="function"||po.apply(r)!==go)throw new TypeError(ho+r);for(var o=mo(arguments,1),s,u=function(){if(this instanceof s){var g=r.apply(this,Cr(o,arguments));return Object(g)===g?g:this}return r.apply(e,Cr(o,arguments))},f=yo(0,r.length-o.length),l=[],p=0;p<f;p++)l[p]="$"+p;if(s=Function("binder","return function ("+bo(l,",")+"){ return binder.apply(this,arguments); }")(u),r.prototype){var A=function(){};A.prototype=r.prototype,s.prototype=new A,A.prototype=null}return s},vo=wo,mn=Function.prototype.bind||vo,Or={}.hasOwnProperty,Lt=Function.prototype.call,So=Lt.bind?Lt.bind(Or):function(t,e){return Lt.call(Or,t,e)},k,Ze=SyntaxError,bn=Function,Xe=TypeError,Ut=function(t){try{return bn('"use strict"; return ('+t+").constructor;")()}catch{}},je=Object.getOwnPropertyDescriptor;if(je)try{je({},"")}catch{je=null}var $t=function(){throw new Xe},Ao=je?function(){try{return arguments.callee,$t}catch{try{return je(arguments,"callee").get}catch{return $t}}}():$t,Qe=co(),Eo=fo(),H=Object.getPrototypeOf||(Eo?function(t){return t.__proto__}:null),ze={},Io=typeof Uint8Array>"u"||!H?k:H(Uint8Array),Me={"%AggregateError%":typeof AggregateError>"u"?k:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?k:ArrayBuffer,"%ArrayIteratorPrototype%":Qe&&H?H([][Symbol.iterator]()):k,"%AsyncFromSyncIteratorPrototype%":k,"%AsyncFunction%":ze,"%AsyncGenerator%":ze,"%AsyncGeneratorFunction%":ze,"%AsyncIteratorPrototype%":ze,"%Atomics%":typeof Atomics>"u"?k:Atomics,"%BigInt%":typeof BigInt>"u"?k:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?k:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?k:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?k:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?k:Float32Array,"%Float64Array%":typeof Float64Array>"u"?k:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?k:FinalizationRegistry,"%Function%":bn,"%GeneratorFunction%":ze,"%Int8Array%":typeof Int8Array>"u"?k:Int8Array,"%Int16Array%":typeof Int16Array>"u"?k:Int16Array,"%Int32Array%":typeof Int32Array>"u"?k:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qe&&H?H(H([][Symbol.iterator]())):k,"%JSON%":typeof JSON=="object"?JSON:k,"%Map%":typeof Map>"u"?k:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qe||!H?k:H(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?k:Promise,"%Proxy%":typeof Proxy>"u"?k:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?k:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?k:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qe||!H?k:H(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?k:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qe&&H?H(""[Symbol.iterator]()):k,"%Symbol%":Qe?Symbol:k,"%SyntaxError%":Ze,"%ThrowTypeError%":Ao,"%TypedArray%":Io,"%TypeError%":Xe,"%Uint8Array%":typeof Uint8Array>"u"?k:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?k:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?k:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?k:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?k:WeakMap,"%WeakRef%":typeof WeakRef>"u"?k:WeakRef,"%WeakSet%":typeof WeakSet>"u"?k:WeakSet};if(H)try{null.error}catch(t){var Fo=H(H(t));Me["%Error.prototype%"]=Fo}var To=function t(e){var r;if(e==="%AsyncFunction%")r=Ut("async function () {}");else if(e==="%GeneratorFunction%")r=Ut("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Ut("async function* () {}");else if(e==="%AsyncGenerator%"){var o=t("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&H&&(r=H(s.prototype))}return Me[e]=r,r},xr={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ft=mn,At=So,_o=ft.call(Function.call,Array.prototype.concat),Co=ft.call(Function.apply,Array.prototype.splice),Br=ft.call(Function.call,String.prototype.replace),Et=ft.call(Function.call,String.prototype.slice),Oo=ft.call(Function.call,RegExp.prototype.exec),xo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Bo=/\\(\\)?/g,ko=function(e){var r=Et(e,0,1),o=Et(e,-1);if(r==="%"&&o!=="%")throw new Ze("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&r!=="%")throw new Ze("invalid intrinsic syntax, expected opening `%`");var s=[];return Br(e,xo,function(u,f,l,p){s[s.length]=l?Br(p,Bo,"$1"):f||u}),s},Po=function(e,r){var o=e,s;if(At(xr,o)&&(s=xr[o],o="%"+s[0]+"%"),At(Me,o)){var u=Me[o];if(u===ze&&(u=To(o)),typeof u>"u"&&!r)throw new Xe("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:o,value:u}}throw new Ze("intrinsic "+e+" does not exist!")},tt=function(e,r){if(typeof e!="string"||e.length===0)throw new Xe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Xe('"allowMissing" argument must be a boolean');if(Oo(/^%?[^%]*%?$/,e)===null)throw new Ze("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=ko(e),s=o.length>0?o[0]:"",u=Po("%"+s+"%",r),f=u.name,l=u.value,p=!1,A=u.alias;A&&(s=A[0],Co(o,_o([0,1],A)));for(var g=1,w=!0;g<o.length;g+=1){var E=o[g],T=Et(E,0,1),P=Et(E,-1);if((T==='"'||T==="'"||T==="`"||P==='"'||P==="'"||P==="`")&&T!==P)throw new Ze("property names with quotes must have matching quotes");if((E==="constructor"||!w)&&(p=!0),s+="."+E,f="%"+s+"%",At(Me,f))l=Me[f];else if(l!=null){if(!(E in l)){if(!r)throw new Xe("base intrinsic for "+e+" exists, but the property is not available.");return}if(je&&g+1>=o.length){var N=je(l,E);w=!!N,w&&"get"in N&&!("originalValue"in N.get)?l=N.get:l=l[E]}else w=At(l,E),l=l[E];w&&!p&&(Me[f]=l)}}return l},wn={exports:{}},Ro=tt,er=Ro("%Object.defineProperty%",!0),tr=function(){if(er)try{return er({},"a",{value:1}),!0}catch{return!1}return!1};tr.hasArrayLengthDefineBug=function(){if(!tr())return null;try{return er([],"length",{value:1}).length!==1}catch{return!0}};var vn=tr,No=tt,gt=No("%Object.getOwnPropertyDescriptor%",!0);if(gt)try{gt([],"length")}catch{gt=null}var mr=gt,Lo=vn(),br=tt,ct=Lo&&br("%Object.defineProperty%",!0);if(ct)try{ct({},"a",{value:1})}catch{ct=!1}var Uo=br("%SyntaxError%"),Ge=br("%TypeError%"),kr=mr,$o=function(e,r,o){if(!e||typeof e!="object"&&typeof e!="function")throw new Ge("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ge("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ge("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ge("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ge("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ge("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,p=!!kr&&kr(e,r);if(ct)ct(e,r,{configurable:f===null&&p?p.configurable:!f,enumerable:s===null&&p?p.enumerable:!s,value:o,writable:u===null&&p?p.writable:!u});else if(l||!s&&!u&&!f)e[r]=o;else throw new Uo("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Sn=tt,Pr=$o,Do=vn(),Rr=mr,Nr=Sn("%TypeError%"),jo=Sn("%Math.floor%"),Mo=function(e,r){if(typeof e!="function")throw new Nr("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||jo(r)!==r)throw new Nr("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in e&&Rr){var f=Rr(e,"length");f&&!f.configurable&&(s=!1),f&&!f.writable&&(u=!1)}return(s||u||!o)&&(Do?Pr(e,"length",r,!0,!0):Pr(e,"length",r)),e};(function(t){var e=mn,r=tt,o=Mo,s=r("%TypeError%"),u=r("%Function.prototype.apply%"),f=r("%Function.prototype.call%"),l=r("%Reflect.apply%",!0)||e.call(f,u),p=r("%Object.defineProperty%",!0),A=r("%Math.max%");if(p)try{p({},"a",{value:1})}catch{p=null}t.exports=function(E){if(typeof E!="function")throw new s("a function is required");var T=l(e,f,arguments);return o(T,1+A(0,E.length-(arguments.length-1)),!0)};var g=function(){return l(e,u,arguments)};p?p(t.exports,"apply",{value:g}):t.exports.apply=g})(wn);var An=wn.exports,En=tt,In=An,Vo=In(En("String.prototype.indexOf")),Fn=function(e,r){var o=En(e,!!r);return typeof o=="function"&&Vo(e,".prototype.")>-1?In(o):o},qo=gr(),Qo=Fn,rr=Qo("Object.prototype.toString"),kt=function(e){return qo&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:rr(e)==="[object Arguments]"},Tn=function(e){return kt(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&rr(e)!=="[object Array]"&&rr(e.callee)==="[object Function]"},Go=function(){return kt(arguments)}();kt.isLegacyArguments=Tn;var zo=Go?kt:Tn,Ko=Object.prototype.toString,Ho=Function.prototype.toString,Wo=/^\s*(?:function)?\*/,_n=gr(),Dt=Object.getPrototypeOf,Jo=function(){if(!_n)return!1;try{return Function("return function*() {}")()}catch{}},jt,Yo=function(e){if(typeof e!="function")return!1;if(Wo.test(Ho.call(e)))return!0;if(!_n){var r=Ko.call(e);return r==="[object GeneratorFunction]"}if(!Dt)return!1;if(typeof jt>"u"){var o=Jo();jt=o?Dt(o):!1}return Dt(e)===jt},Cn=Function.prototype.toString,He=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,nr,mt;if(typeof He=="function"&&typeof Object.defineProperty=="function")try{nr=Object.defineProperty({},"length",{get:function(){throw mt}}),mt={},He(function(){throw 42},null,nr)}catch(t){t!==mt&&(He=null)}else He=null;var Xo=/^\s*class\b/,ir=function(e){try{var r=Cn.call(e);return Xo.test(r)}catch{return!1}},Mt=function(e){try{return ir(e)?!1:(Cn.call(e),!0)}catch{return!1}},bt=Object.prototype.toString,Zo="[object Object]",es="[object Function]",ts="[object GeneratorFunction]",rs="[object HTMLAllCollection]",ns="[object HTML document.all class]",is="[object HTMLCollection]",os=typeof Symbol=="function"&&!!Symbol.toStringTag,ss=!(0 in[,]),or=function(){return!1};if(typeof document=="object"){var as=document.all;bt.call(as)===bt.call(document.all)&&(or=function(e){if((ss||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=bt.call(e);return(r===rs||r===ns||r===is||r===Zo)&&e("")==null}catch{}return!1})}var us=He?function(e){if(or(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{He(e,null,nr)}catch(r){if(r!==mt)return!1}return!ir(e)&&Mt(e)}:function(e){if(or(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(os)return Mt(e);if(ir(e))return!1;var r=bt.call(e);return r!==es&&r!==ts&&!/^\[object HTML/.test(r)?!1:Mt(e)},cs=us,ls=Object.prototype.toString,On=Object.prototype.hasOwnProperty,fs=function(e,r,o){for(var s=0,u=e.length;s<u;s++)On.call(e,s)&&(o==null?r(e[s],s,e):r.call(o,e[s],s,e))},hs=function(e,r,o){for(var s=0,u=e.length;s<u;s++)o==null?r(e.charAt(s),s,e):r.call(o,e.charAt(s),s,e)},ds=function(e,r,o){for(var s in e)On.call(e,s)&&(o==null?r(e[s],s,e):r.call(o,e[s],s,e))},ps=function(e,r,o){if(!cs(r))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=o),ls.call(e)==="[object Array]"?fs(e,r,s):typeof e=="string"?hs(e,r,s):ds(e,r,s)},ys=ps,Vt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],gs=typeof globalThis>"u"?Kr:globalThis,ms=function(){for(var e=[],r=0;r<Vt.length;r++)typeof gs[Vt[r]]=="function"&&(e[e.length]=Vt[r]);return e},It=ys,bs=ms,Lr=An,wr=Fn,wt=mr,ws=wr("Object.prototype.toString"),xn=gr(),Ur=typeof globalThis>"u"?Kr:globalThis,sr=bs(),vr=wr("String.prototype.slice"),qt=Object.getPrototypeOf,vs=wr("Array.prototype.indexOf",!0)||function(e,r){for(var o=0;o<e.length;o+=1)if(e[o]===r)return o;return-1},Ft={__proto__:null};xn&&wt&&qt?It(sr,function(t){var e=new Ur[t];if(Symbol.toStringTag in e){var r=qt(e),o=wt(r,Symbol.toStringTag);if(!o){var s=qt(r);o=wt(s,Symbol.toStringTag)}Ft["$"+t]=Lr(o.get)}}):It(sr,function(t){var e=new Ur[t],r=e.slice||e.set;r&&(Ft["$"+t]=Lr(r))});var Ss=function(e){var r=!1;return It(Ft,function(o,s){if(!r)try{"$"+o(e)===s&&(r=vr(s,1))}catch{}}),r},As=function(e){var r=!1;return It(Ft,function(o,s){if(!r)try{o(e),r=vr(s,1)}catch{}}),r},Bn=function(e){if(!e||typeof e!="object")return!1;if(!xn){var r=vr(ws(e),8,-1);return vs(sr,r)>-1?r:r!=="Object"?!1:As(e)}return wt?Ss(e):null},Es=Bn,Is=function(e){return!!Es(e)};(function(t){var e=zo,r=Yo,o=Bn,s=Is;function u(v){return v.call.bind(v)}var f=typeof BigInt<"u",l=typeof Symbol<"u",p=u(Object.prototype.toString),A=u(Number.prototype.valueOf),g=u(String.prototype.valueOf),w=u(Boolean.prototype.valueOf);if(f)var E=u(BigInt.prototype.valueOf);if(l)var T=u(Symbol.prototype.valueOf);function P(v,dt){if(typeof v!="object")return!1;try{return dt(v),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=s;function N(v){return typeof Promise<"u"&&v instanceof Promise||v!==null&&typeof v=="object"&&typeof v.then=="function"&&typeof v.catch=="function"}t.isPromise=N;function G(v){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(v):s(v)||b(v)}t.isArrayBufferView=G;function z(v){return o(v)==="Uint8Array"}t.isUint8Array=z;function X(v){return o(v)==="Uint8ClampedArray"}t.isUint8ClampedArray=X;function pe(v){return o(v)==="Uint16Array"}t.isUint16Array=pe;function te(v){return o(v)==="Uint32Array"}t.isUint32Array=te;function B(v){return o(v)==="Int8Array"}t.isInt8Array=B;function j(v){return o(v)==="Int16Array"}t.isInt16Array=j;function O(v){return o(v)==="Int32Array"}t.isInt32Array=O;function re(v){return o(v)==="Float32Array"}t.isFloat32Array=re;function ne(v){return o(v)==="Float64Array"}t.isFloat64Array=ne;function Oe(v){return o(v)==="BigInt64Array"}t.isBigInt64Array=Oe;function Ae(v){return o(v)==="BigUint64Array"}t.isBigUint64Array=Ae;function ce(v){return p(v)==="[object Map]"}ce.working=typeof Map<"u"&&ce(new Map);function nt(v){return typeof Map>"u"?!1:ce.working?ce(v):v instanceof Map}t.isMap=nt;function le(v){return p(v)==="[object Set]"}le.working=typeof Set<"u"&&le(new Set);function xe(v){return typeof Set>"u"?!1:le.working?le(v):v instanceof Set}t.isSet=xe;function Be(v){return p(v)==="[object WeakMap]"}Be.working=typeof WeakMap<"u"&&Be(new WeakMap);function it(v){return typeof WeakMap>"u"?!1:Be.working?Be(v):v instanceof WeakMap}t.isWeakMap=it;function ke(v){return p(v)==="[object WeakSet]"}ke.working=typeof WeakSet<"u"&&ke(new WeakSet);function fe(v){return ke(v)}t.isWeakSet=fe;function Pe(v){return p(v)==="[object ArrayBuffer]"}Pe.working=typeof ArrayBuffer<"u"&&Pe(new ArrayBuffer);function V(v){return typeof ArrayBuffer>"u"?!1:Pe.working?Pe(v):v instanceof ArrayBuffer}t.isArrayBuffer=V;function d(v){return p(v)==="[object DataView]"}d.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&d(new DataView(new ArrayBuffer(1),0,1));function b(v){return typeof DataView>"u"?!1:d.working?d(v):v instanceof DataView}t.isDataView=b;var S=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function I(v){return p(v)==="[object SharedArrayBuffer]"}function R(v){return typeof S>"u"?!1:(typeof I.working>"u"&&(I.working=I(new S)),I.working?I(v):v instanceof S)}t.isSharedArrayBuffer=R;function L(v){return p(v)==="[object AsyncFunction]"}t.isAsyncFunction=L;function F(v){return p(v)==="[object Map Iterator]"}t.isMapIterator=F;function x(v){return p(v)==="[object Set Iterator]"}t.isSetIterator=x;function U(v){return p(v)==="[object Generator]"}t.isGeneratorObject=U;function Y(v){return p(v)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=Y;function ye(v){return P(v,A)}t.isNumberObject=ye;function he(v){return P(v,g)}t.isStringObject=he;function ie(v){return P(v,w)}t.isBooleanObject=ie;function Ve(v){return f&&P(v,E)}t.isBigIntObject=Ve;function ht(v){return l&&P(v,T)}t.isSymbolObject=ht;function ot(v){return ye(v)||he(v)||ie(v)||Ve(v)||ht(v)}t.isBoxedPrimitive=ot;function Pt(v){return typeof Uint8Array<"u"&&(V(v)||R(v))}t.isAnyArrayBuffer=Pt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(v){Object.defineProperty(t,v,{enumerable:!1,value:function(){throw new Error(v+" is not supported in userland")}})})})(yn);var Fs=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"},ar={exports:{}};typeof Object.create=="function"?ar.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ar.exports=function(e,r){if(r){e.super_=r;var o=function(){};o.prototype=r.prototype,e.prototype=new o,e.prototype.constructor=e}};var Ts=ar.exports;(function(t){var e=Object.getOwnPropertyDescriptors||function(b){for(var S=Object.keys(b),I={},R=0;R<S.length;R++)I[S[R]]=Object.getOwnPropertyDescriptor(b,S[R]);return I},r=/%[sdj%]/g;t.format=function(d){if(!B(d)){for(var b=[],S=0;S<arguments.length;S++)b.push(f(arguments[S]));return b.join(" ")}for(var S=1,I=arguments,R=I.length,L=String(d).replace(r,function(x){if(x==="%%")return"%";if(S>=R)return x;switch(x){case"%s":return String(I[S++]);case"%d":return Number(I[S++]);case"%j":try{return JSON.stringify(I[S++])}catch{return"[Circular]"}default:return x}}),F=I[S];S<R;F=I[++S])X(F)||!ne(F)?L+=" "+F:L+=" "+f(F);return L},t.deprecate=function(d,b){if(typeof _.process<"u"&&_.process.noDeprecation===!0)return d;if(typeof _.process>"u")return function(){return t.deprecate(d,b).apply(this,arguments)};var S=!1;function I(){if(!S){if(_.process.throwDeprecation)throw new Error(b);_.process.traceDeprecation?console.trace(b):console.error(b),S=!0}return d.apply(this,arguments)}return I};var o={},s=/^$/;if(_.process.env.NODE_DEBUG){var u=_.process.env.NODE_DEBUG;u=u.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+u+"$","i")}t.debuglog=function(d){if(d=d.toUpperCase(),!o[d])if(s.test(d)){var b=_.process.pid;o[d]=function(){var S=t.format.apply(t,arguments);console.error("%s %d: %s",d,b,S)}}else o[d]=function(){};return o[d]};function f(d,b){var S={seen:[],stylize:p};return arguments.length>=3&&(S.depth=arguments[2]),arguments.length>=4&&(S.colors=arguments[3]),z(b)?S.showHidden=b:b&&t._extend(S,b),O(S.showHidden)&&(S.showHidden=!1),O(S.depth)&&(S.depth=2),O(S.colors)&&(S.colors=!1),O(S.customInspect)&&(S.customInspect=!0),S.colors&&(S.stylize=l),g(S,d,S.depth)}t.inspect=f,f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function l(d,b){var S=f.styles[b];return S?"\x1B["+f.colors[S][0]+"m"+d+"\x1B["+f.colors[S][1]+"m":d}function p(d,b){return d}function A(d){var b={};return d.forEach(function(S,I){b[S]=!0}),b}function g(d,b,S){if(d.customInspect&&b&&ce(b.inspect)&&b.inspect!==t.inspect&&!(b.constructor&&b.constructor.prototype===b)){var I=b.inspect(S,d);return B(I)||(I=g(d,I,S)),I}var R=w(d,b);if(R)return R;var L=Object.keys(b),F=A(L);if(d.showHidden&&(L=Object.getOwnPropertyNames(b)),Ae(b)&&(L.indexOf("message")>=0||L.indexOf("description")>=0))return E(b);if(L.length===0){if(ce(b)){var x=b.name?": "+b.name:"";return d.stylize("[Function"+x+"]","special")}if(re(b))return d.stylize(RegExp.prototype.toString.call(b),"regexp");if(Oe(b))return d.stylize(Date.prototype.toString.call(b),"date");if(Ae(b))return E(b)}var U="",Y=!1,ye=["{","}"];if(G(b)&&(Y=!0,ye=["[","]"]),ce(b)){var he=b.name?": "+b.name:"";U=" [Function"+he+"]"}if(re(b)&&(U=" "+RegExp.prototype.toString.call(b)),Oe(b)&&(U=" "+Date.prototype.toUTCString.call(b)),Ae(b)&&(U=" "+E(b)),L.length===0&&(!Y||b.length==0))return ye[0]+U+ye[1];if(S<0)return re(b)?d.stylize(RegExp.prototype.toString.call(b),"regexp"):d.stylize("[Object]","special");d.seen.push(b);var ie;return Y?ie=T(d,b,S,F,L):ie=L.map(function(Ve){return P(d,b,S,F,Ve,Y)}),d.seen.pop(),N(ie,U,ye)}function w(d,b){if(O(b))return d.stylize("undefined","undefined");if(B(b)){var S="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return d.stylize(S,"string")}if(te(b))return d.stylize(""+b,"number");if(z(b))return d.stylize(""+b,"boolean");if(X(b))return d.stylize("null","null")}function E(d){return"["+Error.prototype.toString.call(d)+"]"}function T(d,b,S,I,R){for(var L=[],F=0,x=b.length;F<x;++F)ke(b,String(F))?L.push(P(d,b,S,I,String(F),!0)):L.push("");return R.forEach(function(U){U.match(/^\d+$/)||L.push(P(d,b,S,I,U,!0))}),L}function P(d,b,S,I,R,L){var F,x,U;if(U=Object.getOwnPropertyDescriptor(b,R)||{value:b[R]},U.get?U.set?x=d.stylize("[Getter/Setter]","special"):x=d.stylize("[Getter]","special"):U.set&&(x=d.stylize("[Setter]","special")),ke(I,R)||(F="["+R+"]"),x||(d.seen.indexOf(U.value)<0?(X(S)?x=g(d,U.value,null):x=g(d,U.value,S-1),x.indexOf(`
7
- `)>-1&&(L?x=x.split(`
8
- `).map(function(Y){return" "+Y}).join(`
9
- `).slice(2):x=`
10
- `+x.split(`
11
- `).map(function(Y){return" "+Y}).join(`
12
- `))):x=d.stylize("[Circular]","special")),O(F)){if(L&&R.match(/^\d+$/))return x;F=JSON.stringify(""+R),F.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(F=F.slice(1,-1),F=d.stylize(F,"name")):(F=F.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),F=d.stylize(F,"string"))}return F+": "+x}function N(d,b,S){var I=d.reduce(function(R,L){return L.indexOf(`
13
- `)>=0,R+L.replace(/\u001b\[\d\d?m/g,"").length+1},0);return I>60?S[0]+(b===""?"":b+`
14
- `)+" "+d.join(`,
15
- `)+" "+S[1]:S[0]+b+" "+d.join(", ")+" "+S[1]}t.types=yn;function G(d){return Array.isArray(d)}t.isArray=G;function z(d){return typeof d=="boolean"}t.isBoolean=z;function X(d){return d===null}t.isNull=X;function pe(d){return d==null}t.isNullOrUndefined=pe;function te(d){return typeof d=="number"}t.isNumber=te;function B(d){return typeof d=="string"}t.isString=B;function j(d){return typeof d=="symbol"}t.isSymbol=j;function O(d){return d===void 0}t.isUndefined=O;function re(d){return ne(d)&&le(d)==="[object RegExp]"}t.isRegExp=re,t.types.isRegExp=re;function ne(d){return typeof d=="object"&&d!==null}t.isObject=ne;function Oe(d){return ne(d)&&le(d)==="[object Date]"}t.isDate=Oe,t.types.isDate=Oe;function Ae(d){return ne(d)&&(le(d)==="[object Error]"||d instanceof Error)}t.isError=Ae,t.types.isNativeError=Ae;function ce(d){return typeof d=="function"}t.isFunction=ce;function nt(d){return d===null||typeof d=="boolean"||typeof d=="number"||typeof d=="string"||typeof d=="symbol"||typeof d>"u"}t.isPrimitive=nt,t.isBuffer=Fs;function le(d){return Object.prototype.toString.call(d)}function xe(d){return d<10?"0"+d.toString(10):d.toString(10)}var Be=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function it(){var d=new Date,b=[xe(d.getHours()),xe(d.getMinutes()),xe(d.getSeconds())].join(":");return[d.getDate(),Be[d.getMonth()],b].join(" ")}t.log=function(){console.log("%s - %s",it(),t.format.apply(t,arguments))},t.inherits=Ts,t._extend=function(d,b){if(!b||!ne(b))return d;for(var S=Object.keys(b),I=S.length;I--;)d[S[I]]=b[S[I]];return d};function ke(d,b){return Object.prototype.hasOwnProperty.call(d,b)}var fe=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;t.promisify=function(b){if(typeof b!="function")throw new TypeError('The "original" argument must be of type Function');if(fe&&b[fe]){var S=b[fe];if(typeof S!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(S,fe,{value:S,enumerable:!1,writable:!1,configurable:!0}),S}function S(){for(var I,R,L=new Promise(function(U,Y){I=U,R=Y}),F=[],x=0;x<arguments.length;x++)F.push(arguments[x]);F.push(function(U,Y){U?R(U):I(Y)});try{b.apply(this,F)}catch(U){R(U)}return L}return Object.setPrototypeOf(S,Object.getPrototypeOf(b)),fe&&Object.defineProperty(S,fe,{value:S,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(S,e(b))},t.promisify.custom=fe;function Pe(d,b){if(!d){var S=new Error("Promise was rejected with a falsy value");S.reason=d,d=S}return b(d)}function V(d){if(typeof d!="function")throw new TypeError('The "original" argument must be of type Function');function b(){for(var S=[],I=0;I<arguments.length;I++)S.push(arguments[I]);var R=S.pop();if(typeof R!="function")throw new TypeError("The last argument must be of type Function");var L=this,F=function(){return R.apply(L,arguments)};d.apply(this,S).then(function(x){_.process.nextTick(F.bind(null,null,x))},function(x){_.process.nextTick(Pe.bind(null,x,F))})}return Object.setPrototypeOf(b,Object.getPrototypeOf(d)),Object.defineProperties(b,e(d)),b}t.callbackify=V})(Bt);const{inherits:_s,format:Qt}=Bt;function Le(t,e,r=Error){if(!t)throw new Error("Avvio error code must not be empty");if(!e)throw new Error("Avvio base error message must not be empty");function o(s,u,f){if(!new.target)return new o(s,u,f);Error.captureStackTrace(this,o),this.code=t,this.message=e,this.name="AvvioError",s&&u&&f?this.message=Qt(e,s,u,f):s&&u?this.message=Qt(e,s,u):s?this.message=Qt(e,s):this.message=e}return o.prototype[Symbol.toStringTag]="Error",o.prototype.toString=function(){return`${this.name} [${this.code}]: ${this.message}`},_s(o,r),o}var kn={createError:Le,AVV_ERR_EXPOSE_ALREADY_DEFINED:Le("AVV_ERR_EXPOSE_ALREADY_DEFINED","'%s' () is already defined, specify an expose option"),AVV_ERR_CALLBACK_NOT_FN:Le("AVV_ERR_CALLBACK_NOT_FN","Callback for '%s' hook is not a function. Received: '%s'"),AVV_ERR_PLUGIN_NOT_VALID:Le("AVV_ERR_PLUGIN_NOT_VALID","Plugin must be a function or a promise. Received: '%s'"),AVV_ERR_ROOT_PLG_BOOTED:Le("AVV_ERR_PLUGIN_NOT_VALID","Root plugin has already booted"),AVV_ERR_PARENT_PLG_LOADED:Le("AVV_ERR_PARENT_PLG_LOADED","Impossible to load '%s' plugin because the parent '%s' was already loaded"),AVV_ERR_READY_TIMEOUT:Le("AVV_ERR_READY_TIMEOUT","Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise")},Cs=function t(e,r,o){r===void 0&&(r=""),o||(o={});var s=function(p){var A={"│":"|","└":"`","├":"+","─":"-","┬":"-"};return o.unicode===!1?A[p]:p};typeof e=="string"&&(e={label:e});var u=e.nodes||[],f=(e.label||"").split(`
6
+ */(function(t){const e=Ct,r=lr,o=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=_,t.INSPECT_MAX_BYTES=50;const s=2147483647;t.kMaxLength=s,l.TYPED_ARRAY_SUPPORT=u(),!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function u(){try{const a=new Uint8Array(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,Uint8Array.prototype),Object.setPrototypeOf(a,n),a.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function f(a){if(a>s)throw new RangeError('The value "'+a+'" is invalid for option "size"');const n=new Uint8Array(a);return Object.setPrototypeOf(n,l.prototype),n}function l(a,n,i){if(typeof a=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return b(a)}return d(a,n,i)}l.poolSize=8192;function d(a,n,i){if(typeof a=="string")return E(a,n);if(ArrayBuffer.isView(a))return N(a);if(a==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a);if(ge(a,ArrayBuffer)||a&&ge(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ge(a,SharedArrayBuffer)||a&&ge(a.buffer,SharedArrayBuffer)))return P(a,n,i);if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const c=a.valueOf&&a.valueOf();if(c!=null&&c!==a)return l.from(c,n,i);const h=K(a);if(h)return h;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return l.from(a[Symbol.toPrimitive]("string"),n,i);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a)}l.from=function(a,n,i){return d(a,n,i)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function S(a){if(typeof a!="number")throw new TypeError('"size" argument must be of type number');if(a<0)throw new RangeError('The value "'+a+'" is invalid for option "size"')}function g(a,n,i){return S(a),a<=0?f(a):n!==void 0?typeof i=="string"?f(a).fill(n,i):f(a).fill(n):f(a)}l.alloc=function(a,n,i){return g(a,n,i)};function b(a){return S(a),f(a<0?0:I(a)|0)}l.allocUnsafe=function(a){return b(a)},l.allocUnsafeSlow=function(a){return b(a)};function E(a,n){if((typeof n!="string"||n==="")&&(n="utf8"),!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);const i=j(a,n)|0;let c=f(i);const h=c.write(a,n);return h!==i&&(c=c.slice(0,h)),c}function T(a){const n=a.length<0?0:I(a.length)|0,i=f(n);for(let c=0;c<n;c+=1)i[c]=a[c]&255;return i}function N(a){if(ge(a,Uint8Array)){const n=new Uint8Array(a);return P(n.buffer,n.byteOffset,n.byteLength)}return T(a)}function P(a,n,i){if(n<0||a.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<n+(i||0))throw new RangeError('"length" is outside of buffer bounds');let c;return n===void 0&&i===void 0?c=new Uint8Array(a):i===void 0?c=new Uint8Array(a,n):c=new Uint8Array(a,n,i),Object.setPrototypeOf(c,l.prototype),c}function K(a){if(l.isBuffer(a)){const n=I(a.length)|0,i=f(n);return i.length===0||a.copy(i,0,0,n),i}if(a.length!==void 0)return typeof a.length!="number"||Rt(a.length)?f(0):T(a);if(a.type==="Buffer"&&Array.isArray(a.data))return T(a.data)}function I(a){if(a>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return a|0}function _(a){return+a!=a&&(a=0),l.alloc(+a)}l.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==l.prototype},l.compare=function(n,i){if(ge(n,Uint8Array)&&(n=l.from(n,n.offset,n.byteLength)),ge(i,Uint8Array)&&(i=l.from(i,i.offset,i.byteLength)),!l.isBuffer(n)||!l.isBuffer(i))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===i)return 0;let c=n.length,h=i.length;for(let y=0,m=Math.min(c,h);y<m;++y)if(n[y]!==i[y]){c=n[y],h=i[y];break}return c<h?-1:h<c?1:0},l.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(n,i){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return l.alloc(0);let c;if(i===void 0)for(i=0,c=0;c<n.length;++c)i+=n[c].length;const h=l.allocUnsafe(i);let y=0;for(c=0;c<n.length;++c){let m=n[c];if(ge(m,Uint8Array))y+m.length>h.length?(l.isBuffer(m)||(m=l.from(m)),m.copy(h,y)):Uint8Array.prototype.set.call(h,m,y);else if(l.isBuffer(m))m.copy(h,y);else throw new TypeError('"list" argument must be an Array of Buffers');y+=m.length}return h};function j(a,n){if(l.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||ge(a,ArrayBuffer))return a.byteLength;if(typeof a!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof a);const i=a.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&i===0)return 0;let h=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":return ot(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return dt(a).length;default:if(h)return c?-1:ot(a).length;n=(""+n).toLowerCase(),h=!0}}l.byteLength=j;function U(a,n,i){let c=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((i===void 0||i>this.length)&&(i=this.length),i<=0)||(i>>>=0,n>>>=0,i<=n))return"";for(a||(a="utf8");;)switch(a){case"hex":return he(this,n,i);case"utf8":case"utf-8":return fe(this,n,i);case"ascii":return it(this,n,i);case"latin1":case"binary":return ke(this,n,i);case"base64":return nt(this,n,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pe(this,n,i);default:if(c)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function F(a,n,i){const c=a[n];a[n]=a[i],a[i]=c}l.prototype.swap16=function(){const n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let i=0;i<n;i+=2)F(this,i,i+1);return this},l.prototype.swap32=function(){const n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let i=0;i<n;i+=4)F(this,i,i+3),F(this,i+1,i+2);return this},l.prototype.swap64=function(){const n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let i=0;i<n;i+=8)F(this,i,i+7),F(this,i+1,i+6),F(this,i+2,i+5),F(this,i+3,i+4);return this},l.prototype.toString=function(){const n=this.length;return n===0?"":arguments.length===0?fe(this,0,n):U.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(n){if(!l.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:l.compare(this,n)===0},l.prototype.inspect=function(){let n="";const i=t.INSPECT_MAX_BYTES;return n=this.toString("hex",0,i).replace(/(.{2})/g,"$1 ").trim(),this.length>i&&(n+=" ... "),"<Buffer "+n+">"},o&&(l.prototype[o]=l.prototype.inspect),l.prototype.compare=function(n,i,c,h,y){if(ge(n,Uint8Array)&&(n=l.from(n,n.offset,n.byteLength)),!l.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(i===void 0&&(i=0),c===void 0&&(c=n?n.length:0),h===void 0&&(h=0),y===void 0&&(y=this.length),i<0||c>n.length||h<0||y>this.length)throw new RangeError("out of range index");if(h>=y&&i>=c)return 0;if(h>=y)return-1;if(i>=c)return 1;if(i>>>=0,c>>>=0,h>>>=0,y>>>=0,this===n)return 0;let m=y-h,R=c-i;const W=Math.min(m,R),z=this.slice(h,y),J=n.slice(i,c);for(let Q=0;Q<W;++Q)if(z[Q]!==J[Q]){m=z[Q],R=J[Q];break}return m<R?-1:R<m?1:0};function x(a,n,i,c,h){if(a.length===0)return-1;if(typeof i=="string"?(c=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,Rt(i)&&(i=h?0:a.length-1),i<0&&(i=a.length+i),i>=a.length){if(h)return-1;i=a.length-1}else if(i<0)if(h)i=0;else return-1;if(typeof n=="string"&&(n=l.from(n,c)),l.isBuffer(n))return n.length===0?-1:k(a,n,i,c,h);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?h?Uint8Array.prototype.indexOf.call(a,n,i):Uint8Array.prototype.lastIndexOf.call(a,n,i):k(a,[n],i,c,h);throw new TypeError("val must be string, number or Buffer")}function k(a,n,i,c,h){let y=1,m=a.length,R=n.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(a.length<2||n.length<2)return-1;y=2,m/=2,R/=2,i/=2}function W(J,Q){return y===1?J[Q]:J.readUInt16BE(Q*y)}let z;if(h){let J=-1;for(z=i;z<m;z++)if(W(a,z)===W(n,J===-1?0:z-J)){if(J===-1&&(J=z),z-J+1===R)return J*y}else J!==-1&&(z-=z-J),J=-1}else for(i+R>m&&(i=m-R),z=i;z>=0;z--){let J=!0;for(let Q=0;Q<R;Q++)if(W(a,z+Q)!==W(n,Q)){J=!1;break}if(J)return z}return-1}l.prototype.includes=function(n,i,c){return this.indexOf(n,i,c)!==-1},l.prototype.indexOf=function(n,i,c){return x(this,n,i,c,!0)},l.prototype.lastIndexOf=function(n,i,c){return x(this,n,i,c,!1)};function G(a,n,i,c){i=Number(i)||0;const h=a.length-i;c?(c=Number(c),c>h&&(c=h)):c=h;const y=n.length;c>y/2&&(c=y/2);let m;for(m=0;m<c;++m){const R=parseInt(n.substr(m*2,2),16);if(Rt(R))return m;a[i+m]=R}return m}function ie(a,n,i,c){return st(ot(n,a.length-i),a,i,c)}function Oe(a,n,i,c){return st(Pt(n),a,i,c)}function Ae(a,n,i,c){return st(dt(n),a,i,c)}function le(a,n,i,c){return st(v(n,a.length-i),a,i,c)}l.prototype.write=function(n,i,c,h){if(i===void 0)h="utf8",c=this.length,i=0;else if(c===void 0&&typeof i=="string")h=i,c=this.length,i=0;else if(isFinite(i))i=i>>>0,isFinite(c)?(c=c>>>0,h===void 0&&(h="utf8")):(h=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const y=this.length-i;if((c===void 0||c>y)&&(c=y),n.length>0&&(c<0||i<0)||i>this.length)throw new RangeError("Attempt to write outside buffer bounds");h||(h="utf8");let m=!1;for(;;)switch(h){case"hex":return G(this,n,i,c);case"utf8":case"utf-8":return ie(this,n,i,c);case"ascii":case"latin1":case"binary":return Oe(this,n,i,c);case"base64":return Ae(this,n,i,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return le(this,n,i,c);default:if(m)throw new TypeError("Unknown encoding: "+h);h=(""+h).toLowerCase(),m=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function nt(a,n,i){return n===0&&i===a.length?e.fromByteArray(a):e.fromByteArray(a.slice(n,i))}function fe(a,n,i){i=Math.min(a.length,i);const c=[];let h=n;for(;h<i;){const y=a[h];let m=null,R=y>239?4:y>223?3:y>191?2:1;if(h+R<=i){let W,z,J,Q;switch(R){case 1:y<128&&(m=y);break;case 2:W=a[h+1],(W&192)===128&&(Q=(y&31)<<6|W&63,Q>127&&(m=Q));break;case 3:W=a[h+1],z=a[h+2],(W&192)===128&&(z&192)===128&&(Q=(y&15)<<12|(W&63)<<6|z&63,Q>2047&&(Q<55296||Q>57343)&&(m=Q));break;case 4:W=a[h+1],z=a[h+2],J=a[h+3],(W&192)===128&&(z&192)===128&&(J&192)===128&&(Q=(y&15)<<18|(W&63)<<12|(z&63)<<6|J&63,Q>65535&&Q<1114112&&(m=Q))}}m===null?(m=65533,R=1):m>65535&&(m-=65536,c.push(m>>>10&1023|55296),m=56320|m&1023),c.push(m),h+=R}return Be(c)}const xe=4096;function Be(a){const n=a.length;if(n<=xe)return String.fromCharCode.apply(String,a);let i="",c=0;for(;c<n;)i+=String.fromCharCode.apply(String,a.slice(c,c+=xe));return i}function it(a,n,i){let c="";i=Math.min(a.length,i);for(let h=n;h<i;++h)c+=String.fromCharCode(a[h]&127);return c}function ke(a,n,i){let c="";i=Math.min(a.length,i);for(let h=n;h<i;++h)c+=String.fromCharCode(a[h]);return c}function he(a,n,i){const c=a.length;(!n||n<0)&&(n=0),(!i||i<0||i>c)&&(i=c);let h="";for(let y=n;y<i;++y)h+=$n[a[y]];return h}function Pe(a,n,i){const c=a.slice(n,i);let h="";for(let y=0;y<c.length-1;y+=2)h+=String.fromCharCode(c[y]+c[y+1]*256);return h}l.prototype.slice=function(n,i){const c=this.length;n=~~n,i=i===void 0?c:~~i,n<0?(n+=c,n<0&&(n=0)):n>c&&(n=c),i<0?(i+=c,i<0&&(i=0)):i>c&&(i=c),i<n&&(i=n);const h=this.subarray(n,i);return Object.setPrototypeOf(h,l.prototype),h};function H(a,n,i){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+n>i)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(n,i,c){n=n>>>0,i=i>>>0,c||H(n,i,this.length);let h=this[n],y=1,m=0;for(;++m<i&&(y*=256);)h+=this[n+m]*y;return h},l.prototype.readUintBE=l.prototype.readUIntBE=function(n,i,c){n=n>>>0,i=i>>>0,c||H(n,i,this.length);let h=this[n+--i],y=1;for(;i>0&&(y*=256);)h+=this[n+--i]*y;return h},l.prototype.readUint8=l.prototype.readUInt8=function(n,i){return n=n>>>0,i||H(n,1,this.length),this[n]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(n,i){return n=n>>>0,i||H(n,2,this.length),this[n]|this[n+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(n,i){return n=n>>>0,i||H(n,2,this.length),this[n]<<8|this[n+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(n,i){return n=n>>>0,i||H(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(n,i){return n=n>>>0,i||H(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},l.prototype.readBigUInt64LE=Re(function(n){n=n>>>0,de(n,"offset");const i=this[n],c=this[n+7];(i===void 0||c===void 0)&&oe(n,this.length-8);const h=i+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24,y=this[++n]+this[++n]*2**8+this[++n]*2**16+c*2**24;return BigInt(h)+(BigInt(y)<<BigInt(32))}),l.prototype.readBigUInt64BE=Re(function(n){n=n>>>0,de(n,"offset");const i=this[n],c=this[n+7];(i===void 0||c===void 0)&&oe(n,this.length-8);const h=i*2**24+this[++n]*2**16+this[++n]*2**8+this[++n],y=this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+c;return(BigInt(h)<<BigInt(32))+BigInt(y)}),l.prototype.readIntLE=function(n,i,c){n=n>>>0,i=i>>>0,c||H(n,i,this.length);let h=this[n],y=1,m=0;for(;++m<i&&(y*=256);)h+=this[n+m]*y;return y*=128,h>=y&&(h-=Math.pow(2,8*i)),h},l.prototype.readIntBE=function(n,i,c){n=n>>>0,i=i>>>0,c||H(n,i,this.length);let h=i,y=1,m=this[n+--h];for(;h>0&&(y*=256);)m+=this[n+--h]*y;return y*=128,m>=y&&(m-=Math.pow(2,8*i)),m},l.prototype.readInt8=function(n,i){return n=n>>>0,i||H(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},l.prototype.readInt16LE=function(n,i){n=n>>>0,i||H(n,2,this.length);const c=this[n]|this[n+1]<<8;return c&32768?c|4294901760:c},l.prototype.readInt16BE=function(n,i){n=n>>>0,i||H(n,2,this.length);const c=this[n+1]|this[n]<<8;return c&32768?c|4294901760:c},l.prototype.readInt32LE=function(n,i){return n=n>>>0,i||H(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},l.prototype.readInt32BE=function(n,i){return n=n>>>0,i||H(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},l.prototype.readBigInt64LE=Re(function(n){n=n>>>0,de(n,"offset");const i=this[n],c=this[n+7];(i===void 0||c===void 0)&&oe(n,this.length-8);const h=this[n+4]+this[n+5]*2**8+this[n+6]*2**16+(c<<24);return(BigInt(h)<<BigInt(32))+BigInt(i+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24)}),l.prototype.readBigInt64BE=Re(function(n){n=n>>>0,de(n,"offset");const i=this[n],c=this[n+7];(i===void 0||c===void 0)&&oe(n,this.length-8);const h=(i<<24)+this[++n]*2**16+this[++n]*2**8+this[++n];return(BigInt(h)<<BigInt(32))+BigInt(this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+c)}),l.prototype.readFloatLE=function(n,i){return n=n>>>0,i||H(n,4,this.length),r.read(this,n,!0,23,4)},l.prototype.readFloatBE=function(n,i){return n=n>>>0,i||H(n,4,this.length),r.read(this,n,!1,23,4)},l.prototype.readDoubleLE=function(n,i){return n=n>>>0,i||H(n,8,this.length),r.read(this,n,!0,52,8)},l.prototype.readDoubleBE=function(n,i){return n=n>>>0,i||H(n,8,this.length),r.read(this,n,!1,52,8)};function p(a,n,i,c,h,y){if(!l.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>h||n<y)throw new RangeError('"value" argument is out of bounds');if(i+c>a.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(n,i,c,h){if(n=+n,i=i>>>0,c=c>>>0,!h){const R=Math.pow(2,8*c)-1;p(this,n,i,c,R,0)}let y=1,m=0;for(this[i]=n&255;++m<c&&(y*=256);)this[i+m]=n/y&255;return i+c},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(n,i,c,h){if(n=+n,i=i>>>0,c=c>>>0,!h){const R=Math.pow(2,8*c)-1;p(this,n,i,c,R,0)}let y=c-1,m=1;for(this[i+y]=n&255;--y>=0&&(m*=256);)this[i+y]=n/m&255;return i+c},l.prototype.writeUint8=l.prototype.writeUInt8=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,1,255,0),this[i]=n&255,i+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,2,65535,0),this[i]=n&255,this[i+1]=n>>>8,i+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,2,65535,0),this[i]=n>>>8,this[i+1]=n&255,i+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,4,4294967295,0),this[i+3]=n>>>24,this[i+2]=n>>>16,this[i+1]=n>>>8,this[i]=n&255,i+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,4,4294967295,0),this[i]=n>>>24,this[i+1]=n>>>16,this[i+2]=n>>>8,this[i+3]=n&255,i+4};function w(a,n,i,c,h){ye(n,c,h,a,i,7);let y=Number(n&BigInt(4294967295));a[i++]=y,y=y>>8,a[i++]=y,y=y>>8,a[i++]=y,y=y>>8,a[i++]=y;let m=Number(n>>BigInt(32)&BigInt(4294967295));return a[i++]=m,m=m>>8,a[i++]=m,m=m>>8,a[i++]=m,m=m>>8,a[i++]=m,i}function A(a,n,i,c,h){ye(n,c,h,a,i,7);let y=Number(n&BigInt(4294967295));a[i+7]=y,y=y>>8,a[i+6]=y,y=y>>8,a[i+5]=y,y=y>>8,a[i+4]=y;let m=Number(n>>BigInt(32)&BigInt(4294967295));return a[i+3]=m,m=m>>8,a[i+2]=m,m=m>>8,a[i+1]=m,m=m>>8,a[i]=m,i+8}l.prototype.writeBigUInt64LE=Re(function(n,i=0){return w(this,n,i,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Re(function(n,i=0){return A(this,n,i,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(n,i,c,h){if(n=+n,i=i>>>0,!h){const W=Math.pow(2,8*c-1);p(this,n,i,c,W-1,-W)}let y=0,m=1,R=0;for(this[i]=n&255;++y<c&&(m*=256);)n<0&&R===0&&this[i+y-1]!==0&&(R=1),this[i+y]=(n/m>>0)-R&255;return i+c},l.prototype.writeIntBE=function(n,i,c,h){if(n=+n,i=i>>>0,!h){const W=Math.pow(2,8*c-1);p(this,n,i,c,W-1,-W)}let y=c-1,m=1,R=0;for(this[i+y]=n&255;--y>=0&&(m*=256);)n<0&&R===0&&this[i+y+1]!==0&&(R=1),this[i+y]=(n/m>>0)-R&255;return i+c},l.prototype.writeInt8=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,1,127,-128),n<0&&(n=255+n+1),this[i]=n&255,i+1},l.prototype.writeInt16LE=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,2,32767,-32768),this[i]=n&255,this[i+1]=n>>>8,i+2},l.prototype.writeInt16BE=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,2,32767,-32768),this[i]=n>>>8,this[i+1]=n&255,i+2},l.prototype.writeInt32LE=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,4,2147483647,-2147483648),this[i]=n&255,this[i+1]=n>>>8,this[i+2]=n>>>16,this[i+3]=n>>>24,i+4},l.prototype.writeInt32BE=function(n,i,c){return n=+n,i=i>>>0,c||p(this,n,i,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[i]=n>>>24,this[i+1]=n>>>16,this[i+2]=n>>>8,this[i+3]=n&255,i+4},l.prototype.writeBigInt64LE=Re(function(n,i=0){return w(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Re(function(n,i=0){return A(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function C(a,n,i,c,h,y){if(i+c>a.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function D(a,n,i,c,h){return n=+n,i=i>>>0,h||C(a,n,i,4),r.write(a,n,i,c,23,4),i+4}l.prototype.writeFloatLE=function(n,i,c){return D(this,n,i,!0,c)},l.prototype.writeFloatBE=function(n,i,c){return D(this,n,i,!1,c)};function M(a,n,i,c,h){return n=+n,i=i>>>0,h||C(a,n,i,8),r.write(a,n,i,c,52,8),i+8}l.prototype.writeDoubleLE=function(n,i,c){return M(this,n,i,!0,c)},l.prototype.writeDoubleBE=function(n,i,c){return M(this,n,i,!1,c)},l.prototype.copy=function(n,i,c,h){if(!l.isBuffer(n))throw new TypeError("argument should be a Buffer");if(c||(c=0),!h&&h!==0&&(h=this.length),i>=n.length&&(i=n.length),i||(i=0),h>0&&h<c&&(h=c),h===c||n.length===0||this.length===0)return 0;if(i<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("sourceEnd out of bounds");h>this.length&&(h=this.length),n.length-i<h-c&&(h=n.length-i+c);const y=h-c;return this===n&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(i,c,h):Uint8Array.prototype.set.call(n,this.subarray(c,h),i),y},l.prototype.fill=function(n,i,c,h){if(typeof n=="string"){if(typeof i=="string"?(h=i,i=0,c=this.length):typeof c=="string"&&(h=c,c=this.length),h!==void 0&&typeof h!="string")throw new TypeError("encoding must be a string");if(typeof h=="string"&&!l.isEncoding(h))throw new TypeError("Unknown encoding: "+h);if(n.length===1){const m=n.charCodeAt(0);(h==="utf8"&&m<128||h==="latin1")&&(n=m)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(i<0||this.length<i||this.length<c)throw new RangeError("Out of range index");if(c<=i)return this;i=i>>>0,c=c===void 0?this.length:c>>>0,n||(n=0);let y;if(typeof n=="number")for(y=i;y<c;++y)this[y]=n;else{const m=l.isBuffer(n)?n:l.from(n,h),R=m.length;if(R===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(y=0;y<c-i;++y)this[y+i]=m[y%R]}return this};const B={};function L(a,n,i){B[a]=class extends i{constructor(){super(),Object.defineProperty(this,"message",{value:n.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${a}]`,this.stack,delete this.name}get code(){return a}set code(h){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:h,writable:!0})}toString(){return`${this.name} [${a}]: ${this.message}`}}}L("ERR_BUFFER_OUT_OF_BOUNDS",function(a){return a?`${a} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),L("ERR_INVALID_ARG_TYPE",function(a,n){return`The "${a}" argument must be of type number. Received type ${typeof n}`},TypeError),L("ERR_OUT_OF_RANGE",function(a,n,i){let c=`The value of "${a}" is out of range.`,h=i;return Number.isInteger(i)&&Math.abs(i)>2**32?h=V(String(i)):typeof i=="bigint"&&(h=String(i),(i>BigInt(2)**BigInt(32)||i<-(BigInt(2)**BigInt(32)))&&(h=V(h)),h+="n"),c+=` It must be ${n}. Received ${h}`,c},RangeError);function V(a){let n="",i=a.length;const c=a[0]==="-"?1:0;for(;i>=c+4;i-=3)n=`_${a.slice(i-3,i)}${n}`;return`${a.slice(0,i)}${n}`}function te(a,n,i){de(n,"offset"),(a[n]===void 0||a[n+i]===void 0)&&oe(n,a.length-(i+1))}function ye(a,n,i,c,h,y){if(a>i||a<n){const m=typeof n=="bigint"?"n":"";let R;throw y>3?n===0||n===BigInt(0)?R=`>= 0${m} and < 2${m} ** ${(y+1)*8}${m}`:R=`>= -(2${m} ** ${(y+1)*8-1}${m}) and < 2 ** ${(y+1)*8-1}${m}`:R=`>= ${n}${m} and <= ${i}${m}`,new B.ERR_OUT_OF_RANGE("value",R,a)}te(c,h,y)}function de(a,n){if(typeof a!="number")throw new B.ERR_INVALID_ARG_TYPE(n,"number",a)}function oe(a,n,i){throw Math.floor(a)!==a?(de(a,i),new B.ERR_OUT_OF_RANGE(i||"offset","an integer",a)):n<0?new B.ERR_BUFFER_OUT_OF_BOUNDS:new B.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${n}`,a)}const Ve=/[^+/0-9A-Za-z-_]/g;function ht(a){if(a=a.split("=")[0],a=a.trim().replace(Ve,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function ot(a,n){n=n||1/0;let i;const c=a.length;let h=null;const y=[];for(let m=0;m<c;++m){if(i=a.charCodeAt(m),i>55295&&i<57344){if(!h){if(i>56319){(n-=3)>-1&&y.push(239,191,189);continue}else if(m+1===c){(n-=3)>-1&&y.push(239,191,189);continue}h=i;continue}if(i<56320){(n-=3)>-1&&y.push(239,191,189),h=i;continue}i=(h-55296<<10|i-56320)+65536}else h&&(n-=3)>-1&&y.push(239,191,189);if(h=null,i<128){if((n-=1)<0)break;y.push(i)}else if(i<2048){if((n-=2)<0)break;y.push(i>>6|192,i&63|128)}else if(i<65536){if((n-=3)<0)break;y.push(i>>12|224,i>>6&63|128,i&63|128)}else if(i<1114112){if((n-=4)<0)break;y.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else throw new Error("Invalid code point")}return y}function Pt(a){const n=[];for(let i=0;i<a.length;++i)n.push(a.charCodeAt(i)&255);return n}function v(a,n){let i,c,h;const y=[];for(let m=0;m<a.length&&!((n-=2)<0);++m)i=a.charCodeAt(m),c=i>>8,h=i%256,y.push(h),y.push(c);return y}function dt(a){return e.toByteArray(ht(a))}function st(a,n,i,c){let h;for(h=0;h<c&&!(h+i>=n.length||h>=a.length);++h)n[h+i]=a[h];return h}function ge(a,n){return a instanceof n||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===n.name}function Rt(a){return a!==a}const $n=function(){const a="0123456789abcdef",n=new Array(256);for(let i=0;i<16;++i){const c=i*16;for(let h=0;h<16;++h)n[c+h]=a[i]+a[h]}return n}();function Re(a){return typeof BigInt>"u"?jn:a}function jn(){throw new Error("BigInt not supported")}})(Jr);var Xr={exports:{}},Y=Xr.exports={},me,be;function Xt(){throw new Error("setTimeout has not been defined")}function Zt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?me=setTimeout:me=Xt}catch{me=Xt}try{typeof clearTimeout=="function"?be=clearTimeout:be=Zt}catch{be=Zt}})();function Zr(t){if(me===setTimeout)return setTimeout(t,0);if((me===Xt||!me)&&setTimeout)return me=setTimeout,setTimeout(t,0);try{return me(t,0)}catch{try{return me.call(null,t,0)}catch{return me.call(this,t,0)}}}function Zn(t){if(be===clearTimeout)return clearTimeout(t);if((be===Zt||!be)&&clearTimeout)return be=clearTimeout,clearTimeout(t);try{return be(t)}catch{try{return be.call(null,t)}catch{return be.call(this,t)}}}var _e=[],We=!1,Ue,pt=-1;function ei(){!We||!Ue||(We=!1,Ue.length?_e=Ue.concat(_e):pt=-1,_e.length&&en())}function en(){if(!We){var t=Zr(ei);We=!0;for(var e=_e.length;e;){for(Ue=_e,_e=[];++pt<e;)Ue&&Ue[pt].run();pt=-1,e=_e.length}Ue=null,We=!1,Zn(t)}}Y.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];_e.push(new tn(t,e)),_e.length===1&&!We&&Zr(en)};function tn(t,e){this.fun=t,this.array=e}tn.prototype.run=function(){this.fun.apply(null,this.array)};Y.title="browser";Y.browser=!0;Y.env={};Y.argv=[];Y.version="";Y.versions={};function Ce(){}Y.on=Ce;Y.addListener=Ce;Y.once=Ce;Y.off=Ce;Y.removeListener=Ce;Y.removeAllListeners=Ce;Y.emit=Ce;Y.prependListener=Ce;Y.prependOnceListener=Ce;Y.listeners=function(t){return[]};Y.binding=function(t){throw new Error("process.binding is not supported")};Y.cwd=function(){return"/"};Y.chdir=function(t){throw new Error("process.chdir is not supported")};Y.umask=function(){return 0};var ti=Xr.exports;(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Jr,r=ti,o=f=>f&&f.__esModule?f:{default:f},s=o(r),u=globalThis||void 0||self;Object.defineProperty(t,"Buffer",{enumerable:!0,get:()=>e.Buffer}),Object.defineProperty(t,"process",{enumerable:!0,get:()=>s.default}),t.global=u})(O);class ri{}window.slStore=Object.create(null);class Ot{store;name;constructor(e,r){this.store=e,this.name=r}getStore(){return this.store}}const ni=t=>{const e=Object.keys(t);return Ne.computed(e.map(r=>t[r].getStore()),(...r)=>Object.fromEntries(e.map((o,s)=>[o,r[s]])))};class ut extends Ot{getValues=()=>this.getStore().get();getValue=e=>this.getStore().get()[e];setValue=(e,r)=>this.getStore().setKey(e,r);subscribe=(...e)=>this.getStore().subscribe(...e);unsubscribe=()=>this.getStore().off()}const $e=t=>Ne.map(t);var Fe;(function(t){t.ORGANIZATION="ORGANIZATION",t.STREAM="STREAM"})(Fe||(Fe={}));const ii={[ue.SdkOverlayType.BETTING]:"betting",[ue.SdkOverlayType.GAMES]:"games",[ue.SdkOverlayType.PUBLIC_CHAT]:"publicChat",[ue.SdkOverlayType.TWITTER]:"twitter"};var je;(function(t){t.Ready="ready",t.Suspended="suspended"})(je||(je={}));class fr{status;source;config;settings;listeners=new Set;settingsKey;constructor({settings:e,...r},o){this.settingsKey=ii[r.type],this.status=Ne.atom(je.Suspended),this.config=new ut($e(r),`feature:config:${this.settingsKey}`),this.settingsKey!==void 0&&e?.overlaySettings.case===this.settingsKey?this.settings=new ut($e(e.overlaySettings.value),`feature:settings:${this.settingsKey}`):this.settings=new ut($e({}),`feature:settings:${this.settingsKey}`),this.source=o}get featureConfig(){return this.config.getStore()}get featureSettings(){return this.settings.getStore()}registerEventListener(e){this.listeners.add(e)}enable=()=>{this.status.set(je.Ready)};disable=()=>{this.status.set(je.Suspended)};setFeatureConfig=({settings:e,...r})=>{let o;for(o in r)this.config.setValue(o,r[o]);if(e?.overlaySettings.case===this.settingsKey){const s=e.overlaySettings.value;if(s!==void 0){let u;for(u in s)console.log(u,s[u]),s[u]!==0&&s[u]!==""&&this.settings.setValue(u,s[u])}}};update=(e,r)=>{this.source===Fe.STREAM&&r===Fe.ORGANIZATION||(this.setFeatureConfig(e),this.source=r)};fireEvent(e){for(const r of this.listeners.values())try{r.onEvent(e)}catch(o){console.error(o)}}}class ce extends Ot{getValue=()=>this.getStore().get();getValues(){throw new Error("not implemented")}setValue=e=>this.getStore().set(e);subscribe=e=>this.getStore().subscribe(e);unsubscribe=()=>this.getStore().off();listen(e){return this.getStore().listen(e)}get(){return this.getStore().get()}}const ne=t=>Ne.atom(t),oi=(t,e)=>Ne.computed(t,e);class pe extends Ot{atomStore;constructor(e,r,o){super(e,`api:${r}`),this.atomStore=Ne.atom(),o&&e.subscribe(s=>{this.atomStore.set(o(s))})}getAtomStore=()=>this.atomStore;getValue=async()=>{const e=this.getStore();if(e.value===void 0)throw new Error("no store");return await e.value.promise,e.get().data};getValues=()=>{throw new Error("not implemented")};setValue=e=>this.getStore().set({loading:!1,data:e?.data});subscribe=e=>this.getStore().subscribe(e);unsubscribe=()=>{throw new Error("not implemented")};invalidate=()=>{this.store.invalidate()};listen=e=>this.getStore().listen(e);get(){throw new Error("not implemented")}key=()=>this.getStore().key;off=()=>this.getStore().off()}async function*si(t,e){for await(const r of e){t.response.message=r,t.received_at=Date.now();const o={type:"__GRPC_DEVTOOLS_EXTENSION__",data:t};window.postMessage(o),yield r}}const ai=()=>t=>async e=>{const r={name:e.url,request:{},response:{}};r.request.header=Object.fromEntries(e.header.entries()),r.sent_at=Date.now();try{const o=await t(e);if(r.received_at=Date.now(),r.stream=o.stream,r.response.header=Object.fromEntries(o.header.entries()),r.response.trailer=Object.fromEntries(o.trailer.entries()),o.stream)return{...o,message:si(r,o.message)};{r.request.message=e.message,r.response.message=o.message,r.latency=r.received_at-r.sent_at;const s={type:"__GRPC_DEVTOOLS_EXTENSION__",data:r};window.postMessage(s)}return o}catch(o){r.received_at=Date.now(),r.request.message=e.message,r.response.trailer={"grpc-status":o.code,"grpc-message":o.rawMessage},r.response.message=o.rawMessage,r.latency=r.received_at-r.sent_at;const s={type:"__GRPC_DEVTOOLS_EXTENSION__",data:r};throw window.postMessage(s),o}};window.dispatchEvent(new CustomEvent("grpc_devtools_loaded"));var Ee;(function(t){t.Init="init",t.Ready="ready",t.Connecting="connecting",t.Connected="connected",t.Disconnected="disconnected",t.Failed="failed",t.Reconnecting="reconnecting"})(Ee||(Ee={}));class ui{params;stream;method;name;headers;listeners;state;store;constructor(e,r,o,s){const u={status:Ee.Init,ts:new Date,log:[]};this.state=new ut($e(u),`subscription:${s.name}:state`),this.name=s.name,this.headers=e,this.listeners=new Map,this.params=o,this.method=r,s.withStore&&(this.store=new ce(ne(null),`subscription:${s.name}:store`)),"subscribe"in o&&typeof o.subscribe=="function"&&o.subscribe(()=>{this.reconnect()}),this.updateState(Ee.Ready)}updateState=e=>{this.state.setValue("status",e),this.state.setValue("ts",new Date),this.addStateLog(`status => ${e}`)};addStateLog=e=>{const r=this.state.getStore().get().log;this.state.setValue("log",[...r,`${new Date().toLocaleString()}: ${e}`])};addListener=(e,r)=>this.listeners.has(e)?(this.addStateLog(`listener '${e}' not added`),!1):(this.listeners.set(e,r),this.addStateLog(`listener '${e}' added`),!0);removeListener=e=>{this.listeners.delete(e),this.addStateLog(`listener '${e}' removed`)};connect=()=>{this.updateState(Ee.Connecting),this.stream&&(this.addStateLog("disconnect prev connection"),this.stream());const e="get"in this.params&&typeof this.params.get=="function"?this.params.get():this.params;this.stream=this.method(e,this.onData,this.onStreamError,{headers:this.headers.getValues()}),this.updateState(Ee.Connected)};disconnect=()=>{this.stream&&this.stream(),this.listeners.clear(),this.updateState(Ee.Disconnected)};reconnect=()=>{this.updateState(Ee.Reconnecting),this.connect()};getStore=()=>this.store?.getStore();onData=e=>{this.addStateLog(`received data => ${JSON.stringify(e)}`),this.store&&this.store.setValue(e);for(const[,r]of this.listeners)r(e);this.addStateLog(`data routed to ${this.listeners.size} listeners`)};onStreamError=e=>{e!==void 0&&(e.code!==Yt.Code.Canceled&&e.rawMessage!=="[canceled] BodyStreamBuffer was aborted"?(this.updateState(Ee.Failed),this.state.setValue("error",e)):this.disconnect())}}class ci{toJsonOptions={emitDefaultValues:!1,enumAsInteger:!0,useProtoFieldName:!1};transport;nanoquery;host;interceptors=[];$headers;clients;callbackClients;subscriptions;constructor(e){this.host=e,this.$headers=new ut($e({"sl-device-id":O.process?.env?.NX_DEVICE_ID||"sdk-web-dev"}),"transport:headers"),this.initInterceptors(),this.clients=new Map,this.callbackClients=new Map,this.subscriptions=new Map;const[r,o,s]=Mn.nanoquery();this.nanoquery={createFetcherStore:r,createMutatorStore:o,utils:s},this.transport=Dn.createGrpcWebTransport({baseUrl:e,interceptors:this.interceptors,useBinaryFormat:!0})}addSubscription=(e,r,o)=>{const s=this.subscriptions.get(r);if(s)return s;const u=new ui(this.$headers,e,r,o);return this.subscriptions.set(r,u),u};removeSubscription=e=>{e.disconnect(),this.subscriptions.delete(e.params)};disconnect=()=>{for(const[e,r]of this.subscriptions)r.disconnect(),this.subscriptions.delete(e)};registerInterceptor=e=>{this.interceptors.push(e)};removeInterceptor=e=>{this.interceptors=this.interceptors.filter(r=>r!==e)};getClient=e=>{const r=e.typeName;if(this.clients.has(r))return this.clients.get(r);const o=Yt.createPromiseClient(e,this.transport);return this.clients.set(r,o),o};getCallbackClient=e=>{const r=e.typeName;if(this.callbackClients.has(r))return this.callbackClients.get(r);const o=Yt.createCallbackClient(e,this.transport);return this.callbackClients.set(r,o),o};createPromiseClient=(e,{params:r=[],method:o})=>{const s=this.getClient(e),u=e.methods[o].name,f=[e.typeName,u.charAt(0).toLowerCase()+u.slice(1),...Array.isArray(r)?r:[r]],l=[e.typeName,u.charAt(0).toLowerCase()+u.slice(1)];return{client:s,queryKey:f,queryKeyStr:l.join("")}};createCallbackClient=e=>({client:this.getCallbackClient(e)});setSdkKey=e=>{this.$headers.setValue("sdk",e)};setAuth=(e,r)=>{this.$headers.setValue("authorization",e),this.$headers.setValue("sl-user-id",r)};setHeader=(e,r)=>this.$headers.setValue(e,r);getHeader=e=>this.$headers.getValue(e);getHeaders=()=>this.$headers.getValues();initInterceptors=()=>{if(this.interceptors.length!==0)return;const e=r=>o=>{const s=this.$headers.getValues();for(const u in s)o.header.set(u,s[u]);return r(o)};this.interceptors.push(e),this.interceptors.push(ai())}}const li=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Vn.Events,{method:"retrieveEventId",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>{if(!f||typeof f!="string")return"";try{return(await r.retrieveEventId({id:f})).data?.id||""}catch{return""}}})},fi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(_t.Client,{method:"getStream",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.getStream({id:f})).data?.attributes:void 0})},hi=(t,e)=>{const{queryKey:r,client:o}=e.createPromiseClient(Kr.Users,{method:"me",params:[t]});return e.nanoquery.createFetcherStore(r,{fetcher:()=>o.me({})})},di=t=>{const{client:e}=t.createPromiseClient(Kr.Users,{method:"bypassAuth"});return({userKey:r,schema:o,init:s})=>e.bypassAuth({userKey:r,schema:o,init:s})},pi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(_t.Client,{method:"get",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>(await r.get({})).data?.attributes})},yi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(_t.Client,{method:"getOrganization",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>{const s=await r.getOrganization({});return s.data?{...s.data.attributes,id:s.data.id}:void 0}})},gi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(_t.Client,{method:"getOrganizationAdvertising",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>(await r.getOrganizationAdvertising({})).data?.attributes})},mi=(t,e,r)=>{t.transport=new ci(e.host),t.sdk.host=t.transport.host,t.transport.setSdkKey(e.sdkKey),r()};class hr{delimiter=":";prefix;constructor(e="main"){this.prefix=`sl-sdk${this.delimiter}${e}`}clear=()=>{for(const e in window.localStorage)e.startsWith(this.prefix)&&window.localStorage.removeItem(e)};generateKey=e=>`${this.prefix}${this.delimiter}${e.join(this.delimiter)}`;write=(...e)=>{const r=e.pop()||"";window.localStorage.setItem(this.generateKey(e),r)};read=(...e)=>{const r=window.localStorage.getItem(this.generateKey(e));return r===null?void 0:r};remove=(...e)=>{window.localStorage.removeItem(this.generateKey(e))}}var Ie;(function(t){t.SCHEMA="schema",t.EXTERNAL_TOKEN="eToken",t.TOKEN="token"})(Ie||(Ie={}));class Ke extends hr{constructor(){super("user")}setSchema=e=>{this.write(Ie.SCHEMA,e)};getSchema=()=>this.read(Ie.SCHEMA);setToken=e=>{this.write(Ie.TOKEN,e)};getToken=()=>this.read(Ie.TOKEN);setExternalToken=e=>{this.write(Ie.EXTERNAL_TOKEN,e)};getExternalToken=()=>this.read(Ie.EXTERNAL_TOKEN);removeToken=()=>{this.remove(Ie.TOKEN)}}var Te;(function(t){t.DISABLED="disabled",t.INITIALIZATION="initialization",t.READY="ready",t.FAILED="failed",t.SUSPENDED="suspended"})(Te||(Te={}));const bi=t=>{const e=new Ke,r=new ce(ne(e.getExternalToken()),"userKey"),o=new ce(ne(e.getToken()),"userToken"),s=new pe(hi(o.getStore(),t),"user",f=>f?.data?.data?.id),u=new pe(pi(o.getStore(),t),"userSettings");return{userKey:r,userToken:o,user:s,userSettings:u}},wi=t=>{const e=new ce(ne(void 0),"providerStreamId"),r=new pe(li(e.getStore(),t),"slStreamId",s=>s?.data),o=new pe(fi(r.getAtomStore(),t),"streamSettings");return r.getAtomStore().listen(s=>{(s===""||s===void 0)&&o.getStore().mutate(void 0)}),{providerStreamId:e,slStreamId:r,streamSettings:o}},vi=t=>{const e=new ce(ne(void 0),"enabled"),r=new ce(ne(Te.DISABLED),"status"),o=new pe(yi(e.getStore(),t),"organizationSettings",l=>l?.data?.id),s=new pe(gi(o.getAtomStore(),t),"organizationAdvertising"),u=bi(t),f=wi(t);return{enabled:e,status:r,providerStreamId:f.providerStreamId,slStreamId:f.slStreamId,streamSettings:f.streamSettings,user:u.user,userKey:u.userKey,userToken:u.userToken,userSettings:u.userSettings,organizationSettings:o,organizationAdvertising:s}};class Si extends Ot{stores;constructor(e){const r=vi(e),o=ni(r);super(o,"core"),this.stores=r}getValue(){throw new Error("Not implemented")}getValues(){return this.stores}setValue(){throw new Error("Not implemented")}subscribe=e=>{let r;for(r in this.stores){const o=e[r];r in e&&o!==void 0&&this.stores[r].subscribe(e[r])}};unsubscribe=()=>this.getStore().off()}class Ai extends ri{$coreStore;transport;bypassLogin;constructor(e,r){super(),this.$coreStore=e,this.transport=r,this.bypassLogin=di(this.transport),this.connect()}me=async()=>(this.$coreStore.getValues().user.invalidate(),(await this.$coreStore.getValues().user.getValue())?.data);login=async(e,r)=>{this.$coreStore.getValues().userKey.setValue(r);const o=await this.bypassLogin({schema:e,userKey:r,init:!1}),s=o.meta?.jwt,u=o.data?.id;if(!s||!u)throw new Error("internal: token missing");return this.$coreStore.getValues().user.getStore().mutate(o),this.saveUser(s,u),s};isAuthenticated=()=>this.me();logout=()=>{this.$coreStore.getValues().user.setValue(),this.$coreStore.getValues().userKey.setValue(),this.$coreStore.getValues().userToken.setValue(),this.transport.setAuth("",""),new Ke().clear()};softLogout=()=>{const e=new Ke;this.$coreStore.getValues().user.setValue(),this.$coreStore.getValues().userToken.setValue(),this.transport.setAuth("",""),e.setToken(""),this.reLogin()};reLogin=()=>{const e=new Ke,r=e.getToken(),o=e.getExternalToken();if(this.$coreStore.getValues().userKey.setValue(o),this.$coreStore.getValues().userToken.setValue(r),r)return this.saveUser(r,""),this.me().then(s=>{if(console.log("user",s),s?.id){const u=s.id;this.saveUser(r,u)}});if(o&&!r){const s=e.getSchema();s&&o&&this.login(s,o).catch(()=>{this.logout()})}};saveUser=(e,r)=>{this.transport.setAuth(e,r),this.$coreStore.getValues().userToken.setValue(e),new Ke().setToken(e)};connect=()=>{this.transport.registerInterceptor(e=>async r=>{try{return await e(r)}catch(o){throw o.code&&(o.code===7||o.code===16)&&this.transport.getHeader("authorization")&&this.softLogout(),o}})}}const at=new Ke,Ei=(t,e,r)=>{t.auth=new Ai(t.store,t.transport),t.stores.status.listen(o=>{o===Te.READY&&t.auth.reLogin()}),t.sdk.authorizationBypass=async(o,s)=>{at.getSchema()===o&&at.getExternalToken()===s&&t.transport.getHeader("authorization")||(await t.auth.login(o,s),at.setSchema(o),at.setExternalToken(s))},t.sdk.logout=()=>{t.auth.logout(),at.clear()},t.sdk.getUserStore=()=>t.stores.user.getStore(),t.sdk.isUserAuthorized=()=>t.auth.isAuthenticated(),r()},Ii=(t,e,r)=>{t.store=new Si(t.transport),t.stores=t.store.getValues(),t.sdk.enabled=t.stores.enabled.getStore(),t.sdk.status=t.stores.status.getStore(),t.sdk.sdkStore=t.store.getStore(),t.sdk.organizationStore=()=>t.stores.organizationSettings.getStore(),t.sdk.streamStore=()=>t.stores.streamSettings.getStore(),t.storeUnsubscribe=()=>{t.store.unsubscribe()},r()},Fi=(t,e,r)=>{t.sdk=Object.create(null),t.sdk.initializeApp=async()=>{if(t.stores.enabled.get()==="on")return{enabled:!0};t.storeSubscribe(),t.stores.enabled.setValue("on"),t.stores.status.setValue(Te.INITIALIZATION);try{const o=await t.stores.organizationSettings.getValue();return o?(t.stores.status.setValue(Te.READY),{enabled:!!o}):(t.stores.status.setValue(Te.FAILED),{err:"failed"})}catch(o){return t.stores.enabled.setValue(),t.stores.status.setValue(Te.FAILED),{err:`${o}`}}},t.sdk.disableApp=()=>{t.stores.enabled.get()==="on"&&(t.stores.enabled.setValue(),t.stores.status.setValue(Te.DISABLED),t.storeUnsubscribe())},t.sdk.createEventSession=o=>{t.stores.providerStreamId.setValue(o)},r()},Ti=qn.pino({level:"trace"}),rn=(t,e)=>Ti.child({name:t},e),_i=(t,e,r)=>{const{client:o,queryKey:s}=r.createPromiseClient(Hr.Leaderboard,{method:"summary",params:[t,e]});return r.nanoquery.createFetcherStore(s,{fetcher:async(u,f,l,d)=>(await o.summary({eventId:l,userId:d})).data?.attributes})},Ci=t=>{const{client:e}=t.createPromiseClient(Hr.Leaderboard,{method:"list"});return r=>e.list(r)},Oi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Se.Feed,{method:"get",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>(await r.get({eventId:f})).data?.attributes})},xi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Se.Feed,{method:"syncQuestion",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.syncQuestion({filter:{eventId:f}})).data?.attributes:void 0})},Bi=(t,e)=>{const{client:r}=e.createCallbackClient(Se.Feed),o=Ne.atom({eventId:t.get()||"",feedId:""});return t.subscribe((u="")=>{o.set({eventId:u,feedId:""})}),e.addSubscription(r.subscription,o,{name:"feedSubscription"})},ki=(t,e)=>{const{client:r}=e.createCallbackClient(Se.Feed);return e.addSubscription(r.questionSubscription,{questionId:t},{name:"questionSubscription"})},nn=async(t,e)=>{const{client:r}=e.createPromiseClient(Se.Feed,{method:"questionByUser",params:[t]});return(await r.questionByUser({questionId:t})).data?.attributes?.question},Pi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Se.Feed,{method:"list",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.list({eventId:f})).data:[]})},Ri=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Se.Feed,{method:"insightHistory",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.insightHistory({eventId:f})).data?.map(({attributes:d})=>d):void 0})};var dr={exports:{}};const Ni=Object.getPrototypeOf({});function pr(t){function e(I){return I!=="constructor"&&I!=="prototype"&&I!=="__proto__"}function r(I){let _=0;const j=I.length,U=new Array(j);for(_=0;_<j;++_)U[_]=T(I[_]);return U}function o(I){const _={};if(d&&Object.getPrototypeOf(I)!==Ni)return d(I);const j=l(I);let U,F,x;for(U=0,F=j.length;U<F;++U)e(x=j[U])&&(_[x]=T(I[x]));return _}function s(I,_){const j=I.length,U=_.length;let F=0;const x=new Array(j+U);for(F=0;F<j;++F)x[F]=T(I[F]);for(F=0;F<U;++F)x[F+j]=T(_[F]);return x}const u=Object.prototype.propertyIsEnumerable;function f(I){const _=Object.keys(I),j=Object.getOwnPropertySymbols(I);for(let U=0,F=j.length;U<F;++U)u.call(I,j[U])&&_.push(j[U]);return _}const l=t&&t.symbols?f:Object.keys,d=typeof t?.cloneProtoObject=="function"?t.cloneProtoObject:void 0;function S(I){return typeof I=="object"&&I!==null&&!(I instanceof RegExp)&&!(I instanceof Date)}function g(I){return typeof I!="object"||I===null}const b=typeof O.Buffer<"u"?I=>typeof I!="object"||I===null||I instanceof RegExp||I instanceof Date||I instanceof O.Buffer:I=>typeof I!="object"||I===null||I instanceof RegExp||I instanceof Date,E=t&&typeof t.mergeArray=="function"?t.mergeArray({clone:T,deepmerge:P,getKeys:l,isMergeableObject:S}):s;function T(I){return S(I)?Array.isArray(I)?r(I):o(I):I}function N(I,_){const j={},U=l(I),F=l(_);let x,k,G;for(x=0,k=U.length;x<k;++x)e(G=U[x])&&F.indexOf(G)===-1&&(j[G]=T(I[G]));for(x=0,k=F.length;x<k;++x)e(G=F[x])&&(G in I&&(U.indexOf(G)!==-1&&(j[G]=P(I[G],_[G])),!0)||(j[G]=T(_[G])));return j}function P(I,_){const j=Array.isArray(_),U=Array.isArray(I);return g(_)?_:b(I)?T(_):j&&U?E(I,_):j!==U?T(_):N(I,_)}function K(){switch(arguments.length){case 0:return{};case 1:return T(arguments[0]);case 2:return P(arguments[0],arguments[1])}let I;for(let _=0,j=arguments.length;_<j;++_)I=P(I,arguments[_]);return I}return t&&t.all?K:P}dr.exports=pr;dr.exports.default=pr;var Li=dr.exports.deepmerge=pr;const Ui=t=>(e,r)=>{let o=0;const s=e.length,u=r.length,f=Math.max(s,u),l=new Array(f);for(o=0;o<f;++o)o<u?l[o]=t.deepmerge(e[o],r[o]):l[o]=t.clone(e[o]);return l},$i=Li({mergeArray:Ui}),ji=(t,e,r)=>{const o=Ne.computed([e,r],(f,l)=>{if(f&&l.data)return l.data.find(d=>d.id===f)}),s=$e({data:void 0,loading:void 0,error:void 0});return o.subscribe(async f=>{if(f&&f.type==="question"){s.setKey("loading",!0);const l=await nn(f.id,t);s.set({data:l,loading:!1});return}s.set({data:void 0,loading:!1})}),{$store:o,$extendedStore:s,updateExtendedQuestion:f=>{const l=s.get().data;if(l)for(const d of f?.answers||[])d.youVoted!==!0&&delete d.youVoted;s.set({data:$i(l,f)})}}},on=t=>(t.gamification||(t.gamification=new Di(t)),t.gamification);class Di{slStreamId;organizationId;userId;openedQuestionId;openedQuestion;activeQuestionId;feedList;moderationId;moderation;feedSubscription;questionSubscription;notifications;log;constructor(e){if(e.gamification)throw new Error("GamificationBackground Singleton error");this.log=rn("gamification-background"),this.slStreamId=e.stores.slStreamId.getAtomStore(),this.organizationId=e.stores.organizationSettings.getAtomStore(),this.userId=e.stores.user.getAtomStore(),this.moderationId=new ce(ne(void 0),"moderationId").getStore(),this.openedQuestionId=new ce(ne(void 0),"openedQuestionId").getStore(),this.notifications=e.notifications,this.moderation=new pe(Oi(this.slStreamId,e.transport),"gamification:moderation"),this.feedList=new pe(Pi(this.slStreamId,e.transport),"gamification:feedList"),this.activeQuestionId=new pe(xi(this.slStreamId,e.transport),"gamification:activeQuestionId"),this.openedQuestion=ji(e.transport,this.openedQuestionId,this.feedList.getStore()),this.openedQuestionId.listen(r=>{this.log.debug({questionId:r},"received question"),r?(this.questionSubscription=ki(r,e.transport),this.questionSubscription.addListener("feed-subscription-opened-question",o=>{window.requestAnimationFrame(()=>{this.openedQuestion.updateExtendedQuestion(o.data?.attributes?.question)})}),this.questionSubscription.connect()):(this.log.info("cleanup on close question"),this.questionSubscription!==void 0&&(e.transport.removeSubscription(this.questionSubscription),this.questionSubscription=void 0))}),this.feedSubscription=Bi(this.slStreamId,e.transport),this.feedSubscription.addListener("feed-subscription-active-question",r=>{window.requestAnimationFrame(()=>{const o=this.activeQuestionId.getStore();o&&o.mutate(r.data?.attributes)})})}getCurrentSessionId=e=>{const r=e.eventId||this.slStreamId.get()||"",o=e.userId||this.userId.get()||"",s=e.organizationId||this.organizationId.get()||"",u=e.entity||"",f=e.prefix||"";return[s,r,o,f,u].join(":")};disconnect=()=>{this.feedSubscription?.disconnect()};openQuestion=e=>{this.openedQuestionId.set(e),this.notifications.markAsViewed(this.getCurrentSessionId({prefix:"notification",entity:e}))};closeQuestion=e=>{this.openedQuestionId.set(void 0),e&&this.notifications.markAsViewed(this.getCurrentSessionId({prefix:"notification",entity:e}))}}class Mi{notificationsList;notifications;store;timeouts;waitingQueue;activeQueue;options;logger;constructor(e){this.options=e,this.logger=rn("notifications"),this.store=new Map,this.timeouts=new Map,this.waitingQueue=new Set,this.activeQueue=new Set,this.notifications=new ce(ne(new Map),"notifications-queue"),this.notificationsList=oi(this.notifications.getStore(),r=>r?[...r.values()]:[])}addToQueue=e=>{if(this.store.has(e.id)){this.logger.debug({notification:e},"skip existed notification: %o");return}const r=e.close,o=e.action;this.store.set(e.id,{...e,close:(...s)=>{r&&r(...s),this.closeNotification(e.id)},action:(...s)=>{o&&o(...s),this.closeNotification(e.id)}}),this.waitingQueue.add(e.id),this.logger.debug({notification:e},"notification added to waiting queue"),this.tickWaitingQueue()};tickWaitingQueue=()=>{if(this.activeQueue.size<this.options.concurrency){const[e]=this.waitingQueue;if(!e)return;this.activeQueue.add(e),this.waitingQueue.delete(e),this.logger.debug({job:e},"waiting queue tick"),this.tickActiveQueue(e)}else this.logger.debug({queueSize:this.activeQueue.size,concurrency:this.options.concurrency},"waiting queue tick skipped")};tickActiveQueue=e=>{if(!e)return;const r=this.store.get(e);if(!r){this.logger.debug({notificationId:e},"active queue tick skipped, notification not exist");return}const o=setTimeout(()=>{const s=e,u=new Map(this.notifications.getValue());u.set(r.id,r),this.notifications.setValue(u);const f=setTimeout(()=>{this.logger.debug({notificationId:s},"notification hiding by autoHideDuration"),this.closeNotification(s)},r.autoHideDuration||5e3);this.timeouts.set(s,f),this.logger.debug({notificationId:s,queue:[...u.values()]},"notification displayed")},r.delay||0);this.timeouts.set(e,o),this.logger.debug({notificationId:e},"active queue tick completed"),this.tickWaitingQueue()};closeNotification=e=>{const r=new Map(this.notifications.getValue()),o=r.get(e);if(o){o.hiding=!0,this.notifications.setValue(r);const s=setTimeout(()=>{const u=new Map(this.notifications.getValue());u.delete(e),this.notifications.setValue(u);const f=this.timeouts.get(e);f!==void 0&&(clearTimeout(f),this.timeouts.delete(e)),this.logger.debug({notificationId:e},"notification hidden")},this.options.animationDelay||0);this.timeouts.set(e,s)}this.store.delete(e),this.activeQueue.delete(e),this.waitingQueue.delete(e),this.tickWaitingQueue(),this.logger.debug({notificationId:e},"notification hiding")}}var vt;(function(t){t.OPENED="opened"})(vt||(vt={}));class Vi extends hr{constructor(){super("notification")}setOpened=e=>{this.write(vt.OPENED,e,"true")};isOpened=e=>this.read(vt.OPENED,e);clearNotification=()=>{this.clear()}}var Je;(function(t){t[t.ONBOARDING=1]="ONBOARDING",t[t.QUESTION=2]="QUESTION"})(Je||(Je={}));class qi{queue;storage;constructor(e={}){this.storage=new Vi,this.queue=new Mi({concurrency:1,animationDelay:300,...e})}add=e=>{this.storage.isOpened(e.id)||this.queue.addToQueue(e)};close=e=>{this.queue.closeNotification(e),this.markAsViewed(e)};getQueueStore=()=>this.queue.notificationsList;markAsViewed=e=>{this.storage.setOpened(e)}}const Qi=(t,e,r)=>{t.notifications=new qi,t.addNotification=t.notifications.add,t.sdk.getNotificationsStore=()=>t.notifications.getQueueStore(),r()},Gi=(t,e)=>{const{client:r}=t.createPromiseClient(Se.Feed,{method:"submitAnswer"});return r.submitAnswer({data:e})},zi=(t,e)=>{const{client:r}=t.createPromiseClient(Se.Feed,{method:"submitInplay"});return r.submitInplay({data:{eventId:+e}})},Ki=(t,e)=>{const{client:r}=t.createPromiseClient(Se.Feed,{method:"skipQuestion"});return r.skipQuestion({data:{id:e}})};var St;(function(t){t.ONBOARDING="onboarding"})(St||(St={}));class Hi extends hr{constructor(){super("gamification")}saveOnboardingStatus=({userId:e,eventId:r,organizationId:o},s)=>{this.write(St.ONBOARDING,o,e,r,s)};getOnboardingStatus=({userId:e,eventId:r,organizationId:o})=>this.read(St.ONBOARDING,o,e,r)}const Fr={pageSize:10},Wi=(t,e,r)=>{const o=ne({pageSize:r?.pageSize||Fr.pageSize,page:0}),s=$e({data:[],loading:void 0,error:void 0}),u=Ci(t),f=async S=>{if(S){s.setKey("loading",!0);const g={eventId:S,pagination:{page:0,pageSize:r?.pageSize||Fr.pageSize}},b=await u(g);s.set({data:b.data.map(E=>E.attributes),loading:!1}),o.set(g.pagination)}};e.listen(f);const l=()=>{f(e.get())};return o.listen(async S=>{const g=e.get(),b=s.get().data?.length||0;if(S.page>0&&g&&b>=S.page*S.pageSize){s.setKey("loading",!0);const T=await u({eventId:g,pagination:S}),N=s.get().data||[];s.set({data:[...N,...T.data.map(P=>P.attributes)],loading:!1})}}),{$store:s,fetchMore:()=>{const S=o.get();o.set({...S,page:S.page+1})},invalidate:l}},Ji=new Set([ve.QuestionType.POLL,ve.QuestionType.PREDICTION,ve.QuestionType.TRIVIA]);var re;(function(t){t.Unset="unset",t.Required="required",t.Optional="optional",t.Completed="completed",t.Disabled="disabled",t.Unavailable="unavailable"})(re||(re={}));class Yi extends fr{userSummary;feedList;leaderboardId;leaderboardList;onboardingStatus;openedQuestion;openedUser;notifications;transport;closeFeature;openFeature;background;storage;constructor(e,r,o){super(e,r),this.background=on(o),this.storage=new Hi,this.userSummary=new pe(_i(this.background.slStreamId,this.background.userId,o.transport),"gamification:userSummary"),this.feedList=this.background.feedList,this.openedUser=ne(void 0),this.leaderboardId=new ce(ne(this.settings.getValue("pinnedLeaderboardId")),"pinnedLeaderboardId").getStore(),this.onboardingStatus=new ce(ne(re.Unset),"onboardingStatus").getStore(),this.notifications=o.notifications,this.transport=o.transport,this.closeFeature=o.sdk.closeFeature,this.openFeature=()=>o.sdk.openFeature(ue.SdkOverlayType.GAMES),this.openedQuestion=this.background.openedQuestion,this.leaderboardList=Wi(this.transport,this.background.slStreamId),this.onboardingStatus.subscribe(s=>{(s===re.Optional||re.Required)&&this.showOnboardingInApp()}),this.status.subscribe(s=>{s===je.Ready?(this.notifications.close(this.background.getCurrentSessionId({prefix:"onboarding"})),this.connect(o.transport)):this.disconnect()}),this.onboardingStatus.subscribe(s=>{s&&this.background.activeQuestionId.invalidate()}),this.background.activeQuestionId.listen(s=>{s&&s.data&&this.onboardingStatus.get()&&s.data.question?.id!==void 0&&s.data.question.notification!==void 0&&s.data.moderation?.bypassNotifications?.inAppSilence!==ve.SilenceSetting.ON&&Ji.has(s.data.question.type)&&s.data.question.status===ve.QuestionStatus.ACTIVE&&this.notifications.add({type:Je.QUESTION,action:()=>s.data?.question&&this.openQuestion(s.data.question.id),close:()=>s.data?.question&&this.closeQuestion(s.data.question.id),autoHideDuration:+(s.data.moderation?.question?.appearance?.autoHideInterval||"1000"),id:this.background.getCurrentSessionId({prefix:"notification",entity:s.data.question.id}),data:{title:s.data.question.notification.title,color:s.data.question.notification.indicatorColor,icon:s.data.question.notification.image,imageMode:s.data.question.notification.imageMode,imagePosition:s.data.question.notification.imagePosition}})}),this.onboardingProcess(),this.background.userId.subscribe(s=>{s&&this.onboardingProcess()}),this.background.moderation.subscribe(s=>{s.data&&this.onboardingProcess()})}onboardingProcess=async()=>{const e=this.background.userId.get();if(!e)return;this.storage.getOnboardingStatus({userId:e,organizationId:this.background.organizationId.get()||"",eventId:this.background.slStreamId.get()||""})===re.Completed&&this.onboardingStatus.set(re.Completed);const o=await this.background.moderation.getValue();if(this.onboardingStatus.get()===re.Completed)return;const s=!!(o?.options?.onboardingEnabled&&this.featureSettings.get().inplayGame?.onboarding?.completed),u=!!this.featureSettings.get().inplayGame?.titleCard?.optIn;s?u?this.onboardingStatus.set(re.Required):this.onboardingStatus.set(re.Optional):u?this.onboardingStatus.set(re.Unavailable):this.onboardingStatus.set(re.Disabled)};showOnboardingInApp=()=>{const{inplayGame:e}=this.featureSettings.get();if(!e)return;const{titleCard:r,overview:o}=e;this.notifications.add({type:Je.ONBOARDING,id:this.background.getCurrentSessionId({prefix:"onboarding"}),action:this.openFeature,close:this.closeFeature,autoHideDuration:1e5,data:{header:r?.header,title:r?.title,subtitle:r?.subtitle,graphicBg:r?.appearance?.graphic,icon:r?.media?.icon,sponsorLogo:r?.media?.sponsorLogo,primaryColor:o?.appearance?.primaryColor}})};connect=e=>{this.userSummary.invalidate(),this.leaderboardList.invalidate(),this.feedList.invalidate(),this.background.feedSubscription.addListener("feed-subscription-prediction-close",r=>{window.requestAnimationFrame(async()=>{const o=r.data?.attributes?.question;if(!o)return;const{status:s,type:u,id:f}=o;if(s===ve.QuestionStatus.RESOLVED&&u===ve.QuestionType.PREDICTION){const l=this.background.getCurrentSessionId({prefix:`notification-id:${f}`}),S=(await nn(f,e))?.answers.find(({correct:g})=>g);this.notifications.add({type:Je.ONBOARDING,action:()=>this.openQuestion(f),close:()=>this.closeQuestion(f),autoHideDuration:5e3,id:l,data:{title:S?.youVoted?`Congratulations! You answered correctly! You won ${S.points} pts!`:`Better luck next time! Correct: ${S?.text}!`}})}})}),this.background.feedSubscription.addListener("feed-subscription-questions-list",()=>{window.requestAnimationFrame(()=>{this.feedList?.invalidate()})})};disconnect=()=>{this.background.feedSubscription.removeListener("feed-subscription-questions-list")};submitInplay=async()=>{const e=this.background.slStreamId.get();e&&(await zi(this.transport,e),this.onboardingStatus.set(re.Completed),this.storage.saveOnboardingStatus({organizationId:this.background.organizationId.get()||"",userId:this.background.userId.get()||"",eventId:e},re.Completed))};submitAnswer=async(e,r)=>{await Gi(this.transport,{questionId:e,answerId:r}),this.feedList?.invalidate()};skipQuestion=async e=>{await Ki(this.transport,e),this.feedList?.invalidate()};openQuestion=e=>(this.openFeature(),this.background.openQuestion(e));closeQuestion=e=>this.background.closeQuestion(e);openUser=e=>{const r=this.leaderboardList.$store.get().data?.find(o=>o.userId===e);this.openedUser.set(r)};closeUser=()=>{this.openedUser.set(void 0)}}class Xi extends fr{insights;closeFeature;openFeature;openedInsight;notifications;transport;background;constructor(e,r,o){super(e,r),this.background=on(o),this.notifications=o.notifications,this.transport=o.transport,this.closeFeature=o.sdk.closeFeature,this.openFeature=()=>o.sdk.openFeature(ue.SdkOverlayType.HIGHLIGHTS),this.status.subscribe(s=>{s===je.Ready?this.connect():this.disconnect()}),this.background.activeQuestionId.listen(s=>{s?.data?.question?.id&&s?.data?.question?.notification&&s.data.moderation?.bypassNotifications?.inAppSilence!==ve.SilenceSetting.ON&&s.data.question.type===ve.QuestionType.FACTOID&&s.data.question.status===ve.QuestionStatus.ACTIVE&&this.notifications.add({type:Je.QUESTION,action:()=>s.data?.question&&this.openHighlight(s.data.question.id),close:()=>s.data?.question&&this.closeHighlight(s.data.question.id),autoHideDuration:+(s.data.moderation?.question?.appearance?.autoHideInterval||"1000"),id:this.background.getCurrentSessionId({prefix:"notification",entity:s.data.question.id}),data:{title:s.data.question.notification.title,color:s.data.question.notification.indicatorColor,icon:s.data.question.notification.image,imageMode:s.data.question.notification.imageMode,imagePosition:s.data.question.notification.imagePosition}})}),this.openedInsight=this.background.openedQuestion}connect=()=>{this.insights?this.insights.invalidate():this.insights=new pe(Ri(this.background.slStreamId,this.transport),"gamification:insights"),this.background.feedSubscription.addListener("feed-subscription-insights-list",()=>{window.requestAnimationFrame(()=>{this.insights?.invalidate()})})};disconnect=()=>{this.background.feedSubscription.removeListener("feed-subscription-insights-list")};openHighlight=e=>(this.openFeature(),this.background.openQuestion(e));closeHighlight=e=>this.background.closeQuestion(e)}ue.SdkOverlayType.GAMES+"",ue.SdkOverlayType.HIGHLIGHTS+"";class Zi extends fr{constructor(e,r){super(e,r)}}const eo=(t,e,r)=>t.type===ue.SdkOverlayType.GAMES?new Yi(t,e,r):t.type===ue.SdkOverlayType.HIGHLIGHTS?new Xi(t,e,r):new Zi(t,e),to=(t,e,r)=>{t.features=new Map,t.activeFeature=new ce(ne(ue.SdkOverlayType.UNSET),"activeFeature"),t.sdk.getFeatures=()=>t.features,t.sdk.getFeature=o=>t.features.get(o),t.sdk.getActiveFeature=()=>t.activeFeature.getStore(),t.sdk.openFeature=o=>{t.activeFeature.setValue(o)},t.sdk.closeFeature=()=>{t.activeFeature.setValue(ue.SdkOverlayType.UNSET)},t.initFeature=(o,s=Fe.ORGANIZATION)=>{const u=eo(o,s,t);t.features.set(o.type,u)},t.updateFeature=(o,s)=>{t.features.get(o.type)?.update(o,s)},t.destroyFeature=o=>{t.features.delete(o.type)},t.reinitializeFeatures=async()=>{const o=await t.stores.organizationSettings.getValue();t.features.clear();for(const s of o?.overlays||[])t.initFeature(s,Fe.ORGANIZATION)},t.stores.providerStreamId.listen(o=>{o||t.reinitializeFeatures()}),t.storeSubscribe=()=>{const o=(u,f)=>{if(f?.overlays){u===Fe.STREAM&&t.features.clear();for(const l of f.overlays)l.sdkEnable===!0&&(t.features.has(l.type)?t.updateFeature(l,u):t.initFeature(l,u))}},s={organizationSettings:u=>{if(u.data)try{o(Fe.ORGANIZATION,u.data)}catch(f){console.log(f)}},streamSettings:u=>{if(u.data)try{o(Fe.STREAM,u.data)}catch(f){console.log(f)}}};t.store.subscribe(s)},r()};var yr={exports:{}},gr={exports:{}};function ro(t){var e=new t,r=e;function o(){var u=e;return u.next?e=u.next:(e=new t,r=e),u.next=null,u}function s(u){r.next=u,r=u}return{get:o,release:s}}var no=ro,io=no;function sn(t,e,r){if(typeof t=="function"&&(r=e,e=t,t=null),r<1)throw new Error("fastqueue concurrency must be greater than 1");var o=io(oo),s=null,u=null,f=0,l=null,d={push:P,drain:ae,saturated:ae,pause:g,paused:!1,concurrency:r,running:S,resume:T,idle:N,length:b,getQueue:E,unshift:K,empty:ae,kill:_,killAndDrain:j,error:U};return d;function S(){return f}function g(){d.paused=!0}function b(){for(var F=s,x=0;F;)F=F.next,x++;return x}function E(){for(var F=s,x=[];F;)x.push(F.value),F=F.next;return x}function T(){if(d.paused){d.paused=!1;for(var F=0;F<d.concurrency;F++)f++,I()}}function N(){return f===0&&d.length()===0}function P(F,x){var k=o.get();k.context=t,k.release=I,k.value=F,k.callback=x||ae,k.errorHandler=l,f===d.concurrency||d.paused?u?(u.next=k,u=k):(s=k,u=k,d.saturated()):(f++,e.call(t,k.value,k.worked))}function K(F,x){var k=o.get();k.context=t,k.release=I,k.value=F,k.callback=x||ae,f===d.concurrency||d.paused?s?(k.next=s,s=k):(s=k,u=k,d.saturated()):(f++,e.call(t,k.value,k.worked))}function I(F){F&&o.release(F);var x=s;x?d.paused?f--:(u===s&&(u=null),s=x.next,x.next=null,e.call(t,x.value,x.worked),u===null&&d.empty()):--f===0&&d.drain()}function _(){s=null,u=null,d.drain=ae}function j(){s=null,u=null,d.drain(),d.drain=ae}function U(F){l=F}}function ae(){}function oo(){this.value=null,this.callback=ae,this.next=null,this.release=ae,this.context=null,this.errorHandler=null;var t=this;this.worked=function(r,o){var s=t.callback,u=t.errorHandler,f=t.value;t.value=null,t.callback=ae,t.errorHandler&&u(r,f),s.call(t.context,r,o),t.release(t)}}function so(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function o(g,b){e.call(this,g).then(function(E){b(null,E)},b)}var s=sn(t,o,r),u=s.push,f=s.unshift;return s.push=l,s.unshift=d,s.drained=S,s;function l(g){var b=new Promise(function(E,T){u(g,function(N,P){if(N){T(N);return}E(P)})});return b.catch(ae),b}function d(g){var b=new Promise(function(E,T){f(g,function(N,P){if(N){T(N);return}E(P)})});return b.catch(ae),b}function S(){if(s.idle())return new Promise(function(E){E()});var g=s.drain,b=new Promise(function(E){s.drain=function(){g(),E()}});return b}}gr.exports=sn;gr.exports.promise=so;var an=gr.exports,mr={exports:{}},Ye=typeof Reflect=="object"?Reflect:null,Tr=Ye&&typeof Ye.apply=="function"?Ye.apply:function(e,r,o){return Function.prototype.apply.call(e,r,o)},yt;Ye&&typeof Ye.ownKeys=="function"?yt=Ye.ownKeys:Object.getOwnPropertySymbols?yt=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:yt=function(e){return Object.getOwnPropertyNames(e)};function ao(t){console&&console.warn&&console.warn(t)}var un=Number.isNaN||function(e){return e!==e};function q(){q.init.call(this)}mr.exports=q;mr.exports.once=fo;q.EventEmitter=q;q.prototype._events=void 0;q.prototype._eventsCount=0;q.prototype._maxListeners=void 0;var _r=10;function xt(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(q,"defaultMaxListeners",{enumerable:!0,get:function(){return _r},set:function(t){if(typeof t!="number"||t<0||un(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");_r=t}});q.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};q.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||un(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function cn(t){return t._maxListeners===void 0?q.defaultMaxListeners:t._maxListeners}q.prototype.getMaxListeners=function(){return cn(this)};q.prototype.emit=function(e){for(var r=[],o=1;o<arguments.length;o++)r.push(arguments[o]);var s=e==="error",u=this._events;if(u!==void 0)s=s&&u.error===void 0;else if(!s)return!1;if(s){var f;if(r.length>0&&(f=r[0]),f instanceof Error)throw f;var l=new Error("Unhandled error."+(f?" ("+f.message+")":""));throw l.context=f,l}var d=u[e];if(d===void 0)return!1;if(typeof d=="function")Tr(d,this,r);else for(var S=d.length,g=pn(d,S),o=0;o<S;++o)Tr(g[o],this,r);return!0};function ln(t,e,r,o){var s,u,f;if(xt(r),u=t._events,u===void 0?(u=t._events=Object.create(null),t._eventsCount=0):(u.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),u=t._events),f=u[e]),f===void 0)f=u[e]=r,++t._eventsCount;else if(typeof f=="function"?f=u[e]=o?[r,f]:[f,r]:o?f.unshift(r):f.push(r),s=cn(t),s>0&&f.length>s&&!f.warned){f.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+f.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=f.length,ao(l)}return t}q.prototype.addListener=function(e,r){return ln(this,e,r,!1)};q.prototype.on=q.prototype.addListener;q.prototype.prependListener=function(e,r){return ln(this,e,r,!0)};function uo(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function fn(t,e,r){var o={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=uo.bind(o);return s.listener=r,o.wrapFn=s,s}q.prototype.once=function(e,r){return xt(r),this.on(e,fn(this,e,r)),this};q.prototype.prependOnceListener=function(e,r){return xt(r),this.prependListener(e,fn(this,e,r)),this};q.prototype.removeListener=function(e,r){var o,s,u,f,l;if(xt(r),s=this._events,s===void 0)return this;if(o=s[e],o===void 0)return this;if(o===r||o.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,o.listener||r));else if(typeof o!="function"){for(u=-1,f=o.length-1;f>=0;f--)if(o[f]===r||o[f].listener===r){l=o[f].listener,u=f;break}if(u<0)return this;u===0?o.shift():co(o,u),o.length===1&&(s[e]=o[0]),s.removeListener!==void 0&&this.emit("removeListener",e,l||r)}return this};q.prototype.off=q.prototype.removeListener;q.prototype.removeAllListeners=function(e){var r,o,s;if(o=this._events,o===void 0)return this;if(o.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):o[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete o[e]),this;if(arguments.length===0){var u=Object.keys(o),f;for(s=0;s<u.length;++s)f=u[s],f!=="removeListener"&&this.removeAllListeners(f);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=o[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(s=r.length-1;s>=0;s--)this.removeListener(e,r[s]);return this};function hn(t,e,r){var o=t._events;if(o===void 0)return[];var s=o[e];return s===void 0?[]:typeof s=="function"?r?[s.listener||s]:[s]:r?lo(s):pn(s,s.length)}q.prototype.listeners=function(e){return hn(this,e,!0)};q.prototype.rawListeners=function(e){return hn(this,e,!1)};q.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):dn.call(t,e)};q.prototype.listenerCount=dn;function dn(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}q.prototype.eventNames=function(){return this._eventsCount>0?yt(this._events):[]};function pn(t,e){for(var r=new Array(e),o=0;o<e;++o)r[o]=t[o];return r}function co(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function lo(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function fo(t,e){return new Promise(function(r,o){function s(f){t.removeListener(e,u),o(f)}function u(){typeof t.removeListener=="function"&&t.removeListener("error",s),r([].slice.call(arguments))}yn(t,e,u,{once:!0}),e!=="error"&&ho(t,s,{once:!0})})}function ho(t,e,r){typeof t.on=="function"&&yn(t,"error",e,r)}function yn(t,e,r,o){if(typeof t.on=="function")o.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function s(u){o.once&&t.removeEventListener(e,s),r(u)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var gn=mr.exports,Bt={},mn={},bn=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),o=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var s=42;e[r]=s;for(r in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var u=Object.getOwnPropertySymbols(e);if(u.length!==1||u[0]!==r||!Object.prototype.propertyIsEnumerable.call(e,r))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(e,r);if(f.value!==s||f.enumerable!==!0)return!1}return!0},po=bn,br=function(){return po()&&!!Symbol.toStringTag},Cr=typeof Symbol<"u"&&Symbol,yo=bn,go=function(){return typeof Cr!="function"||typeof Symbol!="function"||typeof Cr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:yo()},Or={foo:{}},mo=Object,bo=function(){return{__proto__:Or}.foo===Or.foo&&!({__proto__:null}instanceof mo)},wo="Function.prototype.bind called on incompatible ",vo=Object.prototype.toString,So=Math.max,Ao="[object Function]",xr=function(e,r){for(var o=[],s=0;s<e.length;s+=1)o[s]=e[s];for(var u=0;u<r.length;u+=1)o[u+e.length]=r[u];return o},Eo=function(e,r){for(var o=[],s=r||0,u=0;s<e.length;s+=1,u+=1)o[u]=e[s];return o},Io=function(t,e){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=e);return r},Fo=function(e){var r=this;if(typeof r!="function"||vo.apply(r)!==Ao)throw new TypeError(wo+r);for(var o=Eo(arguments,1),s,u=function(){if(this instanceof s){var g=r.apply(this,xr(o,arguments));return Object(g)===g?g:this}return r.apply(e,xr(o,arguments))},f=So(0,r.length-o.length),l=[],d=0;d<f;d++)l[d]="$"+d;if(s=Function("binder","return function ("+Io(l,",")+"){ return binder.apply(this,arguments); }")(u),r.prototype){var S=function(){};S.prototype=r.prototype,s.prototype=new S,S.prototype=null}return s},To=Fo,wn=Function.prototype.bind||To,Br={}.hasOwnProperty,Lt=Function.prototype.call,_o=Lt.bind?Lt.bind(Br):function(t,e){return Lt.call(Br,t,e)},$,Ze=SyntaxError,vn=Function,Xe=TypeError,Ut=function(t){try{return vn('"use strict"; return ('+t+").constructor;")()}catch{}},De=Object.getOwnPropertyDescriptor;if(De)try{De({},"")}catch{De=null}var $t=function(){throw new Xe},Co=De?function(){try{return arguments.callee,$t}catch{try{return De(arguments,"callee").get}catch{return $t}}}():$t,Qe=go(),Oo=bo(),X=Object.getPrototypeOf||(Oo?function(t){return t.__proto__}:null),ze={},xo=typeof Uint8Array>"u"||!X?$:X(Uint8Array),Me={"%AggregateError%":typeof AggregateError>"u"?$:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$:ArrayBuffer,"%ArrayIteratorPrototype%":Qe&&X?X([][Symbol.iterator]()):$,"%AsyncFromSyncIteratorPrototype%":$,"%AsyncFunction%":ze,"%AsyncGenerator%":ze,"%AsyncGeneratorFunction%":ze,"%AsyncIteratorPrototype%":ze,"%Atomics%":typeof Atomics>"u"?$:Atomics,"%BigInt%":typeof BigInt>"u"?$:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$:FinalizationRegistry,"%Function%":vn,"%GeneratorFunction%":ze,"%Int8Array%":typeof Int8Array>"u"?$:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qe&&X?X(X([][Symbol.iterator]())):$,"%JSON%":typeof JSON=="object"?JSON:$,"%Map%":typeof Map>"u"?$:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qe||!X?$:X(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$:Promise,"%Proxy%":typeof Proxy>"u"?$:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qe||!X?$:X(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qe&&X?X(""[Symbol.iterator]()):$,"%Symbol%":Qe?Symbol:$,"%SyntaxError%":Ze,"%ThrowTypeError%":Co,"%TypedArray%":xo,"%TypeError%":Xe,"%Uint8Array%":typeof Uint8Array>"u"?$:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$:WeakSet};if(X)try{null.error}catch(t){var Bo=X(X(t));Me["%Error.prototype%"]=Bo}var ko=function t(e){var r;if(e==="%AsyncFunction%")r=Ut("async function () {}");else if(e==="%GeneratorFunction%")r=Ut("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Ut("async function* () {}");else if(e==="%AsyncGenerator%"){var o=t("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&X&&(r=X(s.prototype))}return Me[e]=r,r},kr={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ft=wn,At=_o,Po=ft.call(Function.call,Array.prototype.concat),Ro=ft.call(Function.apply,Array.prototype.splice),Pr=ft.call(Function.call,String.prototype.replace),Et=ft.call(Function.call,String.prototype.slice),No=ft.call(Function.call,RegExp.prototype.exec),Lo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Uo=/\\(\\)?/g,$o=function(e){var r=Et(e,0,1),o=Et(e,-1);if(r==="%"&&o!=="%")throw new Ze("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&r!=="%")throw new Ze("invalid intrinsic syntax, expected opening `%`");var s=[];return Pr(e,Lo,function(u,f,l,d){s[s.length]=l?Pr(d,Uo,"$1"):f||u}),s},jo=function(e,r){var o=e,s;if(At(kr,o)&&(s=kr[o],o="%"+s[0]+"%"),At(Me,o)){var u=Me[o];if(u===ze&&(u=ko(o)),typeof u>"u"&&!r)throw new Xe("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:o,value:u}}throw new Ze("intrinsic "+e+" does not exist!")},tt=function(e,r){if(typeof e!="string"||e.length===0)throw new Xe("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Xe('"allowMissing" argument must be a boolean');if(No(/^%?[^%]*%?$/,e)===null)throw new Ze("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=$o(e),s=o.length>0?o[0]:"",u=jo("%"+s+"%",r),f=u.name,l=u.value,d=!1,S=u.alias;S&&(s=S[0],Ro(o,Po([0,1],S)));for(var g=1,b=!0;g<o.length;g+=1){var E=o[g],T=Et(E,0,1),N=Et(E,-1);if((T==='"'||T==="'"||T==="`"||N==='"'||N==="'"||N==="`")&&T!==N)throw new Ze("property names with quotes must have matching quotes");if((E==="constructor"||!b)&&(d=!0),s+="."+E,f="%"+s+"%",At(Me,f))l=Me[f];else if(l!=null){if(!(E in l)){if(!r)throw new Xe("base intrinsic for "+e+" exists, but the property is not available.");return}if(De&&g+1>=o.length){var P=De(l,E);b=!!P,b&&"get"in P&&!("originalValue"in P.get)?l=P.get:l=l[E]}else b=At(l,E),l=l[E];b&&!d&&(Me[f]=l)}}return l},Sn={exports:{}},Do=tt,er=Do("%Object.defineProperty%",!0),tr=function(){if(er)try{return er({},"a",{value:1}),!0}catch{return!1}return!1};tr.hasArrayLengthDefineBug=function(){if(!tr())return null;try{return er([],"length",{value:1}).length!==1}catch{return!0}};var An=tr,Mo=tt,gt=Mo("%Object.getOwnPropertyDescriptor%",!0);if(gt)try{gt([],"length")}catch{gt=null}var wr=gt,Vo=An(),vr=tt,ct=Vo&&vr("%Object.defineProperty%",!0);if(ct)try{ct({},"a",{value:1})}catch{ct=!1}var qo=vr("%SyntaxError%"),Ge=vr("%TypeError%"),Rr=wr,Qo=function(e,r,o){if(!e||typeof e!="object"&&typeof e!="function")throw new Ge("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Ge("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Ge("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Ge("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Ge("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Ge("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,l=arguments.length>6?arguments[6]:!1,d=!!Rr&&Rr(e,r);if(ct)ct(e,r,{configurable:f===null&&d?d.configurable:!f,enumerable:s===null&&d?d.enumerable:!s,value:o,writable:u===null&&d?d.writable:!u});else if(l||!s&&!u&&!f)e[r]=o;else throw new qo("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},En=tt,Nr=Qo,Go=An(),Lr=wr,Ur=En("%TypeError%"),zo=En("%Math.floor%"),Ko=function(e,r){if(typeof e!="function")throw new Ur("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||zo(r)!==r)throw new Ur("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in e&&Lr){var f=Lr(e,"length");f&&!f.configurable&&(s=!1),f&&!f.writable&&(u=!1)}return(s||u||!o)&&(Go?Nr(e,"length",r,!0,!0):Nr(e,"length",r)),e};(function(t){var e=wn,r=tt,o=Ko,s=r("%TypeError%"),u=r("%Function.prototype.apply%"),f=r("%Function.prototype.call%"),l=r("%Reflect.apply%",!0)||e.call(f,u),d=r("%Object.defineProperty%",!0),S=r("%Math.max%");if(d)try{d({},"a",{value:1})}catch{d=null}t.exports=function(E){if(typeof E!="function")throw new s("a function is required");var T=l(e,f,arguments);return o(T,1+S(0,E.length-(arguments.length-1)),!0)};var g=function(){return l(e,u,arguments)};d?d(t.exports,"apply",{value:g}):t.exports.apply=g})(Sn);var In=Sn.exports,Fn=tt,Tn=In,Ho=Tn(Fn("String.prototype.indexOf")),_n=function(e,r){var o=Fn(e,!!r);return typeof o=="function"&&Ho(e,".prototype.")>-1?Tn(o):o},Wo=br(),Jo=_n,rr=Jo("Object.prototype.toString"),kt=function(e){return Wo&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:rr(e)==="[object Arguments]"},Cn=function(e){return kt(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&rr(e)!=="[object Array]"&&rr(e.callee)==="[object Function]"},Yo=function(){return kt(arguments)}();kt.isLegacyArguments=Cn;var Xo=Yo?kt:Cn,Zo=Object.prototype.toString,es=Function.prototype.toString,ts=/^\s*(?:function)?\*/,On=br(),jt=Object.getPrototypeOf,rs=function(){if(!On)return!1;try{return Function("return function*() {}")()}catch{}},Dt,ns=function(e){if(typeof e!="function")return!1;if(ts.test(es.call(e)))return!0;if(!On){var r=Zo.call(e);return r==="[object GeneratorFunction]"}if(!jt)return!1;if(typeof Dt>"u"){var o=rs();Dt=o?jt(o):!1}return jt(e)===Dt},xn=Function.prototype.toString,He=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,nr,mt;if(typeof He=="function"&&typeof Object.defineProperty=="function")try{nr=Object.defineProperty({},"length",{get:function(){throw mt}}),mt={},He(function(){throw 42},null,nr)}catch(t){t!==mt&&(He=null)}else He=null;var is=/^\s*class\b/,ir=function(e){try{var r=xn.call(e);return is.test(r)}catch{return!1}},Mt=function(e){try{return ir(e)?!1:(xn.call(e),!0)}catch{return!1}},bt=Object.prototype.toString,os="[object Object]",ss="[object Function]",as="[object GeneratorFunction]",us="[object HTMLAllCollection]",cs="[object HTML document.all class]",ls="[object HTMLCollection]",fs=typeof Symbol=="function"&&!!Symbol.toStringTag,hs=!(0 in[,]),or=function(){return!1};if(typeof document=="object"){var ds=document.all;bt.call(ds)===bt.call(document.all)&&(or=function(e){if((hs||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=bt.call(e);return(r===us||r===cs||r===ls||r===os)&&e("")==null}catch{}return!1})}var ps=He?function(e){if(or(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{He(e,null,nr)}catch(r){if(r!==mt)return!1}return!ir(e)&&Mt(e)}:function(e){if(or(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(fs)return Mt(e);if(ir(e))return!1;var r=bt.call(e);return r!==ss&&r!==as&&!/^\[object HTML/.test(r)?!1:Mt(e)},ys=ps,gs=Object.prototype.toString,Bn=Object.prototype.hasOwnProperty,ms=function(e,r,o){for(var s=0,u=e.length;s<u;s++)Bn.call(e,s)&&(o==null?r(e[s],s,e):r.call(o,e[s],s,e))},bs=function(e,r,o){for(var s=0,u=e.length;s<u;s++)o==null?r(e.charAt(s),s,e):r.call(o,e.charAt(s),s,e)},ws=function(e,r,o){for(var s in e)Bn.call(e,s)&&(o==null?r(e[s],s,e):r.call(o,e[s],s,e))},vs=function(e,r,o){if(!ys(r))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=o),gs.call(e)==="[object Array]"?ms(e,r,s):typeof e=="string"?bs(e,r,s):ws(e,r,s)},Ss=vs,Vt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],As=typeof globalThis>"u"?Wr:globalThis,Es=function(){for(var e=[],r=0;r<Vt.length;r++)typeof As[Vt[r]]=="function"&&(e[e.length]=Vt[r]);return e},It=Ss,Is=Es,$r=In,Sr=_n,wt=wr,Fs=Sr("Object.prototype.toString"),kn=br(),jr=typeof globalThis>"u"?Wr:globalThis,sr=Is(),Ar=Sr("String.prototype.slice"),qt=Object.getPrototypeOf,Ts=Sr("Array.prototype.indexOf",!0)||function(e,r){for(var o=0;o<e.length;o+=1)if(e[o]===r)return o;return-1},Ft={__proto__:null};kn&&wt&&qt?It(sr,function(t){var e=new jr[t];if(Symbol.toStringTag in e){var r=qt(e),o=wt(r,Symbol.toStringTag);if(!o){var s=qt(r);o=wt(s,Symbol.toStringTag)}Ft["$"+t]=$r(o.get)}}):It(sr,function(t){var e=new jr[t],r=e.slice||e.set;r&&(Ft["$"+t]=$r(r))});var _s=function(e){var r=!1;return It(Ft,function(o,s){if(!r)try{"$"+o(e)===s&&(r=Ar(s,1))}catch{}}),r},Cs=function(e){var r=!1;return It(Ft,function(o,s){if(!r)try{o(e),r=Ar(s,1)}catch{}}),r},Pn=function(e){if(!e||typeof e!="object")return!1;if(!kn){var r=Ar(Fs(e),8,-1);return Ts(sr,r)>-1?r:r!=="Object"?!1:Cs(e)}return wt?_s(e):null},Os=Pn,xs=function(e){return!!Os(e)};(function(t){var e=Xo,r=ns,o=Pn,s=xs;function u(v){return v.call.bind(v)}var f=typeof BigInt<"u",l=typeof Symbol<"u",d=u(Object.prototype.toString),S=u(Number.prototype.valueOf),g=u(String.prototype.valueOf),b=u(Boolean.prototype.valueOf);if(f)var E=u(BigInt.prototype.valueOf);if(l)var T=u(Symbol.prototype.valueOf);function N(v,dt){if(typeof v!="object")return!1;try{return dt(v),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=s;function P(v){return typeof Promise<"u"&&v instanceof Promise||v!==null&&typeof v=="object"&&typeof v.then=="function"&&typeof v.catch=="function"}t.isPromise=P;function K(v){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(v):s(v)||w(v)}t.isArrayBufferView=K;function I(v){return o(v)==="Uint8Array"}t.isUint8Array=I;function _(v){return o(v)==="Uint8ClampedArray"}t.isUint8ClampedArray=_;function j(v){return o(v)==="Uint16Array"}t.isUint16Array=j;function U(v){return o(v)==="Uint32Array"}t.isUint32Array=U;function F(v){return o(v)==="Int8Array"}t.isInt8Array=F;function x(v){return o(v)==="Int16Array"}t.isInt16Array=x;function k(v){return o(v)==="Int32Array"}t.isInt32Array=k;function G(v){return o(v)==="Float32Array"}t.isFloat32Array=G;function ie(v){return o(v)==="Float64Array"}t.isFloat64Array=ie;function Oe(v){return o(v)==="BigInt64Array"}t.isBigInt64Array=Oe;function Ae(v){return o(v)==="BigUint64Array"}t.isBigUint64Array=Ae;function le(v){return d(v)==="[object Map]"}le.working=typeof Map<"u"&&le(new Map);function nt(v){return typeof Map>"u"?!1:le.working?le(v):v instanceof Map}t.isMap=nt;function fe(v){return d(v)==="[object Set]"}fe.working=typeof Set<"u"&&fe(new Set);function xe(v){return typeof Set>"u"?!1:fe.working?fe(v):v instanceof Set}t.isSet=xe;function Be(v){return d(v)==="[object WeakMap]"}Be.working=typeof WeakMap<"u"&&Be(new WeakMap);function it(v){return typeof WeakMap>"u"?!1:Be.working?Be(v):v instanceof WeakMap}t.isWeakMap=it;function ke(v){return d(v)==="[object WeakSet]"}ke.working=typeof WeakSet<"u"&&ke(new WeakSet);function he(v){return ke(v)}t.isWeakSet=he;function Pe(v){return d(v)==="[object ArrayBuffer]"}Pe.working=typeof ArrayBuffer<"u"&&Pe(new ArrayBuffer);function H(v){return typeof ArrayBuffer>"u"?!1:Pe.working?Pe(v):v instanceof ArrayBuffer}t.isArrayBuffer=H;function p(v){return d(v)==="[object DataView]"}p.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&p(new DataView(new ArrayBuffer(1),0,1));function w(v){return typeof DataView>"u"?!1:p.working?p(v):v instanceof DataView}t.isDataView=w;var A=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function C(v){return d(v)==="[object SharedArrayBuffer]"}function D(v){return typeof A>"u"?!1:(typeof C.working>"u"&&(C.working=C(new A)),C.working?C(v):v instanceof A)}t.isSharedArrayBuffer=D;function M(v){return d(v)==="[object AsyncFunction]"}t.isAsyncFunction=M;function B(v){return d(v)==="[object Map Iterator]"}t.isMapIterator=B;function L(v){return d(v)==="[object Set Iterator]"}t.isSetIterator=L;function V(v){return d(v)==="[object Generator]"}t.isGeneratorObject=V;function te(v){return d(v)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=te;function ye(v){return N(v,S)}t.isNumberObject=ye;function de(v){return N(v,g)}t.isStringObject=de;function oe(v){return N(v,b)}t.isBooleanObject=oe;function Ve(v){return f&&N(v,E)}t.isBigIntObject=Ve;function ht(v){return l&&N(v,T)}t.isSymbolObject=ht;function ot(v){return ye(v)||de(v)||oe(v)||Ve(v)||ht(v)}t.isBoxedPrimitive=ot;function Pt(v){return typeof Uint8Array<"u"&&(H(v)||D(v))}t.isAnyArrayBuffer=Pt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(v){Object.defineProperty(t,v,{enumerable:!1,value:function(){throw new Error(v+" is not supported in userland")}})})})(mn);var Bs=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"},ar={exports:{}};typeof Object.create=="function"?ar.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ar.exports=function(e,r){if(r){e.super_=r;var o=function(){};o.prototype=r.prototype,e.prototype=new o,e.prototype.constructor=e}};var ks=ar.exports;(function(t){var e=Object.getOwnPropertyDescriptors||function(w){for(var A=Object.keys(w),C={},D=0;D<A.length;D++)C[A[D]]=Object.getOwnPropertyDescriptor(w,A[D]);return C},r=/%[sdj%]/g;t.format=function(p){if(!F(p)){for(var w=[],A=0;A<arguments.length;A++)w.push(f(arguments[A]));return w.join(" ")}for(var A=1,C=arguments,D=C.length,M=String(p).replace(r,function(L){if(L==="%%")return"%";if(A>=D)return L;switch(L){case"%s":return String(C[A++]);case"%d":return Number(C[A++]);case"%j":try{return JSON.stringify(C[A++])}catch{return"[Circular]"}default:return L}}),B=C[A];A<D;B=C[++A])_(B)||!ie(B)?M+=" "+B:M+=" "+f(B);return M},t.deprecate=function(p,w){if(typeof O.process<"u"&&O.process.noDeprecation===!0)return p;if(typeof O.process>"u")return function(){return t.deprecate(p,w).apply(this,arguments)};var A=!1;function C(){if(!A){if(O.process.throwDeprecation)throw new Error(w);O.process.traceDeprecation?console.trace(w):console.error(w),A=!0}return p.apply(this,arguments)}return C};var o={},s=/^$/;if(O.process.env.NODE_DEBUG){var u=O.process.env.NODE_DEBUG;u=u.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+u+"$","i")}t.debuglog=function(p){if(p=p.toUpperCase(),!o[p])if(s.test(p)){var w=O.process.pid;o[p]=function(){var A=t.format.apply(t,arguments);console.error("%s %d: %s",p,w,A)}}else o[p]=function(){};return o[p]};function f(p,w){var A={seen:[],stylize:d};return arguments.length>=3&&(A.depth=arguments[2]),arguments.length>=4&&(A.colors=arguments[3]),I(w)?A.showHidden=w:w&&t._extend(A,w),k(A.showHidden)&&(A.showHidden=!1),k(A.depth)&&(A.depth=2),k(A.colors)&&(A.colors=!1),k(A.customInspect)&&(A.customInspect=!0),A.colors&&(A.stylize=l),g(A,p,A.depth)}t.inspect=f,f.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},f.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function l(p,w){var A=f.styles[w];return A?"\x1B["+f.colors[A][0]+"m"+p+"\x1B["+f.colors[A][1]+"m":p}function d(p,w){return p}function S(p){var w={};return p.forEach(function(A,C){w[A]=!0}),w}function g(p,w,A){if(p.customInspect&&w&&le(w.inspect)&&w.inspect!==t.inspect&&!(w.constructor&&w.constructor.prototype===w)){var C=w.inspect(A,p);return F(C)||(C=g(p,C,A)),C}var D=b(p,w);if(D)return D;var M=Object.keys(w),B=S(M);if(p.showHidden&&(M=Object.getOwnPropertyNames(w)),Ae(w)&&(M.indexOf("message")>=0||M.indexOf("description")>=0))return E(w);if(M.length===0){if(le(w)){var L=w.name?": "+w.name:"";return p.stylize("[Function"+L+"]","special")}if(G(w))return p.stylize(RegExp.prototype.toString.call(w),"regexp");if(Oe(w))return p.stylize(Date.prototype.toString.call(w),"date");if(Ae(w))return E(w)}var V="",te=!1,ye=["{","}"];if(K(w)&&(te=!0,ye=["[","]"]),le(w)){var de=w.name?": "+w.name:"";V=" [Function"+de+"]"}if(G(w)&&(V=" "+RegExp.prototype.toString.call(w)),Oe(w)&&(V=" "+Date.prototype.toUTCString.call(w)),Ae(w)&&(V=" "+E(w)),M.length===0&&(!te||w.length==0))return ye[0]+V+ye[1];if(A<0)return G(w)?p.stylize(RegExp.prototype.toString.call(w),"regexp"):p.stylize("[Object]","special");p.seen.push(w);var oe;return te?oe=T(p,w,A,B,M):oe=M.map(function(Ve){return N(p,w,A,B,Ve,te)}),p.seen.pop(),P(oe,V,ye)}function b(p,w){if(k(w))return p.stylize("undefined","undefined");if(F(w)){var A="'"+JSON.stringify(w).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return p.stylize(A,"string")}if(U(w))return p.stylize(""+w,"number");if(I(w))return p.stylize(""+w,"boolean");if(_(w))return p.stylize("null","null")}function E(p){return"["+Error.prototype.toString.call(p)+"]"}function T(p,w,A,C,D){for(var M=[],B=0,L=w.length;B<L;++B)ke(w,String(B))?M.push(N(p,w,A,C,String(B),!0)):M.push("");return D.forEach(function(V){V.match(/^\d+$/)||M.push(N(p,w,A,C,V,!0))}),M}function N(p,w,A,C,D,M){var B,L,V;if(V=Object.getOwnPropertyDescriptor(w,D)||{value:w[D]},V.get?V.set?L=p.stylize("[Getter/Setter]","special"):L=p.stylize("[Getter]","special"):V.set&&(L=p.stylize("[Setter]","special")),ke(C,D)||(B="["+D+"]"),L||(p.seen.indexOf(V.value)<0?(_(A)?L=g(p,V.value,null):L=g(p,V.value,A-1),L.indexOf(`
7
+ `)>-1&&(M?L=L.split(`
8
+ `).map(function(te){return" "+te}).join(`
9
+ `).slice(2):L=`
10
+ `+L.split(`
11
+ `).map(function(te){return" "+te}).join(`
12
+ `))):L=p.stylize("[Circular]","special")),k(B)){if(M&&D.match(/^\d+$/))return L;B=JSON.stringify(""+D),B.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(B=B.slice(1,-1),B=p.stylize(B,"name")):(B=B.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),B=p.stylize(B,"string"))}return B+": "+L}function P(p,w,A){var C=p.reduce(function(D,M){return M.indexOf(`
13
+ `)>=0,D+M.replace(/\u001b\[\d\d?m/g,"").length+1},0);return C>60?A[0]+(w===""?"":w+`
14
+ `)+" "+p.join(`,
15
+ `)+" "+A[1]:A[0]+w+" "+p.join(", ")+" "+A[1]}t.types=mn;function K(p){return Array.isArray(p)}t.isArray=K;function I(p){return typeof p=="boolean"}t.isBoolean=I;function _(p){return p===null}t.isNull=_;function j(p){return p==null}t.isNullOrUndefined=j;function U(p){return typeof p=="number"}t.isNumber=U;function F(p){return typeof p=="string"}t.isString=F;function x(p){return typeof p=="symbol"}t.isSymbol=x;function k(p){return p===void 0}t.isUndefined=k;function G(p){return ie(p)&&fe(p)==="[object RegExp]"}t.isRegExp=G,t.types.isRegExp=G;function ie(p){return typeof p=="object"&&p!==null}t.isObject=ie;function Oe(p){return ie(p)&&fe(p)==="[object Date]"}t.isDate=Oe,t.types.isDate=Oe;function Ae(p){return ie(p)&&(fe(p)==="[object Error]"||p instanceof Error)}t.isError=Ae,t.types.isNativeError=Ae;function le(p){return typeof p=="function"}t.isFunction=le;function nt(p){return p===null||typeof p=="boolean"||typeof p=="number"||typeof p=="string"||typeof p=="symbol"||typeof p>"u"}t.isPrimitive=nt,t.isBuffer=Bs;function fe(p){return Object.prototype.toString.call(p)}function xe(p){return p<10?"0"+p.toString(10):p.toString(10)}var Be=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function it(){var p=new Date,w=[xe(p.getHours()),xe(p.getMinutes()),xe(p.getSeconds())].join(":");return[p.getDate(),Be[p.getMonth()],w].join(" ")}t.log=function(){console.log("%s - %s",it(),t.format.apply(t,arguments))},t.inherits=ks,t._extend=function(p,w){if(!w||!ie(w))return p;for(var A=Object.keys(w),C=A.length;C--;)p[A[C]]=w[A[C]];return p};function ke(p,w){return Object.prototype.hasOwnProperty.call(p,w)}var he=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;t.promisify=function(w){if(typeof w!="function")throw new TypeError('The "original" argument must be of type Function');if(he&&w[he]){var A=w[he];if(typeof A!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(A,he,{value:A,enumerable:!1,writable:!1,configurable:!0}),A}function A(){for(var C,D,M=new Promise(function(V,te){C=V,D=te}),B=[],L=0;L<arguments.length;L++)B.push(arguments[L]);B.push(function(V,te){V?D(V):C(te)});try{w.apply(this,B)}catch(V){D(V)}return M}return Object.setPrototypeOf(A,Object.getPrototypeOf(w)),he&&Object.defineProperty(A,he,{value:A,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(A,e(w))},t.promisify.custom=he;function Pe(p,w){if(!p){var A=new Error("Promise was rejected with a falsy value");A.reason=p,p=A}return w(p)}function H(p){if(typeof p!="function")throw new TypeError('The "original" argument must be of type Function');function w(){for(var A=[],C=0;C<arguments.length;C++)A.push(arguments[C]);var D=A.pop();if(typeof D!="function")throw new TypeError("The last argument must be of type Function");var M=this,B=function(){return D.apply(M,arguments)};p.apply(this,A).then(function(L){O.process.nextTick(B.bind(null,null,L))},function(L){O.process.nextTick(Pe.bind(null,L,B))})}return Object.setPrototypeOf(w,Object.getPrototypeOf(p)),Object.defineProperties(w,e(p)),w}t.callbackify=H})(Bt);const{inherits:Ps,format:Qt}=Bt;function Le(t,e,r=Error){if(!t)throw new Error("Avvio error code must not be empty");if(!e)throw new Error("Avvio base error message must not be empty");function o(s,u,f){if(!new.target)return new o(s,u,f);Error.captureStackTrace(this,o),this.code=t,this.message=e,this.name="AvvioError",s&&u&&f?this.message=Qt(e,s,u,f):s&&u?this.message=Qt(e,s,u):s?this.message=Qt(e,s):this.message=e}return o.prototype[Symbol.toStringTag]="Error",o.prototype.toString=function(){return`${this.name} [${this.code}]: ${this.message}`},Ps(o,r),o}var Rn={createError:Le,AVV_ERR_EXPOSE_ALREADY_DEFINED:Le("AVV_ERR_EXPOSE_ALREADY_DEFINED","'%s' () is already defined, specify an expose option"),AVV_ERR_CALLBACK_NOT_FN:Le("AVV_ERR_CALLBACK_NOT_FN","Callback for '%s' hook is not a function. Received: '%s'"),AVV_ERR_PLUGIN_NOT_VALID:Le("AVV_ERR_PLUGIN_NOT_VALID","Plugin must be a function or a promise. Received: '%s'"),AVV_ERR_ROOT_PLG_BOOTED:Le("AVV_ERR_PLUGIN_NOT_VALID","Root plugin has already booted"),AVV_ERR_PARENT_PLG_LOADED:Le("AVV_ERR_PARENT_PLG_LOADED","Impossible to load '%s' plugin because the parent '%s' was already loaded"),AVV_ERR_READY_TIMEOUT:Le("AVV_ERR_READY_TIMEOUT","Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise")},Rs=function t(e,r,o){r===void 0&&(r=""),o||(o={});var s=function(d){var S={"│":"|","└":"`","├":"+","─":"-","┬":"-"};return o.unicode===!1?S[d]:d};typeof e=="string"&&(e={label:e});var u=e.nodes||[],f=(e.label||"").split(`
16
16
  `),l=`
17
17
  `+r+(u.length?s("│"):" ")+" ";return r+f.join(l)+`
18
- `+u.map(function(p,A){var g=A===u.length-1,w=p.nodes&&p.nodes.length,E=r+(g?" ":s("│"))+" ";return r+s(g?"└":"├")+s("─")+s(w?"┬":"─")+" "+t(p,E,o).slice(r.length+2)}).join("")};const Os=Cs,$r=Symbol("avvio.TimeTree.untrackNode"),Gt=Symbol("avvio.TimeTree.trackNode"),Dr=Symbol("avvio.TimeTree.getParent"),jr=Symbol("avvio.TimeTree.getNode"),Mr=Symbol("avvio.TimeTree.addNode");let xs=class{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[Gt](e){this.tableId.set(e.id,e),this.tableLabel.has(e.label)?this.tableLabel.get(e.label).push(e):this.tableLabel.set(e.label,[e])}[$r](e){this.tableId.delete(e.id);const r=this.tableLabel.get(e.label);if(r.id){this.tableLabel.delete(e.label);return}r.pop(),r.length===0&&this.tableLabel.delete(e.label)}[Dr](e){if(e===null)return this.root;const r=this.tableLabel.get(e);return r.id?r:r[r.length-1]}[jr](e){return this.tableId.get(e)}[Mr](e,r,o){if(e===null)return this.root={id:"root",label:r,start:o,nodes:[]},this[Gt](this.root),this.root.id;const u=this[Dr](e),f=`${r}-${Math.random()}`,l={id:f,parent:e,start:o,label:r,nodes:[]};return u.nodes.push(l),this[Gt](l),f}start(e,r,o=Date.now()){return this[Mr](e,r,o)}stop(e,r=Date.now()){const o=this[jr](e);o&&(o.stop=r,o.diff=o.stop-o.start||0,this[$r](o))}toJSON(){return Object.assign({},this.root)}prittyPrint(){const e=o=>(o.label=`${o.label} ${o.diff} ms`,o.nodes.length>0&&(o.nodes=o.nodes.map(s=>e(s))),o),r=e(this.toJSON());return Os(r)}};var Bs=xs,Sr={exports:{}},ur={exports:{}},zt,Vr;function ks(){if(Vr)return zt;Vr=1;var t=1e3,e=t*60,r=e*60,o=r*24,s=o*7,u=o*365.25;zt=function(g,w){w=w||{};var E=typeof g;if(E==="string"&&g.length>0)return f(g);if(E==="number"&&isFinite(g))return w.long?p(g):l(g);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(g))};function f(g){if(g=String(g),!(g.length>100)){var w=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(g);if(w){var E=parseFloat(w[1]),T=(w[2]||"ms").toLowerCase();switch(T){case"years":case"year":case"yrs":case"yr":case"y":return E*u;case"weeks":case"week":case"w":return E*s;case"days":case"day":case"d":return E*o;case"hours":case"hour":case"hrs":case"hr":case"h":return E*r;case"minutes":case"minute":case"mins":case"min":case"m":return E*e;case"seconds":case"second":case"secs":case"sec":case"s":return E*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return E;default:return}}}}function l(g){var w=Math.abs(g);return w>=o?Math.round(g/o)+"d":w>=r?Math.round(g/r)+"h":w>=e?Math.round(g/e)+"m":w>=t?Math.round(g/t)+"s":g+"ms"}function p(g){var w=Math.abs(g);return w>=o?A(g,w,o,"day"):w>=r?A(g,w,r,"hour"):w>=e?A(g,w,e,"minute"):w>=t?A(g,w,t,"second"):g+" ms"}function A(g,w,E,T){var P=w>=E*1.5;return Math.round(g/E)+" "+T+(P?"s":"")}return zt}function Ps(t){r.debug=r,r.default=r,r.coerce=p,r.disable=u,r.enable=s,r.enabled=f,r.humanize=ks(),r.destroy=A,Object.keys(t).forEach(g=>{r[g]=t[g]}),r.names=[],r.skips=[],r.formatters={};function e(g){let w=0;for(let E=0;E<g.length;E++)w=(w<<5)-w+g.charCodeAt(E),w|=0;return r.colors[Math.abs(w)%r.colors.length]}r.selectColor=e;function r(g){let w,E=null,T,P;function N(...G){if(!N.enabled)return;const z=N,X=Number(new Date),pe=X-(w||X);z.diff=pe,z.prev=w,z.curr=X,w=X,G[0]=r.coerce(G[0]),typeof G[0]!="string"&&G.unshift("%O");let te=0;G[0]=G[0].replace(/%([a-zA-Z%])/g,(j,O)=>{if(j==="%%")return"%";te++;const re=r.formatters[O];if(typeof re=="function"){const ne=G[te];j=re.call(z,ne),G.splice(te,1),te--}return j}),r.formatArgs.call(z,G),(z.log||r.log).apply(z,G)}return N.namespace=g,N.useColors=r.useColors(),N.color=r.selectColor(g),N.extend=o,N.destroy=r.destroy,Object.defineProperty(N,"enabled",{enumerable:!0,configurable:!1,get:()=>E!==null?E:(T!==r.namespaces&&(T=r.namespaces,P=r.enabled(g)),P),set:G=>{E=G}}),typeof r.init=="function"&&r.init(N),N}function o(g,w){const E=r(this.namespace+(typeof w>"u"?":":w)+g);return E.log=this.log,E}function s(g){r.save(g),r.namespaces=g,r.names=[],r.skips=[];let w;const E=(typeof g=="string"?g:"").split(/[\s,]+/),T=E.length;for(w=0;w<T;w++)E[w]&&(g=E[w].replace(/\*/g,".*?"),g[0]==="-"?r.skips.push(new RegExp("^"+g.slice(1)+"$")):r.names.push(new RegExp("^"+g+"$")))}function u(){const g=[...r.names.map(l),...r.skips.map(l).map(w=>"-"+w)].join(",");return r.enable(""),g}function f(g){if(g[g.length-1]==="*")return!0;let w,E;for(w=0,E=r.skips.length;w<E;w++)if(r.skips[w].test(g))return!1;for(w=0,E=r.names.length;w<E;w++)if(r.names[w].test(g))return!0;return!1}function l(g){return g.toString().substring(2,g.toString().length-2).replace(/\.\*\?$/,"*")}function p(g){return g instanceof Error?g.stack||g.message:g}function A(){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 r.enable(r.load()),r}var Rs=Ps;(function(t,e){e.formatArgs=o,e.save=s,e.load=u,e.useColors=r,e.storage=f(),e.destroy=(()=>{let p=!1;return()=>{p||(p=!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`."))}})(),e.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 r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(p){if(p[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+p[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const A="color: "+this.color;p.splice(1,0,A,"color: inherit");let g=0,w=0;p[0].replace(/%[a-zA-Z%]/g,E=>{E!=="%%"&&(g++,E==="%c"&&(w=g))}),p.splice(w,0,A)}e.log=console.debug||console.log||(()=>{});function s(p){try{p?e.storage.setItem("debug",p):e.storage.removeItem("debug")}catch{}}function u(){let p;try{p=e.storage.getItem("debug")}catch{}return!p&&typeof _.process<"u"&&"env"in _.process&&(p=_.process.env.DEBUG),p}function f(){try{return localStorage}catch{}}t.exports=Rs(e);const{formatters:l}=t.exports;l.j=function(p){try{return JSON.stringify(p)}catch(A){return"[UnexpectedJSONParseError]: "+A.message}}})(ur,ur.exports);var Pn=ur.exports;const Ns=on,Ls=pn.EventEmitter,Us=Bt.inherits,W=Pn("avvio"),{AVV_ERR_READY_TIMEOUT:$s}=kn,Kt=Symbol.for("plugin-meta");function Ds(t,e){return t[Kt]&&t[Kt].name?t[Kt].name:typeof e<"u"&&typeof e!="function"&&e.name?e.name:t.name?t.name:t.toString().split(`
19
- `).slice(0,2).map(r=>r.trim()).join(" -- ")}function js(){const t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}function rt(t,e,r,o,s){this.started=!1,this.func=e,this.opts=r,this.onFinish=null,this.parent=t,this.timeout=s===void 0?t._timeout:s,this.name=Ds(e,r),this.isAfter=o,this.q=Ns(t,Ms,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}Us(rt,Ls);rt.prototype.exec=function(t,e){const r=this.func;let o=!1;const s=this.name;if(this.parent._error&&!this.isAfter){W("skipping loading of plugin as parent errored and it is not an after",s),_.process.nextTick(e);return}if(this.isAfter)this.server=t;else try{this.server=this.parent.override(t,r,this.opts)}catch(p){return W("override errored",s),e(p)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,W("exec",s);let u;const f=p=>{if(o){W("loading complete",s);return}this._error=p,W(p?"exec errored":"exec completed",s),o=!0,u&&clearTimeout(u),e(p)};this.timeout>0&&(W("setting up timeout",s,this.timeout),u=setTimeout(function(){W("timed out",s),u=null;const p=new $s(s);p.fn=r,f(p)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const l=r(this.server,this.opts,f);l&&typeof l.then=="function"&&(W("exec: resolving promise",s),l.then(()=>_.process.nextTick(f),p=>_.process.nextTick(f,p)))};rt.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const t=()=>{this.server.after((r,o)=>{this._error=r,this.q.pause(),r?(W("rejecting promise",this.name,r),this._promise.reject(r)):(W("resolving promise",this.name),this._promise.resolve()),this._promise=null,_.process.nextTick(o,r)}),this.q.resume()};let e;return this._promise?e=Promise.resolve():(this._promise=js(),e=this._promise.promise,this.server?t():this.on("start",t)),e};rt.prototype.enqueue=function(t,e){W("enqueue",this.name,t.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(t,e)};rt.prototype.finish=function(t,e){W("finish",this.name,t);const r=()=>{this.loaded||(W("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,e(t))};if(t){this._promise&&(this._promise.reject(t),this._promise=null),r();return}const o=()=>{if(W("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const s=()=>{W("wrap"),queueMicrotask(o)};this._promise.resolve(),this._promise.promise.then(s,s),this._promise=null}else r();else W("delayed",this.name),this.q.drain=()=>{W("drain",this.name),this.q.drain=Vs,queueMicrotask(o)}};queueMicrotask(o),this.q.resume()};function Ms(t,e){const r=this;_.process.nextTick(Ar.bind(r),t,e)}function Ar(t,e){if(typeof t.func.then=="function"){t.func.then(o=>{typeof o.default=="function"&&(o=o.default),t.func=o,Ar.call(this,t,e)},e);return}const r=this._current[0];this._current.unshift(t),t.exec(r&&r.server||this._server,o=>{t.finish(o,s=>{this._current.shift(),e(s)})})}function Vs(){}Sr.exports=rt;Sr.exports.loadPlugin=Ar;var qs=Sr.exports;const qr=on,Qs=pn.EventEmitter,Gs=Bt.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:Ht,AVV_ERR_CALLBACK_NOT_FN:lt,AVV_ERR_PLUGIN_NOT_VALID:zs,AVV_ERR_ROOT_PLG_BOOTED:Ks,AVV_ERR_READY_TIMEOUT:Hs}=kn,Ws=Bs,cr=qs,et=Pn("avvio"),Tt=Symbol("kAvvio"),Wt=Symbol("kThenifyDoNotWrap");function Js(t,e,r){const o=e.expose||{},s=o.use||"use",u=o.after||"after",f=o.ready||"ready",l=o.onClose||"onClose",p=o.close||"close";if(t[s])throw new Ht(s);if(t[u])throw new Ht(u);if(t[f])throw new Ht(f);t[s]=function(A,g){return r.use(A,g),this},Object.defineProperty(t,"then",{get:Rn.bind(r)}),t[Tt]=!0,t[u]=function(A){return typeof A!="function"?r._loadRegistered():(r.after(Jt(A,this)),this)},t[f]=function(A){if(A&&typeof A!="function")throw new lt(f,typeof A);return r.ready(A?Jt(A,this):void 0)},t[l]=function(A){if(typeof A!="function")throw new lt(l,typeof A);return r.onClose(ta(A,this)),this},t[p]=function(A){if(A&&typeof A!="function")throw new lt(p,typeof A);return A?(r.close(Jt(A,this)),this):r.close()}}function J(t,e,r){if(typeof t=="function"&&arguments.length===1&&(r=t,e={},t=null),typeof e=="function"&&(r=e,e={}),e=e||{},!(this instanceof J)){const o=new J(t,e,r);return t&&Js(t,e,o),o}e.autostart!==!1&&(e.autostart=!0),t=t||this,this._timeout=Number(e.timeout)||0,this._server=t,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),r&&this.once("start",r),this.started=!1,this.booted=!1,this.pluginTree=new Ws,this._readyQ=qr(this,Nn,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=Qr},this._closeQ=qr(this,ea,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=Qr},this._doStart=null,this._root=new cr(this,Ys.bind(this),e,!1,0),this._root.once("start",(o,s,u)=>{const f=this.pluginTree.start(null,s,u);this._root.once("loaded",(l,p,A)=>{this.pluginTree.stop(f,A)})}),cr.loadPlugin.call(this,this._root,o=>{et("root plugin ready");try{this.emit("preReady"),this._root=null}catch(s){o=o||this._error||s}if(o){if(this._error=o,this._readyQ.length()===0)throw o}else this.booted=!0;this._readyQ.resume()})}function Ys(t,e,r){this._doStart=r,e.autostart&&this.start()}Gs(J,Qs);J.prototype.start=function(){return this.started=!0,_.process.nextTick(this._doStart),this};J.prototype.override=function(t,e,r){return t};function Xs(t){if(t&&typeof t=="object"&&typeof t.default=="function"&&(t=t.default),!(t&&(typeof t=="function"||typeof t.then=="function")))throw new zs(typeof t);return t}J.prototype[Tt]=!0;J.prototype.use=function(t,e){return this._lastUsed=this._addPlugin(t,e,!1),this};J.prototype._loadRegistered=function(){const t=this._current[0];return!this.started&&!this.booted&&_.process.nextTick(()=>this._root.q.resume()),t?t.loadedSoFar():Promise.resolve()};Object.defineProperty(J.prototype,"then",{get:Rn});J.prototype._addPlugin=function(t,e,r){if(t=Xs(t),e=e||{},this.booted)throw new Ks;const o=this._current[0],s=new cr(this,t,e,r);if(s.once("start",(u,f,l)=>{const p=this.pluginTree.start(o.name,f,l);s.once("loaded",(A,g,w)=>{this.pluginTree.stop(p,w)})}),o.loaded)throw new Error(s.name,o.name);return o.enqueue(s,u=>{u&&(this._error=u)}),s};J.prototype.after=function(t){if(!t)return this._loadRegistered();this._addPlugin(e.bind(this),{},!0);function e(r,o,s){Nn.call(this,t,s)}return this};J.prototype.onClose=function(t){if(typeof t!="function")throw new Error("not a function");t[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(t,e.bind(this));function e(r){r&&(this._error=r)}return this};J.prototype.close=function(t){let e;if(t){if(typeof t!="function")throw new lt("close",typeof t)}else e=new Promise(function(r,o){t=function(s){if(s)return o(s);r()}});return this.ready(()=>{this._error=null,this._closeQ.push(t),_.process.nextTick(this._closeQ.resume.bind(this._closeQ))}),e};J.prototype.ready=function(t){if(t){if(typeof t!="function")throw new lt("ready",typeof t);this._readyQ.push(t),queueMicrotask(this.start.bind(this));return}return new Promise((e,r)=>{this._readyQ.push(s),this.start();const o=this._current[0].server;function s(u,f,l){u?r(u):e(o),_.process.nextTick(l)}})};J.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};J.prototype.toJSON=function(){return this.pluginTree.toJSON()};function Qr(){}function Rn(){if(this.booted){et("thenify returning null because we are already booted");return}if(this[Wt]){this[Wt]=!1;return}return et("thenify"),(t,e)=>this._loadRegistered().then(()=>(this[Wt]=!0,t(this._server)),e)}function Nn(t,e){const r=this._server,o=this._error;let s;if(this._error=null,t.length===0)this._error=o,s=t(),s&&!s[Tt]&&typeof s.then=="function"?s.then(()=>_.process.nextTick(e),u=>_.process.nextTick(e,u)):_.process.nextTick(e);else if(t.length===1)s=t(o),s&&!s[Tt]&&typeof s.then=="function"?s.then(()=>_.process.nextTick(e),u=>_.process.nextTick(e,u)):_.process.nextTick(e);else if(this._timeout===0){const u=f=>{this._error=f,e(this._error)};t.length===2?t(o,u):t(o,r,u)}else Zs.call(this,t,o,r,e)}function Zs(t,e,r,o){const s=t.name;et("setting up ready timeout",s,this._timeout);let u=setTimeout(()=>{et("timed out",s),u=null;const l=new Hs(s);l.fn=t,this._error=l,o(l)},this._timeout);t.length===2?t(e,f.bind(this)):t(e,r,f.bind(this));function f(l){u&&(clearTimeout(u),this._error=l,o(this._error))}}function ea(t,e){const r=this._server,o=t[this._isOnCloseHandlerKey];if(t.length===0||t.length===1){let s;o?s=t(r):s=t(this._error),s&&typeof s.then=="function"?(et("resolving close/onClose promise"),s.then(()=>_.process.nextTick(e),u=>_.process.nextTick(e,u))):_.process.nextTick(e)}else t.length===2?t(o?r:this._error,e):o?t(r,e):t(this._error,r,e)}function ta(t,e){return r.bind(e);function r(o,s){let u;t.length===0?(u=t(),u&&u.then?u.then(function(){_.process.nextTick(s)},s):_.process.nextTick(s)):t.length===1?(u=t(this),u&&u.then?u.then(function(){_.process.nextTick(s)},s):_.process.nextTick(s)):t(this,s)}}function Jt(t,e){return r.bind(e);function r(o,s){let u;t?t.length===0?(u=t(),u&&u.then?u.then(function(){_.process.nextTick(s,o)},s):_.process.nextTick(s,o)):t.length===1?(u=t(o),u&&u.then?u.then(function(){_.process.nextTick(s)},s):_.process.nextTick(s)):t.length===2?t(o,s):t(o,this,s):_.process.nextTick(s)}}dr.exports=J;dr.exports.express=function(t){return J(t,{expose:{use:"load"}})};var ra=dr.exports;const na=Vn(ra);function ia(t,e=!0,r=!0){const o=e?"https://grpc-web.streamlayer.io:443":"https://grpc-web.next.streamlayer.io:443",s=na(Object.create({}),{autostart:!1});return s.use(Ei),s.use(yi,{sdkKey:t,host:o}),s.use(Ai),s.use(Si),s.use(Wi),s.use($i),r&&s.after(async(u,f,l)=>{if(u)throw u;await f.sdk.initializeApp(),l()}),s.onClose(()=>{console.log("close")}),s}exports.StreamLayer=ia;
18
+ `+u.map(function(d,S){var g=S===u.length-1,b=d.nodes&&d.nodes.length,E=r+(g?" ":s("│"))+" ";return r+s(g?"└":"├")+s("─")+s(b?"┬":"─")+" "+t(d,E,o).slice(r.length+2)}).join("")};const Ns=Rs,Dr=Symbol("avvio.TimeTree.untrackNode"),Gt=Symbol("avvio.TimeTree.trackNode"),Mr=Symbol("avvio.TimeTree.getParent"),Vr=Symbol("avvio.TimeTree.getNode"),qr=Symbol("avvio.TimeTree.addNode");let Ls=class{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[Gt](e){this.tableId.set(e.id,e),this.tableLabel.has(e.label)?this.tableLabel.get(e.label).push(e):this.tableLabel.set(e.label,[e])}[Dr](e){this.tableId.delete(e.id);const r=this.tableLabel.get(e.label);if(r.id){this.tableLabel.delete(e.label);return}r.pop(),r.length===0&&this.tableLabel.delete(e.label)}[Mr](e){if(e===null)return this.root;const r=this.tableLabel.get(e);return r.id?r:r[r.length-1]}[Vr](e){return this.tableId.get(e)}[qr](e,r,o){if(e===null)return this.root={id:"root",label:r,start:o,nodes:[]},this[Gt](this.root),this.root.id;const u=this[Mr](e),f=`${r}-${Math.random()}`,l={id:f,parent:e,start:o,label:r,nodes:[]};return u.nodes.push(l),this[Gt](l),f}start(e,r,o=Date.now()){return this[qr](e,r,o)}stop(e,r=Date.now()){const o=this[Vr](e);o&&(o.stop=r,o.diff=o.stop-o.start||0,this[Dr](o))}toJSON(){return Object.assign({},this.root)}prittyPrint(){const e=o=>(o.label=`${o.label} ${o.diff} ms`,o.nodes.length>0&&(o.nodes=o.nodes.map(s=>e(s))),o),r=e(this.toJSON());return Ns(r)}};var Us=Ls,Er={exports:{}},ur={exports:{}},zt,Qr;function $s(){if(Qr)return zt;Qr=1;var t=1e3,e=t*60,r=e*60,o=r*24,s=o*7,u=o*365.25;zt=function(g,b){b=b||{};var E=typeof g;if(E==="string"&&g.length>0)return f(g);if(E==="number"&&isFinite(g))return b.long?d(g):l(g);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(g))};function f(g){if(g=String(g),!(g.length>100)){var b=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(g);if(b){var E=parseFloat(b[1]),T=(b[2]||"ms").toLowerCase();switch(T){case"years":case"year":case"yrs":case"yr":case"y":return E*u;case"weeks":case"week":case"w":return E*s;case"days":case"day":case"d":return E*o;case"hours":case"hour":case"hrs":case"hr":case"h":return E*r;case"minutes":case"minute":case"mins":case"min":case"m":return E*e;case"seconds":case"second":case"secs":case"sec":case"s":return E*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return E;default:return}}}}function l(g){var b=Math.abs(g);return b>=o?Math.round(g/o)+"d":b>=r?Math.round(g/r)+"h":b>=e?Math.round(g/e)+"m":b>=t?Math.round(g/t)+"s":g+"ms"}function d(g){var b=Math.abs(g);return b>=o?S(g,b,o,"day"):b>=r?S(g,b,r,"hour"):b>=e?S(g,b,e,"minute"):b>=t?S(g,b,t,"second"):g+" ms"}function S(g,b,E,T){var N=b>=E*1.5;return Math.round(g/E)+" "+T+(N?"s":"")}return zt}function js(t){r.debug=r,r.default=r,r.coerce=d,r.disable=u,r.enable=s,r.enabled=f,r.humanize=$s(),r.destroy=S,Object.keys(t).forEach(g=>{r[g]=t[g]}),r.names=[],r.skips=[],r.formatters={};function e(g){let b=0;for(let E=0;E<g.length;E++)b=(b<<5)-b+g.charCodeAt(E),b|=0;return r.colors[Math.abs(b)%r.colors.length]}r.selectColor=e;function r(g){let b,E=null,T,N;function P(...K){if(!P.enabled)return;const I=P,_=Number(new Date),j=_-(b||_);I.diff=j,I.prev=b,I.curr=_,b=_,K[0]=r.coerce(K[0]),typeof K[0]!="string"&&K.unshift("%O");let U=0;K[0]=K[0].replace(/%([a-zA-Z%])/g,(x,k)=>{if(x==="%%")return"%";U++;const G=r.formatters[k];if(typeof G=="function"){const ie=K[U];x=G.call(I,ie),K.splice(U,1),U--}return x}),r.formatArgs.call(I,K),(I.log||r.log).apply(I,K)}return P.namespace=g,P.useColors=r.useColors(),P.color=r.selectColor(g),P.extend=o,P.destroy=r.destroy,Object.defineProperty(P,"enabled",{enumerable:!0,configurable:!1,get:()=>E!==null?E:(T!==r.namespaces&&(T=r.namespaces,N=r.enabled(g)),N),set:K=>{E=K}}),typeof r.init=="function"&&r.init(P),P}function o(g,b){const E=r(this.namespace+(typeof b>"u"?":":b)+g);return E.log=this.log,E}function s(g){r.save(g),r.namespaces=g,r.names=[],r.skips=[];let b;const E=(typeof g=="string"?g:"").split(/[\s,]+/),T=E.length;for(b=0;b<T;b++)E[b]&&(g=E[b].replace(/\*/g,".*?"),g[0]==="-"?r.skips.push(new RegExp("^"+g.slice(1)+"$")):r.names.push(new RegExp("^"+g+"$")))}function u(){const g=[...r.names.map(l),...r.skips.map(l).map(b=>"-"+b)].join(",");return r.enable(""),g}function f(g){if(g[g.length-1]==="*")return!0;let b,E;for(b=0,E=r.skips.length;b<E;b++)if(r.skips[b].test(g))return!1;for(b=0,E=r.names.length;b<E;b++)if(r.names[b].test(g))return!0;return!1}function l(g){return g.toString().substring(2,g.toString().length-2).replace(/\.\*\?$/,"*")}function d(g){return g instanceof Error?g.stack||g.message:g}function S(){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 r.enable(r.load()),r}var Ds=js;(function(t,e){e.formatArgs=o,e.save=s,e.load=u,e.useColors=r,e.storage=f(),e.destroy=(()=>{let d=!1;return()=>{d||(d=!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`."))}})(),e.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 r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(d){if(d[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+d[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const S="color: "+this.color;d.splice(1,0,S,"color: inherit");let g=0,b=0;d[0].replace(/%[a-zA-Z%]/g,E=>{E!=="%%"&&(g++,E==="%c"&&(b=g))}),d.splice(b,0,S)}e.log=console.debug||console.log||(()=>{});function s(d){try{d?e.storage.setItem("debug",d):e.storage.removeItem("debug")}catch{}}function u(){let d;try{d=e.storage.getItem("debug")}catch{}return!d&&typeof O.process<"u"&&"env"in O.process&&(d=O.process.env.DEBUG),d}function f(){try{return localStorage}catch{}}t.exports=Ds(e);const{formatters:l}=t.exports;l.j=function(d){try{return JSON.stringify(d)}catch(S){return"[UnexpectedJSONParseError]: "+S.message}}})(ur,ur.exports);var Nn=ur.exports;const Ms=an,Vs=gn.EventEmitter,qs=Bt.inherits,Z=Nn("avvio"),{AVV_ERR_READY_TIMEOUT:Qs}=Rn,Kt=Symbol.for("plugin-meta");function Gs(t,e){return t[Kt]&&t[Kt].name?t[Kt].name:typeof e<"u"&&typeof e!="function"&&e.name?e.name:t.name?t.name:t.toString().split(`
19
+ `).slice(0,2).map(r=>r.trim()).join(" -- ")}function zs(){const t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}function rt(t,e,r,o,s){this.started=!1,this.func=e,this.opts=r,this.onFinish=null,this.parent=t,this.timeout=s===void 0?t._timeout:s,this.name=Gs(e,r),this.isAfter=o,this.q=Ms(t,Ks,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}qs(rt,Vs);rt.prototype.exec=function(t,e){const r=this.func;let o=!1;const s=this.name;if(this.parent._error&&!this.isAfter){Z("skipping loading of plugin as parent errored and it is not an after",s),O.process.nextTick(e);return}if(this.isAfter)this.server=t;else try{this.server=this.parent.override(t,r,this.opts)}catch(d){return Z("override errored",s),e(d)}this.opts=typeof this.opts=="function"?this.opts(this.server):this.opts,Z("exec",s);let u;const f=d=>{if(o){Z("loading complete",s);return}this._error=d,Z(d?"exec errored":"exec completed",s),o=!0,u&&clearTimeout(u),e(d)};this.timeout>0&&(Z("setting up timeout",s,this.timeout),u=setTimeout(function(){Z("timed out",s),u=null;const d=new Qs(s);d.fn=r,f(d)},this.timeout)),this.started=!0,this.emit("start",this.server?this.server.name:null,this.name,Date.now());const l=r(this.server,this.opts,f);l&&typeof l.then=="function"&&(Z("exec: resolving promise",s),l.then(()=>O.process.nextTick(f),d=>O.process.nextTick(f,d)))};rt.prototype.loadedSoFar=function(){if(this.loaded)return Promise.resolve();const t=()=>{this.server.after((r,o)=>{this._error=r,this.q.pause(),r?(Z("rejecting promise",this.name,r),this._promise.reject(r)):(Z("resolving promise",this.name),this._promise.resolve()),this._promise=null,O.process.nextTick(o,r)}),this.q.resume()};let e;return this._promise?e=Promise.resolve():(this._promise=zs(),e=this._promise.promise,this.server?t():this.on("start",t)),e};rt.prototype.enqueue=function(t,e){Z("enqueue",this.name,t.name),this.emit("enqueue",this.server?this.server.name:null,this.name,Date.now()),this.q.push(t,e)};rt.prototype.finish=function(t,e){Z("finish",this.name,t);const r=()=>{this.loaded||(Z("loaded",this.name),this.emit("loaded",this.server?this.server.name:null,this.name,Date.now()),this.loaded=!0,e(t))};if(t){this._promise&&(this._promise.reject(t),this._promise=null),r();return}const o=()=>{if(Z("check",this.name,this.q.length(),this.q.running(),this._promise),this.q.length()===0&&this.q.running()===0)if(this._promise){const s=()=>{Z("wrap"),queueMicrotask(o)};this._promise.resolve(),this._promise.promise.then(s,s),this._promise=null}else r();else Z("delayed",this.name),this.q.drain=()=>{Z("drain",this.name),this.q.drain=Hs,queueMicrotask(o)}};queueMicrotask(o),this.q.resume()};function Ks(t,e){const r=this;O.process.nextTick(Ir.bind(r),t,e)}function Ir(t,e){if(typeof t.func.then=="function"){t.func.then(o=>{typeof o.default=="function"&&(o=o.default),t.func=o,Ir.call(this,t,e)},e);return}const r=this._current[0];this._current.unshift(t),t.exec(r&&r.server||this._server,o=>{t.finish(o,s=>{this._current.shift(),e(s)})})}function Hs(){}Er.exports=rt;Er.exports.loadPlugin=Ir;var Ws=Er.exports;const Gr=an,Js=gn.EventEmitter,Ys=Bt.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:Ht,AVV_ERR_CALLBACK_NOT_FN:lt,AVV_ERR_PLUGIN_NOT_VALID:Xs,AVV_ERR_ROOT_PLG_BOOTED:Zs,AVV_ERR_READY_TIMEOUT:ea}=Rn,ta=Us,cr=Ws,et=Nn("avvio"),Tt=Symbol("kAvvio"),Wt=Symbol("kThenifyDoNotWrap");function ra(t,e,r){const o=e.expose||{},s=o.use||"use",u=o.after||"after",f=o.ready||"ready",l=o.onClose||"onClose",d=o.close||"close";if(t[s])throw new Ht(s);if(t[u])throw new Ht(u);if(t[f])throw new Ht(f);t[s]=function(S,g){return r.use(S,g),this},Object.defineProperty(t,"then",{get:Ln.bind(r)}),t[Tt]=!0,t[u]=function(S){return typeof S!="function"?r._loadRegistered():(r.after(Jt(S,this)),this)},t[f]=function(S){if(S&&typeof S!="function")throw new lt(f,typeof S);return r.ready(S?Jt(S,this):void 0)},t[l]=function(S){if(typeof S!="function")throw new lt(l,typeof S);return r.onClose(aa(S,this)),this},t[d]=function(S){if(S&&typeof S!="function")throw new lt(d,typeof S);return S?(r.close(Jt(S,this)),this):r.close()}}function ee(t,e,r){if(typeof t=="function"&&arguments.length===1&&(r=t,e={},t=null),typeof e=="function"&&(r=e,e={}),e=e||{},!(this instanceof ee)){const o=new ee(t,e,r);return t&&ra(t,e,o),o}e.autostart!==!1&&(e.autostart=!0),t=t||this,this._timeout=Number(e.timeout)||0,this._server=t,this._current=[],this._error=null,this._isOnCloseHandlerKey=Symbol("isOnCloseHandler"),this._lastUsed=null,this.setMaxListeners(0),r&&this.once("start",r),this.started=!1,this.booted=!1,this.pluginTree=new ta,this._readyQ=Gr(this,Un,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=zr},this._closeQ=Gr(this,sa,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=zr},this._doStart=null,this._root=new cr(this,na.bind(this),e,!1,0),this._root.once("start",(o,s,u)=>{const f=this.pluginTree.start(null,s,u);this._root.once("loaded",(l,d,S)=>{this.pluginTree.stop(f,S)})}),cr.loadPlugin.call(this,this._root,o=>{et("root plugin ready");try{this.emit("preReady"),this._root=null}catch(s){o=o||this._error||s}if(o){if(this._error=o,this._readyQ.length()===0)throw o}else this.booted=!0;this._readyQ.resume()})}function na(t,e,r){this._doStart=r,e.autostart&&this.start()}Ys(ee,Js);ee.prototype.start=function(){return this.started=!0,O.process.nextTick(this._doStart),this};ee.prototype.override=function(t,e,r){return t};function ia(t){if(t&&typeof t=="object"&&typeof t.default=="function"&&(t=t.default),!(t&&(typeof t=="function"||typeof t.then=="function")))throw new Xs(typeof t);return t}ee.prototype[Tt]=!0;ee.prototype.use=function(t,e){return this._lastUsed=this._addPlugin(t,e,!1),this};ee.prototype._loadRegistered=function(){const t=this._current[0];return!this.started&&!this.booted&&O.process.nextTick(()=>this._root.q.resume()),t?t.loadedSoFar():Promise.resolve()};Object.defineProperty(ee.prototype,"then",{get:Ln});ee.prototype._addPlugin=function(t,e,r){if(t=ia(t),e=e||{},this.booted)throw new Zs;const o=this._current[0],s=new cr(this,t,e,r);if(s.once("start",(u,f,l)=>{const d=this.pluginTree.start(o.name,f,l);s.once("loaded",(S,g,b)=>{this.pluginTree.stop(d,b)})}),o.loaded)throw new Error(s.name,o.name);return o.enqueue(s,u=>{u&&(this._error=u)}),s};ee.prototype.after=function(t){if(!t)return this._loadRegistered();this._addPlugin(e.bind(this),{},!0);function e(r,o,s){Un.call(this,t,s)}return this};ee.prototype.onClose=function(t){if(typeof t!="function")throw new Error("not a function");t[this._isOnCloseHandlerKey]=!0,this._closeQ.unshift(t,e.bind(this));function e(r){r&&(this._error=r)}return this};ee.prototype.close=function(t){let e;if(t){if(typeof t!="function")throw new lt("close",typeof t)}else e=new Promise(function(r,o){t=function(s){if(s)return o(s);r()}});return this.ready(()=>{this._error=null,this._closeQ.push(t),O.process.nextTick(this._closeQ.resume.bind(this._closeQ))}),e};ee.prototype.ready=function(t){if(t){if(typeof t!="function")throw new lt("ready",typeof t);this._readyQ.push(t),queueMicrotask(this.start.bind(this));return}return new Promise((e,r)=>{this._readyQ.push(s),this.start();const o=this._current[0].server;function s(u,f,l){u?r(u):e(o),O.process.nextTick(l)}})};ee.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};ee.prototype.toJSON=function(){return this.pluginTree.toJSON()};function zr(){}function Ln(){if(this.booted){et("thenify returning null because we are already booted");return}if(this[Wt]){this[Wt]=!1;return}return et("thenify"),(t,e)=>this._loadRegistered().then(()=>(this[Wt]=!0,t(this._server)),e)}function Un(t,e){const r=this._server,o=this._error;let s;if(this._error=null,t.length===0)this._error=o,s=t(),s&&!s[Tt]&&typeof s.then=="function"?s.then(()=>O.process.nextTick(e),u=>O.process.nextTick(e,u)):O.process.nextTick(e);else if(t.length===1)s=t(o),s&&!s[Tt]&&typeof s.then=="function"?s.then(()=>O.process.nextTick(e),u=>O.process.nextTick(e,u)):O.process.nextTick(e);else if(this._timeout===0){const u=f=>{this._error=f,e(this._error)};t.length===2?t(o,u):t(o,r,u)}else oa.call(this,t,o,r,e)}function oa(t,e,r,o){const s=t.name;et("setting up ready timeout",s,this._timeout);let u=setTimeout(()=>{et("timed out",s),u=null;const l=new ea(s);l.fn=t,this._error=l,o(l)},this._timeout);t.length===2?t(e,f.bind(this)):t(e,r,f.bind(this));function f(l){u&&(clearTimeout(u),this._error=l,o(this._error))}}function sa(t,e){const r=this._server,o=t[this._isOnCloseHandlerKey];if(t.length===0||t.length===1){let s;o?s=t(r):s=t(this._error),s&&typeof s.then=="function"?(et("resolving close/onClose promise"),s.then(()=>O.process.nextTick(e),u=>O.process.nextTick(e,u))):O.process.nextTick(e)}else t.length===2?t(o?r:this._error,e):o?t(r,e):t(this._error,r,e)}function aa(t,e){return r.bind(e);function r(o,s){let u;t.length===0?(u=t(),u&&u.then?u.then(function(){O.process.nextTick(s)},s):O.process.nextTick(s)):t.length===1?(u=t(this),u&&u.then?u.then(function(){O.process.nextTick(s)},s):O.process.nextTick(s)):t(this,s)}}function Jt(t,e){return r.bind(e);function r(o,s){let u;t?t.length===0?(u=t(),u&&u.then?u.then(function(){O.process.nextTick(s,o)},s):O.process.nextTick(s,o)):t.length===1?(u=t(o),u&&u.then?u.then(function(){O.process.nextTick(s)},s):O.process.nextTick(s)):t.length===2?t(o,s):t(o,this,s):O.process.nextTick(s)}}yr.exports=ee;yr.exports.express=function(t){return ee(t,{expose:{use:"load"}})};var ua=yr.exports;const ca=Qn(ua);function la(t,e=!0,r=!0){const o=e?"https://grpc-web.streamlayer.io:443":"https://grpc-web.next.streamlayer.io:443",s=ca(Object.create({}),{autostart:!1});return s.use(Fi),s.use(mi,{sdkKey:t,host:o}),s.use(Ii),s.use(Ei),s.use(to),s.use(Qi),r&&s.after(async(u,f,l)=>{if(u)throw u;await f.sdk.initializeApp(),l()}),s.onClose(()=>{console.log("close")}),s}exports.StreamLayer=la;