@streamlayer/sdk-web 0.28.2 → 0.28.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const de=require("@streamlayer/sl-eslib/interactive/interactive.common_pb");require("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb");const ce=require("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb"),De=require("nanostores");require("@nanostores/logger");require("microdiff");const Wt=require("@connectrpc/connect"),Un=require("@connectrpc/connect-web"),$n=require("@nanostores/query"),jn=require("@streamlayer/sl-eslib/sports/events/events_connect"),Ft=require("@streamlayer/sl-eslib/sdkSettings/client/client_connect"),Qr=require("@streamlayer/sl-eslib/users/users_connect"),Dn=require("pino"),ye=require("@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect"),Gr=require("@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_connect");var zr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var C={},Hr={},_t={};_t.byteLength=Qn;_t.toByteArray=zn;_t.fromByteArray=Wn;var Se=[],oe=[],Vn=typeof Uint8Array<"u"?Uint8Array:Array,Pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Ve=0,qn=Pt.length;Ve<qn;++Ve)Se[Ve]=Pt[Ve],oe[Pt.charCodeAt(Ve)]=Ve;oe["-".charCodeAt(0)]=62;oe["_".charCodeAt(0)]=63;function Kr(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 Qn(t){var e=Kr(t),r=e[0],o=e[1];return(r+o)*3/4-o}function Gn(t,e,r){return(e+r)*3/4-r}function zn(t){var e,r=Kr(t),o=r[0],s=r[1],u=new Vn(Gn(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 Se[t>>18&63]+Se[t>>12&63]+Se[t>>6&63]+Se[t&63]}function Kn(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 Wn(t){for(var e,r=t.length,o=r%3,s=[],u=16383,f=0,l=r-o;f<l;f+=u)s.push(Kn(t,f,f+u>l?l:f+u));return o===1?(e=t[r-1],s.push(Se[e>>2]+Se[e<<4&63]+"==")):o===2&&(e=(t[r-2]<<8)+t[r-1],s.push(Se[e>>10]+Se[e>>4&63]+Se[e<<2&63]+"=")),s.join("")}var ur={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ur.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,I=t[e+w];for(w+=E,u=I&(1<<-g)-1,I>>=-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:(I?-1:1)*(1/0);f=f+Math.pow(2,o),u=u-A}return(I?-1:1)*f*Math.pow(2,u-o)};ur.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,I=o?0:u-1,R=o?1:-1,L=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+I]=l&255,I+=R,l/=256,s-=8);for(f=f<<s|l,A+=s;A>0;t[r+I]=f&255,I+=R,f/=256,A-=8);t[r+I-R]|=L*128};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const de=require("@streamlayer/sl-eslib/interactive/interactive.common_pb");require("@streamlayer/sl-eslib/interactive/feed/interactive.feed_pb");const ce=require("@streamlayer/sl-eslib/sdkSettings/sdkSettings.common_pb"),je=require("nanostores");require("@nanostores/logger");require("microdiff");const Wt=require("@connectrpc/connect"),Un=require("@connectrpc/connect-web"),$n=require("@nanostores/query"),Dn=require("@streamlayer/sl-eslib/sports/events/events_connect"),Ft=require("@streamlayer/sl-eslib/sdkSettings/client/client_connect"),Qr=require("@streamlayer/sl-eslib/users/users_connect"),jn=require("pino"),ye=require("@streamlayer/sl-eslib/interactive/feed/interactive.feed_connect"),Gr=require("@streamlayer/sl-eslib/interactive/leaderboard/interactive.leaderboard_connect");var zr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var C={},Hr={},_t={};_t.byteLength=Qn;_t.toByteArray=zn;_t.fromByteArray=Wn;var Se=[],oe=[],Vn=typeof Uint8Array<"u"?Uint8Array:Array,Pt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Ve=0,qn=Pt.length;Ve<qn;++Ve)Se[Ve]=Pt[Ve],oe[Pt.charCodeAt(Ve)]=Ve;oe["-".charCodeAt(0)]=62;oe["_".charCodeAt(0)]=63;function Kr(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 Qn(t){var e=Kr(t),r=e[0],o=e[1];return(r+o)*3/4-o}function Gn(t,e,r){return(e+r)*3/4-r}function zn(t){var e,r=Kr(t),o=r[0],s=r[1],u=new Vn(Gn(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 Se[t>>18&63]+Se[t>>12&63]+Se[t>>6&63]+Se[t&63]}function Kn(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 Wn(t){for(var e,r=t.length,o=r%3,s=[],u=16383,f=0,l=r-o;f<l;f+=u)s.push(Kn(t,f,f+u>l?l:f+u));return o===1?(e=t[r-1],s.push(Se[e>>2]+Se[e<<4&63]+"==")):o===2&&(e=(t[r-2]<<8)+t[r-1],s.push(Se[e>>10]+Se[e>>4&63]+Se[e<<2&63]+"=")),s.join("")}var ur={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */ur.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,I=t[e+w];for(w+=E,u=I&(1<<-g)-1,I>>=-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:(I?-1:1)*(1/0);f=f+Math.pow(2,o),u=u-A}return(I?-1:1)*f*Math.pow(2,u-o)};ur.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,I=o?0:u-1,R=o?1:-1,L=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+I]=l&255,I+=R,l/=256,s-=8);for(f=f<<s|l,A+=s;A>0;t[r+I]=f&255,I+=R,f/=256,A-=8);t[r+I-R]|=L*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=_t,r=ur,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 R(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(be(a,ArrayBuffer)||a&&be(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(be(a,SharedArrayBuffer)||a&&be(a.buffer,SharedArrayBuffer)))return L(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=ge(a,n)|0;let c=f(i);const h=c.write(a,n);return h!==i&&(c=c.slice(0,h)),c}function I(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 R(a){if(be(a,Uint8Array)){const n=new Uint8Array(a);return L(n.buffer,n.byteOffset,n.byteLength)}return I(a)}function L(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"||kt(a.length)?f(0):I(a);if(a.type==="Buffer"&&Array.isArray(a.data))return I(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(be(n,Uint8Array)&&(n=l.from(n,n.offset,n.byteLength)),be(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(be(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 ge(a,n){if(l.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||be(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 nt(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return ft(a).length;default:if(h)return c?-1:nt(a).length;n=(""+n).toLowerCase(),h=!0}}l.byteLength=ge;function ee(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 rt(this,n,i);case"latin1":case"binary":return Be(this,n,i);case"base64":return tt(this,n,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xe(this,n,i);default:if(c)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function x(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)x(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)x(this,i,i+3),x(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)x(this,i,i+7),x(this,i+1,i+6),x(this,i+2,i+5),x(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):ee.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(be(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,T=c-i;const q=Math.min(m,T),M=this.slice(h,y),Q=n.slice(i,c);for(let j=0;j<q;++j)if(M[j]!==Q[j]){m=M[j],T=Q[j];break}return m<T?-1:T<m?1:0};function D(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,kt(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,T=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,T/=2,i/=2}function q(Q,j){return y===1?Q[j]:Q.readUInt16BE(j*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===T)return Q*y}else Q!==-1&&(M-=M-Q),Q=-1}else for(i+T>m&&(i=m-T),M=i;M>=0;M--){let Q=!0;for(let j=0;j<T;j++)if(q(a,M+j)!==q(n,j)){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 D(this,n,i,c,!0)},l.prototype.lastIndexOf=function(n,i,c){return D(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 T=parseInt(n.substr(m*2,2),16);if(kt(T))return m;a[i+m]=T}return m}function ne(a,n,i,c){return it(nt(n,a.length-i),a,i,c)}function Ce(a,n,i,c){return it(xt(n),a,i,c)}function Ae(a,n,i,c){return it(ft(n),a,i,c)}function le(a,n,i,c){return it(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 Ce(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 tt(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,T=y>239?4:y>223?3:y>191?2:1;if(h+T<=i){let q,M,Q,j;switch(T){case 1:y<128&&(m=y);break;case 2:q=a[h+1],(q&192)===128&&(j=(y&31)<<6|q&63,j>127&&(m=j));break;case 3:q=a[h+1],M=a[h+2],(q&192)===128&&(M&192)===128&&(j=(y&15)<<12|(q&63)<<6|M&63,j>2047&&(j<55296||j>57343)&&(m=j));break;case 4:q=a[h+1],M=a[h+2],Q=a[h+3],(q&192)===128&&(M&192)===128&&(Q&192)===128&&(j=(y&15)<<18|(q&63)<<12|(M&63)<<6|Q&63,j>65535&&j<1114112&&(m=j))}}m===null?(m=65533,T=1):m>65535&&(m-=65536,c.push(m>>>10&1023|55296),m=56320|m&1023),c.push(m),h+=T}return Oe(c)}const Te=4096;function Oe(a){const n=a.length;if(n<=Te)return String.fromCharCode.apply(String,a);let i="",c=0;for(;c<n;)i+=String.fromCharCode.apply(String,a.slice(c,c+=Te));return i}function rt(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 Be(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+=Nn[a[y]];return h}function xe(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=ke(function(n){n=n>>>0,pe(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=ke(function(n){n=n>>>0,pe(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=ke(function(n){n=n>>>0,pe(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=ke(function(n){n=n>>>0,pe(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 T=Math.pow(2,8*c)-1;d(this,n,i,c,T,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 T=Math.pow(2,8*c)-1;d(this,n,i,c,T,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){me(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){me(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=ke(function(n,i=0){return b(this,n,i,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=ke(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,T=0;for(this[i]=n&255;++y<c&&(m*=256);)n<0&&T===0&&this[i+y-1]!==0&&(T=1),this[i+y]=(n/m>>0)-T&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,T=0;for(this[i+y]=n&255;--y>=0&&(m*=256);)n<0&&T===0&&this[i+y+1]!==0&&(T=1),this[i+y]=(n/m>>0)-T&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=ke(function(n,i=0){return b(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=ke(function(n,i=0){return S(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(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 P(a,n,i,c,h){return n=+n,i=i>>>0,h||F(a,n,i,4),r.write(a,n,i,c,23,4),i+4}l.prototype.writeFloatLE=function(n,i,c){return P(this,n,i,!0,c)},l.prototype.writeFloatBE=function(n,i,c){return P(this,n,i,!1,c)};function N(a,n,i,c,h){return n=+n,i=i>>>0,h||F(a,n,i,8),r.write(a,n,i,c,52,8),i+8}l.prototype.writeDoubleLE=function(n,i,c){return N(this,n,i,!0,c)},l.prototype.writeDoubleBE=function(n,i,c){return N(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),T=m.length;if(T===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(y=0;y<c-i;++y)this[y+i]=m[y%T]}return this};const _={};function B(a,n,i){_[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}`}}}B("ERR_BUFFER_OUT_OF_BOUNDS",function(a){return a?`${a} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),B("ERR_INVALID_ARG_TYPE",function(a,n){return`The "${a}" argument must be of type number. Received type ${typeof n}`},TypeError),B("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){pe(n,"offset"),(a[n]===void 0||a[n+i]===void 0)&&ie(n,a.length-(i+1))}function me(a,n,i,c,h,y){if(a>i||a<n){const m=typeof n=="bigint"?"n":"";let T;throw y>3?n===0||n===BigInt(0)?T=`>= 0${m} and < 2${m} ** ${(y+1)*8}${m}`:T=`>= -(2${m} ** ${(y+1)*8-1}${m}) and < 2 ** ${(y+1)*8-1}${m}`:T=`>= ${n}${m} and <= ${i}${m}`,new _.ERR_OUT_OF_RANGE("value",T,a)}Y(c,h,y)}function pe(a,n){if(typeof a!="number")throw new _.ERR_INVALID_ARG_TYPE(n,"number",a)}function ie(a,n,i){throw Math.floor(a)!==a?(pe(a,i),new _.ERR_OUT_OF_RANGE(i||"offset","an integer",a)):n<0?new _.ERR_BUFFER_OUT_OF_BOUNDS:new _.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${n}`,a)}const Me=/[^+/0-9A-Za-z-_]/g;function lt(a){if(a=a.split("=")[0],a=a.trim().replace(Me,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function nt(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 xt(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 ft(a){return e.toByteArray(lt(a))}function it(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 be(a,n){return a instanceof n||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===n.name}function kt(a){return a!==a}const Nn=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 ke(a){return typeof BigInt>"u"?Ln:a}function Ln(){throw new Error("BigInt not supported")}})(Hr);var Wr={exports:{}},H=Wr.exports={},we,ve;function Jt(){throw new Error("setTimeout has not been defined")}function Yt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?we=setTimeout:we=Jt}catch{we=Jt}try{typeof clearTimeout=="function"?ve=clearTimeout:ve=Yt}catch{ve=Yt}})();function Jr(t){if(we===setTimeout)return setTimeout(t,0);if((we===Jt||!we)&&setTimeout)return we=setTimeout,setTimeout(t,0);try{return we(t,0)}catch{try{return we.call(null,t,0)}catch{return we.call(this,t,0)}}}function Jn(t){if(ve===clearTimeout)return clearTimeout(t);if((ve===Yt||!ve)&&clearTimeout)return ve=clearTimeout,clearTimeout(t);try{return ve(t)}catch{try{return ve.call(null,t)}catch{return ve.call(this,t)}}}var Fe=[],He=!1,Le,ht=-1;function Yn(){!He||!Le||(He=!1,Le.length?Fe=Le.concat(Fe):ht=-1,Fe.length&&Yr())}function Yr(){if(!He){var t=Jr(Yn);He=!0;for(var e=Fe.length;e;){for(Le=Fe,Fe=[];++ht<e;)Le&&Le[ht].run();ht=-1,e=Fe.length}Le=null,He=!1,Jn(t)}}H.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];Fe.push(new Xr(t,e)),Fe.length===1&&!He&&Jr(Yr)};function Xr(t,e){this.fun=t,this.array=e}Xr.prototype.run=function(){this.fun.apply(null,this.array)};H.title="browser";H.browser=!0;H.env={};H.argv=[];H.version="";H.versions={};function _e(){}H.on=_e;H.addListener=_e;H.once=_e;H.off=_e;H.removeListener=_e;H.removeAllListeners=_e;H.emit=_e;H.prependListener=_e;H.prependOnceListener=_e;H.listeners=function(t){return[]};H.binding=function(t){throw new Error("process.binding is not supported")};H.cwd=function(){return"/"};H.chdir=function(t){throw new Error("process.chdir is not supported")};H.umask=function(){return 0};var Xn=Wr.exports;(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Hr,r=Xn,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})(C);class Zn{}window.slStore=Object.create(null);class Ct{store;name;constructor(e,r){this.store=e,this.name=r}getStore(){return this.store}}const ei=t=>{const e=Object.keys(t);return De.computed(e.map(r=>t[r].getStore()),(...r)=>Object.fromEntries(e.map((o,s)=>[o,r[s]])))};class ot extends Ct{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 st=t=>De.map(t);var Ie;(function(t){t.ORGANIZATION="ORGANIZATION",t.STREAM="STREAM"})(Ie||(Ie={}));const ti={[ce.SdkOverlayType.BETTING]:"betting",[ce.SdkOverlayType.GAMES]:"games",[ce.SdkOverlayType.PUBLIC_CHAT]:"publicChat",[ce.SdkOverlayType.TWITTER]:"twitter"};var Ue;(function(t){t.Ready="ready",t.Suspended="suspended"})(Ue||(Ue={}));class cr{status;source;config;settings;listeners=new Set;settingsKey;constructor({settings:e,...r},o){this.settingsKey=ti[r.type],this.status=De.atom(Ue.Suspended),this.config=new ot(st(r),`feature:config:${this.settingsKey}`),this.settingsKey!==void 0&&e?.overlaySettings.case===this.settingsKey?this.settings=new ot(st(e.overlaySettings.value),`feature:settings:${this.settingsKey}`):this.settings=new ot(st({}),`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(Ue.Ready)};disable=()=>{this.status.set(Ue.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===Ie.STREAM&&r===Ie.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 ae extends Ct{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 ue=t=>De.atom(t),lr=(t,e)=>De.computed(t,e);class te extends Ct{atomStore;constructor(e,r,o){super(e,`api:${r}`),this.atomStore=De.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*ri(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 ni=()=>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:ri(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 ii{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 ot(st(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 ae(ue(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!==Wt.Code.Canceled&&e.rawMessage!=="[canceled] BodyStreamBuffer was aborted"?(this.updateState(Ee.Failed),this.state.setValue("error",e)):this.disconnect())}}class oi{toJsonOptions={emitDefaultValues:!1,enumAsInteger:!0,useProtoFieldName:!1};transport;nanoquery;host;interceptors=[];$headers;clients;callbackClients;subscriptions;constructor(e){this.host=e,this.$headers=new ot(st({"sl-device-id":C.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]=$n.nanoquery();this.nanoquery={createFetcherStore:r,createMutatorStore:o,utils:s},this.transport=Un.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 ii(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=Wt.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=Wt.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=>{this.$headers.setValue("authorization",e)};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(ni())}}const si=(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""}}})},ai=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Ft.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})},ui=(t,e)=>{const{queryKey:r,client:o}=e.createPromiseClient(Qr.Users,{method:"me",params:[t]});return e.nanoquery.createFetcherStore(r,{fetcher:()=>o.me({})})},ci=t=>{const{client:e,queryKeyStr:r}=t.createPromiseClient(Qr.Users,{method:"bypassAuth"});return t.nanoquery.createMutatorStore(async({data:{userKey:o,schema:s,init:u},getCacheUpdater:f})=>{const[l]=f(r),p=await e.bypassAuth({userKey:o,schema:s,init:u});return l(p),p})},li=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Ft.Client,{method:"get",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>(await r.get({})).data?.attributes})},fi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Ft.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}})},hi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Ft.Client,{method:"getOrganizationAdvertising",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>(await r.getOrganizationAdvertising({})).data?.attributes})},pi=(t,e,r)=>{t.transport=new oi(e.host),t.sdk.host=t.transport.host,t.transport.setSdkKey(e.sdkKey),r()};class fr{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 Ne;(function(t){t.SCHEMA="schema",t.TOKEN="token"})(Ne||(Ne={}));class Zr extends fr{constructor(){super("user")}setSchema=e=>{this.write(Ne.SCHEMA,e)};getSchema=()=>this.read(Ne.SCHEMA);setToken=e=>{this.write(Ne.TOKEN,e)};getToken=()=>this.read(Ne.TOKEN);removeToken=()=>{this.remove(Ne.TOKEN)};clearNotification=()=>{this.clear()}}var Pe;(function(t){t.DISABLED="disabled",t.INITIALIZATION="initialization",t.READY="ready",t.FAILED="failed",t.SUSPENDED="suspended"})(Pe||(Pe={}));const di=t=>{const e=new ae(ue(void 0),"enabled"),r=new ae(ue(Pe.DISABLED),"status"),o=new ae(ue(void 0),"userKey"),s=new ae(ue(void 0),"userToken"),u=new Zr;s.listen(I=>{I?u.setToken(I):u.removeToken()});const f=new ae(ue(void 0),"providerStreamId"),l=new te(si(f.getStore(),t),"slStreamId",I=>I?.data),p=new te(ui(s.getStore(),t),"user",I=>I?.data?.data?.id),A=new te(li(s.getStore(),t),"userSettings"),g=new te(ai(l.getAtomStore(),t),"streamSettings");l.getAtomStore().listen(I=>{(I===""||I===void 0)&&g.getStore().mutate(void 0)});const w=new te(fi(e.getStore(),t),"organizationSettings",I=>I?.data?.id),E=new te(hi(w.getAtomStore(),t),"organizationAdvertising");return{enabled:e,status:r,providerStreamId:f,slStreamId:l,streamSettings:g,user:p,userKey:o,userToken:s,userSettings:A,organizationSettings:w,organizationAdvertising:E}};class yi extends Ct{stores;constructor(e){const r=di(e),o=ei(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 gi extends Zn{$coreStore;transport;$bypassLogin;constructor(e,r){super(),this.$coreStore=e,this.transport=r,this.$bypassLogin=ci(this.transport),this.subscribe()}me=async()=>(await this.$coreStore.getValues().user.getValue())?.data;login=async(e,r)=>(this.$coreStore.getValues().userKey.setValue(r),await this.$bypassLogin.mutate({schema:e,userKey:r,init:!1}),this.me());isAuthenticated=()=>this.me();logout=()=>{this.$coreStore.getValues().user.setValue(),this.$coreStore.getValues().userKey.setValue(),this.$coreStore.getValues().userToken.setValue(),this.transport.setAuth("")};subscribe=()=>{this.$bypassLogin.subscribe((e,r)=>{r==="data"&&(this.transport.setAuth(e?.data?.meta?.jwt),this.$coreStore.getValues().userToken.setValue(e?.data?.meta?.jwt))})}}const mi=async(t,e,r)=>{t.auth=new gi(t.store,t.transport);const o=new Zr,s=o.getSchema(),u=o.getToken();s&&u&&(console.log("try to login prev user"),await t.auth.login(s,u)),t.sdk.authorizationBypass=async(f,l)=>{await t.auth.login(f,l),o.setSchema("streamlayer:streamlayer")},t.sdk.logout=()=>{t.auth.logout()},t.sdk.getUserStore=()=>t.stores.user.getStore(),t.sdk.isUserAuthorized=()=>t.auth.isAuthenticated(),r()},bi=(t,e,r)=>{t.store=new yi(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()},wi=(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(Pe.INITIALIZATION);try{const o=await t.stores.organizationSettings.getValue();return o?(t.stores.status.setValue(Pe.READY),{enabled:!!o}):(t.stores.status.setValue(Pe.FAILED),{err:"failed"})}catch(o){return t.stores.enabled.setValue(),t.stores.status.setValue(Pe.FAILED),{err:`${o}`}}},t.sdk.disableApp=()=>{t.stores.enabled.get()==="on"&&(t.stores.enabled.setValue(),t.stores.status.setValue(Pe.DISABLED),t.storeUnsubscribe())},t.sdk.createEventSession=o=>{t.stores.providerStreamId.setValue(o)},r()},vi=Dn.pino({level:"trace"}),en=(t,e)=>vi.child({name:t},e),Si=(t,e,r)=>{const{client:o,queryKey:s}=r.createPromiseClient(Gr.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})},Ai=(t,e,r)=>{const{client:o,queryKey:s}=r.createPromiseClient(Gr.Leaderboard,{method:"list",params:[t,e]});return r.nanoquery.createFetcherStore(s,{fetcher:async(u,f,l,p)=>{const A={usersIds:[]};return l&&(A.eventId=l),p&&(A.leaderboardId=p),(await o.list(A)).data}})},Ei=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.Feed,{method:"get",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>(await r.get({eventId:f})).data?.attributes})},Ii=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.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})},Fi=(t,e)=>{const{client:r}=e.createCallbackClient(ye.Feed),o=De.atom({eventId:t.get()||"",feedId:""});return t.subscribe((u="")=>{o.set({eventId:u,feedId:""})}),e.addSubscription(r.subscription,o,{name:"feedSubscription"})},_i=(t,e)=>{const{client:r}=e.createCallbackClient(ye.Feed);return e.addSubscription(r.questionSubscription,{questionId:t},{name:"questionSubscription"})},Ci=async(t,e)=>{const{client:r}=e.createPromiseClient(ye.Feed,{method:"questionByUser",params:[t]});return(await r.questionByUser({questionId:t})).data?.attributes?.question},Ti=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.Feed,{method:"questionByUser",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>(await r.questionByUser({questionId:f})).data?.attributes?.question})},Oi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.Feed,{method:"pickHistory",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.pickHistory({eventId:f})).data?.map(({attributes:p})=>p):[]})},Bi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.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})},tn=t=>(t.gamification||(t.gamification=new xi(t)),t.gamification);class xi{slStreamId;organizationId;userId;openedQuestionId;openedQuestion;activeQuestionId;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 ae(ue(void 0),"moderationId").getStore(),this.openedQuestionId=new ae(ue(void 0),"openedQuestionId").getStore(),this.notifications=e.notifications,this.moderation=new te(Ei(this.slStreamId,e.transport),"gamification:moderation"),this.activeQuestionId=new te(Ii(this.slStreamId,e.transport),"gamification:activeQuestionId"),this.openedQuestion=new te(Ti(this.openedQuestionId,e.transport),"gamification:openedQuestion"),this.openedQuestionId.listen(r=>{this.log.debug({questionId:r},"received question"),r?(this.questionSubscription=_i(r,e.transport),this.questionSubscription.addListener("feed-subscription-opened-question",o=>{window.requestAnimationFrame(()=>{this.openedQuestion?.getStore().mutate(o.data?.attributes?.question),this.openedQuestion?.getStore().invalidate()})}),this.questionSubscription.connect()):(this.log.info("cleanup on close question"),this.openedQuestion?.getStore().mutate(void 0),this.questionSubscription!==void 0&&(e.transport.removeSubscription(this.questionSubscription),this.questionSubscription=void 0))}),this.feedSubscription=Fi(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 ki{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 ae(ue(new Map),"notifications-queue"),this.notificationsList=lr(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 bt;(function(t){t.OPENED="opened"})(bt||(bt={}));class Pi extends fr{constructor(){super("notification")}setOpened=e=>{this.write(bt.OPENED,e,"true")};isOpened=e=>this.read(bt.OPENED,e);clearNotification=()=>{this.clear()}}var Ke;(function(t){t[t.ONBOARDING=1]="ONBOARDING",t[t.QUESTION=2]="QUESTION"})(Ke||(Ke={}));class Ri{queue;storage;constructor(e={}){this.storage=new Pi,this.queue=new ki({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 Ni=(t,e,r)=>{t.notifications=new Ri,t.addNotification=t.notifications.add,t.sdk.getNotificationsStore=()=>t.notifications.getQueueStore(),r()},Li=(t,e)=>{const{client:r}=t.createPromiseClient(ye.Feed,{method:"submitAnswer"});return r.submitAnswer({data:e})},Ui=(t,e)=>{const{client:r}=t.createPromiseClient(ye.Feed,{method:"submitInplay"});return r.submitInplay({data:{eventId:+e}})},$i=(t,e)=>{const{client:r}=t.createPromiseClient(ye.Feed,{method:"skipQuestion"});return r.skipQuestion({data:{id:e}})};var wt;(function(t){t.ONBOARDING="onboarding"})(wt||(wt={}));class ji extends fr{constructor(){super("gamification")}saveOnboardingStatus=({userId:e,eventId:r,organizationId:o},s)=>{this.write(wt.ONBOARDING,o,e,r,s)};getOnboardingStatus=({userId:e,eventId:r,organizationId:o})=>this.read(wt.ONBOARDING,o,e,r)}const Ar=new Set([de.QuestionType.POLL,de.QuestionType.PREDICTION,de.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 Di extends cr{userSummary;questions;leaderboardId;leaderboardList;onboardingStatus;openedQuestion;notifications;transport;closeFeature;openFeature;background;storage;constructor(e,r,o){super(e,r),this.background=tn(o),this.storage=new ji,this.userSummary=new te(Si(this.background.slStreamId,this.background.userId,o.transport),"gamification:userSummary"),this.questions=new te(Oi(this.background.slStreamId,o.transport),"gamification:questions"),this.leaderboardId=new ae(ue(this.settings.getValue("pinnedLeaderboardId")),"pinnedLeaderboardId").getStore(),this.onboardingStatus=new ae(ue(Z.Unset),"onboardingStatus").getStore(),this.notifications=o.notifications,this.transport=o.transport,this.closeFeature=o.sdk.closeFeature,this.openFeature=()=>o.sdk.openFeature(ce.SdkOverlayType.GAMES),this.openedQuestion=lr(this.background.openedQuestion.getStore(),s=>{if(s.data?.type&&Ar.has(s.data.type))return s.data}),this.leaderboardList=new te(Ai(this.background.slStreamId,this.leaderboardId,o.transport),"gamification:leaderboardList"),this.onboardingStatus.subscribe(s=>{(s===Z.Optional||Z.Required)&&this.showOnboardingInApp()}),this.status.subscribe(s=>{s===Ue.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!==de.SilenceSetting.ON&&Ar.has(s.data.question.type)&&s.data.question.status===de.QuestionStatus.ACTIVE&&this.notifications.add({type:Ke.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:Ke.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.questions.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===de.QuestionStatus.RESOLVED&&u===de.QuestionType.PREDICTION){const l=this.background.getCurrentSessionId({prefix:`notification-id:${f}`}),A=(await Ci(f,e))?.answers.find(({correct:g})=>g);this.notifications.add({type:Ke.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.questions?.invalidate()})})};disconnect=()=>{this.background.feedSubscription.removeListener("feed-subscription-questions-list")};submitInplay=async()=>{const e=this.background.slStreamId.get();e&&(await Ui(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 Li(this.transport,{questionId:e,answerId:r}),this.questions?.invalidate()};skipQuestion=async e=>{await $i(this.transport,e),this.questions?.invalidate()};openQuestion=e=>(this.openFeature(),this.background.openQuestion(e));closeQuestion=e=>this.background.closeQuestion(e)}class Mi extends cr{insights;closeFeature;openFeature;openedInsight;notifications;transport;background;constructor(e,r,o){super(e,r),this.background=tn(o),this.notifications=o.notifications,this.transport=o.transport,this.closeFeature=o.sdk.closeFeature,this.openFeature=()=>o.sdk.openFeature(ce.SdkOverlayType.HIGHLIGHTS),this.status.subscribe(s=>{s===Ue.Ready?this.connect():this.disconnect()}),this.background.activeQuestionId.listen(s=>{s?.data?.question?.id&&s?.data?.question?.notification&&s.data.moderation?.bypassNotifications?.inAppSilence!==de.SilenceSetting.ON&&s.data.question.type===de.QuestionType.FACTOID&&s.data.question.status===de.QuestionStatus.ACTIVE&&this.notifications.add({type:Ke.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=lr(this.background.openedQuestion.getStore(),s=>{if(s.data?.type===de.QuestionType.FACTOID)return s.data})}connect=()=>{this.insights?this.insights.invalidate():this.insights=new te(Bi(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)}ce.SdkOverlayType.GAMES+"",ce.SdkOverlayType.HIGHLIGHTS+"";class Vi extends cr{constructor(e,r){super(e,r)}}const qi=(t,e,r)=>t.type===ce.SdkOverlayType.GAMES?new Di(t,e,r):t.type===ce.SdkOverlayType.HIGHLIGHTS?new Mi(t,e,r):new Vi(t,e),Qi=(t,e,r)=>{t.features=new Map,t.activeFeature=new ae(ue(ce.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(ce.SdkOverlayType.UNSET)},t.initFeature=(o,s=Ie.ORGANIZATION)=>{const u=qi(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,Ie.ORGANIZATION)},t.stores.providerStreamId.listen(o=>{o||t.reinitializeFeatures()}),t.storeSubscribe=()=>{const o=(u,f)=>{if(f?.overlays){u===Ie.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(Ie.ORGANIZATION,u.data)}catch(f){console.log(f)}},streamSettings:u=>{if(u.data)try{o(Ie.STREAM,u.data)}catch(f){console.log(f)}}};t.store.subscribe(s)},r()};var hr={exports:{}},pr={exports:{}};function Gi(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 zi=Gi,Hi=zi;function rn(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=Hi(Ki),s=null,u=null,f=0,l=null,p={push:L,drain:se,saturated:se,pause:g,paused:!1,concurrency:r,running:A,resume:I,idle:R,length:w,getQueue:E,unshift:G,empty:se,kill:X,killAndDrain:ge,error:ee};return p;function A(){return f}function g(){p.paused=!0}function w(){for(var x=s,D=0;x;)x=x.next,D++;return D}function E(){for(var x=s,D=[];x;)D.push(x.value),x=x.next;return D}function I(){if(p.paused){p.paused=!1;for(var x=0;x<p.concurrency;x++)f++,z()}}function R(){return f===0&&p.length()===0}function L(x,D){var O=o.get();O.context=t,O.release=z,O.value=x,O.callback=D||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(x,D){var O=o.get();O.context=t,O.release=z,O.value=x,O.callback=D||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(x){x&&o.release(x);var D=s;D?p.paused?f--:(u===s&&(u=null),s=D.next,D.next=null,e.call(t,D.value,D.worked),u===null&&p.empty()):--f===0&&p.drain()}function X(){s=null,u=null,p.drain=se}function ge(){s=null,u=null,p.drain(),p.drain=se}function ee(x){l=x}}function se(){}function Ki(){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 Wi(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=rn(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,I){u(g,function(R,L){if(R){I(R);return}E(L)})});return w.catch(se),w}function p(g){var w=new Promise(function(E,I){f(g,function(R,L){if(R){I(R);return}E(L)})});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=rn;pr.exports.promise=Wi;var nn=pr.exports,dr={exports:{}},We=typeof Reflect=="object"?Reflect:null,Er=We&&typeof We.apply=="function"?We.apply:function(e,r,o){return Function.prototype.apply.call(e,r,o)},pt;We&&typeof We.ownKeys=="function"?pt=We.ownKeys:Object.getOwnPropertySymbols?pt=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:pt=function(e){return Object.getOwnPropertyNames(e)};function Ji(t){console&&console.warn&&console.warn(t)}var on=Number.isNaN||function(e){return e!==e};function $(){$.init.call(this)}dr.exports=$;dr.exports.once=eo;$.EventEmitter=$;$.prototype._events=void 0;$.prototype._eventsCount=0;$.prototype._maxListeners=void 0;var Ir=10;function Tt(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 Ir},set:function(t){if(typeof t!="number"||t<0||on(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ir=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||on(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 sn(t){return t._maxListeners===void 0?$.defaultMaxListeners:t._maxListeners}$.prototype.getMaxListeners=function(){return sn(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")Er(p,this,r);else for(var A=p.length,g=fn(p,A),o=0;o<A;++o)Er(g[o],this,r);return!0};function an(t,e,r,o){var s,u,f;if(Tt(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=sn(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,Ji(l)}return t}$.prototype.addListener=function(e,r){return an(this,e,r,!1)};$.prototype.on=$.prototype.addListener;$.prototype.prependListener=function(e,r){return an(this,e,r,!0)};function Yi(){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 un(t,e,r){var o={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=Yi.bind(o);return s.listener=r,o.wrapFn=s,s}$.prototype.once=function(e,r){return Tt(r),this.on(e,un(this,e,r)),this};$.prototype.prependOnceListener=function(e,r){return Tt(r),this.prependListener(e,un(this,e,r)),this};$.prototype.removeListener=function(e,r){var o,s,u,f,l;if(Tt(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():Xi(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 cn(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?Zi(s):fn(s,s.length)}$.prototype.listeners=function(e){return cn(this,e,!0)};$.prototype.rawListeners=function(e){return cn(this,e,!1)};$.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ln.call(t,e)};$.prototype.listenerCount=ln;function ln(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?pt(this._events):[]};function fn(t,e){for(var r=new Array(e),o=0;o<e;++o)r[o]=t[o];return r}function Xi(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Zi(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function eo(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))}hn(t,e,u,{once:!0}),e!=="error"&&to(t,s,{once:!0})})}function to(t,e,r){typeof t.on=="function"&&hn(t,"error",e,r)}function hn(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=dr.exports,Ot={},dn={},yn=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},ro=yn,yr=function(){return ro()&&!!Symbol.toStringTag},Fr=typeof Symbol<"u"&&Symbol,no=yn,io=function(){return typeof Fr!="function"||typeof Symbol!="function"||typeof Fr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:no()},_r={foo:{}},oo=Object,so=function(){return{__proto__:_r}.foo===_r.foo&&!({__proto__:null}instanceof oo)},ao="Function.prototype.bind called on incompatible ",uo=Object.prototype.toString,co=Math.max,lo="[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},fo=function(e,r){for(var o=[],s=r||0,u=0;s<e.length;s+=1,u+=1)o[u]=e[s];return o},ho=function(t,e){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=e);return r},po=function(e){var r=this;if(typeof r!="function"||uo.apply(r)!==lo)throw new TypeError(ao+r);for(var o=fo(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=co(0,r.length-o.length),l=[],p=0;p<f;p++)l[p]="$"+p;if(s=Function("binder","return function ("+ho(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},yo=po,gn=Function.prototype.bind||yo,Tr={}.hasOwnProperty,Rt=Function.prototype.call,go=Rt.bind?Rt.bind(Tr):function(t,e){return Rt.call(Tr,t,e)},k,Ye=SyntaxError,mn=Function,Je=TypeError,Nt=function(t){try{return mn('"use strict"; return ('+t+").constructor;")()}catch{}},$e=Object.getOwnPropertyDescriptor;if($e)try{$e({},"")}catch{$e=null}var Lt=function(){throw new Je},mo=$e?function(){try{return arguments.callee,Lt}catch{try{return $e(arguments,"callee").get}catch{return Lt}}}():Lt,qe=io(),bo=so(),K=Object.getPrototypeOf||(bo?function(t){return t.__proto__}:null),Ge={},wo=typeof Uint8Array>"u"||!K?k:K(Uint8Array),je={"%AggregateError%":typeof AggregateError>"u"?k:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?k:ArrayBuffer,"%ArrayIteratorPrototype%":qe&&K?K([][Symbol.iterator]()):k,"%AsyncFromSyncIteratorPrototype%":k,"%AsyncFunction%":Ge,"%AsyncGenerator%":Ge,"%AsyncGeneratorFunction%":Ge,"%AsyncIteratorPrototype%":Ge,"%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%":mn,"%GeneratorFunction%":Ge,"%Int8Array%":typeof Int8Array>"u"?k:Int8Array,"%Int16Array%":typeof Int16Array>"u"?k:Int16Array,"%Int32Array%":typeof Int32Array>"u"?k:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qe&&K?K(K([][Symbol.iterator]())):k,"%JSON%":typeof JSON=="object"?JSON:k,"%Map%":typeof Map>"u"?k:Map,"%MapIteratorPrototype%":typeof Map>"u"||!qe||!K?k:K(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||!K?k:K(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?k:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qe&&K?K(""[Symbol.iterator]()):k,"%Symbol%":qe?Symbol:k,"%SyntaxError%":Ye,"%ThrowTypeError%":mo,"%TypedArray%":wo,"%TypeError%":Je,"%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(K)try{null.error}catch(t){var vo=K(K(t));je["%Error.prototype%"]=vo}var So=function t(e){var r;if(e==="%AsyncFunction%")r=Nt("async function () {}");else if(e==="%GeneratorFunction%")r=Nt("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Nt("async function* () {}");else if(e==="%AsyncGenerator%"){var o=t("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&K&&(r=K(s.prototype))}return je[e]=r,r},Or={"%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"]},ct=gn,vt=go,Ao=ct.call(Function.call,Array.prototype.concat),Eo=ct.call(Function.apply,Array.prototype.splice),Br=ct.call(Function.call,String.prototype.replace),St=ct.call(Function.call,String.prototype.slice),Io=ct.call(Function.call,RegExp.prototype.exec),Fo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,_o=/\\(\\)?/g,Co=function(e){var r=St(e,0,1),o=St(e,-1);if(r==="%"&&o!=="%")throw new Ye("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&r!=="%")throw new Ye("invalid intrinsic syntax, expected opening `%`");var s=[];return Br(e,Fo,function(u,f,l,p){s[s.length]=l?Br(p,_o,"$1"):f||u}),s},To=function(e,r){var o=e,s;if(vt(Or,o)&&(s=Or[o],o="%"+s[0]+"%"),vt(je,o)){var u=je[o];if(u===Ge&&(u=So(o)),typeof u>"u"&&!r)throw new Je("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:o,value:u}}throw new Ye("intrinsic "+e+" does not exist!")},Ze=function(e,r){if(typeof e!="string"||e.length===0)throw new Je("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Je('"allowMissing" argument must be a boolean');if(Io(/^%?[^%]*%?$/,e)===null)throw new Ye("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=Co(e),s=o.length>0?o[0]:"",u=To("%"+s+"%",r),f=u.name,l=u.value,p=!1,A=u.alias;A&&(s=A[0],Eo(o,Ao([0,1],A)));for(var g=1,w=!0;g<o.length;g+=1){var E=o[g],I=St(E,0,1),R=St(E,-1);if((I==='"'||I==="'"||I==="`"||R==='"'||R==="'"||R==="`")&&I!==R)throw new Ye("property names with quotes must have matching quotes");if((E==="constructor"||!w)&&(p=!0),s+="."+E,f="%"+s+"%",vt(je,f))l=je[f];else if(l!=null){if(!(E in l)){if(!r)throw new Je("base intrinsic for "+e+" exists, but the property is not available.");return}if($e&&g+1>=o.length){var L=$e(l,E);w=!!L,w&&"get"in L&&!("originalValue"in L.get)?l=L.get:l=l[E]}else w=vt(l,E),l=l[E];w&&!p&&(je[f]=l)}}return l},bn={exports:{}},Oo=Ze,Xt=Oo("%Object.defineProperty%",!0),Zt=function(){if(Xt)try{return Xt({},"a",{value:1}),!0}catch{return!1}return!1};Zt.hasArrayLengthDefineBug=function(){if(!Zt())return null;try{return Xt([],"length",{value:1}).length!==1}catch{return!0}};var wn=Zt,Bo=Ze,dt=Bo("%Object.getOwnPropertyDescriptor%",!0);if(dt)try{dt([],"length")}catch{dt=null}var gr=dt,xo=wn(),mr=Ze,at=xo&&mr("%Object.defineProperty%",!0);if(at)try{at({},"a",{value:1})}catch{at=!1}var ko=mr("%SyntaxError%"),Qe=mr("%TypeError%"),xr=gr,Po=function(e,r,o){if(!e||typeof e!="object"&&typeof e!="function")throw new Qe("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Qe("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Qe("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Qe("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Qe("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Qe("`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=!!xr&&xr(e,r);if(at)at(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 ko("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},vn=Ze,kr=Po,Ro=wn(),Pr=gr,Rr=vn("%TypeError%"),No=vn("%Math.floor%"),Lo=function(e,r){if(typeof e!="function")throw new Rr("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||No(r)!==r)throw new Rr("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in e&&Pr){var f=Pr(e,"length");f&&!f.configurable&&(s=!1),f&&!f.writable&&(u=!1)}return(s||u||!o)&&(Ro?kr(e,"length",r,!0,!0):kr(e,"length",r)),e};(function(t){var e=gn,r=Ze,o=Lo,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 I=l(e,f,arguments);return o(I,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})(bn);var Sn=bn.exports,An=Ze,En=Sn,Uo=En(An("String.prototype.indexOf")),In=function(e,r){var o=An(e,!!r);return typeof o=="function"&&Uo(e,".prototype.")>-1?En(o):o},$o=yr(),jo=In,er=jo("Object.prototype.toString"),Bt=function(e){return $o&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:er(e)==="[object Arguments]"},Fn=function(e){return Bt(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&er(e)!=="[object Array]"&&er(e.callee)==="[object Function]"},Do=function(){return Bt(arguments)}();Bt.isLegacyArguments=Fn;var Mo=Do?Bt:Fn,Vo=Object.prototype.toString,qo=Function.prototype.toString,Qo=/^\s*(?:function)?\*/,_n=yr(),Ut=Object.getPrototypeOf,Go=function(){if(!_n)return!1;try{return Function("return function*() {}")()}catch{}},$t,zo=function(e){if(typeof e!="function")return!1;if(Qo.test(qo.call(e)))return!0;if(!_n){var r=Vo.call(e);return r==="[object GeneratorFunction]"}if(!Ut)return!1;if(typeof $t>"u"){var o=Go();$t=o?Ut(o):!1}return Ut(e)===$t},Cn=Function.prototype.toString,ze=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,tr,yt;if(typeof ze=="function"&&typeof Object.defineProperty=="function")try{tr=Object.defineProperty({},"length",{get:function(){throw yt}}),yt={},ze(function(){throw 42},null,tr)}catch(t){t!==yt&&(ze=null)}else ze=null;var Ho=/^\s*class\b/,rr=function(e){try{var r=Cn.call(e);return Ho.test(r)}catch{return!1}},jt=function(e){try{return rr(e)?!1:(Cn.call(e),!0)}catch{return!1}},gt=Object.prototype.toString,Ko="[object Object]",Wo="[object Function]",Jo="[object GeneratorFunction]",Yo="[object HTMLAllCollection]",Xo="[object HTML document.all class]",Zo="[object HTMLCollection]",es=typeof Symbol=="function"&&!!Symbol.toStringTag,ts=!(0 in[,]),nr=function(){return!1};if(typeof document=="object"){var rs=document.all;gt.call(rs)===gt.call(document.all)&&(nr=function(e){if((ts||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=gt.call(e);return(r===Yo||r===Xo||r===Zo||r===Ko)&&e("")==null}catch{}return!1})}var ns=ze?function(e){if(nr(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ze(e,null,tr)}catch(r){if(r!==yt)return!1}return!rr(e)&&jt(e)}:function(e){if(nr(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(es)return jt(e);if(rr(e))return!1;var r=gt.call(e);return r!==Wo&&r!==Jo&&!/^\[object HTML/.test(r)?!1:jt(e)},is=ns,os=Object.prototype.toString,Tn=Object.prototype.hasOwnProperty,ss=function(e,r,o){for(var s=0,u=e.length;s<u;s++)Tn.call(e,s)&&(o==null?r(e[s],s,e):r.call(o,e[s],s,e))},as=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)},us=function(e,r,o){for(var s in e)Tn.call(e,s)&&(o==null?r(e[s],s,e):r.call(o,e[s],s,e))},cs=function(e,r,o){if(!is(r))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=o),os.call(e)==="[object Array]"?ss(e,r,s):typeof e=="string"?as(e,r,s):us(e,r,s)},ls=cs,Dt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],fs=typeof globalThis>"u"?zr:globalThis,hs=function(){for(var e=[],r=0;r<Dt.length;r++)typeof fs[Dt[r]]=="function"&&(e[e.length]=Dt[r]);return e},At=ls,ps=hs,Nr=Sn,br=In,mt=gr,ds=br("Object.prototype.toString"),On=yr(),Lr=typeof globalThis>"u"?zr:globalThis,ir=ps(),wr=br("String.prototype.slice"),Mt=Object.getPrototypeOf,ys=br("Array.prototype.indexOf",!0)||function(e,r){for(var o=0;o<e.length;o+=1)if(e[o]===r)return o;return-1},Et={__proto__:null};On&&mt&&Mt?At(ir,function(t){var e=new Lr[t];if(Symbol.toStringTag in e){var r=Mt(e),o=mt(r,Symbol.toStringTag);if(!o){var s=Mt(r);o=mt(s,Symbol.toStringTag)}Et["$"+t]=Nr(o.get)}}):At(ir,function(t){var e=new Lr[t],r=e.slice||e.set;r&&(Et["$"+t]=Nr(r))});var gs=function(e){var r=!1;return At(Et,function(o,s){if(!r)try{"$"+o(e)===s&&(r=wr(s,1))}catch{}}),r},ms=function(e){var r=!1;return At(Et,function(o,s){if(!r)try{o(e),r=wr(s,1)}catch{}}),r},Bn=function(e){if(!e||typeof e!="object")return!1;if(!On){var r=wr(ds(e),8,-1);return ys(ir,r)>-1?r:r!=="Object"?!1:ms(e)}return mt?gs(e):null},bs=Bn,ws=function(e){return!!bs(e)};(function(t){var e=Mo,r=zo,o=Bn,s=ws;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 I=u(Symbol.prototype.valueOf);function R(v,ft){if(typeof v!="object")return!1;try{return ft(v),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=s;function L(v){return typeof Promise<"u"&&v instanceof Promise||v!==null&&typeof v=="object"&&typeof v.then=="function"&&typeof v.catch=="function"}t.isPromise=L;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 ge(v){return o(v)==="Uint16Array"}t.isUint16Array=ge;function ee(v){return o(v)==="Uint32Array"}t.isUint32Array=ee;function x(v){return o(v)==="Int8Array"}t.isInt8Array=x;function D(v){return o(v)==="Int16Array"}t.isInt16Array=D;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 Ce(v){return o(v)==="BigInt64Array"}t.isBigInt64Array=Ce;function Ae(v){return o(v)==="BigUint64Array"}t.isBigUint64Array=Ae;function le(v){return p(v)==="[object Map]"}le.working=typeof Map<"u"&&le(new Map);function tt(v){return typeof Map>"u"?!1:le.working?le(v):v instanceof Map}t.isMap=tt;function fe(v){return p(v)==="[object Set]"}fe.working=typeof Set<"u"&&fe(new Set);function Te(v){return typeof Set>"u"?!1:fe.working?fe(v):v instanceof Set}t.isSet=Te;function Oe(v){return p(v)==="[object WeakMap]"}Oe.working=typeof WeakMap<"u"&&Oe(new WeakMap);function rt(v){return typeof WeakMap>"u"?!1:Oe.working?Oe(v):v instanceof WeakMap}t.isWeakMap=rt;function Be(v){return p(v)==="[object WeakSet]"}Be.working=typeof WeakSet<"u"&&Be(new WeakSet);function he(v){return Be(v)}t.isWeakSet=he;function xe(v){return p(v)==="[object ArrayBuffer]"}xe.working=typeof ArrayBuffer<"u"&&xe(new ArrayBuffer);function V(v){return typeof ArrayBuffer>"u"?!1:xe.working?xe(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 F(v){return p(v)==="[object SharedArrayBuffer]"}function P(v){return typeof S>"u"?!1:(typeof F.working>"u"&&(F.working=F(new S)),F.working?F(v):v instanceof S)}t.isSharedArrayBuffer=P;function N(v){return p(v)==="[object AsyncFunction]"}t.isAsyncFunction=N;function _(v){return p(v)==="[object Map Iterator]"}t.isMapIterator=_;function B(v){return p(v)==="[object Set Iterator]"}t.isSetIterator=B;function U(v){return p(v)==="[object Generator]"}t.isGeneratorObject=U;function Y(v){return p(v)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=Y;function me(v){return R(v,A)}t.isNumberObject=me;function pe(v){return R(v,g)}t.isStringObject=pe;function ie(v){return R(v,w)}t.isBooleanObject=ie;function Me(v){return f&&R(v,E)}t.isBigIntObject=Me;function lt(v){return l&&R(v,I)}t.isSymbolObject=lt;function nt(v){return me(v)||pe(v)||ie(v)||Me(v)||lt(v)}t.isBoxedPrimitive=nt;function xt(v){return typeof Uint8Array<"u"&&(V(v)||P(v))}t.isAnyArrayBuffer=xt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(v){Object.defineProperty(t,v,{enumerable:!1,value:function(){throw new Error(v+" is not supported in userland")}})})})(dn);var vs=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"},or={exports:{}};typeof Object.create=="function"?or.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:or.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 Ss=or.exports;(function(t){var e=Object.getOwnPropertyDescriptors||function(b){for(var S=Object.keys(b),F={},P=0;P<S.length;P++)F[S[P]]=Object.getOwnPropertyDescriptor(b,S[P]);return F},r=/%[sdj%]/g;t.format=function(d){if(!x(d)){for(var b=[],S=0;S<arguments.length;S++)b.push(f(arguments[S]));return b.join(" ")}for(var S=1,F=arguments,P=F.length,N=String(d).replace(r,function(B){if(B==="%%")return"%";if(S>=P)return B;switch(B){case"%s":return String(F[S++]);case"%d":return Number(F[S++]);case"%j":try{return JSON.stringify(F[S++])}catch{return"[Circular]"}default:return B}}),_=F[S];S<P;_=F[++S])X(_)||!ne(_)?N+=" "+_:N+=" "+f(_);return N},t.deprecate=function(d,b){if(typeof C.process<"u"&&C.process.noDeprecation===!0)return d;if(typeof C.process>"u")return function(){return t.deprecate(d,b).apply(this,arguments)};var S=!1;function F(){if(!S){if(C.process.throwDeprecation)throw new Error(b);C.process.traceDeprecation?console.trace(b):console.error(b),S=!0}return d.apply(this,arguments)}return F};var o={},s=/^$/;if(C.process.env.NODE_DEBUG){var u=C.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=C.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,F){b[S]=!0}),b}function g(d,b,S){if(d.customInspect&&b&&le(b.inspect)&&b.inspect!==t.inspect&&!(b.constructor&&b.constructor.prototype===b)){var F=b.inspect(S,d);return x(F)||(F=g(d,F,S)),F}var P=w(d,b);if(P)return P;var N=Object.keys(b),_=A(N);if(d.showHidden&&(N=Object.getOwnPropertyNames(b)),Ae(b)&&(N.indexOf("message")>=0||N.indexOf("description")>=0))return E(b);if(N.length===0){if(le(b)){var B=b.name?": "+b.name:"";return d.stylize("[Function"+B+"]","special")}if(re(b))return d.stylize(RegExp.prototype.toString.call(b),"regexp");if(Ce(b))return d.stylize(Date.prototype.toString.call(b),"date");if(Ae(b))return E(b)}var U="",Y=!1,me=["{","}"];if(G(b)&&(Y=!0,me=["[","]"]),le(b)){var pe=b.name?": "+b.name:"";U=" [Function"+pe+"]"}if(re(b)&&(U=" "+RegExp.prototype.toString.call(b)),Ce(b)&&(U=" "+Date.prototype.toUTCString.call(b)),Ae(b)&&(U=" "+E(b)),N.length===0&&(!Y||b.length==0))return me[0]+U+me[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=I(d,b,S,_,N):ie=N.map(function(Me){return R(d,b,S,_,Me,Y)}),d.seen.pop(),L(ie,U,me)}function w(d,b){if(O(b))return d.stylize("undefined","undefined");if(x(b)){var S="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return d.stylize(S,"string")}if(ee(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 I(d,b,S,F,P){for(var N=[],_=0,B=b.length;_<B;++_)Be(b,String(_))?N.push(R(d,b,S,F,String(_),!0)):N.push("");return P.forEach(function(U){U.match(/^\d+$/)||N.push(R(d,b,S,F,U,!0))}),N}function R(d,b,S,F,P,N){var _,B,U;if(U=Object.getOwnPropertyDescriptor(b,P)||{value:b[P]},U.get?U.set?B=d.stylize("[Getter/Setter]","special"):B=d.stylize("[Getter]","special"):U.set&&(B=d.stylize("[Setter]","special")),Be(F,P)||(_="["+P+"]"),B||(d.seen.indexOf(U.value)<0?(X(S)?B=g(d,U.value,null):B=g(d,U.value,S-1),B.indexOf(`
6
+ */(function(t){const e=_t,r=ur,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 R(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(be(a,ArrayBuffer)||a&&be(a.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(be(a,SharedArrayBuffer)||a&&be(a.buffer,SharedArrayBuffer)))return L(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=ge(a,n)|0;let c=f(i);const h=c.write(a,n);return h!==i&&(c=c.slice(0,h)),c}function I(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 R(a){if(be(a,Uint8Array)){const n=new Uint8Array(a);return L(n.buffer,n.byteOffset,n.byteLength)}return I(a)}function L(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"||kt(a.length)?f(0):I(a);if(a.type==="Buffer"&&Array.isArray(a.data))return I(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(be(n,Uint8Array)&&(n=l.from(n,n.offset,n.byteLength)),be(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(be(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 ge(a,n){if(l.isBuffer(a))return a.length;if(ArrayBuffer.isView(a)||be(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 nt(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i*2;case"hex":return i>>>1;case"base64":return ft(a).length;default:if(h)return c?-1:nt(a).length;n=(""+n).toLowerCase(),h=!0}}l.byteLength=ge;function ee(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 rt(this,n,i);case"latin1":case"binary":return xe(this,n,i);case"base64":return tt(this,n,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ke(this,n,i);default:if(c)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function x(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)x(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)x(this,i,i+3),x(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)x(this,i,i+7),x(this,i+1,i+6),x(this,i+2,i+5),x(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):ee.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(be(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,T=c-i;const q=Math.min(m,T),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],T=Q[D];break}return m<T?-1:T<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,kt(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,T=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,T/=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===T)return Q*y}else Q!==-1&&(M-=M-Q),Q=-1}else for(i+T>m&&(i=m-T),M=i;M>=0;M--){let Q=!0;for(let D=0;D<T;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 T=parseInt(n.substr(m*2,2),16);if(kt(T))return m;a[i+m]=T}return m}function ne(a,n,i,c){return it(nt(n,a.length-i),a,i,c)}function Te(a,n,i,c){return it(xt(n),a,i,c)}function Ae(a,n,i,c){return it(ft(n),a,i,c)}function le(a,n,i,c){return it(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 Te(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 tt(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,T=y>239?4:y>223?3:y>191?2:1;if(h+T<=i){let q,M,Q,D;switch(T){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,T=1):m>65535&&(m-=65536,c.push(m>>>10&1023|55296),m=56320|m&1023),c.push(m),h+=T}return Be(c)}const Oe=4096;function Be(a){const n=a.length;if(n<=Oe)return String.fromCharCode.apply(String,a);let i="",c=0;for(;c<n;)i+=String.fromCharCode.apply(String,a.slice(c,c+=Oe));return i}function rt(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 xe(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+=Nn[a[y]];return h}function ke(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=Pe(function(n){n=n>>>0,pe(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=Pe(function(n){n=n>>>0,pe(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=Pe(function(n){n=n>>>0,pe(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=Pe(function(n){n=n>>>0,pe(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 T=Math.pow(2,8*c)-1;d(this,n,i,c,T,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 T=Math.pow(2,8*c)-1;d(this,n,i,c,T,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){me(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){me(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=Pe(function(n,i=0){return b(this,n,i,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Pe(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,T=0;for(this[i]=n&255;++y<c&&(m*=256);)n<0&&T===0&&this[i+y-1]!==0&&(T=1),this[i+y]=(n/m>>0)-T&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,T=0;for(this[i+y]=n&255;--y>=0&&(m*=256);)n<0&&T===0&&this[i+y+1]!==0&&(T=1),this[i+y]=(n/m>>0)-T&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=Pe(function(n,i=0){return b(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Pe(function(n,i=0){return S(this,n,i,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(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 P(a,n,i,c,h){return n=+n,i=i>>>0,h||F(a,n,i,4),r.write(a,n,i,c,23,4),i+4}l.prototype.writeFloatLE=function(n,i,c){return P(this,n,i,!0,c)},l.prototype.writeFloatBE=function(n,i,c){return P(this,n,i,!1,c)};function N(a,n,i,c,h){return n=+n,i=i>>>0,h||F(a,n,i,8),r.write(a,n,i,c,52,8),i+8}l.prototype.writeDoubleLE=function(n,i,c){return N(this,n,i,!0,c)},l.prototype.writeDoubleBE=function(n,i,c){return N(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),T=m.length;if(T===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(y=0;y<c-i;++y)this[y+i]=m[y%T]}return this};const _={};function B(a,n,i){_[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}`}}}B("ERR_BUFFER_OUT_OF_BOUNDS",function(a){return a?`${a} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),B("ERR_INVALID_ARG_TYPE",function(a,n){return`The "${a}" argument must be of type number. Received type ${typeof n}`},TypeError),B("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){pe(n,"offset"),(a[n]===void 0||a[n+i]===void 0)&&ie(n,a.length-(i+1))}function me(a,n,i,c,h,y){if(a>i||a<n){const m=typeof n=="bigint"?"n":"";let T;throw y>3?n===0||n===BigInt(0)?T=`>= 0${m} and < 2${m} ** ${(y+1)*8}${m}`:T=`>= -(2${m} ** ${(y+1)*8-1}${m}) and < 2 ** ${(y+1)*8-1}${m}`:T=`>= ${n}${m} and <= ${i}${m}`,new _.ERR_OUT_OF_RANGE("value",T,a)}Y(c,h,y)}function pe(a,n){if(typeof a!="number")throw new _.ERR_INVALID_ARG_TYPE(n,"number",a)}function ie(a,n,i){throw Math.floor(a)!==a?(pe(a,i),new _.ERR_OUT_OF_RANGE(i||"offset","an integer",a)):n<0?new _.ERR_BUFFER_OUT_OF_BOUNDS:new _.ERR_OUT_OF_RANGE(i||"offset",`>= ${i?1:0} and <= ${n}`,a)}const Me=/[^+/0-9A-Za-z-_]/g;function lt(a){if(a=a.split("=")[0],a=a.trim().replace(Me,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function nt(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 xt(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 ft(a){return e.toByteArray(lt(a))}function it(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 be(a,n){return a instanceof n||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===n.name}function kt(a){return a!==a}const Nn=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 Pe(a){return typeof BigInt>"u"?Ln:a}function Ln(){throw new Error("BigInt not supported")}})(Hr);var Wr={exports:{}},H=Wr.exports={},we,ve;function Jt(){throw new Error("setTimeout has not been defined")}function Yt(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?we=setTimeout:we=Jt}catch{we=Jt}try{typeof clearTimeout=="function"?ve=clearTimeout:ve=Yt}catch{ve=Yt}})();function Jr(t){if(we===setTimeout)return setTimeout(t,0);if((we===Jt||!we)&&setTimeout)return we=setTimeout,setTimeout(t,0);try{return we(t,0)}catch{try{return we.call(null,t,0)}catch{return we.call(this,t,0)}}}function Jn(t){if(ve===clearTimeout)return clearTimeout(t);if((ve===Yt||!ve)&&clearTimeout)return ve=clearTimeout,clearTimeout(t);try{return ve(t)}catch{try{return ve.call(null,t)}catch{return ve.call(this,t)}}}var _e=[],He=!1,Le,ht=-1;function Yn(){!He||!Le||(He=!1,Le.length?_e=Le.concat(_e):ht=-1,_e.length&&Yr())}function Yr(){if(!He){var t=Jr(Yn);He=!0;for(var e=_e.length;e;){for(Le=_e,_e=[];++ht<e;)Le&&Le[ht].run();ht=-1,e=_e.length}Le=null,He=!1,Jn(t)}}H.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 Xr(t,e)),_e.length===1&&!He&&Jr(Yr)};function Xr(t,e){this.fun=t,this.array=e}Xr.prototype.run=function(){this.fun.apply(null,this.array)};H.title="browser";H.browser=!0;H.env={};H.argv=[];H.version="";H.versions={};function Ce(){}H.on=Ce;H.addListener=Ce;H.once=Ce;H.off=Ce;H.removeListener=Ce;H.removeAllListeners=Ce;H.emit=Ce;H.prependListener=Ce;H.prependOnceListener=Ce;H.listeners=function(t){return[]};H.binding=function(t){throw new Error("process.binding is not supported")};H.cwd=function(){return"/"};H.chdir=function(t){throw new Error("process.chdir is not supported")};H.umask=function(){return 0};var Xn=Wr.exports;(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const e=Hr,r=Xn,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})(C);class Zn{}window.slStore=Object.create(null);class Ct{store;name;constructor(e,r){this.store=e,this.name=r}getStore(){return this.store}}const ei=t=>{const e=Object.keys(t);return je.computed(e.map(r=>t[r].getStore()),(...r)=>Object.fromEntries(e.map((o,s)=>[o,r[s]])))};class ot extends Ct{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 st=t=>je.map(t);var Ie;(function(t){t.ORGANIZATION="ORGANIZATION",t.STREAM="STREAM"})(Ie||(Ie={}));const ti={[ce.SdkOverlayType.BETTING]:"betting",[ce.SdkOverlayType.GAMES]:"games",[ce.SdkOverlayType.PUBLIC_CHAT]:"publicChat",[ce.SdkOverlayType.TWITTER]:"twitter"};var Ue;(function(t){t.Ready="ready",t.Suspended="suspended"})(Ue||(Ue={}));class cr{status;source;config;settings;listeners=new Set;settingsKey;constructor({settings:e,...r},o){this.settingsKey=ti[r.type],this.status=je.atom(Ue.Suspended),this.config=new ot(st(r),`feature:config:${this.settingsKey}`),this.settingsKey!==void 0&&e?.overlaySettings.case===this.settingsKey?this.settings=new ot(st(e.overlaySettings.value),`feature:settings:${this.settingsKey}`):this.settings=new ot(st({}),`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(Ue.Ready)};disable=()=>{this.status.set(Ue.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===Ie.STREAM&&r===Ie.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 ae extends Ct{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 ue=t=>je.atom(t),lr=(t,e)=>je.computed(t,e);class te extends Ct{atomStore;constructor(e,r,o){super(e,`api:${r}`),this.atomStore=je.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*ri(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 ni=()=>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:ri(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 ii{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 ot(st(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 ae(ue(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!==Wt.Code.Canceled&&e.rawMessage!=="[canceled] BodyStreamBuffer was aborted"?(this.updateState(Ee.Failed),this.state.setValue("error",e)):this.disconnect())}}class oi{toJsonOptions={emitDefaultValues:!1,enumAsInteger:!0,useProtoFieldName:!1};transport;nanoquery;host;interceptors=[];$headers;clients;callbackClients;subscriptions;constructor(e){this.host=e,this.$headers=new ot(st({"sl-device-id":C.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]=$n.nanoquery();this.nanoquery={createFetcherStore:r,createMutatorStore:o,utils:s},this.transport=Un.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 ii(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=Wt.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=Wt.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=>{this.$headers.setValue("authorization",e)};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(ni())}}const si=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Dn.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""}}})},ai=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Ft.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})},ui=(t,e)=>{const{queryKey:r,client:o}=e.createPromiseClient(Qr.Users,{method:"me",params:[t]});return e.nanoquery.createFetcherStore(r,{fetcher:()=>o.me({})})},ci=t=>{const{client:e,queryKeyStr:r}=t.createPromiseClient(Qr.Users,{method:"bypassAuth"});return t.nanoquery.createMutatorStore(async({data:{userKey:o,schema:s,init:u},getCacheUpdater:f})=>{const[l]=f(r),p=await e.bypassAuth({userKey:o,schema:s,init:u});return l(p),p})},li=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Ft.Client,{method:"get",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>(await r.get({})).data?.attributes})},fi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Ft.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}})},hi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(Ft.Client,{method:"getOrganizationAdvertising",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async()=>(await r.getOrganizationAdvertising({})).data?.attributes})},pi=(t,e,r)=>{t.transport=new oi(e.host),t.sdk.host=t.transport.host,t.transport.setSdkKey(e.sdkKey),r()};class fr{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 Ne;(function(t){t.SCHEMA="schema",t.TOKEN="token"})(Ne||(Ne={}));class Zr extends fr{constructor(){super("user")}setSchema=e=>{this.write(Ne.SCHEMA,e)};getSchema=()=>this.read(Ne.SCHEMA);setToken=e=>{this.write(Ne.TOKEN,e)};getToken=()=>this.read(Ne.TOKEN);removeToken=()=>{this.remove(Ne.TOKEN)};clearNotification=()=>{this.clear()}}var Fe;(function(t){t.DISABLED="disabled",t.INITIALIZATION="initialization",t.READY="ready",t.FAILED="failed",t.SUSPENDED="suspended"})(Fe||(Fe={}));const di=t=>{const e=new ae(ue(void 0),"enabled"),r=new ae(ue(Fe.DISABLED),"status"),o=new ae(ue(void 0),"userKey"),s=new ae(ue(void 0),"userToken"),u=new Zr;s.listen(I=>{I?u.setToken(I):u.removeToken()});const f=new ae(ue(void 0),"providerStreamId"),l=new te(si(f.getStore(),t),"slStreamId",I=>I?.data),p=new te(ui(s.getStore(),t),"user",I=>I?.data?.data?.id),A=new te(li(s.getStore(),t),"userSettings"),g=new te(ai(l.getAtomStore(),t),"streamSettings");l.getAtomStore().listen(I=>{(I===""||I===void 0)&&g.getStore().mutate(void 0)});const w=new te(fi(e.getStore(),t),"organizationSettings",I=>I?.data?.id),E=new te(hi(w.getAtomStore(),t),"organizationAdvertising");return{enabled:e,status:r,providerStreamId:f,slStreamId:l,streamSettings:g,user:p,userKey:o,userToken:s,userSettings:A,organizationSettings:w,organizationAdvertising:E}};class yi extends Ct{stores;constructor(e){const r=di(e),o=ei(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 gi extends Zn{$coreStore;transport;$bypassLogin;constructor(e,r){super(),this.$coreStore=e,this.transport=r,this.$bypassLogin=ci(this.transport),this.subscribe()}me=async()=>(await this.$coreStore.getValues().user.getValue())?.data;login=async(e,r)=>(this.$coreStore.getValues().userKey.setValue(r),await this.$bypassLogin.mutate({schema:e,userKey:r,init:!1}),this.me());isAuthenticated=()=>this.me();logout=()=>{this.$coreStore.getValues().user.setValue(),this.$coreStore.getValues().userKey.setValue(),this.$coreStore.getValues().userToken.setValue(),this.transport.setAuth("")};subscribe=()=>{this.$bypassLogin.subscribe((e,r)=>{r==="data"&&(this.transport.setAuth(e?.data?.meta?.jwt),this.$coreStore.getValues().userToken.setValue(e?.data?.meta?.jwt))})}}const mi=(t,e,r)=>{t.auth=new gi(t.store,t.transport);const o=new Zr;t.stores.status.listen(async s=>{if(s===Fe.READY){const u=o.getSchema(),f=o.getToken();u&&f&&await t.auth.login(u,f)}}),t.sdk.authorizationBypass=async(s,u)=>{await t.auth.login(s,u),o.setSchema("streamlayer:streamlayer")},t.sdk.logout=()=>{t.auth.logout()},t.sdk.getUserStore=()=>t.stores.user.getStore(),t.sdk.isUserAuthorized=()=>t.auth.isAuthenticated(),r()},bi=(t,e,r)=>{t.store=new yi(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()},wi=(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(Fe.INITIALIZATION);try{const o=await t.stores.organizationSettings.getValue();return o?(t.stores.status.setValue(Fe.READY),{enabled:!!o}):(t.stores.status.setValue(Fe.FAILED),{err:"failed"})}catch(o){return t.stores.enabled.setValue(),t.stores.status.setValue(Fe.FAILED),{err:`${o}`}}},t.sdk.disableApp=()=>{t.stores.enabled.get()==="on"&&(t.stores.enabled.setValue(),t.stores.status.setValue(Fe.DISABLED),t.storeUnsubscribe())},t.sdk.createEventSession=o=>{t.stores.providerStreamId.setValue(o)},r()},vi=jn.pino({level:"trace"}),en=(t,e)=>vi.child({name:t},e),Si=(t,e,r)=>{const{client:o,queryKey:s}=r.createPromiseClient(Gr.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})},Ai=(t,e,r)=>{const{client:o,queryKey:s}=r.createPromiseClient(Gr.Leaderboard,{method:"list",params:[t,e]});return r.nanoquery.createFetcherStore(s,{fetcher:async(u,f,l,p)=>{const A={usersIds:[]};return l&&(A.eventId=l),p&&(A.leaderboardId=p),(await o.list(A)).data}})},Ei=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.Feed,{method:"get",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>(await r.get({eventId:f})).data?.attributes})},Ii=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.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})},Fi=(t,e)=>{const{client:r}=e.createCallbackClient(ye.Feed),o=je.atom({eventId:t.get()||"",feedId:""});return t.subscribe((u="")=>{o.set({eventId:u,feedId:""})}),e.addSubscription(r.subscription,o,{name:"feedSubscription"})},_i=(t,e)=>{const{client:r}=e.createCallbackClient(ye.Feed);return e.addSubscription(r.questionSubscription,{questionId:t},{name:"questionSubscription"})},Ci=async(t,e)=>{const{client:r}=e.createPromiseClient(ye.Feed,{method:"questionByUser",params:[t]});return(await r.questionByUser({questionId:t})).data?.attributes?.question},Ti=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.Feed,{method:"questionByUser",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>(await r.questionByUser({questionId:f})).data?.attributes?.question})},Oi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.Feed,{method:"pickHistory",params:[t]});return e.nanoquery.createFetcherStore(o,{fetcher:async(s,u,f)=>f?(await r.pickHistory({eventId:f})).data?.map(({attributes:p})=>p):[]})},Bi=(t,e)=>{const{client:r,queryKey:o}=e.createPromiseClient(ye.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})},tn=t=>(t.gamification||(t.gamification=new xi(t)),t.gamification);class xi{slStreamId;organizationId;userId;openedQuestionId;openedQuestion;activeQuestionId;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 ae(ue(void 0),"moderationId").getStore(),this.openedQuestionId=new ae(ue(void 0),"openedQuestionId").getStore(),this.notifications=e.notifications,this.moderation=new te(Ei(this.slStreamId,e.transport),"gamification:moderation"),this.activeQuestionId=new te(Ii(this.slStreamId,e.transport),"gamification:activeQuestionId"),this.openedQuestion=new te(Ti(this.openedQuestionId,e.transport),"gamification:openedQuestion"),this.openedQuestionId.listen(r=>{this.log.debug({questionId:r},"received question"),r?(this.questionSubscription=_i(r,e.transport),this.questionSubscription.addListener("feed-subscription-opened-question",o=>{window.requestAnimationFrame(()=>{this.openedQuestion.getStore().mutate(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=Fi(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 ki{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 ae(ue(new Map),"notifications-queue"),this.notificationsList=lr(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 bt;(function(t){t.OPENED="opened"})(bt||(bt={}));class Pi extends fr{constructor(){super("notification")}setOpened=e=>{this.write(bt.OPENED,e,"true")};isOpened=e=>this.read(bt.OPENED,e);clearNotification=()=>{this.clear()}}var Ke;(function(t){t[t.ONBOARDING=1]="ONBOARDING",t[t.QUESTION=2]="QUESTION"})(Ke||(Ke={}));class Ri{queue;storage;constructor(e={}){this.storage=new Pi,this.queue=new ki({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 Ni=(t,e,r)=>{t.notifications=new Ri,t.addNotification=t.notifications.add,t.sdk.getNotificationsStore=()=>t.notifications.getQueueStore(),r()},Li=(t,e)=>{const{client:r}=t.createPromiseClient(ye.Feed,{method:"submitAnswer"});return r.submitAnswer({data:e})},Ui=(t,e)=>{const{client:r}=t.createPromiseClient(ye.Feed,{method:"submitInplay"});return r.submitInplay({data:{eventId:+e}})},$i=(t,e)=>{const{client:r}=t.createPromiseClient(ye.Feed,{method:"skipQuestion"});return r.skipQuestion({data:{id:e}})};var wt;(function(t){t.ONBOARDING="onboarding"})(wt||(wt={}));class Di extends fr{constructor(){super("gamification")}saveOnboardingStatus=({userId:e,eventId:r,organizationId:o},s)=>{this.write(wt.ONBOARDING,o,e,r,s)};getOnboardingStatus=({userId:e,eventId:r,organizationId:o})=>this.read(wt.ONBOARDING,o,e,r)}const Ar=new Set([de.QuestionType.POLL,de.QuestionType.PREDICTION,de.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 ji extends cr{userSummary;questions;leaderboardId;leaderboardList;onboardingStatus;openedQuestion;notifications;transport;closeFeature;openFeature;background;storage;constructor(e,r,o){super(e,r),this.background=tn(o),this.storage=new Di,this.userSummary=new te(Si(this.background.slStreamId,this.background.userId,o.transport),"gamification:userSummary"),this.questions=new te(Oi(this.background.slStreamId,o.transport),"gamification:questions"),this.leaderboardId=new ae(ue(this.settings.getValue("pinnedLeaderboardId")),"pinnedLeaderboardId").getStore(),this.onboardingStatus=new ae(ue(Z.Unset),"onboardingStatus").getStore(),this.notifications=o.notifications,this.transport=o.transport,this.closeFeature=o.sdk.closeFeature,this.openFeature=()=>o.sdk.openFeature(ce.SdkOverlayType.GAMES),this.openedQuestion=lr(this.background.openedQuestion.getStore(),s=>s.data?.type&&Ar.has(s.data.type)?{loading:!1,data:s.data}:{loading:s.loading,data:void 0}),this.leaderboardList=new te(Ai(this.background.slStreamId,this.leaderboardId,o.transport),"gamification:leaderboardList"),this.onboardingStatus.subscribe(s=>{(s===Z.Optional||Z.Required)&&this.showOnboardingInApp()}),this.status.subscribe(s=>{s===Ue.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!==de.SilenceSetting.ON&&Ar.has(s.data.question.type)&&s.data.question.status===de.QuestionStatus.ACTIVE&&this.notifications.add({type:Ke.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:Ke.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.questions.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===de.QuestionStatus.RESOLVED&&u===de.QuestionType.PREDICTION){const l=this.background.getCurrentSessionId({prefix:`notification-id:${f}`}),A=(await Ci(f,e))?.answers.find(({correct:g})=>g);this.notifications.add({type:Ke.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.questions?.invalidate()})})};disconnect=()=>{this.background.feedSubscription.removeListener("feed-subscription-questions-list")};submitInplay=async()=>{const e=this.background.slStreamId.get();e&&(await Ui(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 Li(this.transport,{questionId:e,answerId:r}),this.questions?.invalidate()};skipQuestion=async e=>{await $i(this.transport,e),this.questions?.invalidate()};openQuestion=e=>(this.openFeature(),this.background.openQuestion(e));closeQuestion=e=>this.background.closeQuestion(e)}class Mi extends cr{insights;closeFeature;openFeature;openedInsight;notifications;transport;background;constructor(e,r,o){super(e,r),this.background=tn(o),this.notifications=o.notifications,this.transport=o.transport,this.closeFeature=o.sdk.closeFeature,this.openFeature=()=>o.sdk.openFeature(ce.SdkOverlayType.HIGHLIGHTS),this.status.subscribe(s=>{s===Ue.Ready?this.connect():this.disconnect()}),this.background.activeQuestionId.listen(s=>{s?.data?.question?.id&&s?.data?.question?.notification&&s.data.moderation?.bypassNotifications?.inAppSilence!==de.SilenceSetting.ON&&s.data.question.type===de.QuestionType.FACTOID&&s.data.question.status===de.QuestionStatus.ACTIVE&&this.notifications.add({type:Ke.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=lr(this.background.openedQuestion.getStore(),s=>{if(s.data?.type===de.QuestionType.FACTOID)return s.data})}connect=()=>{this.insights?this.insights.invalidate():this.insights=new te(Bi(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)}ce.SdkOverlayType.GAMES+"",ce.SdkOverlayType.HIGHLIGHTS+"";class Vi extends cr{constructor(e,r){super(e,r)}}const qi=(t,e,r)=>t.type===ce.SdkOverlayType.GAMES?new ji(t,e,r):t.type===ce.SdkOverlayType.HIGHLIGHTS?new Mi(t,e,r):new Vi(t,e),Qi=(t,e,r)=>{t.features=new Map,t.activeFeature=new ae(ue(ce.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(ce.SdkOverlayType.UNSET)},t.initFeature=(o,s=Ie.ORGANIZATION)=>{const u=qi(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,Ie.ORGANIZATION)},t.stores.providerStreamId.listen(o=>{o||t.reinitializeFeatures()}),t.storeSubscribe=()=>{const o=(u,f)=>{if(f?.overlays){u===Ie.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(Ie.ORGANIZATION,u.data)}catch(f){console.log(f)}},streamSettings:u=>{if(u.data)try{o(Ie.STREAM,u.data)}catch(f){console.log(f)}}};t.store.subscribe(s)},r()};var hr={exports:{}},pr={exports:{}};function Gi(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 zi=Gi,Hi=zi;function rn(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=Hi(Ki),s=null,u=null,f=0,l=null,p={push:L,drain:se,saturated:se,pause:g,paused:!1,concurrency:r,running:A,resume:I,idle:R,length:w,getQueue:E,unshift:G,empty:se,kill:X,killAndDrain:ge,error:ee};return p;function A(){return f}function g(){p.paused=!0}function w(){for(var x=s,j=0;x;)x=x.next,j++;return j}function E(){for(var x=s,j=[];x;)j.push(x.value),x=x.next;return j}function I(){if(p.paused){p.paused=!1;for(var x=0;x<p.concurrency;x++)f++,z()}}function R(){return f===0&&p.length()===0}function L(x,j){var O=o.get();O.context=t,O.release=z,O.value=x,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(x,j){var O=o.get();O.context=t,O.release=z,O.value=x,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(x){x&&o.release(x);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 ge(){s=null,u=null,p.drain(),p.drain=se}function ee(x){l=x}}function se(){}function Ki(){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 Wi(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=rn(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,I){u(g,function(R,L){if(R){I(R);return}E(L)})});return w.catch(se),w}function p(g){var w=new Promise(function(E,I){f(g,function(R,L){if(R){I(R);return}E(L)})});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=rn;pr.exports.promise=Wi;var nn=pr.exports,dr={exports:{}},We=typeof Reflect=="object"?Reflect:null,Er=We&&typeof We.apply=="function"?We.apply:function(e,r,o){return Function.prototype.apply.call(e,r,o)},pt;We&&typeof We.ownKeys=="function"?pt=We.ownKeys:Object.getOwnPropertySymbols?pt=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:pt=function(e){return Object.getOwnPropertyNames(e)};function Ji(t){console&&console.warn&&console.warn(t)}var on=Number.isNaN||function(e){return e!==e};function $(){$.init.call(this)}dr.exports=$;dr.exports.once=eo;$.EventEmitter=$;$.prototype._events=void 0;$.prototype._eventsCount=0;$.prototype._maxListeners=void 0;var Ir=10;function Tt(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 Ir},set:function(t){if(typeof t!="number"||t<0||on(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ir=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||on(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 sn(t){return t._maxListeners===void 0?$.defaultMaxListeners:t._maxListeners}$.prototype.getMaxListeners=function(){return sn(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")Er(p,this,r);else for(var A=p.length,g=fn(p,A),o=0;o<A;++o)Er(g[o],this,r);return!0};function an(t,e,r,o){var s,u,f;if(Tt(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=sn(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,Ji(l)}return t}$.prototype.addListener=function(e,r){return an(this,e,r,!1)};$.prototype.on=$.prototype.addListener;$.prototype.prependListener=function(e,r){return an(this,e,r,!0)};function Yi(){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 un(t,e,r){var o={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=Yi.bind(o);return s.listener=r,o.wrapFn=s,s}$.prototype.once=function(e,r){return Tt(r),this.on(e,un(this,e,r)),this};$.prototype.prependOnceListener=function(e,r){return Tt(r),this.prependListener(e,un(this,e,r)),this};$.prototype.removeListener=function(e,r){var o,s,u,f,l;if(Tt(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():Xi(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 cn(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?Zi(s):fn(s,s.length)}$.prototype.listeners=function(e){return cn(this,e,!0)};$.prototype.rawListeners=function(e){return cn(this,e,!1)};$.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):ln.call(t,e)};$.prototype.listenerCount=ln;function ln(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?pt(this._events):[]};function fn(t,e){for(var r=new Array(e),o=0;o<e;++o)r[o]=t[o];return r}function Xi(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Zi(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function eo(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))}hn(t,e,u,{once:!0}),e!=="error"&&to(t,s,{once:!0})})}function to(t,e,r){typeof t.on=="function"&&hn(t,"error",e,r)}function hn(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=dr.exports,Ot={},dn={},yn=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},ro=yn,yr=function(){return ro()&&!!Symbol.toStringTag},Fr=typeof Symbol<"u"&&Symbol,no=yn,io=function(){return typeof Fr!="function"||typeof Symbol!="function"||typeof Fr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:no()},_r={foo:{}},oo=Object,so=function(){return{__proto__:_r}.foo===_r.foo&&!({__proto__:null}instanceof oo)},ao="Function.prototype.bind called on incompatible ",uo=Object.prototype.toString,co=Math.max,lo="[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},fo=function(e,r){for(var o=[],s=r||0,u=0;s<e.length;s+=1,u+=1)o[u]=e[s];return o},ho=function(t,e){for(var r="",o=0;o<t.length;o+=1)r+=t[o],o+1<t.length&&(r+=e);return r},po=function(e){var r=this;if(typeof r!="function"||uo.apply(r)!==lo)throw new TypeError(ao+r);for(var o=fo(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=co(0,r.length-o.length),l=[],p=0;p<f;p++)l[p]="$"+p;if(s=Function("binder","return function ("+ho(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},yo=po,gn=Function.prototype.bind||yo,Tr={}.hasOwnProperty,Rt=Function.prototype.call,go=Rt.bind?Rt.bind(Tr):function(t,e){return Rt.call(Tr,t,e)},k,Ye=SyntaxError,mn=Function,Je=TypeError,Nt=function(t){try{return mn('"use strict"; return ('+t+").constructor;")()}catch{}},$e=Object.getOwnPropertyDescriptor;if($e)try{$e({},"")}catch{$e=null}var Lt=function(){throw new Je},mo=$e?function(){try{return arguments.callee,Lt}catch{try{return $e(arguments,"callee").get}catch{return Lt}}}():Lt,qe=io(),bo=so(),K=Object.getPrototypeOf||(bo?function(t){return t.__proto__}:null),Ge={},wo=typeof Uint8Array>"u"||!K?k:K(Uint8Array),De={"%AggregateError%":typeof AggregateError>"u"?k:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?k:ArrayBuffer,"%ArrayIteratorPrototype%":qe&&K?K([][Symbol.iterator]()):k,"%AsyncFromSyncIteratorPrototype%":k,"%AsyncFunction%":Ge,"%AsyncGenerator%":Ge,"%AsyncGeneratorFunction%":Ge,"%AsyncIteratorPrototype%":Ge,"%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%":mn,"%GeneratorFunction%":Ge,"%Int8Array%":typeof Int8Array>"u"?k:Int8Array,"%Int16Array%":typeof Int16Array>"u"?k:Int16Array,"%Int32Array%":typeof Int32Array>"u"?k:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":qe&&K?K(K([][Symbol.iterator]())):k,"%JSON%":typeof JSON=="object"?JSON:k,"%Map%":typeof Map>"u"?k:Map,"%MapIteratorPrototype%":typeof Map>"u"||!qe||!K?k:K(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||!K?k:K(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?k:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":qe&&K?K(""[Symbol.iterator]()):k,"%Symbol%":qe?Symbol:k,"%SyntaxError%":Ye,"%ThrowTypeError%":mo,"%TypedArray%":wo,"%TypeError%":Je,"%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(K)try{null.error}catch(t){var vo=K(K(t));De["%Error.prototype%"]=vo}var So=function t(e){var r;if(e==="%AsyncFunction%")r=Nt("async function () {}");else if(e==="%GeneratorFunction%")r=Nt("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Nt("async function* () {}");else if(e==="%AsyncGenerator%"){var o=t("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&K&&(r=K(s.prototype))}return De[e]=r,r},Or={"%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"]},ct=gn,vt=go,Ao=ct.call(Function.call,Array.prototype.concat),Eo=ct.call(Function.apply,Array.prototype.splice),Br=ct.call(Function.call,String.prototype.replace),St=ct.call(Function.call,String.prototype.slice),Io=ct.call(Function.call,RegExp.prototype.exec),Fo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,_o=/\\(\\)?/g,Co=function(e){var r=St(e,0,1),o=St(e,-1);if(r==="%"&&o!=="%")throw new Ye("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&r!=="%")throw new Ye("invalid intrinsic syntax, expected opening `%`");var s=[];return Br(e,Fo,function(u,f,l,p){s[s.length]=l?Br(p,_o,"$1"):f||u}),s},To=function(e,r){var o=e,s;if(vt(Or,o)&&(s=Or[o],o="%"+s[0]+"%"),vt(De,o)){var u=De[o];if(u===Ge&&(u=So(o)),typeof u>"u"&&!r)throw new Je("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:o,value:u}}throw new Ye("intrinsic "+e+" does not exist!")},Ze=function(e,r){if(typeof e!="string"||e.length===0)throw new Je("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Je('"allowMissing" argument must be a boolean');if(Io(/^%?[^%]*%?$/,e)===null)throw new Ye("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=Co(e),s=o.length>0?o[0]:"",u=To("%"+s+"%",r),f=u.name,l=u.value,p=!1,A=u.alias;A&&(s=A[0],Eo(o,Ao([0,1],A)));for(var g=1,w=!0;g<o.length;g+=1){var E=o[g],I=St(E,0,1),R=St(E,-1);if((I==='"'||I==="'"||I==="`"||R==='"'||R==="'"||R==="`")&&I!==R)throw new Ye("property names with quotes must have matching quotes");if((E==="constructor"||!w)&&(p=!0),s+="."+E,f="%"+s+"%",vt(De,f))l=De[f];else if(l!=null){if(!(E in l)){if(!r)throw new Je("base intrinsic for "+e+" exists, but the property is not available.");return}if($e&&g+1>=o.length){var L=$e(l,E);w=!!L,w&&"get"in L&&!("originalValue"in L.get)?l=L.get:l=l[E]}else w=vt(l,E),l=l[E];w&&!p&&(De[f]=l)}}return l},bn={exports:{}},Oo=Ze,Xt=Oo("%Object.defineProperty%",!0),Zt=function(){if(Xt)try{return Xt({},"a",{value:1}),!0}catch{return!1}return!1};Zt.hasArrayLengthDefineBug=function(){if(!Zt())return null;try{return Xt([],"length",{value:1}).length!==1}catch{return!0}};var wn=Zt,Bo=Ze,dt=Bo("%Object.getOwnPropertyDescriptor%",!0);if(dt)try{dt([],"length")}catch{dt=null}var gr=dt,xo=wn(),mr=Ze,at=xo&&mr("%Object.defineProperty%",!0);if(at)try{at({},"a",{value:1})}catch{at=!1}var ko=mr("%SyntaxError%"),Qe=mr("%TypeError%"),xr=gr,Po=function(e,r,o){if(!e||typeof e!="object"&&typeof e!="function")throw new Qe("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new Qe("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Qe("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Qe("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Qe("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Qe("`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=!!xr&&xr(e,r);if(at)at(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 ko("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},vn=Ze,kr=Po,Ro=wn(),Pr=gr,Rr=vn("%TypeError%"),No=vn("%Math.floor%"),Lo=function(e,r){if(typeof e!="function")throw new Rr("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||No(r)!==r)throw new Rr("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in e&&Pr){var f=Pr(e,"length");f&&!f.configurable&&(s=!1),f&&!f.writable&&(u=!1)}return(s||u||!o)&&(Ro?kr(e,"length",r,!0,!0):kr(e,"length",r)),e};(function(t){var e=gn,r=Ze,o=Lo,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 I=l(e,f,arguments);return o(I,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})(bn);var Sn=bn.exports,An=Ze,En=Sn,Uo=En(An("String.prototype.indexOf")),In=function(e,r){var o=An(e,!!r);return typeof o=="function"&&Uo(e,".prototype.")>-1?En(o):o},$o=yr(),Do=In,er=Do("Object.prototype.toString"),Bt=function(e){return $o&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:er(e)==="[object Arguments]"},Fn=function(e){return Bt(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&er(e)!=="[object Array]"&&er(e.callee)==="[object Function]"},jo=function(){return Bt(arguments)}();Bt.isLegacyArguments=Fn;var Mo=jo?Bt:Fn,Vo=Object.prototype.toString,qo=Function.prototype.toString,Qo=/^\s*(?:function)?\*/,_n=yr(),Ut=Object.getPrototypeOf,Go=function(){if(!_n)return!1;try{return Function("return function*() {}")()}catch{}},$t,zo=function(e){if(typeof e!="function")return!1;if(Qo.test(qo.call(e)))return!0;if(!_n){var r=Vo.call(e);return r==="[object GeneratorFunction]"}if(!Ut)return!1;if(typeof $t>"u"){var o=Go();$t=o?Ut(o):!1}return Ut(e)===$t},Cn=Function.prototype.toString,ze=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,tr,yt;if(typeof ze=="function"&&typeof Object.defineProperty=="function")try{tr=Object.defineProperty({},"length",{get:function(){throw yt}}),yt={},ze(function(){throw 42},null,tr)}catch(t){t!==yt&&(ze=null)}else ze=null;var Ho=/^\s*class\b/,rr=function(e){try{var r=Cn.call(e);return Ho.test(r)}catch{return!1}},Dt=function(e){try{return rr(e)?!1:(Cn.call(e),!0)}catch{return!1}},gt=Object.prototype.toString,Ko="[object Object]",Wo="[object Function]",Jo="[object GeneratorFunction]",Yo="[object HTMLAllCollection]",Xo="[object HTML document.all class]",Zo="[object HTMLCollection]",es=typeof Symbol=="function"&&!!Symbol.toStringTag,ts=!(0 in[,]),nr=function(){return!1};if(typeof document=="object"){var rs=document.all;gt.call(rs)===gt.call(document.all)&&(nr=function(e){if((ts||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=gt.call(e);return(r===Yo||r===Xo||r===Zo||r===Ko)&&e("")==null}catch{}return!1})}var ns=ze?function(e){if(nr(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{ze(e,null,tr)}catch(r){if(r!==yt)return!1}return!rr(e)&&Dt(e)}:function(e){if(nr(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(es)return Dt(e);if(rr(e))return!1;var r=gt.call(e);return r!==Wo&&r!==Jo&&!/^\[object HTML/.test(r)?!1:Dt(e)},is=ns,os=Object.prototype.toString,Tn=Object.prototype.hasOwnProperty,ss=function(e,r,o){for(var s=0,u=e.length;s<u;s++)Tn.call(e,s)&&(o==null?r(e[s],s,e):r.call(o,e[s],s,e))},as=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)},us=function(e,r,o){for(var s in e)Tn.call(e,s)&&(o==null?r(e[s],s,e):r.call(o,e[s],s,e))},cs=function(e,r,o){if(!is(r))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=o),os.call(e)==="[object Array]"?ss(e,r,s):typeof e=="string"?as(e,r,s):us(e,r,s)},ls=cs,jt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],fs=typeof globalThis>"u"?zr:globalThis,hs=function(){for(var e=[],r=0;r<jt.length;r++)typeof fs[jt[r]]=="function"&&(e[e.length]=jt[r]);return e},At=ls,ps=hs,Nr=Sn,br=In,mt=gr,ds=br("Object.prototype.toString"),On=yr(),Lr=typeof globalThis>"u"?zr:globalThis,ir=ps(),wr=br("String.prototype.slice"),Mt=Object.getPrototypeOf,ys=br("Array.prototype.indexOf",!0)||function(e,r){for(var o=0;o<e.length;o+=1)if(e[o]===r)return o;return-1},Et={__proto__:null};On&&mt&&Mt?At(ir,function(t){var e=new Lr[t];if(Symbol.toStringTag in e){var r=Mt(e),o=mt(r,Symbol.toStringTag);if(!o){var s=Mt(r);o=mt(s,Symbol.toStringTag)}Et["$"+t]=Nr(o.get)}}):At(ir,function(t){var e=new Lr[t],r=e.slice||e.set;r&&(Et["$"+t]=Nr(r))});var gs=function(e){var r=!1;return At(Et,function(o,s){if(!r)try{"$"+o(e)===s&&(r=wr(s,1))}catch{}}),r},ms=function(e){var r=!1;return At(Et,function(o,s){if(!r)try{o(e),r=wr(s,1)}catch{}}),r},Bn=function(e){if(!e||typeof e!="object")return!1;if(!On){var r=wr(ds(e),8,-1);return ys(ir,r)>-1?r:r!=="Object"?!1:ms(e)}return mt?gs(e):null},bs=Bn,ws=function(e){return!!bs(e)};(function(t){var e=Mo,r=zo,o=Bn,s=ws;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 I=u(Symbol.prototype.valueOf);function R(v,ft){if(typeof v!="object")return!1;try{return ft(v),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=s;function L(v){return typeof Promise<"u"&&v instanceof Promise||v!==null&&typeof v=="object"&&typeof v.then=="function"&&typeof v.catch=="function"}t.isPromise=L;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 ge(v){return o(v)==="Uint16Array"}t.isUint16Array=ge;function ee(v){return o(v)==="Uint32Array"}t.isUint32Array=ee;function x(v){return o(v)==="Int8Array"}t.isInt8Array=x;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 Te(v){return o(v)==="BigInt64Array"}t.isBigInt64Array=Te;function Ae(v){return o(v)==="BigUint64Array"}t.isBigUint64Array=Ae;function le(v){return p(v)==="[object Map]"}le.working=typeof Map<"u"&&le(new Map);function tt(v){return typeof Map>"u"?!1:le.working?le(v):v instanceof Map}t.isMap=tt;function fe(v){return p(v)==="[object Set]"}fe.working=typeof Set<"u"&&fe(new Set);function Oe(v){return typeof Set>"u"?!1:fe.working?fe(v):v instanceof Set}t.isSet=Oe;function Be(v){return p(v)==="[object WeakMap]"}Be.working=typeof WeakMap<"u"&&Be(new WeakMap);function rt(v){return typeof WeakMap>"u"?!1:Be.working?Be(v):v instanceof WeakMap}t.isWeakMap=rt;function xe(v){return p(v)==="[object WeakSet]"}xe.working=typeof WeakSet<"u"&&xe(new WeakSet);function he(v){return xe(v)}t.isWeakSet=he;function ke(v){return p(v)==="[object ArrayBuffer]"}ke.working=typeof ArrayBuffer<"u"&&ke(new ArrayBuffer);function V(v){return typeof ArrayBuffer>"u"?!1:ke.working?ke(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 F(v){return p(v)==="[object SharedArrayBuffer]"}function P(v){return typeof S>"u"?!1:(typeof F.working>"u"&&(F.working=F(new S)),F.working?F(v):v instanceof S)}t.isSharedArrayBuffer=P;function N(v){return p(v)==="[object AsyncFunction]"}t.isAsyncFunction=N;function _(v){return p(v)==="[object Map Iterator]"}t.isMapIterator=_;function B(v){return p(v)==="[object Set Iterator]"}t.isSetIterator=B;function U(v){return p(v)==="[object Generator]"}t.isGeneratorObject=U;function Y(v){return p(v)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=Y;function me(v){return R(v,A)}t.isNumberObject=me;function pe(v){return R(v,g)}t.isStringObject=pe;function ie(v){return R(v,w)}t.isBooleanObject=ie;function Me(v){return f&&R(v,E)}t.isBigIntObject=Me;function lt(v){return l&&R(v,I)}t.isSymbolObject=lt;function nt(v){return me(v)||pe(v)||ie(v)||Me(v)||lt(v)}t.isBoxedPrimitive=nt;function xt(v){return typeof Uint8Array<"u"&&(V(v)||P(v))}t.isAnyArrayBuffer=xt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(v){Object.defineProperty(t,v,{enumerable:!1,value:function(){throw new Error(v+" is not supported in userland")}})})})(dn);var vs=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"},or={exports:{}};typeof Object.create=="function"?or.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:or.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 Ss=or.exports;(function(t){var e=Object.getOwnPropertyDescriptors||function(b){for(var S=Object.keys(b),F={},P=0;P<S.length;P++)F[S[P]]=Object.getOwnPropertyDescriptor(b,S[P]);return F},r=/%[sdj%]/g;t.format=function(d){if(!x(d)){for(var b=[],S=0;S<arguments.length;S++)b.push(f(arguments[S]));return b.join(" ")}for(var S=1,F=arguments,P=F.length,N=String(d).replace(r,function(B){if(B==="%%")return"%";if(S>=P)return B;switch(B){case"%s":return String(F[S++]);case"%d":return Number(F[S++]);case"%j":try{return JSON.stringify(F[S++])}catch{return"[Circular]"}default:return B}}),_=F[S];S<P;_=F[++S])X(_)||!ne(_)?N+=" "+_:N+=" "+f(_);return N},t.deprecate=function(d,b){if(typeof C.process<"u"&&C.process.noDeprecation===!0)return d;if(typeof C.process>"u")return function(){return t.deprecate(d,b).apply(this,arguments)};var S=!1;function F(){if(!S){if(C.process.throwDeprecation)throw new Error(b);C.process.traceDeprecation?console.trace(b):console.error(b),S=!0}return d.apply(this,arguments)}return F};var o={},s=/^$/;if(C.process.env.NODE_DEBUG){var u=C.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=C.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,F){b[S]=!0}),b}function g(d,b,S){if(d.customInspect&&b&&le(b.inspect)&&b.inspect!==t.inspect&&!(b.constructor&&b.constructor.prototype===b)){var F=b.inspect(S,d);return x(F)||(F=g(d,F,S)),F}var P=w(d,b);if(P)return P;var N=Object.keys(b),_=A(N);if(d.showHidden&&(N=Object.getOwnPropertyNames(b)),Ae(b)&&(N.indexOf("message")>=0||N.indexOf("description")>=0))return E(b);if(N.length===0){if(le(b)){var B=b.name?": "+b.name:"";return d.stylize("[Function"+B+"]","special")}if(re(b))return d.stylize(RegExp.prototype.toString.call(b),"regexp");if(Te(b))return d.stylize(Date.prototype.toString.call(b),"date");if(Ae(b))return E(b)}var U="",Y=!1,me=["{","}"];if(G(b)&&(Y=!0,me=["[","]"]),le(b)){var pe=b.name?": "+b.name:"";U=" [Function"+pe+"]"}if(re(b)&&(U=" "+RegExp.prototype.toString.call(b)),Te(b)&&(U=" "+Date.prototype.toUTCString.call(b)),Ae(b)&&(U=" "+E(b)),N.length===0&&(!Y||b.length==0))return me[0]+U+me[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=I(d,b,S,_,N):ie=N.map(function(Me){return R(d,b,S,_,Me,Y)}),d.seen.pop(),L(ie,U,me)}function w(d,b){if(O(b))return d.stylize("undefined","undefined");if(x(b)){var S="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return d.stylize(S,"string")}if(ee(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 I(d,b,S,F,P){for(var N=[],_=0,B=b.length;_<B;++_)xe(b,String(_))?N.push(R(d,b,S,F,String(_),!0)):N.push("");return P.forEach(function(U){U.match(/^\d+$/)||N.push(R(d,b,S,F,U,!0))}),N}function R(d,b,S,F,P,N){var _,B,U;if(U=Object.getOwnPropertyDescriptor(b,P)||{value:b[P]},U.get?U.set?B=d.stylize("[Getter/Setter]","special"):B=d.stylize("[Getter]","special"):U.set&&(B=d.stylize("[Setter]","special")),xe(F,P)||(_="["+P+"]"),B||(d.seen.indexOf(U.value)<0?(X(S)?B=g(d,U.value,null):B=g(d,U.value,S-1),B.indexOf(`
7
7
  `)>-1&&(N?B=B.split(`
8
8
  `).map(function(Y){return" "+Y}).join(`
9
9
  `).slice(2):B=`
@@ -12,8 +12,8 @@
12
12
  `))):B=d.stylize("[Circular]","special")),O(_)){if(N&&P.match(/^\d+$/))return B;_=JSON.stringify(""+P),_.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(_=_.slice(1,-1),_=d.stylize(_,"name")):(_=_.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),_=d.stylize(_,"string"))}return _+": "+B}function L(d,b,S){var F=d.reduce(function(P,N){return N.indexOf(`
13
13
  `)>=0,P+N.replace(/\u001b\[\d\d?m/g,"").length+1},0);return F>60?S[0]+(b===""?"":b+`
14
14
  `)+" "+d.join(`,
15
- `)+" "+S[1]:S[0]+b+" "+d.join(", ")+" "+S[1]}t.types=dn;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 ge(d){return d==null}t.isNullOrUndefined=ge;function ee(d){return typeof d=="number"}t.isNumber=ee;function x(d){return typeof d=="string"}t.isString=x;function D(d){return typeof d=="symbol"}t.isSymbol=D;function O(d){return d===void 0}t.isUndefined=O;function re(d){return ne(d)&&fe(d)==="[object RegExp]"}t.isRegExp=re,t.types.isRegExp=re;function ne(d){return typeof d=="object"&&d!==null}t.isObject=ne;function Ce(d){return ne(d)&&fe(d)==="[object Date]"}t.isDate=Ce,t.types.isDate=Ce;function Ae(d){return ne(d)&&(fe(d)==="[object Error]"||d instanceof Error)}t.isError=Ae,t.types.isNativeError=Ae;function le(d){return typeof d=="function"}t.isFunction=le;function tt(d){return d===null||typeof d=="boolean"||typeof d=="number"||typeof d=="string"||typeof d=="symbol"||typeof d>"u"}t.isPrimitive=tt,t.isBuffer=vs;function fe(d){return Object.prototype.toString.call(d)}function Te(d){return d<10?"0"+d.toString(10):d.toString(10)}var Oe=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function rt(){var d=new Date,b=[Te(d.getHours()),Te(d.getMinutes()),Te(d.getSeconds())].join(":");return[d.getDate(),Oe[d.getMonth()],b].join(" ")}t.log=function(){console.log("%s - %s",rt(),t.format.apply(t,arguments))},t.inherits=Ss,t._extend=function(d,b){if(!b||!ne(b))return d;for(var S=Object.keys(b),F=S.length;F--;)d[S[F]]=b[S[F]];return d};function Be(d,b){return Object.prototype.hasOwnProperty.call(d,b)}var he=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(he&&b[he]){var S=b[he];if(typeof S!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(S,he,{value:S,enumerable:!1,writable:!1,configurable:!0}),S}function S(){for(var F,P,N=new Promise(function(U,Y){F=U,P=Y}),_=[],B=0;B<arguments.length;B++)_.push(arguments[B]);_.push(function(U,Y){U?P(U):F(Y)});try{b.apply(this,_)}catch(U){P(U)}return N}return Object.setPrototypeOf(S,Object.getPrototypeOf(b)),he&&Object.defineProperty(S,he,{value:S,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(S,e(b))},t.promisify.custom=he;function xe(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=[],F=0;F<arguments.length;F++)S.push(arguments[F]);var P=S.pop();if(typeof P!="function")throw new TypeError("The last argument must be of type Function");var N=this,_=function(){return P.apply(N,arguments)};d.apply(this,S).then(function(B){C.process.nextTick(_.bind(null,null,B))},function(B){C.process.nextTick(xe.bind(null,B,_))})}return Object.setPrototypeOf(b,Object.getPrototypeOf(d)),Object.defineProperties(b,e(d)),b}t.callbackify=V})(Ot);const{inherits:As,format:Vt}=Ot;function Re(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=Vt(e,s,u,f):s&&u?this.message=Vt(e,s,u):s?this.message=Vt(e,s):this.message=e}return o.prototype[Symbol.toStringTag]="Error",o.prototype.toString=function(){return`${this.name} [${this.code}]: ${this.message}`},As(o,r),o}var xn={createError:Re,AVV_ERR_EXPOSE_ALREADY_DEFINED:Re("AVV_ERR_EXPOSE_ALREADY_DEFINED","'%s' () is already defined, specify an expose option"),AVV_ERR_CALLBACK_NOT_FN:Re("AVV_ERR_CALLBACK_NOT_FN","Callback for '%s' hook is not a function. Received: '%s'"),AVV_ERR_PLUGIN_NOT_VALID:Re("AVV_ERR_PLUGIN_NOT_VALID","Plugin must be a function or a promise. Received: '%s'"),AVV_ERR_ROOT_PLG_BOOTED:Re("AVV_ERR_PLUGIN_NOT_VALID","Root plugin has already booted"),AVV_ERR_PARENT_PLG_LOADED:Re("AVV_ERR_PARENT_PLG_LOADED","Impossible to load '%s' plugin because the parent '%s' was already loaded"),AVV_ERR_READY_TIMEOUT:Re("AVV_ERR_READY_TIMEOUT","Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise")},Es=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(`
15
+ `)+" "+S[1]:S[0]+b+" "+d.join(", ")+" "+S[1]}t.types=dn;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 ge(d){return d==null}t.isNullOrUndefined=ge;function ee(d){return typeof d=="number"}t.isNumber=ee;function x(d){return typeof d=="string"}t.isString=x;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)&&fe(d)==="[object RegExp]"}t.isRegExp=re,t.types.isRegExp=re;function ne(d){return typeof d=="object"&&d!==null}t.isObject=ne;function Te(d){return ne(d)&&fe(d)==="[object Date]"}t.isDate=Te,t.types.isDate=Te;function Ae(d){return ne(d)&&(fe(d)==="[object Error]"||d instanceof Error)}t.isError=Ae,t.types.isNativeError=Ae;function le(d){return typeof d=="function"}t.isFunction=le;function tt(d){return d===null||typeof d=="boolean"||typeof d=="number"||typeof d=="string"||typeof d=="symbol"||typeof d>"u"}t.isPrimitive=tt,t.isBuffer=vs;function fe(d){return Object.prototype.toString.call(d)}function Oe(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 rt(){var d=new Date,b=[Oe(d.getHours()),Oe(d.getMinutes()),Oe(d.getSeconds())].join(":");return[d.getDate(),Be[d.getMonth()],b].join(" ")}t.log=function(){console.log("%s - %s",rt(),t.format.apply(t,arguments))},t.inherits=Ss,t._extend=function(d,b){if(!b||!ne(b))return d;for(var S=Object.keys(b),F=S.length;F--;)d[S[F]]=b[S[F]];return d};function xe(d,b){return Object.prototype.hasOwnProperty.call(d,b)}var he=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(he&&b[he]){var S=b[he];if(typeof S!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(S,he,{value:S,enumerable:!1,writable:!1,configurable:!0}),S}function S(){for(var F,P,N=new Promise(function(U,Y){F=U,P=Y}),_=[],B=0;B<arguments.length;B++)_.push(arguments[B]);_.push(function(U,Y){U?P(U):F(Y)});try{b.apply(this,_)}catch(U){P(U)}return N}return Object.setPrototypeOf(S,Object.getPrototypeOf(b)),he&&Object.defineProperty(S,he,{value:S,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(S,e(b))},t.promisify.custom=he;function ke(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=[],F=0;F<arguments.length;F++)S.push(arguments[F]);var P=S.pop();if(typeof P!="function")throw new TypeError("The last argument must be of type Function");var N=this,_=function(){return P.apply(N,arguments)};d.apply(this,S).then(function(B){C.process.nextTick(_.bind(null,null,B))},function(B){C.process.nextTick(ke.bind(null,B,_))})}return Object.setPrototypeOf(b,Object.getPrototypeOf(d)),Object.defineProperties(b,e(d)),b}t.callbackify=V})(Ot);const{inherits:As,format:Vt}=Ot;function Re(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=Vt(e,s,u,f):s&&u?this.message=Vt(e,s,u):s?this.message=Vt(e,s):this.message=e}return o.prototype[Symbol.toStringTag]="Error",o.prototype.toString=function(){return`${this.name} [${this.code}]: ${this.message}`},As(o,r),o}var xn={createError:Re,AVV_ERR_EXPOSE_ALREADY_DEFINED:Re("AVV_ERR_EXPOSE_ALREADY_DEFINED","'%s' () is already defined, specify an expose option"),AVV_ERR_CALLBACK_NOT_FN:Re("AVV_ERR_CALLBACK_NOT_FN","Callback for '%s' hook is not a function. Received: '%s'"),AVV_ERR_PLUGIN_NOT_VALID:Re("AVV_ERR_PLUGIN_NOT_VALID","Plugin must be a function or a promise. Received: '%s'"),AVV_ERR_ROOT_PLG_BOOTED:Re("AVV_ERR_PLUGIN_NOT_VALID","Root plugin has already booted"),AVV_ERR_PARENT_PLG_LOADED:Re("AVV_ERR_PARENT_PLG_LOADED","Impossible to load '%s' plugin because the parent '%s' was already loaded"),AVV_ERR_READY_TIMEOUT:Re("AVV_ERR_READY_TIMEOUT","Plugin did not start in time: '%s'. You may have forgotten to call 'done' function or to resolve a Promise")},Es=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(`
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 Is=Es,Ur=Symbol("avvio.TimeTree.untrackNode"),qt=Symbol("avvio.TimeTree.trackNode"),$r=Symbol("avvio.TimeTree.getParent"),jr=Symbol("avvio.TimeTree.getNode"),Dr=Symbol("avvio.TimeTree.addNode");let Fs=class{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[qt](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])}[Ur](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)}[$r](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)}[Dr](e,r,o){if(e===null)return this.root={id:"root",label:r,start:o,nodes:[]},this[qt](this.root),this.root.id;const u=this[$r](e),f=`${r}-${Math.random()}`,l={id:f,parent:e,start:o,label:r,nodes:[]};return u.nodes.push(l),this[qt](l),f}start(e,r,o=Date.now()){return this[Dr](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[Ur](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 Is(r)}};var _s=Fs,vr={exports:{}},sr={exports:{}},Qt,Mr;function Cs(){if(Mr)return Qt;Mr=1;var t=1e3,e=t*60,r=e*60,o=r*24,s=o*7,u=o*365.25;Qt=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]),I=(w[2]||"ms").toLowerCase();switch(I){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,I){var R=w>=E*1.5;return Math.round(g/E)+" "+I+(R?"s":"")}return Qt}function Ts(t){r.debug=r,r.default=r,r.coerce=p,r.disable=u,r.enable=s,r.enabled=f,r.humanize=Cs(),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,I,R;function L(...G){if(!L.enabled)return;const z=L,X=Number(new Date),ge=X-(w||X);z.diff=ge,z.prev=w,z.curr=X,w=X,G[0]=r.coerce(G[0]),typeof G[0]!="string"&&G.unshift("%O");let ee=0;G[0]=G[0].replace(/%([a-zA-Z%])/g,(D,O)=>{if(D==="%%")return"%";ee++;const re=r.formatters[O];if(typeof re=="function"){const ne=G[ee];D=re.call(z,ne),G.splice(ee,1),ee--}return D}),r.formatArgs.call(z,G),(z.log||r.log).apply(z,G)}return L.namespace=g,L.useColors=r.useColors(),L.color=r.selectColor(g),L.extend=o,L.destroy=r.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>E!==null?E:(I!==r.namespaces&&(I=r.namespaces,R=r.enabled(g)),R),set:G=>{E=G}}),typeof r.init=="function"&&r.init(L),L}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,]+/),I=E.length;for(w=0;w<I;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 Os=Ts;(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 C.process<"u"&&"env"in C.process&&(p=C.process.env.DEBUG),p}function f(){try{return localStorage}catch{}}t.exports=Os(e);const{formatters:l}=t.exports;l.j=function(p){try{return JSON.stringify(p)}catch(A){return"[UnexpectedJSONParseError]: "+A.message}}})(sr,sr.exports);var kn=sr.exports;const Bs=nn,xs=pn.EventEmitter,ks=Ot.inherits,W=kn("avvio"),{AVV_ERR_READY_TIMEOUT:Ps}=xn,Gt=Symbol.for("plugin-meta");function Rs(t,e){return t[Gt]&&t[Gt].name?t[Gt].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 Ns(){const t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}function et(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=Rs(e,r),this.isAfter=o,this.q=Bs(t,Ls,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}ks(et,xs);et.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),C.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 Ps(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(()=>C.process.nextTick(f),p=>C.process.nextTick(f,p)))};et.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,C.process.nextTick(o,r)}),this.q.resume()};let e;return this._promise?e=Promise.resolve():(this._promise=Ns(),e=this._promise.promise,this.server?t():this.on("start",t)),e};et.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)};et.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=Us,queueMicrotask(o)}};queueMicrotask(o),this.q.resume()};function Ls(t,e){const r=this;C.process.nextTick(Sr.bind(r),t,e)}function Sr(t,e){if(typeof t.func.then=="function"){t.func.then(o=>{typeof o.default=="function"&&(o=o.default),t.func=o,Sr.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 Us(){}vr.exports=et;vr.exports.loadPlugin=Sr;var $s=vr.exports;const Vr=nn,js=pn.EventEmitter,Ds=Ot.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:zt,AVV_ERR_CALLBACK_NOT_FN:ut,AVV_ERR_PLUGIN_NOT_VALID:Ms,AVV_ERR_ROOT_PLG_BOOTED:Vs,AVV_ERR_READY_TIMEOUT:qs}=xn,Qs=_s,ar=$s,Xe=kn("avvio"),It=Symbol("kAvvio"),Ht=Symbol("kThenifyDoNotWrap");function Gs(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 zt(s);if(t[u])throw new zt(u);if(t[f])throw new zt(f);t[s]=function(A,g){return r.use(A,g),this},Object.defineProperty(t,"then",{get:Pn.bind(r)}),t[It]=!0,t[u]=function(A){return typeof A!="function"?r._loadRegistered():(r.after(Kt(A,this)),this)},t[f]=function(A){if(A&&typeof A!="function")throw new ut(f,typeof A);return r.ready(A?Kt(A,this):void 0)},t[l]=function(A){if(typeof A!="function")throw new ut(l,typeof A);return r.onClose(Js(A,this)),this},t[p]=function(A){if(A&&typeof A!="function")throw new ut(p,typeof A);return A?(r.close(Kt(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&&Gs(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 Qs,this._readyQ=Vr(this,Rn,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=qr},this._closeQ=Vr(this,Ws,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=qr},this._doStart=null,this._root=new ar(this,zs.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)})}),ar.loadPlugin.call(this,this._root,o=>{Xe("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 zs(t,e,r){this._doStart=r,e.autostart&&this.start()}Ds(J,js);J.prototype.start=function(){return this.started=!0,C.process.nextTick(this._doStart),this};J.prototype.override=function(t,e,r){return t};function Hs(t){if(t&&typeof t=="object"&&typeof t.default=="function"&&(t=t.default),!(t&&(typeof t=="function"||typeof t.then=="function")))throw new Ms(typeof t);return t}J.prototype[It]=!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&&C.process.nextTick(()=>this._root.q.resume()),t?t.loadedSoFar():Promise.resolve()};Object.defineProperty(J.prototype,"then",{get:Pn});J.prototype._addPlugin=function(t,e,r){if(t=Hs(t),e=e||{},this.booted)throw new Vs;const o=this._current[0],s=new ar(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){Rn.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 ut("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),C.process.nextTick(this._closeQ.resume.bind(this._closeQ))}),e};J.prototype.ready=function(t){if(t){if(typeof t!="function")throw new ut("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),C.process.nextTick(l)}})};J.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};J.prototype.toJSON=function(){return this.pluginTree.toJSON()};function qr(){}function Pn(){if(this.booted){Xe("thenify returning null because we are already booted");return}if(this[Ht]){this[Ht]=!1;return}return Xe("thenify"),(t,e)=>this._loadRegistered().then(()=>(this[Ht]=!0,t(this._server)),e)}function Rn(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[It]&&typeof s.then=="function"?s.then(()=>C.process.nextTick(e),u=>C.process.nextTick(e,u)):C.process.nextTick(e);else if(t.length===1)s=t(o),s&&!s[It]&&typeof s.then=="function"?s.then(()=>C.process.nextTick(e),u=>C.process.nextTick(e,u)):C.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 Ks.call(this,t,o,r,e)}function Ks(t,e,r,o){const s=t.name;Xe("setting up ready timeout",s,this._timeout);let u=setTimeout(()=>{Xe("timed out",s),u=null;const l=new qs(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 Ws(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"?(Xe("resolving close/onClose promise"),s.then(()=>C.process.nextTick(e),u=>C.process.nextTick(e,u))):C.process.nextTick(e)}else t.length===2?t(o?r:this._error,e):o?t(r,e):t(this._error,r,e)}function Js(t,e){return r.bind(e);function r(o,s){let u;t.length===0?(u=t(),u&&u.then?u.then(function(){C.process.nextTick(s)},s):C.process.nextTick(s)):t.length===1?(u=t(this),u&&u.then?u.then(function(){C.process.nextTick(s)},s):C.process.nextTick(s)):t(this,s)}}function Kt(t,e){return r.bind(e);function r(o,s){let u;t?t.length===0?(u=t(),u&&u.then?u.then(function(){C.process.nextTick(s,o)},s):C.process.nextTick(s,o)):t.length===1?(u=t(o),u&&u.then?u.then(function(){C.process.nextTick(s)},s):C.process.nextTick(s)):t.length===2?t(o,s):t(o,this,s):C.process.nextTick(s)}}hr.exports=J;hr.exports.express=function(t){return J(t,{expose:{use:"load"}})};var Ys=hr.exports;const Xs=Mn(Ys);function Zs(t,e=!0,r=!0){const o=e?"https://grpc-web.streamlayer.io:443":"https://grpc-web.next.streamlayer.io:443",s=Xs(Object.create({}),{autostart:!1});return s.use(wi),s.use(pi,{sdkKey:t,host:o}),s.use(bi),s.use(mi),s.use(Qi),s.use(Ni),r&&s.after(async(u,f,l)=>{if(u)throw u;await f.sdk.initializeApp(),l()}),s.onClose(()=>{console.log("close")}),s}exports.StreamLayer=Zs;
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 Is=Es,Ur=Symbol("avvio.TimeTree.untrackNode"),qt=Symbol("avvio.TimeTree.trackNode"),$r=Symbol("avvio.TimeTree.getParent"),Dr=Symbol("avvio.TimeTree.getNode"),jr=Symbol("avvio.TimeTree.addNode");let Fs=class{constructor(){this.root=null,this.tableId=new Map,this.tableLabel=new Map}[qt](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])}[Ur](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)}[$r](e){if(e===null)return this.root;const r=this.tableLabel.get(e);return r.id?r:r[r.length-1]}[Dr](e){return this.tableId.get(e)}[jr](e,r,o){if(e===null)return this.root={id:"root",label:r,start:o,nodes:[]},this[qt](this.root),this.root.id;const u=this[$r](e),f=`${r}-${Math.random()}`,l={id:f,parent:e,start:o,label:r,nodes:[]};return u.nodes.push(l),this[qt](l),f}start(e,r,o=Date.now()){return this[jr](e,r,o)}stop(e,r=Date.now()){const o=this[Dr](e);o&&(o.stop=r,o.diff=o.stop-o.start||0,this[Ur](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 Is(r)}};var _s=Fs,vr={exports:{}},sr={exports:{}},Qt,Mr;function Cs(){if(Mr)return Qt;Mr=1;var t=1e3,e=t*60,r=e*60,o=r*24,s=o*7,u=o*365.25;Qt=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]),I=(w[2]||"ms").toLowerCase();switch(I){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,I){var R=w>=E*1.5;return Math.round(g/E)+" "+I+(R?"s":"")}return Qt}function Ts(t){r.debug=r,r.default=r,r.coerce=p,r.disable=u,r.enable=s,r.enabled=f,r.humanize=Cs(),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,I,R;function L(...G){if(!L.enabled)return;const z=L,X=Number(new Date),ge=X-(w||X);z.diff=ge,z.prev=w,z.curr=X,w=X,G[0]=r.coerce(G[0]),typeof G[0]!="string"&&G.unshift("%O");let ee=0;G[0]=G[0].replace(/%([a-zA-Z%])/g,(j,O)=>{if(j==="%%")return"%";ee++;const re=r.formatters[O];if(typeof re=="function"){const ne=G[ee];j=re.call(z,ne),G.splice(ee,1),ee--}return j}),r.formatArgs.call(z,G),(z.log||r.log).apply(z,G)}return L.namespace=g,L.useColors=r.useColors(),L.color=r.selectColor(g),L.extend=o,L.destroy=r.destroy,Object.defineProperty(L,"enabled",{enumerable:!0,configurable:!1,get:()=>E!==null?E:(I!==r.namespaces&&(I=r.namespaces,R=r.enabled(g)),R),set:G=>{E=G}}),typeof r.init=="function"&&r.init(L),L}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,]+/),I=E.length;for(w=0;w<I;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 Os=Ts;(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 C.process<"u"&&"env"in C.process&&(p=C.process.env.DEBUG),p}function f(){try{return localStorage}catch{}}t.exports=Os(e);const{formatters:l}=t.exports;l.j=function(p){try{return JSON.stringify(p)}catch(A){return"[UnexpectedJSONParseError]: "+A.message}}})(sr,sr.exports);var kn=sr.exports;const Bs=nn,xs=pn.EventEmitter,ks=Ot.inherits,W=kn("avvio"),{AVV_ERR_READY_TIMEOUT:Ps}=xn,Gt=Symbol.for("plugin-meta");function Rs(t,e){return t[Gt]&&t[Gt].name?t[Gt].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 Ns(){const t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}function et(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=Rs(e,r),this.isAfter=o,this.q=Bs(t,Ls,1),this.q.pause(),this._error=null,this.loaded=!1,this._promise=null}ks(et,xs);et.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),C.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 Ps(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(()=>C.process.nextTick(f),p=>C.process.nextTick(f,p)))};et.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,C.process.nextTick(o,r)}),this.q.resume()};let e;return this._promise?e=Promise.resolve():(this._promise=Ns(),e=this._promise.promise,this.server?t():this.on("start",t)),e};et.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)};et.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=Us,queueMicrotask(o)}};queueMicrotask(o),this.q.resume()};function Ls(t,e){const r=this;C.process.nextTick(Sr.bind(r),t,e)}function Sr(t,e){if(typeof t.func.then=="function"){t.func.then(o=>{typeof o.default=="function"&&(o=o.default),t.func=o,Sr.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 Us(){}vr.exports=et;vr.exports.loadPlugin=Sr;var $s=vr.exports;const Vr=nn,Ds=pn.EventEmitter,js=Ot.inherits,{AVV_ERR_EXPOSE_ALREADY_DEFINED:zt,AVV_ERR_CALLBACK_NOT_FN:ut,AVV_ERR_PLUGIN_NOT_VALID:Ms,AVV_ERR_ROOT_PLG_BOOTED:Vs,AVV_ERR_READY_TIMEOUT:qs}=xn,Qs=_s,ar=$s,Xe=kn("avvio"),It=Symbol("kAvvio"),Ht=Symbol("kThenifyDoNotWrap");function Gs(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 zt(s);if(t[u])throw new zt(u);if(t[f])throw new zt(f);t[s]=function(A,g){return r.use(A,g),this},Object.defineProperty(t,"then",{get:Pn.bind(r)}),t[It]=!0,t[u]=function(A){return typeof A!="function"?r._loadRegistered():(r.after(Kt(A,this)),this)},t[f]=function(A){if(A&&typeof A!="function")throw new ut(f,typeof A);return r.ready(A?Kt(A,this):void 0)},t[l]=function(A){if(typeof A!="function")throw new ut(l,typeof A);return r.onClose(Js(A,this)),this},t[p]=function(A){if(A&&typeof A!="function")throw new ut(p,typeof A);return A?(r.close(Kt(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&&Gs(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 Qs,this._readyQ=Vr(this,Rn,1),this._readyQ.pause(),this._readyQ.drain=()=>{this.emit("start"),this._readyQ.drain=qr},this._closeQ=Vr(this,Ws,1),this._closeQ.pause(),this._closeQ.drain=()=>{this.emit("close"),this._closeQ.drain=qr},this._doStart=null,this._root=new ar(this,zs.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)})}),ar.loadPlugin.call(this,this._root,o=>{Xe("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 zs(t,e,r){this._doStart=r,e.autostart&&this.start()}js(J,Ds);J.prototype.start=function(){return this.started=!0,C.process.nextTick(this._doStart),this};J.prototype.override=function(t,e,r){return t};function Hs(t){if(t&&typeof t=="object"&&typeof t.default=="function"&&(t=t.default),!(t&&(typeof t=="function"||typeof t.then=="function")))throw new Ms(typeof t);return t}J.prototype[It]=!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&&C.process.nextTick(()=>this._root.q.resume()),t?t.loadedSoFar():Promise.resolve()};Object.defineProperty(J.prototype,"then",{get:Pn});J.prototype._addPlugin=function(t,e,r){if(t=Hs(t),e=e||{},this.booted)throw new Vs;const o=this._current[0],s=new ar(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){Rn.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 ut("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),C.process.nextTick(this._closeQ.resume.bind(this._closeQ))}),e};J.prototype.ready=function(t){if(t){if(typeof t!="function")throw new ut("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),C.process.nextTick(l)}})};J.prototype.prettyPrint=function(){return this.pluginTree.prittyPrint()};J.prototype.toJSON=function(){return this.pluginTree.toJSON()};function qr(){}function Pn(){if(this.booted){Xe("thenify returning null because we are already booted");return}if(this[Ht]){this[Ht]=!1;return}return Xe("thenify"),(t,e)=>this._loadRegistered().then(()=>(this[Ht]=!0,t(this._server)),e)}function Rn(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[It]&&typeof s.then=="function"?s.then(()=>C.process.nextTick(e),u=>C.process.nextTick(e,u)):C.process.nextTick(e);else if(t.length===1)s=t(o),s&&!s[It]&&typeof s.then=="function"?s.then(()=>C.process.nextTick(e),u=>C.process.nextTick(e,u)):C.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 Ks.call(this,t,o,r,e)}function Ks(t,e,r,o){const s=t.name;Xe("setting up ready timeout",s,this._timeout);let u=setTimeout(()=>{Xe("timed out",s),u=null;const l=new qs(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 Ws(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"?(Xe("resolving close/onClose promise"),s.then(()=>C.process.nextTick(e),u=>C.process.nextTick(e,u))):C.process.nextTick(e)}else t.length===2?t(o?r:this._error,e):o?t(r,e):t(this._error,r,e)}function Js(t,e){return r.bind(e);function r(o,s){let u;t.length===0?(u=t(),u&&u.then?u.then(function(){C.process.nextTick(s)},s):C.process.nextTick(s)):t.length===1?(u=t(this),u&&u.then?u.then(function(){C.process.nextTick(s)},s):C.process.nextTick(s)):t(this,s)}}function Kt(t,e){return r.bind(e);function r(o,s){let u;t?t.length===0?(u=t(),u&&u.then?u.then(function(){C.process.nextTick(s,o)},s):C.process.nextTick(s,o)):t.length===1?(u=t(o),u&&u.then?u.then(function(){C.process.nextTick(s)},s):C.process.nextTick(s)):t.length===2?t(o,s):t(o,this,s):C.process.nextTick(s)}}hr.exports=J;hr.exports.express=function(t){return J(t,{expose:{use:"load"}})};var Ys=hr.exports;const Xs=Mn(Ys);function Zs(t,e=!0,r=!0){const o=e?"https://grpc-web.streamlayer.io:443":"https://grpc-web.next.streamlayer.io:443",s=Xs(Object.create({}),{autostart:!1});return s.use(wi),s.use(pi,{sdkKey:t,host:o}),s.use(bi),s.use(mi),s.use(Qi),s.use(Ni),r&&s.after(async(u,f,l)=>{if(u)throw u;await f.sdk.initializeApp(),l()}),s.onClose(()=>{console.log("close")}),s}exports.StreamLayer=Zs;
package/lib/es/index.js CHANGED
@@ -353,14 +353,14 @@ ur.write = function(t, e, r, o, s, u) {
353
353
  return tt(this, n, i);
354
354
  case "latin1":
355
355
  case "binary":
356
- return Be(this, n, i);
356
+ return Oe(this, n, i);
357
357
  case "base64":
358
358
  return et(this, n, i);
359
359
  case "ucs2":
360
360
  case "ucs-2":
361
361
  case "utf16le":
362
362
  case "utf-16le":
363
- return Oe(this, n, i);
363
+ return xe(this, n, i);
364
364
  default:
365
365
  if (c)
366
366
  throw new TypeError("Unknown encoding: " + a);
@@ -503,7 +503,7 @@ ur.write = function(t, e, r, o, s, u) {
503
503
  function ne(a, n, i, c) {
504
504
  return nt(rt(n, a.length - i), a, i, c);
505
505
  }
506
- function Ce(a, n, i, c) {
506
+ function _e(a, n, i, c) {
507
507
  return nt(xt(n), a, i, c);
508
508
  }
509
509
  function Se(a, n, i, c) {
@@ -538,7 +538,7 @@ ur.write = function(t, e, r, o, s, u) {
538
538
  case "ascii":
539
539
  case "latin1":
540
540
  case "binary":
541
- return Ce(this, n, i, c);
541
+ return _e(this, n, i, c);
542
542
  case "base64":
543
543
  return Se(this, n, i, c);
544
544
  case "ucs2":
@@ -585,18 +585,18 @@ ur.write = function(t, e, r, o, s, u) {
585
585
  }
586
586
  m === null ? (m = 65533, T = 1) : m > 65535 && (m -= 65536, c.push(m >>> 10 & 1023 | 55296), m = 56320 | m & 1023), c.push(m), h += T;
587
587
  }
588
- return Te(c);
588
+ return Be(c);
589
589
  }
590
- const _e = 4096;
591
- function Te(a) {
590
+ const Te = 4096;
591
+ function Be(a) {
592
592
  const n = a.length;
593
- if (n <= _e)
593
+ if (n <= Te)
594
594
  return String.fromCharCode.apply(String, a);
595
595
  let i = "", c = 0;
596
596
  for (; c < n; )
597
597
  i += String.fromCharCode.apply(
598
598
  String,
599
- a.slice(c, c += _e)
599
+ a.slice(c, c += Te)
600
600
  );
601
601
  return i;
602
602
  }
@@ -607,7 +607,7 @@ ur.write = function(t, e, r, o, s, u) {
607
607
  c += String.fromCharCode(a[h] & 127);
608
608
  return c;
609
609
  }
610
- function Be(a, n, i) {
610
+ function Oe(a, n, i) {
611
611
  let c = "";
612
612
  i = Math.min(a.length, i);
613
613
  for (let h = n; h < i; ++h)
@@ -622,7 +622,7 @@ ur.write = function(t, e, r, o, s, u) {
622
622
  h += Ln[a[y]];
623
623
  return h;
624
624
  }
625
- function Oe(a, n, i) {
625
+ function xe(a, n, i) {
626
626
  const c = a.slice(n, i);
627
627
  let h = "";
628
628
  for (let y = 0; y < c.length - 1; y += 2)
@@ -663,13 +663,13 @@ ur.write = function(t, e, r, o, s, u) {
663
663
  return n = n >>> 0, i || V(n, 4, this.length), (this[n] | this[n + 1] << 8 | this[n + 2] << 16) + this[n + 3] * 16777216;
664
664
  }, f.prototype.readUint32BE = f.prototype.readUInt32BE = function(n, i) {
665
665
  return n = n >>> 0, i || V(n, 4, this.length), this[n] * 16777216 + (this[n + 1] << 16 | this[n + 2] << 8 | this[n + 3]);
666
- }, f.prototype.readBigUInt64LE = xe(function(n) {
666
+ }, f.prototype.readBigUInt64LE = ke(function(n) {
667
667
  n = n >>> 0, pe(n, "offset");
668
668
  const i = this[n], c = this[n + 7];
669
669
  (i === void 0 || c === void 0) && ie(n, this.length - 8);
670
670
  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;
671
671
  return BigInt(h) + (BigInt(y) << BigInt(32));
672
- }), f.prototype.readBigUInt64BE = xe(function(n) {
672
+ }), f.prototype.readBigUInt64BE = ke(function(n) {
673
673
  n = n >>> 0, pe(n, "offset");
674
674
  const i = this[n], c = this[n + 7];
675
675
  (i === void 0 || c === void 0) && ie(n, this.length - 8);
@@ -701,13 +701,13 @@ ur.write = function(t, e, r, o, s, u) {
701
701
  return n = n >>> 0, i || V(n, 4, this.length), this[n] | this[n + 1] << 8 | this[n + 2] << 16 | this[n + 3] << 24;
702
702
  }, f.prototype.readInt32BE = function(n, i) {
703
703
  return n = n >>> 0, i || V(n, 4, this.length), this[n] << 24 | this[n + 1] << 16 | this[n + 2] << 8 | this[n + 3];
704
- }, f.prototype.readBigInt64LE = xe(function(n) {
704
+ }, f.prototype.readBigInt64LE = ke(function(n) {
705
705
  n = n >>> 0, pe(n, "offset");
706
706
  const i = this[n], c = this[n + 7];
707
707
  (i === void 0 || c === void 0) && ie(n, this.length - 8);
708
708
  const h = this[n + 4] + this[n + 5] * 2 ** 8 + this[n + 6] * 2 ** 16 + (c << 24);
709
709
  return (BigInt(h) << BigInt(32)) + BigInt(i + this[++n] * 2 ** 8 + this[++n] * 2 ** 16 + this[++n] * 2 ** 24);
710
- }), f.prototype.readBigInt64BE = xe(function(n) {
710
+ }), f.prototype.readBigInt64BE = ke(function(n) {
711
711
  n = n >>> 0, pe(n, "offset");
712
712
  const i = this[n], c = this[n + 7];
713
713
  (i === void 0 || c === void 0) && ie(n, this.length - 8);
@@ -774,9 +774,9 @@ ur.write = function(t, e, r, o, s, u) {
774
774
  let m = Number(n >> BigInt(32) & BigInt(4294967295));
775
775
  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;
776
776
  }
777
- f.prototype.writeBigUInt64LE = xe(function(n, i = 0) {
777
+ f.prototype.writeBigUInt64LE = ke(function(n, i = 0) {
778
778
  return b(this, n, i, BigInt(0), BigInt("0xffffffffffffffff"));
779
- }), f.prototype.writeBigUInt64BE = xe(function(n, i = 0) {
779
+ }), f.prototype.writeBigUInt64BE = ke(function(n, i = 0) {
780
780
  return S(this, n, i, BigInt(0), BigInt("0xffffffffffffffff"));
781
781
  }), f.prototype.writeIntLE = function(n, i, c, h) {
782
782
  if (n = +n, i = i >>> 0, !h) {
@@ -806,9 +806,9 @@ ur.write = function(t, e, r, o, s, u) {
806
806
  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;
807
807
  }, f.prototype.writeInt32BE = function(n, i, c) {
808
808
  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;
809
- }, f.prototype.writeBigInt64LE = xe(function(n, i = 0) {
809
+ }, f.prototype.writeBigInt64LE = ke(function(n, i = 0) {
810
810
  return b(this, n, i, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
811
- }), f.prototype.writeBigInt64BE = xe(function(n, i = 0) {
811
+ }), f.prototype.writeBigInt64BE = ke(function(n, i = 0) {
812
812
  return S(this, n, i, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
813
813
  });
814
814
  function F(a, n, i, c, h, y) {
@@ -1059,7 +1059,7 @@ ur.write = function(t, e, r, o, s, u) {
1059
1059
  }
1060
1060
  return n;
1061
1061
  }();
1062
- function xe(a) {
1062
+ function ke(a) {
1063
1063
  return typeof BigInt > "u" ? $n : a;
1064
1064
  }
1065
1065
  function $n() {
@@ -1115,18 +1115,18 @@ function ri(t) {
1115
1115
  }
1116
1116
  }
1117
1117
  }
1118
- var Ie = [], ze = !1, Ne, lt = -1;
1118
+ var Fe = [], ze = !1, Ne, lt = -1;
1119
1119
  function ni() {
1120
- !ze || !Ne || (ze = !1, Ne.length ? Ie = Ne.concat(Ie) : lt = -1, Ie.length && Zr());
1120
+ !ze || !Ne || (ze = !1, Ne.length ? Fe = Ne.concat(Fe) : lt = -1, Fe.length && Zr());
1121
1121
  }
1122
1122
  function Zr() {
1123
1123
  if (!ze) {
1124
1124
  var t = Xr(ni);
1125
1125
  ze = !0;
1126
- for (var e = Ie.length; e; ) {
1127
- for (Ne = Ie, Ie = []; ++lt < e; )
1126
+ for (var e = Fe.length; e; ) {
1127
+ for (Ne = Fe, Fe = []; ++lt < e; )
1128
1128
  Ne && Ne[lt].run();
1129
- lt = -1, e = Ie.length;
1129
+ lt = -1, e = Fe.length;
1130
1130
  }
1131
1131
  Ne = null, ze = !1, ri(t);
1132
1132
  }
@@ -1136,7 +1136,7 @@ H.nextTick = function(t) {
1136
1136
  if (arguments.length > 1)
1137
1137
  for (var r = 1; r < arguments.length; r++)
1138
1138
  e[r - 1] = arguments[r];
1139
- Ie.push(new en(t, e)), Ie.length === 1 && !ze && Xr(Zr);
1139
+ Fe.push(new en(t, e)), Fe.length === 1 && !ze && Xr(Zr);
1140
1140
  };
1141
1141
  function en(t, e) {
1142
1142
  this.fun = t, this.array = e;
@@ -1150,17 +1150,17 @@ H.env = {};
1150
1150
  H.argv = [];
1151
1151
  H.version = "";
1152
1152
  H.versions = {};
1153
- function Fe() {
1153
+ function Ce() {
1154
1154
  }
1155
- H.on = Fe;
1156
- H.addListener = Fe;
1157
- H.once = Fe;
1158
- H.off = Fe;
1159
- H.removeListener = Fe;
1160
- H.removeAllListeners = Fe;
1161
- H.emit = Fe;
1162
- H.prependListener = Fe;
1163
- H.prependOnceListener = Fe;
1155
+ H.on = Ce;
1156
+ H.addListener = Ce;
1157
+ H.once = Ce;
1158
+ H.off = Ce;
1159
+ H.removeListener = Ce;
1160
+ H.removeAllListeners = Ce;
1161
+ H.emit = Ce;
1162
+ H.prependListener = Ce;
1163
+ H.prependOnceListener = Ce;
1164
1164
  H.listeners = function(t) {
1165
1165
  return [];
1166
1166
  };
@@ -1644,12 +1644,12 @@ class tn extends lr {
1644
1644
  this.clear();
1645
1645
  };
1646
1646
  }
1647
- var ke;
1647
+ var Ie;
1648
1648
  (function(t) {
1649
1649
  t.DISABLED = "disabled", t.INITIALIZATION = "initialization", t.READY = "ready", t.FAILED = "failed", t.SUSPENDED = "suspended";
1650
- })(ke || (ke = {}));
1650
+ })(Ie || (Ie = {}));
1651
1651
  const vi = (t) => {
1652
- const e = new ae(ue(void 0), "enabled"), r = new ae(ue(ke.DISABLED), "status"), o = new ae(ue(void 0), "userKey"), s = new ae(ue(void 0), "userToken"), u = new tn();
1652
+ const e = new ae(ue(void 0), "enabled"), r = new ae(ue(Ie.DISABLED), "status"), o = new ae(ue(void 0), "userKey"), s = new ae(ue(void 0), "userToken"), u = new tn();
1653
1653
  s.listen((I) => {
1654
1654
  I ? u.setToken(I) : u.removeToken();
1655
1655
  });
@@ -1718,11 +1718,16 @@ class Ai extends oi {
1718
1718
  });
1719
1719
  };
1720
1720
  }
1721
- const Ei = async (t, e, r) => {
1721
+ const Ei = (t, e, r) => {
1722
1722
  t.auth = new Ai(t.store, t.transport);
1723
- const o = new tn(), s = o.getSchema(), u = o.getToken();
1724
- s && u && (console.log("try to login prev user"), await t.auth.login(s, u)), t.sdk.authorizationBypass = async (l, f) => {
1725
- await t.auth.login(l, f), o.setSchema("streamlayer:streamlayer");
1723
+ const o = new tn();
1724
+ t.stores.status.listen(async (s) => {
1725
+ if (s === Ie.READY) {
1726
+ const u = o.getSchema(), l = o.getToken();
1727
+ u && l && await t.auth.login(u, l);
1728
+ }
1729
+ }), t.sdk.authorizationBypass = async (s, u) => {
1730
+ await t.auth.login(s, u), o.setSchema("streamlayer:streamlayer");
1726
1731
  }, t.sdk.logout = () => {
1727
1732
  t.auth.logout();
1728
1733
  }, t.sdk.getUserStore = () => t.stores.user.getStore(), t.sdk.isUserAuthorized = () => t.auth.isAuthenticated(), r();
@@ -1734,15 +1739,15 @@ const Ei = async (t, e, r) => {
1734
1739
  t.sdk = /* @__PURE__ */ Object.create(null), t.sdk.initializeApp = async () => {
1735
1740
  if (t.stores.enabled.get() === "on")
1736
1741
  return { enabled: !0 };
1737
- t.storeSubscribe(), t.stores.enabled.setValue("on"), t.stores.status.setValue(ke.INITIALIZATION);
1742
+ t.storeSubscribe(), t.stores.enabled.setValue("on"), t.stores.status.setValue(Ie.INITIALIZATION);
1738
1743
  try {
1739
1744
  const o = await t.stores.organizationSettings.getValue();
1740
- return o ? (t.stores.status.setValue(ke.READY), { enabled: !!o }) : (t.stores.status.setValue(ke.FAILED), { err: "failed" });
1745
+ return o ? (t.stores.status.setValue(Ie.READY), { enabled: !!o }) : (t.stores.status.setValue(Ie.FAILED), { err: "failed" });
1741
1746
  } catch (o) {
1742
- return t.stores.enabled.setValue(), t.stores.status.setValue(ke.FAILED), { err: `${o}` };
1747
+ return t.stores.enabled.setValue(), t.stores.status.setValue(Ie.FAILED), { err: `${o}` };
1743
1748
  }
1744
1749
  }, t.sdk.disableApp = () => {
1745
- t.stores.enabled.get() === "on" && (t.stores.enabled.setValue(), t.stores.status.setValue(ke.DISABLED), t.storeUnsubscribe());
1750
+ t.stores.enabled.get() === "on" && (t.stores.enabled.setValue(), t.stores.status.setValue(Ie.DISABLED), t.storeUnsubscribe());
1746
1751
  }, t.sdk.createEventSession = (o) => {
1747
1752
  t.stores.providerStreamId.setValue(o);
1748
1753
  }, r();
@@ -1850,9 +1855,9 @@ class Li {
1850
1855
  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 ae(ue(void 0), "moderationId").getStore(), this.openedQuestionId = new ae(ue(void 0), "openedQuestionId").getStore(), this.notifications = e.notifications, this.moderation = new te(Bi(this.slStreamId, e.transport), "gamification:moderation"), this.activeQuestionId = new te(Oi(this.slStreamId, e.transport), "gamification:activeQuestionId"), this.openedQuestion = new te(Ri(this.openedQuestionId, e.transport), "gamification:openedQuestion"), this.openedQuestionId.listen((r) => {
1851
1856
  this.log.debug({ questionId: r }, "received question"), r ? (this.questionSubscription = ki(r, e.transport), this.questionSubscription.addListener("feed-subscription-opened-question", (o) => {
1852
1857
  window.requestAnimationFrame(() => {
1853
- this.openedQuestion?.getStore().mutate(o.data?.attributes?.question), this.openedQuestion?.getStore().invalidate();
1858
+ this.openedQuestion.getStore().mutate(o.data?.attributes?.question);
1854
1859
  });
1855
- }), this.questionSubscription.connect()) : (this.log.info("cleanup on close question"), this.openedQuestion?.getStore().mutate(void 0), this.questionSubscription !== void 0 && (e.transport.removeSubscription(this.questionSubscription), this.questionSubscription = void 0));
1860
+ }), this.questionSubscription.connect()) : (this.log.info("cleanup on close question"), this.questionSubscription !== void 0 && (e.transport.removeSubscription(this.questionSubscription), this.questionSubscription = void 0));
1856
1861
  }), this.feedSubscription = xi(this.slStreamId, e.transport), this.feedSubscription.addListener("feed-subscription-active-question", (r) => {
1857
1862
  window.requestAnimationFrame(() => {
1858
1863
  const o = this.activeQuestionId.getStore();
@@ -2047,10 +2052,7 @@ class zi extends cr {
2047
2052
  /** Browser cache */
2048
2053
  storage;
2049
2054
  constructor(e, r, o) {
2050
- super(e, r), this.background = nn(o), this.storage = new Qi(), this.userSummary = new te(_i(this.background.slStreamId, this.background.userId, o.transport), "gamification:userSummary"), this.questions = new te(Ni(this.background.slStreamId, o.transport), "gamification:questions"), this.leaderboardId = new ae(ue(this.settings.getValue("pinnedLeaderboardId")), "pinnedLeaderboardId").getStore(), this.onboardingStatus = new ae(ue(Z.Unset), "onboardingStatus").getStore(), this.notifications = o.notifications, this.transport = o.transport, this.closeFeature = o.sdk.closeFeature, this.openFeature = () => o.sdk.openFeature(ce.GAMES), this.openedQuestion = fr(this.background.openedQuestion.getStore(), (s) => {
2051
- if (s.data?.type && Ar.has(s.data.type))
2052
- return s.data;
2053
- }), this.leaderboardList = new te(Ti(this.background.slStreamId, this.leaderboardId, o.transport), "gamification:leaderboardList"), this.onboardingStatus.subscribe((s) => {
2055
+ super(e, r), this.background = nn(o), this.storage = new Qi(), this.userSummary = new te(_i(this.background.slStreamId, this.background.userId, o.transport), "gamification:userSummary"), this.questions = new te(Ni(this.background.slStreamId, o.transport), "gamification:questions"), this.leaderboardId = new ae(ue(this.settings.getValue("pinnedLeaderboardId")), "pinnedLeaderboardId").getStore(), this.onboardingStatus = new ae(ue(Z.Unset), "onboardingStatus").getStore(), this.notifications = o.notifications, this.transport = o.transport, this.closeFeature = o.sdk.closeFeature, this.openFeature = () => o.sdk.openFeature(ce.GAMES), this.openedQuestion = fr(this.background.openedQuestion.getStore(), (s) => s.data?.type && Ar.has(s.data.type) ? { loading: !1, data: s.data } : { loading: s.loading, data: void 0 }), this.leaderboardList = new te(Ti(this.background.slStreamId, this.leaderboardId, o.transport), "gamification:leaderboardList"), this.onboardingStatus.subscribe((s) => {
2054
2056
  (s === Z.Optional || Z.Required) && this.showOnboardingInApp();
2055
2057
  }), this.status.subscribe((s) => {
2056
2058
  s === Ue.Ready ? (this.notifications.close(this.background.getCurrentSessionId({ prefix: "onboarding" })), this.connect(o.transport)) : this.disconnect();
@@ -3272,10 +3274,10 @@ var As = function(e) {
3272
3274
  return o(v) === "Float64Array";
3273
3275
  }
3274
3276
  t.isFloat64Array = ne;
3275
- function Ce(v) {
3277
+ function _e(v) {
3276
3278
  return o(v) === "BigInt64Array";
3277
3279
  }
3278
- t.isBigInt64Array = Ce;
3280
+ t.isBigInt64Array = _e;
3279
3281
  function Se(v) {
3280
3282
  return o(v) === "BigUint64Array";
3281
3283
  }
@@ -3292,32 +3294,32 @@ var As = function(e) {
3292
3294
  return p(v) === "[object Set]";
3293
3295
  }
3294
3296
  le.working = typeof Set < "u" && le(/* @__PURE__ */ new Set());
3295
- function _e(v) {
3297
+ function Te(v) {
3296
3298
  return typeof Set > "u" ? !1 : le.working ? le(v) : v instanceof Set;
3297
3299
  }
3298
- t.isSet = _e;
3299
- function Te(v) {
3300
+ t.isSet = Te;
3301
+ function Be(v) {
3300
3302
  return p(v) === "[object WeakMap]";
3301
3303
  }
3302
- Te.working = typeof WeakMap < "u" && Te(/* @__PURE__ */ new WeakMap());
3304
+ Be.working = typeof WeakMap < "u" && Be(/* @__PURE__ */ new WeakMap());
3303
3305
  function tt(v) {
3304
- return typeof WeakMap > "u" ? !1 : Te.working ? Te(v) : v instanceof WeakMap;
3306
+ return typeof WeakMap > "u" ? !1 : Be.working ? Be(v) : v instanceof WeakMap;
3305
3307
  }
3306
3308
  t.isWeakMap = tt;
3307
- function Be(v) {
3309
+ function Oe(v) {
3308
3310
  return p(v) === "[object WeakSet]";
3309
3311
  }
3310
- Be.working = typeof WeakSet < "u" && Be(/* @__PURE__ */ new WeakSet());
3312
+ Oe.working = typeof WeakSet < "u" && Oe(/* @__PURE__ */ new WeakSet());
3311
3313
  function he(v) {
3312
- return Be(v);
3314
+ return Oe(v);
3313
3315
  }
3314
3316
  t.isWeakSet = he;
3315
- function Oe(v) {
3317
+ function xe(v) {
3316
3318
  return p(v) === "[object ArrayBuffer]";
3317
3319
  }
3318
- Oe.working = typeof ArrayBuffer < "u" && Oe(new ArrayBuffer());
3320
+ xe.working = typeof ArrayBuffer < "u" && xe(new ArrayBuffer());
3319
3321
  function V(v) {
3320
- return typeof ArrayBuffer > "u" ? !1 : Oe.working ? Oe(v) : v instanceof ArrayBuffer;
3322
+ return typeof ArrayBuffer > "u" ? !1 : xe.working ? xe(v) : v instanceof ArrayBuffer;
3321
3323
  }
3322
3324
  t.isArrayBuffer = V;
3323
3325
  function d(v) {
@@ -3548,7 +3550,7 @@ var _s = or.exports;
3548
3550
  }
3549
3551
  if (re(b))
3550
3552
  return d.stylize(RegExp.prototype.toString.call(b), "regexp");
3551
- if (Ce(b))
3553
+ if (_e(b))
3552
3554
  return d.stylize(Date.prototype.toString.call(b), "date");
3553
3555
  if (Se(b))
3554
3556
  return E(b);
@@ -3558,7 +3560,7 @@ var _s = or.exports;
3558
3560
  var pe = b.name ? ": " + b.name : "";
3559
3561
  L = " [Function" + pe + "]";
3560
3562
  }
3561
- if (re(b) && (L = " " + RegExp.prototype.toString.call(b)), Ce(b) && (L = " " + Date.prototype.toUTCString.call(b)), Se(b) && (L = " " + E(b)), N.length === 0 && (!Y || b.length == 0))
3563
+ if (re(b) && (L = " " + RegExp.prototype.toString.call(b)), _e(b) && (L = " " + Date.prototype.toUTCString.call(b)), Se(b) && (L = " " + E(b)), N.length === 0 && (!Y || b.length == 0))
3562
3564
  return ge[0] + L + ge[1];
3563
3565
  if (S < 0)
3564
3566
  return re(b) ? d.stylize(RegExp.prototype.toString.call(b), "regexp") : d.stylize("[Object]", "special");
@@ -3587,7 +3589,7 @@ var _s = or.exports;
3587
3589
  }
3588
3590
  function I(d, b, S, F, P) {
3589
3591
  for (var N = [], C = 0, O = b.length; C < O; ++C)
3590
- Be(b, String(C)) ? N.push(R(
3592
+ Oe(b, String(C)) ? N.push(R(
3591
3593
  d,
3592
3594
  b,
3593
3595
  S,
@@ -3608,7 +3610,7 @@ var _s = or.exports;
3608
3610
  }
3609
3611
  function R(d, b, S, F, P, N) {
3610
3612
  var C, O, L;
3611
- if (L = Object.getOwnPropertyDescriptor(b, P) || { value: b[P] }, L.get ? L.set ? O = d.stylize("[Getter/Setter]", "special") : O = d.stylize("[Getter]", "special") : L.set && (O = d.stylize("[Setter]", "special")), Be(F, P) || (C = "[" + P + "]"), O || (d.seen.indexOf(L.value) < 0 ? (X(S) ? O = g(d, L.value, null) : O = g(d, L.value, S - 1), O.indexOf(`
3613
+ if (L = Object.getOwnPropertyDescriptor(b, P) || { value: b[P] }, L.get ? L.set ? O = d.stylize("[Getter/Setter]", "special") : O = d.stylize("[Getter]", "special") : L.set && (O = d.stylize("[Setter]", "special")), Oe(F, P) || (C = "[" + P + "]"), O || (d.seen.indexOf(L.value) < 0 ? (X(S) ? O = g(d, L.value, null) : O = g(d, L.value, S - 1), O.indexOf(`
3612
3614
  `) > -1 && (N ? O = O.split(`
3613
3615
  `).map(function(Y) {
3614
3616
  return " " + Y;
@@ -3675,10 +3677,10 @@ var _s = or.exports;
3675
3677
  return typeof d == "object" && d !== null;
3676
3678
  }
3677
3679
  t.isObject = ne;
3678
- function Ce(d) {
3680
+ function _e(d) {
3679
3681
  return ne(d) && le(d) === "[object Date]";
3680
3682
  }
3681
- t.isDate = Ce, t.types.isDate = Ce;
3683
+ t.isDate = _e, t.types.isDate = _e;
3682
3684
  function Se(d) {
3683
3685
  return ne(d) && (le(d) === "[object Error]" || d instanceof Error);
3684
3686
  }
@@ -3695,10 +3697,10 @@ var _s = or.exports;
3695
3697
  function le(d) {
3696
3698
  return Object.prototype.toString.call(d);
3697
3699
  }
3698
- function _e(d) {
3700
+ function Te(d) {
3699
3701
  return d < 10 ? "0" + d.toString(10) : d.toString(10);
3700
3702
  }
3701
- var Te = [
3703
+ var Be = [
3702
3704
  "Jan",
3703
3705
  "Feb",
3704
3706
  "Mar",
@@ -3714,11 +3716,11 @@ var _s = or.exports;
3714
3716
  ];
3715
3717
  function tt() {
3716
3718
  var d = /* @__PURE__ */ new Date(), b = [
3717
- _e(d.getHours()),
3718
- _e(d.getMinutes()),
3719
- _e(d.getSeconds())
3719
+ Te(d.getHours()),
3720
+ Te(d.getMinutes()),
3721
+ Te(d.getSeconds())
3720
3722
  ].join(":");
3721
- return [d.getDate(), Te[d.getMonth()], b].join(" ");
3723
+ return [d.getDate(), Be[d.getMonth()], b].join(" ");
3722
3724
  }
3723
3725
  t.log = function() {
3724
3726
  console.log("%s - %s", tt(), t.format.apply(t, arguments));
@@ -3729,7 +3731,7 @@ var _s = or.exports;
3729
3731
  d[S[F]] = b[S[F]];
3730
3732
  return d;
3731
3733
  };
3732
- function Be(d, b) {
3734
+ function Oe(d, b) {
3733
3735
  return Object.prototype.hasOwnProperty.call(d, b);
3734
3736
  }
3735
3737
  var he = typeof Symbol < "u" ? Symbol("util.promisify.custom") : void 0;
@@ -3772,7 +3774,7 @@ var _s = or.exports;
3772
3774
  e(b)
3773
3775
  );
3774
3776
  }, t.promisify.custom = he;
3775
- function Oe(d, b) {
3777
+ function xe(d, b) {
3776
3778
  if (!d) {
3777
3779
  var S = new Error("Promise was rejected with a falsy value");
3778
3780
  S.reason = d, d = S;
@@ -3796,7 +3798,7 @@ var _s = or.exports;
3796
3798
  _.process.nextTick(C.bind(null, null, O));
3797
3799
  },
3798
3800
  function(O) {
3799
- _.process.nextTick(Oe.bind(null, O, C));
3801
+ _.process.nextTick(xe.bind(null, O, C));
3800
3802
  }
3801
3803
  );
3802
3804
  }
package/package.json CHANGED
@@ -25,17 +25,17 @@
25
25
  "devDependencies": {
26
26
  "avvio": "^8.2.1",
27
27
  "tslib": "^2.6.2",
28
- "@streamlayer/sdk-web-api": "^0.0.6",
29
- "@streamlayer/sdk-web-core": "^0.14.2",
30
- "@streamlayer/sdk-web-types": "^0.16.4",
31
- "@streamlayer/sdk-web-logger": "^0.5.6",
32
- "@streamlayer/sdk-web-storage": "^0.3.6",
33
- "@streamlayer/sdk-web-features": "^0.10.5",
34
- "@streamlayer/sdk-web-interfaces": "^0.18.4",
35
- "@streamlayer/feature-gamification": "^0.18.0",
36
- "@streamlayer/sdk-web-notifications": "^0.10.3"
28
+ "@streamlayer/sdk-web-api": "^0.0.7",
29
+ "@streamlayer/sdk-web-core": "^0.15.1",
30
+ "@streamlayer/sdk-web-logger": "^0.5.7",
31
+ "@streamlayer/sdk-web-storage": "^0.3.7",
32
+ "@streamlayer/sdk-web-types": "^0.16.5",
33
+ "@streamlayer/sdk-web-features": "^0.10.7",
34
+ "@streamlayer/sdk-web-interfaces": "^0.18.5",
35
+ "@streamlayer/sdk-web-notifications": "^0.10.4",
36
+ "@streamlayer/feature-gamification": "^0.18.2"
37
37
  },
38
- "version": "0.28.2",
38
+ "version": "0.28.4",
39
39
  "type": "module",
40
40
  "main": "./src/index.js",
41
41
  "typings": "./src/index.d.ts"