@streamlayer/sdk-web 0.30.1 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @author Feross Aboukhadijeh <https://feross.org>
6
6
  * @license MIT
7
- */(function(t){const e=kt,r=hr,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=C,t.INSPECT_MAX_BYTES=50;const s=2147483647;t.kMaxLength=s;const{Uint8Array:u,ArrayBuffer:f,SharedArrayBuffer:p}=globalThis;l.TYPED_ARRAY_SUPPORT=h(),!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 h(){try{const a=new u(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,u.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 m(a){if(a>s)throw new RangeError('The value "'+a+'" is invalid for option "size"');const n=new u(a);return Object.setPrototypeOf(n,l.prototype),n}function l(a,n,o){if(typeof a=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _(a)}return w(a,n,o)}l.poolSize=8192;function w(a,n,o){if(typeof a=="string")return B(a,n);if(f.isView(a))return I(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(pe(a,f)||a&&pe(a.buffer,f)||typeof p<"u"&&(pe(a,p)||a&&pe(a.buffer,p)))return F(a,n,o);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,o);const d=U(a);if(d)return d;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return l.from(a[Symbol.toPrimitive]("string"),n,o);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,o){return w(a,n,o)},Object.setPrototypeOf(l.prototype,u.prototype),Object.setPrototypeOf(l,u);function E(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 T(a,n,o){return E(a),a<=0?m(a):n!==void 0?typeof o=="string"?m(a).fill(n,o):m(a).fill(n):m(a)}l.alloc=function(a,n,o){return T(a,n,o)};function _(a){return E(a),m(a<0?0:L(a)|0)}l.allocUnsafe=function(a){return _(a)},l.allocUnsafeSlow=function(a){return _(a)};function B(a,n){if((typeof n!="string"||n==="")&&(n="utf8"),!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);const o=x(a,n)|0;let c=m(o);const d=c.write(a,n);return d!==o&&(c=c.slice(0,d)),c}function M(a){const n=a.length<0?0:L(a.length)|0,o=m(n);for(let c=0;c<n;c+=1)o[c]=a[c]&255;return o}function I(a){if(pe(a,u)){const n=new u(a);return F(n.buffer,n.byteOffset,n.byteLength)}return M(a)}function F(a,n,o){if(n<0||a.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');let c;return n===void 0&&o===void 0?c=new u(a):o===void 0?c=new u(a,n):c=new u(a,n,o),Object.setPrototypeOf(c,l.prototype),c}function U(a){if(l.isBuffer(a)){const n=L(a.length)|0,o=m(n);return o.length===0||a.copy(o,0,0,n),o}if(a.length!==void 0)return typeof a.length!="number"||Dt(a.length)?m(0):M(a);if(a.type==="Buffer"&&Array.isArray(a.data))return M(a.data)}function L(a){if(a>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return a|0}function C(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,o){if(pe(n,u)&&(n=l.from(n,n.offset,n.byteLength)),pe(o,u)&&(o=l.from(o,o.offset,o.byteLength)),!l.isBuffer(n)||!l.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;let c=n.length,d=o.length;for(let y=0,b=Math.min(c,d);y<b;++y)if(n[y]!==o[y]){c=n[y],d=o[y];break}return c<d?-1:d<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,o){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(o===void 0)for(o=0,c=0;c<n.length;++c)o+=n[c].length;const d=l.allocUnsafe(o);let y=0;for(c=0;c<n.length;++c){let b=n[c];if(pe(b,u))y+b.length>d.length?(l.isBuffer(b)||(b=l.from(b)),b.copy(d,y)):u.prototype.set.call(d,b,y);else if(l.isBuffer(b))b.copy(d,y);else throw new TypeError('"list" argument must be an Array of Buffers');y+=b.length}return d};function x(a,n){if(l.isBuffer(a))return a.length;if(f.isView(a)||pe(a,f))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 o=a.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&o===0)return 0;let d=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return lt(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return Fr(a).length;default:if(d)return c?-1:lt(a).length;n=(""+n).toLowerCase(),d=!0}}l.byteLength=x;function k(a,n,o){let c=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(a||(a="utf8");;)switch(a){case"hex":return g(this,n,o);case"utf8":case"utf-8":return Ge(this,n,o);case"ascii":return Be(this,n,o);case"latin1":case"binary":return ze(this,n,o);case"base64":return xe(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,n,o);default:if(c)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function q(a,n,o){const c=a[n];a[n]=a[o],a[o]=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 o=0;o<n;o+=2)q(this,o,o+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 o=0;o<n;o+=4)q(this,o,o+3),q(this,o+1,o+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 o=0;o<n;o+=8)q(this,o,o+7),q(this,o+1,o+6),q(this,o+2,o+5),q(this,o+3,o+4);return this},l.prototype.toString=function(){const n=this.length;return n===0?"":arguments.length===0?Ge(this,0,n):k.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 o=t.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(n,o,c,d,y){if(pe(n,u)&&(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(o===void 0&&(o=0),c===void 0&&(c=n?n.length:0),d===void 0&&(d=0),y===void 0&&(y=this.length),o<0||c>n.length||d<0||y>this.length)throw new RangeError("out of range index");if(d>=y&&o>=c)return 0;if(d>=y)return-1;if(o>=c)return 1;if(o>>>=0,c>>>=0,d>>>=0,y>>>=0,this===n)return 0;let b=y-d,N=c-o;const W=Math.min(b,N),K=this.slice(d,y),H=n.slice(o,c);for(let z=0;z<W;++z)if(K[z]!==H[z]){b=K[z],N=H[z];break}return b<N?-1:N<b?1:0};function ie(a,n,o,c,d){if(a.length===0)return-1;if(typeof o=="string"?(c=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Dt(o)&&(o=d?0:a.length-1),o<0&&(o=a.length+o),o>=a.length){if(d)return-1;o=a.length-1}else if(o<0)if(d)o=0;else return-1;if(typeof n=="string"&&(n=l.from(n,c)),l.isBuffer(n))return n.length===0?-1:we(a,n,o,c,d);if(typeof n=="number")return n=n&255,typeof u.prototype.indexOf=="function"?d?u.prototype.indexOf.call(a,n,o):u.prototype.lastIndexOf.call(a,n,o):we(a,[n],o,c,d);throw new TypeError("val must be string, number or Buffer")}function we(a,n,o,c,d){let y=1,b=a.length,N=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,b/=2,N/=2,o/=2}function W(H,z){return y===1?H[z]:H.readUInt16BE(z*y)}let K;if(d){let H=-1;for(K=o;K<b;K++)if(W(a,K)===W(n,H===-1?0:K-H)){if(H===-1&&(H=K),K-H+1===N)return H*y}else H!==-1&&(K-=K-H),H=-1}else for(o+N>b&&(o=b-N),K=o;K>=0;K--){let H=!0;for(let z=0;z<N;z++)if(W(a,K+z)!==W(n,z)){H=!1;break}if(H)return K}return-1}l.prototype.includes=function(n,o,c){return this.indexOf(n,o,c)!==-1},l.prototype.indexOf=function(n,o,c){return ie(this,n,o,c,!0)},l.prototype.lastIndexOf=function(n,o,c){return ie(this,n,o,c,!1)};function be(a,n,o,c){o=Number(o)||0;const d=a.length-o;c?(c=Number(c),c>d&&(c=d)):c=d;const y=n.length;c>y/2&&(c=y/2);let b;for(b=0;b<c;++b){const N=parseInt(n.substr(b*2,2),16);if(Dt(N))return b;a[o+b]=N}return b}function ue(a,n,o,c){return mt(lt(n,a.length-o),a,o,c)}function ct(a,n,o,c){return mt(_r(n),a,o,c)}function he(a,n,o,c){return mt(Fr(n),a,o,c)}function Re(a,n,o,c){return mt(Vn(n,a.length-o),a,o,c)}l.prototype.write=function(n,o,c,d){if(o===void 0)d="utf8",c=this.length,o=0;else if(c===void 0&&typeof o=="string")d=o,c=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(c)?(c=c>>>0,d===void 0&&(d="utf8")):(d=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const y=this.length-o;if((c===void 0||c>y)&&(c=y),n.length>0&&(c<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");let b=!1;for(;;)switch(d){case"hex":return be(this,n,o,c);case"utf8":case"utf-8":return ue(this,n,o,c);case"ascii":case"latin1":case"binary":return ct(this,n,o,c);case"base64":return he(this,n,o,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Re(this,n,o,c);default:if(b)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),b=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function xe(a,n,o){return n===0&&o===a.length?e.fromByteArray(a):e.fromByteArray(a.slice(n,o))}function Ge(a,n,o){o=Math.min(a.length,o);const c=[];let d=n;for(;d<o;){const y=a[d];let b=null,N=y>239?4:y>223?3:y>191?2:1;if(d+N<=o){let W,K,H,z;switch(N){case 1:y<128&&(b=y);break;case 2:W=a[d+1],(W&192)===128&&(z=(y&31)<<6|W&63,z>127&&(b=z));break;case 3:W=a[d+1],K=a[d+2],(W&192)===128&&(K&192)===128&&(z=(y&15)<<12|(W&63)<<6|K&63,z>2047&&(z<55296||z>57343)&&(b=z));break;case 4:W=a[d+1],K=a[d+2],H=a[d+3],(W&192)===128&&(K&192)===128&&(H&192)===128&&(z=(y&15)<<18|(W&63)<<12|(K&63)<<6|H&63,z>65535&&z<1114112&&(b=z))}}b===null?(b=65533,N=1):b>65535&&(b-=65536,c.push(b>>>10&1023|55296),b=56320|b&1023),c.push(b),d+=N}return ce(c)}const ve=4096;function ce(a){const n=a.length;if(n<=ve)return String.fromCharCode.apply(String,a);let o="",c=0;for(;c<n;)o+=String.fromCharCode.apply(String,a.slice(c,c+=ve));return o}function Be(a,n,o){let c="";o=Math.min(a.length,o);for(let d=n;d<o;++d)c+=String.fromCharCode(a[d]&127);return c}function ze(a,n,o){let c="";o=Math.min(a.length,o);for(let d=n;d<o;++d)c+=String.fromCharCode(a[d]);return c}function g(a,n,o){const c=a.length;(!n||n<0)&&(n=0),(!o||o<0||o>c)&&(o=c);let d="";for(let y=n;y<o;++y)d+=qn[a[y]];return d}function v(a,n,o){const c=a.slice(n,o);let d="";for(let y=0;y<c.length-1;y+=2)d+=String.fromCharCode(c[y]+c[y+1]*256);return d}l.prototype.slice=function(n,o){const c=this.length;n=~~n,o=o===void 0?c:~~o,n<0?(n+=c,n<0&&(n=0)):n>c&&(n=c),o<0?(o+=c,o<0&&(o=0)):o>c&&(o=c),o<n&&(o=n);const d=this.subarray(n,o);return Object.setPrototypeOf(d,l.prototype),d};function S(a,n,o){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+n>o)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(n,o,c){n=n>>>0,o=o>>>0,c||S(n,o,this.length);let d=this[n],y=1,b=0;for(;++b<o&&(y*=256);)d+=this[n+b]*y;return d},l.prototype.readUintBE=l.prototype.readUIntBE=function(n,o,c){n=n>>>0,o=o>>>0,c||S(n,o,this.length);let d=this[n+--o],y=1;for(;o>0&&(y*=256);)d+=this[n+--o]*y;return d},l.prototype.readUint8=l.prototype.readUInt8=function(n,o){return n=n>>>0,o||S(n,1,this.length),this[n]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||S(n,2,this.length),this[n]|this[n+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||S(n,2,this.length),this[n]<<8|this[n+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||S(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,o){return n=n>>>0,o||S(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,Se(n,"offset");const o=this[n],c=this[n+7];(o===void 0||c===void 0)&&$e(n,this.length-8);const d=o+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(d)+(BigInt(y)<<BigInt(32))}),l.prototype.readBigUInt64BE=Pe(function(n){n=n>>>0,Se(n,"offset");const o=this[n],c=this[n+7];(o===void 0||c===void 0)&&$e(n,this.length-8);const d=o*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(d)<<BigInt(32))+BigInt(y)}),l.prototype.readIntLE=function(n,o,c){n=n>>>0,o=o>>>0,c||S(n,o,this.length);let d=this[n],y=1,b=0;for(;++b<o&&(y*=256);)d+=this[n+b]*y;return y*=128,d>=y&&(d-=Math.pow(2,8*o)),d},l.prototype.readIntBE=function(n,o,c){n=n>>>0,o=o>>>0,c||S(n,o,this.length);let d=o,y=1,b=this[n+--d];for(;d>0&&(y*=256);)b+=this[n+--d]*y;return y*=128,b>=y&&(b-=Math.pow(2,8*o)),b},l.prototype.readInt8=function(n,o){return n=n>>>0,o||S(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},l.prototype.readInt16LE=function(n,o){n=n>>>0,o||S(n,2,this.length);const c=this[n]|this[n+1]<<8;return c&32768?c|4294901760:c},l.prototype.readInt16BE=function(n,o){n=n>>>0,o||S(n,2,this.length);const c=this[n+1]|this[n]<<8;return c&32768?c|4294901760:c},l.prototype.readInt32LE=function(n,o){return n=n>>>0,o||S(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},l.prototype.readInt32BE=function(n,o){return n=n>>>0,o||S(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,Se(n,"offset");const o=this[n],c=this[n+7];(o===void 0||c===void 0)&&$e(n,this.length-8);const d=this[n+4]+this[n+5]*2**8+this[n+6]*2**16+(c<<24);return(BigInt(d)<<BigInt(32))+BigInt(o+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24)}),l.prototype.readBigInt64BE=Pe(function(n){n=n>>>0,Se(n,"offset");const o=this[n],c=this[n+7];(o===void 0||c===void 0)&&$e(n,this.length-8);const d=(o<<24)+this[++n]*2**16+this[++n]*2**8+this[++n];return(BigInt(d)<<BigInt(32))+BigInt(this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+c)}),l.prototype.readFloatLE=function(n,o){return n=n>>>0,o||S(n,4,this.length),r.read(this,n,!0,23,4)},l.prototype.readFloatBE=function(n,o){return n=n>>>0,o||S(n,4,this.length),r.read(this,n,!1,23,4)},l.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||S(n,8,this.length),r.read(this,n,!0,52,8)},l.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||S(n,8,this.length),r.read(this,n,!1,52,8)};function O(a,n,o,c,d,y){if(!l.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>d||n<y)throw new RangeError('"value" argument is out of bounds');if(o+c>a.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(n,o,c,d){if(n=+n,o=o>>>0,c=c>>>0,!d){const N=Math.pow(2,8*c)-1;O(this,n,o,c,N,0)}let y=1,b=0;for(this[o]=n&255;++b<c&&(y*=256);)this[o+b]=n/y&255;return o+c},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(n,o,c,d){if(n=+n,o=o>>>0,c=c>>>0,!d){const N=Math.pow(2,8*c)-1;O(this,n,o,c,N,0)}let y=c-1,b=1;for(this[o+y]=n&255;--y>=0&&(b*=256);)this[o+y]=n/b&255;return o+c},l.prototype.writeUint8=l.prototype.writeUInt8=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,1,255,0),this[o]=n&255,o+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function j(a,n,o,c,d){De(n,c,d,a,o,7);let y=Number(n&BigInt(4294967295));a[o++]=y,y=y>>8,a[o++]=y,y=y>>8,a[o++]=y,y=y>>8,a[o++]=y;let b=Number(n>>BigInt(32)&BigInt(4294967295));return a[o++]=b,b=b>>8,a[o++]=b,b=b>>8,a[o++]=b,b=b>>8,a[o++]=b,o}function V(a,n,o,c,d){De(n,c,d,a,o,7);let y=Number(n&BigInt(4294967295));a[o+7]=y,y=y>>8,a[o+6]=y,y=y>>8,a[o+5]=y,y=y>>8,a[o+4]=y;let b=Number(n>>BigInt(32)&BigInt(4294967295));return a[o+3]=b,b=b>>8,a[o+2]=b,b=b>>8,a[o+1]=b,b=b>>8,a[o]=b,o+8}l.prototype.writeBigUInt64LE=Pe(function(n,o=0){return j(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Pe(function(n,o=0){return V(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(n,o,c,d){if(n=+n,o=o>>>0,!d){const W=Math.pow(2,8*c-1);O(this,n,o,c,W-1,-W)}let y=0,b=1,N=0;for(this[o]=n&255;++y<c&&(b*=256);)n<0&&N===0&&this[o+y-1]!==0&&(N=1),this[o+y]=(n/b>>0)-N&255;return o+c},l.prototype.writeIntBE=function(n,o,c,d){if(n=+n,o=o>>>0,!d){const W=Math.pow(2,8*c-1);O(this,n,o,c,W-1,-W)}let y=c-1,b=1,N=0;for(this[o+y]=n&255;--y>=0&&(b*=256);)n<0&&N===0&&this[o+y+1]!==0&&(N=1),this[o+y]=(n/b>>0)-N&255;return o+c},l.prototype.writeInt8=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},l.prototype.writeInt16LE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},l.prototype.writeInt16BE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},l.prototype.writeInt32LE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},l.prototype.writeInt32BE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},l.prototype.writeBigInt64LE=Pe(function(n,o=0){return j(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Pe(function(n,o=0){return V(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function R(a,n,o,c,d,y){if(o+c>a.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function D(a,n,o,c,d){return n=+n,o=o>>>0,d||R(a,n,o,4),r.write(a,n,o,c,23,4),o+4}l.prototype.writeFloatLE=function(n,o,c){return D(this,n,o,!0,c)},l.prototype.writeFloatBE=function(n,o,c){return D(this,n,o,!1,c)};function Q(a,n,o,c,d){return n=+n,o=o>>>0,d||R(a,n,o,8),r.write(a,n,o,c,52,8),o+8}l.prototype.writeDoubleLE=function(n,o,c){return Q(this,n,o,!0,c)},l.prototype.writeDoubleBE=function(n,o,c){return Q(this,n,o,!1,c)},l.prototype.copy=function(n,o,c,d){if(!l.isBuffer(n))throw new TypeError("argument should be a Buffer");if(c||(c=0),!d&&d!==0&&(d=this.length),o>=n.length&&(o=n.length),o||(o=0),d>0&&d<c&&(d=c),d===c||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),n.length-o<d-c&&(d=n.length-o+c);const y=d-c;return this===n&&typeof u.prototype.copyWithin=="function"?this.copyWithin(o,c,d):u.prototype.set.call(n,this.subarray(c,d),o),y},l.prototype.fill=function(n,o,c,d){if(typeof n=="string"){if(typeof o=="string"?(d=o,o=0,c=this.length):typeof c=="string"&&(d=c,c=this.length),d!==void 0&&typeof d!="string")throw new TypeError("encoding must be a string");if(typeof d=="string"&&!l.isEncoding(d))throw new TypeError("Unknown encoding: "+d);if(n.length===1){const b=n.charCodeAt(0);(d==="utf8"&&b<128||d==="latin1")&&(n=b)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<c)throw new RangeError("Out of range index");if(c<=o)return this;o=o>>>0,c=c===void 0?this.length:c>>>0,n||(n=0);let y;if(typeof n=="number")for(y=o;y<c;++y)this[y]=n;else{const b=l.isBuffer(n)?n:l.from(n,d),N=b.length;if(N===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(y=0;y<c-o;++y)this[y+o]=b[y%N]}return this};const J={};function le(a,n,o){J[a]=class extends o{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(d){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:d,writable:!0})}toString(){return`${this.name} [${a}]: ${this.message}`}}}le("ERR_BUFFER_OUT_OF_BOUNDS",function(a){return a?`${a} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),le("ERR_INVALID_ARG_TYPE",function(a,n){return`The "${a}" argument must be of type number. Received type ${typeof n}`},TypeError),le("ERR_OUT_OF_RANGE",function(a,n,o){let c=`The value of "${a}" is out of range.`,d=o;return Number.isInteger(o)&&Math.abs(o)>2**32?d=Ne(String(o)):typeof o=="bigint"&&(d=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(d=Ne(d)),d+="n"),c+=` It must be ${n}. Received ${d}`,c},RangeError);function Ne(a){let n="",o=a.length;const c=a[0]==="-"?1:0;for(;o>=c+4;o-=3)n=`_${a.slice(o-3,o)}${n}`;return`${a.slice(0,o)}${n}`}function ke(a,n,o){Se(n,"offset"),(a[n]===void 0||a[n+o]===void 0)&&$e(n,a.length-(o+1))}function De(a,n,o,c,d,y){if(a>o||a<n){const b=typeof n=="bigint"?"n":"";let N;throw y>3?n===0||n===BigInt(0)?N=`>= 0${b} and < 2${b} ** ${(y+1)*8}${b}`:N=`>= -(2${b} ** ${(y+1)*8-1}${b}) and < 2 ** ${(y+1)*8-1}${b}`:N=`>= ${n}${b} and <= ${o}${b}`,new J.ERR_OUT_OF_RANGE("value",N,a)}ke(c,d,y)}function Se(a,n){if(typeof a!="number")throw new J.ERR_INVALID_ARG_TYPE(n,"number",a)}function $e(a,n,o){throw Math.floor(a)!==a?(Se(a,o),new J.ERR_OUT_OF_RANGE(o||"offset","an integer",a)):n<0?new J.ERR_BUFFER_OUT_OF_BOUNDS:new J.ERR_OUT_OF_RANGE(o||"offset",`>= ${o?1:0} and <= ${n}`,a)}const Nt=/[^+/0-9A-Za-z-_]/g;function A(a){if(a=a.split("=")[0],a=a.trim().replace(Nt,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function lt(a,n){n=n||1/0;let o;const c=a.length;let d=null;const y=[];for(let b=0;b<c;++b){if(o=a.charCodeAt(b),o>55295&&o<57344){if(!d){if(o>56319){(n-=3)>-1&&y.push(239,191,189);continue}else if(b+1===c){(n-=3)>-1&&y.push(239,191,189);continue}d=o;continue}if(o<56320){(n-=3)>-1&&y.push(239,191,189),d=o;continue}o=(d-55296<<10|o-56320)+65536}else d&&(n-=3)>-1&&y.push(239,191,189);if(d=null,o<128){if((n-=1)<0)break;y.push(o)}else if(o<2048){if((n-=2)<0)break;y.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;y.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;y.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return y}function _r(a){const n=[];for(let o=0;o<a.length;++o)n.push(a.charCodeAt(o)&255);return n}function Vn(a,n){let o,c,d;const y=[];for(let b=0;b<a.length&&!((n-=2)<0);++b)o=a.charCodeAt(b),c=o>>8,d=o%256,y.push(d),y.push(c);return y}function Fr(a){return e.toByteArray(A(a))}function mt(a,n,o,c){let d;for(d=0;d<c&&!(d+o>=n.length||d>=a.length);++d)n[d+o]=a[d];return d}function pe(a,n){return a instanceof n||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===n.name}function Dt(a){return a!==a}const qn=function(){const a="0123456789abcdef",n=new Array(256);for(let o=0;o<16;++o){const c=o*16;for(let d=0;d<16;++d)n[c+d]=a[o]+a[d]}return n}();function Pe(a){return typeof BigInt>"u"?Qn:a}function Qn(){throw new Error("BigInt not supported")}})(an);const xr=an.Buffer;var cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ui(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pr={exports:{}};const ji=Object.getPrototypeOf({});function yr(t){function e(I){return I!=="constructor"&&I!=="prototype"&&I!=="__proto__"}function r(I){let F=0;const U=I.length,L=new Array(U);for(F=0;F<U;++F)L[F]=T(I[F]);return L}function i(I){const F={};if(h&&Object.getPrototypeOf(I)!==ji)return h(I);const U=p(I);let L,C,x;for(L=0,C=U.length;L<C;++L)e(x=U[L])&&(F[x]=T(I[x]));return F}function s(I,F){const U=I.length,L=F.length;let C=0;const x=new Array(U+L);for(C=0;C<U;++C)x[C]=T(I[C]);for(C=0;C<L;++C)x[C+U]=T(F[C]);return x}const u=Object.prototype.propertyIsEnumerable;function f(I){const F=Object.keys(I),U=Object.getOwnPropertySymbols(I);for(let L=0,C=U.length;L<C;++L)u.call(I,U[L])&&F.push(U[L]);return F}const p=t&&t.symbols?f:Object.keys,h=typeof t?.cloneProtoObject=="function"?t.cloneProtoObject:void 0;function m(I){return typeof I=="object"&&I!==null&&!(I instanceof RegExp)&&!(I instanceof Date)}function l(I){return typeof I!="object"||I===null}const w=typeof xr<"u"?I=>typeof I!="object"||I===null||I instanceof RegExp||I instanceof Date||I instanceof xr:I=>typeof I!="object"||I===null||I instanceof RegExp||I instanceof Date,E=t&&typeof t.mergeArray=="function"?t.mergeArray({clone:T,deepmerge:B,getKeys:p,isMergeableObject:m}):s;function T(I){return m(I)?Array.isArray(I)?r(I):i(I):I}function _(I,F){const U={},L=p(I),C=p(F);let x,k,q;for(x=0,k=L.length;x<k;++x)e(q=L[x])&&C.indexOf(q)===-1&&(U[q]=T(I[q]));for(x=0,k=C.length;x<k;++x)e(q=C[x])&&(q in I&&(L.indexOf(q)!==-1&&(U[q]=B(I[q],F[q])),!0)||(U[q]=T(F[q])));return U}function B(I,F){const U=Array.isArray(F),L=Array.isArray(I);return l(F)?F:w(I)?T(F):U&&L?E(I,F):U!==L?T(F):_(I,F)}function M(){switch(arguments.length){case 0:return{};case 1:return T(arguments[0]);case 2:return B(arguments[0],arguments[1])}let I;for(let F=0,U=arguments.length;F<U;++F)I=B(I,arguments[F]);return I}return t&&t.all?M:B}pr.exports=yr;pr.exports.default=yr;var Mi=pr.exports.deepmerge=yr;const Vi=t=>(e,r)=>{let i=0;const s=e.length,u=r.length,f=Math.max(s,u),p=new Array(f);for(i=0;i<f;++i)i<u?p[i]=t.deepmerge(e[i],r[i]):p[i]=t.clone(e[i]);return p},qi=Mi({mergeArray:Vi}),Qi=(t,e,r)=>{const i=_e.computed([e,r],(f,p)=>{if(f){const h=p.data?.find(m=>m.id===f);if(h)return h;console.error("Feed list is not loaded yet. Issue with the opened question.")}}),s=Le({data:void 0,loading:void 0,error:void 0});return i.subscribe(async f=>{if(f&&f.type==="question"){s.setKey("loading",!0);const p=await sn(f.id,t);s.set({data:p,loading:!1});return}s.set({data:void 0,loading:!1})}),{$store:i,$extendedStore:s,updateExtendedQuestion:f=>{const p=s.get().data;if(p&&f?.answers)for(const h of f.answers)h.youVoted!==!0&&delete h.youVoted;s.set({data:qi(p,f)})}}};var Ve;(function(t){t.ALLOWED="allowed",t.DISALLOWED="disallowed"})(Ve||(Ve={}));class Gi{slStreamId;organizationId;userId;interactiveAllowed;openedQuestionId;openedQuestion;activeQuestionId;feedList;moderationId;moderation;feedSubscription;questionSubscription;notifications;log;constructor(e){this.log=on("gamification-background"),this.slStreamId=e.stores.slStreamId.getAtomStore(),this.organizationId=e.stores.organizationSettings.getAtomStore(),this.userId=e.stores.user.getAtomStore(),this.moderationId=new ae(ne(void 0),"moderationId").getStore(),this.interactiveAllowed=new ae(ne(Ve.DISALLOWED),"interactiveAllowed").getStore(),this.openedQuestionId=new ae(ne(void 0),"openedQuestionId").getStore(),this.notifications=e.notifications,this.moderation=new de(Oi(this.slStreamId,e.transport),"gamification:moderation"),this.feedList=new de(xi(this.slStreamId,this.interactiveAllowed,e.transport),"gamification:feedList"),this.activeQuestionId=new de(_i(this.slStreamId,e.transport),"gamification:activeQuestionId"),this.openedQuestion=Qi(e.transport,this.openedQuestionId,this.feedList.getStore()),this.openedQuestionId.listen(r=>{this.log.debug({questionId:r},"received question"),r?(this.questionSubscription=Ci(r,e.transport),this.questionSubscription.addListener("feed-subscription-opened-question",i=>{window.requestAnimationFrame(()=>{this.openedQuestion.updateExtendedQuestion(i.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 i=this.activeQuestionId.getStore();i&&i.mutate(r.data?.attributes)})}),this.feedSubscription.addListener("moderation update",r=>{window.requestAnimationFrame(()=>{r.data?.attributes?.question===void 0&&r.data?.attributes?.moderation&&this.moderation.invalidate()})}),this.feedSubscription.connect(),this.interactiveAllowed.listen(()=>{window.requestAnimationFrame(()=>{this.activeQuestionId.invalidate()})})}getCurrentSessionId=e=>{const r=e.eventId||this.slStreamId.get()||"",i=e.userId||this.userId.get()||"",s=e.organizationId||this.organizationId.get()||"",u=e.entity||"",f=e.prefix||"";return[s,r,i,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 zi{notificationsList;notifications;store;timeouts;waitingQueue;activeQueue;options;logger;constructor(e){this.options=e,this.logger=on("notifications"),this.store=new Map,this.timeouts=new Map,this.waitingQueue=new Set,this.activeQueue=new Set,this.notifications=new ae(ne(new Map),"notifications-queue"),this.notificationsList=this.notifications.getStore()}addToQueue=e=>{if(this.store.has(e.id)){this.logger.debug({notification:e},"skip existed notification: %o");return}const r=e.close,i=e.action;if(this.store.set(e.id,{...e,close:(...s)=>{r&&r(...s),this.closeNotification(e.id)},action:(...s)=>{i&&i(...s),this.closeNotification(e.id)}}),this.waitingQueue.add(e.id),this.activeQueue.size===this.options.concurrency){const[s]=this.activeQueue;if(this.store.get(s)?.persistent!==!0)this.closeNotification(s);else{const[f]=this.waitingQueue;this.waitingQueue.size>1&&this.closeNotification(f),this.tickWaitingQueue()}}else 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 i=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,delay:r.autoHideDuration||5e3},"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,i),this.logger.debug({notificationId:e},"active queue tick completed"),this.tickWaitingQueue()};closeNotification=e=>{const r=new Map(this.notifications.getValue()),i=r.get(e);if(i){i.hiding=!(this.waitingQueue.size>=this.options.concurrency),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 Tt;(function(t){t.OPENED="opened"})(Tt||(Tt={}));class Ki extends dr{constructor(){super("notification")}setOpened=e=>{this.write(Tt.OPENED,e,"true")};isOpened=e=>this.read(Tt.OPENED,e);clearNotification=()=>{this.clear()}}var Me;(function(t){t[t.ONBOARDING=1]="ONBOARDING",t[t.QUESTION=2]="QUESTION",t[t.QUESTION_RESOLVED=3]="QUESTION_RESOLVED"})(Me||(Me={}));class Wi{queue;storage;constructor(e={}){this.storage=new Ki,this.queue=new zi({concurrency:1,animationDelay:1600,...e})}add=e=>{this.storage.isOpened(e.id)||this.queue.addToQueue(e)};close=(e,r=!0)=>{this.queue.closeNotification(e),r&&this.markAsViewed(e)};getQueueStore=()=>this.queue.notificationsList;markAsViewed=e=>{this.storage.setOpened(e)}}const Hi=(t,e,r)=>{t.notifications=new Wi,t.addNotification=t.notifications.add,t.sdk.getNotificationsStore=()=>t.notifications.getQueueStore(),r()},Ji=(t,e)=>{const{client:r}=t.createPromiseClient(Fe.Feed,{method:"submitAnswer"});return r.submitAnswer({data:e})},Yi=(t,e)=>{const{client:r}=t.createPromiseClient(Fe.Feed,{method:"submitInplay"});return r.submitInplay({data:{eventId:+e}})},Xi=(t,e)=>{const{client:r}=t.createPromiseClient(Fe.Feed,{method:"skipQuestion"});return r.skipQuestion({data:{id:e}})};var Ze;(function(t){t.ONBOARDING="onboarding",t.ONBOARDING_IO="onboarding_io"})(Ze||(Ze={}));class ln extends dr{constructor(){super("gamification")}saveOnboardingStatus=({userId:e,eventId:r,organizationId:i},s)=>{this.write(Ze.ONBOARDING,i,e,r,s)};getOnboardingStatus=({userId:e,eventId:r,organizationId:i})=>this.read(Ze.ONBOARDING,i,e,r);setOnboardingInstantOpen=({userId:e,eventId:r,organizationId:i})=>{const s=this.generateKey([Ze.ONBOARDING_IO,i,e,r]);window.sessionStorage.setItem(s,"1")};getOnboardingInstantOpen=({userId:e,eventId:r,organizationId:i})=>{const s=this.generateKey([Ze.ONBOARDING_IO,i,e,r]);return window.sessionStorage.getItem(s)}}const Br={pageSize:10},Zi=(t,e,r,i,s)=>{let u=0;const f=ne({pageSize:s?.pageSize||Br.pageSize,page:0}),p=Le({data:[],key:Date.now(),hasMore:!0,loading:void 0,error:void 0}),h=Ii(t),m=async()=>{const E=e.get(),T=i.getStore().get().data?.map(_=>_.slId)||[];if(E&&T?.length){const _=r.get();_&&T.push(_),p.setKey("loading",!0),p.setKey("data",[]);const B={eventId:E,usersIds:T,pagination:{page:0,pageSize:s?.pageSize||Br.pageSize}},M=await h(B);p.set({data:M.data.map(I=>I.attributes),hasMore:!0,key:Date.now(),loading:!1}),M.meta&&(u=Math.round(M.meta.count/M.meta.pageSize)),f.set(B.pagination)}},l=()=>{m()},w=E=>{const T=f.get(),_=E||T.page+1;_<=u&&f.set({...T,page:_})};return _e.onMount(p,()=>{const E=e.listen(m),T=i.listen(m),_=f.listen(async B=>{const M=e.get();if(B.page>0&&M)if(B.page<u){p.setKey("loading",!0);const F=await h({eventId:M,pagination:B}),U=p.get().data||[];p.set({data:[...U,...F.data.map(L=>L.attributes)],key:p.get().key,loading:!1,hasMore:!0})}else p.setKey("hasMore",!1)});return()=>{E(),T(),_()}}),{$store:p,fetchMore:w,invalidate:l}},eo=(t,e)=>{const{client:r,queryKey:i}=t.createPromiseClient(yt.Client,{method:"generateDeepLink",params:e});return t.nanoquery.createFetcherStore(i,{fetcher:async(s,u,f)=>f?(await r.generateDeepLink({data:{eventId:f}})).data?.attributes:{}})},to=(t,{web:e,mobile:r})=>{const{client:i}=t.createPromiseClient(Wn.LinksClient,{method:"generate"});return i.generate({web:e,mobile:r})},ro=(t,e,r)=>{const i=Le({});return _e.onMount(i,()=>eo(t,[e]).subscribe(async({data:f,error:p,loading:h})=>{const m=p?"https://masters.com":f?.url;if(!h&&m){i.setKey("loading",!0);let l=window.location.search,w=window.location.hash;if(l&&w||w){const _=new URLSearchParams(l);_.append("slprms",`sl_eid=${e.get()}:sl_uid=${r.get()}`),l=`?${_.toString()}`}else w=`#slprms::${`sl_eid=${e.get()}:sl_uid=${r.get()}`}`;const E=window.location.origin+window.location.pathname+l+w,T=await to(t,{web:E,mobile:m});i.set({data:T.data?.link,loading:!1})}else i.setKey("loading",!0)})),{$store:i,fetch}};var ee;(function(t){t.Unset="unset",t.Required="required",t.Optional="optional",t.Completed="completed",t.Disabled="disabled",t.Unavailable="unavailable"})(ee||(ee={}));const no=(t,e,r,i)=>{const{inplayGame:s}=t.featureSettings.get(),u=e.getCurrentSessionId({prefix:"onboarding"});s&&r.add({type:Me.ONBOARDING,id:u,action:t.openFeature,persistent:!0,autoHideDuration:1e6,data:{questionType:re.QuestionType.UNSET,onboarding:{...s,instantOpen:!i.getOnboardingInstantOpen({userId:e.userId.get()||"",organizationId:e.organizationId.get()||"",eventId:e.slStreamId.get()||""})}}})},wt=(t,e,r,i,s,u)=>{try{const f=e.userId.get();if(!f)return;if(s.getOnboardingStatus({userId:f,organizationId:e.organizationId.get()||"",eventId:e.slStreamId.get()||""})===ee.Completed){t.set(ee.Completed);for(const E of u)E();return}const h=e.moderation.getStore().value?.data,m=r.featureSettings.get().inplayGame;if(h===void 0||m===void 0)return;const l=h?.options?.onboardingEnabled,w=m?.titleCard?.optIn;l?w?t.set(ee.Required):t.set(ee.Optional):(w?t.set(ee.Unavailable):t.set(ee.Disabled),i.close(e.getCurrentSessionId({prefix:"onboarding"}),!1))}catch(f){console.error(f)}},io=(t,e,r,i)=>{let s=!1;const u=new ln,f=ne(ee.Unset);f.subscribe(m=>{m!==ee.Unset&&((m===ee.Optional||m===ee.Required)&&s===!1&&(no(t,e,i,u),s=!0),m===ee.Completed&&e.activeQuestionId.invalidate(),u.setOnboardingInstantOpen({userId:e.userId.get()||"",organizationId:e.organizationId.get()||"",eventId:e.slStreamId.get()||""}))});const p=[];return wt(f,e,t,i,u,p),f.get()!==ee.Completed&&(p.push(e.userId.listen(m=>{m&&wt(f,e,t,i,u,p)})),p.push(e.moderation.listen(m=>{m.data&&wt(f,e,t,i,u,p)})),p.push(t.featureSettings.listen(m=>{m&&wt(f,e,t,i,u,p)}))),{$store:f,submitInplay:async()=>{const m=e.slStreamId.get();if(m){await Yi(r,m),f.set(ee.Completed),u.saveOnboardingStatus({organizationId:e.organizationId.get()||"",userId:e.userId.get()||"",eventId:m},ee.Completed);const l=e.getCurrentSessionId({prefix:"onboarding"});i.close(l)}}}},oo=new Set([re.QuestionType.POLL,re.QuestionType.PREDICTION,re.QuestionType.TRIVIA]);class so extends nn{userSummary;feedList;friends;leaderboardId;leaderboardList;deepLink;onboardingStatus;openedQuestion;currentUserId;openedUser;closeFeature;openFeature;notifications;transport;background;storage;constructor(e,r,i){super(e,r),this.background=new Gi(i),this.storage=new ln,this.userSummary=new de(Ei(this.background.slStreamId,this.background.userId,i.transport),"gamification:userSummary"),this.feedList=this.background.feedList,this.friends=new de(Ti(this.background.userId,i.transport),"gamification:friends"),this.currentUserId=this.background.userId,this.openedUser=ne(void 0),this.leaderboardId=new ae(ne(this.settings.getValue("pinnedLeaderboardId")),"pinnedLeaderboardId").getStore(),this.onboardingStatus=io(this,this.background,i.transport,i.notifications),this.notifications=i.notifications,this.transport=i.transport,this.closeFeature=()=>i.sdk.closeFeature(!0),this.openFeature=()=>i.sdk.openFeature(Te.SdkOverlayType.GAMES),this.openedQuestion=this.background.openedQuestion,this.deepLink=ro(this.transport,this.background.slStreamId,this.background.userId),this.leaderboardList=Zi(this.transport,this.background.slStreamId,this.background.userId,this.friends),this.status.subscribe(s=>{s===rt.Ready?this.connect(i.transport):this.disconnect()}),this.userSummary.listen(s=>{this.leaderboardList.$store.lc!==0&&s?.data?.summary&&window.requestAnimationFrame(()=>{this.leaderboardList.invalidate()})}),this.background.activeQuestionId.listen(this.showInApp),this.onboardingStatus.$store.listen(this.checkInteractiveFlag),this.background.moderation.getStore().listen(this.checkInteractiveFlag),this.settings.subscribe(this.checkInteractiveFlag)}get isInteractiveAllowed(){return this.background.interactiveAllowed.get()===Ve.ALLOWED}checkInteractiveFlag=()=>{const e=this.onboardingStatus.$store.get(),r=this.background.moderation.getStore().value?.data?.options?.onboardingEnabled,i=this.settings.getValues().inplayGame?.titleCard?.optIn,s=e===ee.Completed,u=!r||s||i!==!0;this.background.interactiveAllowed.set(u?Ve.ALLOWED:Ve.DISALLOWED)};connect=e=>{this.userSummary.invalidate(),this.leaderboardList.invalidate(),this.feedList.invalidate(),this.friends.invalidate(),this.background.feedSubscription.addListener("feed-subscription-prediction-close",r=>{this.isInteractiveAllowed&&window.requestAnimationFrame(async()=>{const i=r.data?.attributes?.question;if(!i)return;const{status:s,type:u,id:f}=i;if(s===re.QuestionStatus.RESOLVED&&u===re.QuestionType.PREDICTION){const p=this.background.getCurrentSessionId({prefix:`notification-id:${f}`}),h=await sn(f,e),m=h?.answers.find(({correct:w})=>w),l=h?.answers.find(({youVoted:w})=>w);if(!l)return;this.notifications.add({type:Me.QUESTION_RESOLVED,action:()=>this.openQuestion(f),close:()=>this.closeQuestion(f),autoHideDuration:35e3,id:p,data:{questionType:re.QuestionType.PREDICTION,question:{title:m?.youVoted?`Congratulations! You answered correctly! You won ${m.points} pts!`:`Better luck next time! Correct: ${m?.text}!`,votedAnswer:{title:l?.text,points:l?.points},correctAnswerTitle:m?.text,correct:m?.youVoted,predictionResult:s===re.QuestionStatus.RESOLVED,questionTitle:h?.subject}}}),this.userSummary.invalidate()}})}),this.background.feedSubscription.addListener("feed-subscription-questions-list",()=>{window.requestAnimationFrame(()=>{this.feedList?.invalidate()})})};disconnect=()=>{this.background.feedSubscription.removeListener("feed-subscription-questions-list")};submitAnswer=async(e,r)=>{await Ji(this.transport,{questionId:e,answerId:r}),this.feedList.invalidate(),this.userSummary.invalidate()};skipQuestion=async e=>{await Xi(this.transport,e),this.feedList.invalidate(),this.userSummary.invalidate()};openQuestion=e=>(this.openFeature(),this.notifications.close(this.background.getCurrentSessionId({prefix:"notification",entity:e})),this.background.openQuestion(e));closeQuestion=e=>this.background.closeQuestion(e);openUser=e=>{const r=this.leaderboardList.$store.get().data?.find(i=>i.userId===e);this.openedUser.set(r)};closeUser=()=>{this.openedUser.set(void 0)};showInApp=e=>{const r=this.onboardingStatus.$store.get();if(e&&e.data&&r&&r!==ee.Unset&&e.data.question?.id!==void 0&&e.data.question.notification!==void 0&&e.data.question?.bypassNotifications?.inAppSilence!==re.SilenceSetting.ON&&e.data.question.status===re.QuestionStatus.ACTIVE){if(oo.has(e.data.question.type))this.isInteractiveAllowed&&this.notifications.add({type:Me.QUESTION,action:()=>e.data?.question&&this.openQuestion(e.data.question.id),close:()=>e.data?.question&&this.closeQuestion(e.data.question.id),autoHideDuration:1e3*60,id:this.background.getCurrentSessionId({prefix:"notification",entity:e.data.question.id}),data:{questionType:e.data.question.type,question:{title:e.data.question.notification.title}}});else if(e.data.question.type===re.QuestionType.FACTOID){const i=e.data.question.options?.options.value,s={heading:e.data.question.notification.title,body:e.data.question.notification.body,image:i.image,video:{id:i?.video?.id||"",url:i?.video?.url||"",thumbnailUrl:i?.video?.thumbnailUrl||""},webLink:{label:"",url:""}};this.notifications.add({type:Me.QUESTION,action:()=>e.data?.question&&this.openQuestion(e.data.question.id),close:()=>e.data?.question&&this.closeQuestion(e.data.question.id),autoHideDuration:1e3*120,id:this.background.getCurrentSessionId({prefix:"notification",entity:e.data.question.id}),data:{questionType:e.data.question.type,insight:s}})}else if(e.data.question.type===re.QuestionType.TWEET){const i=e.data.question.options?.options.value,s={title:e.data.question.notification.title,body:e.data.question.notification.body,image:e.data.question.notification.image,account:i?.tweetMeta?.account||"",accountVerified:!!i?.tweetMeta?.accountVerified};this.notifications.add({type:Me.QUESTION,action:()=>e.data?.question&&this.openQuestion(e.data.question.id),close:()=>e.data?.question&&this.closeQuestion(e.data.question.id),autoHideDuration:1e3*120,id:this.background.getCurrentSessionId({prefix:"notification",entity:e.data.question.id}),data:{questionType:e.data.question.type,tweet:s}})}}}}const ao={[Te.SdkOverlayType.GAMES]:!0};class uo extends nn{constructor(e,r){super(e,r)}}const co=(t,e,r)=>t.type===Te.SdkOverlayType.GAMES?new so(t,e,r):new uo(t,e),lo=(t,e,r)=>{t.features=new Map,t.activeFeature=new ae(ne(Te.SdkOverlayType.UNSET),"activeFeature"),t.sdk.getFeatures=()=>t.features,t.sdk.getFeature=i=>t.features.get(i),t.sdk.getActiveFeature=()=>t.activeFeature.getStore(),t.sdk.openFeature=i=>{t.activeFeature.setValue(i)},t.sdk.closeFeature=(i=!1)=>{if(i){const s=t.activeFeature.getValue();t.activeFeature.setValue(Te.SdkOverlayType.UNSET),s&&t.features.delete(s)}},t.initFeature=(i,s=Ee.ORGANIZATION)=>{if(i.type in ao&&!t.features.has(i.type)){const u=co(i,s,t);t.features.set(i.type,u)}},t.updateFeature=(i,s)=>{t.features.get(i.type)?.update(i,s)},t.destroyFeature=i=>{t.features.delete(i.type)},t.reinitializeFeatures=async()=>{const i=await t.stores.organizationSettings.getValue();t.features.clear();for(const s of i?.overlays||[])t.initFeature(s,Ee.ORGANIZATION)},t.stores.providerStreamId.listen(i=>{i||t.reinitializeFeatures()}),t.storeSubscribe=()=>{const i=(u,f)=>{if(f?.overlays&&!(t.contextConfig?.skipOrganizationSettings&&u===Ee.ORGANIZATION))for(const p of f.overlays)p.sdkEnable===!0&&(t.features.has(p.type)?t.updateFeature(p,u):t.initFeature(p,u))},s={organizationSettings:u=>{if(u.data)try{i(Ee.ORGANIZATION,u.data)}catch(f){console.log(f)}},streamSettings:u=>{if(u.data)try{i(Ee.STREAM,u.data)}catch(f){console.log(f)}}};t.store.subscribe(s)},r()};var gr={exports:{}},mr={exports:{}};function fo(t){var e=new t,r=e;function i(){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:i,release:s}}var ho=fo,po=ho;function fn(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 i=po(yo),s=null,u=null,f=0,p=null,h={push:B,drain:se,saturated:se,pause:l,paused:!1,concurrency:r,running:m,resume:T,idle:_,length:w,getQueue:E,unshift:M,empty:se,kill:F,killAndDrain:U,error:L};return h;function m(){return f}function l(){h.paused=!0}function w(){for(var C=s,x=0;C;)C=C.next,x++;return x}function E(){for(var C=s,x=[];C;)x.push(C.value),C=C.next;return x}function T(){if(h.paused){h.paused=!1;for(var C=0;C<h.concurrency;C++)f++,I()}}function _(){return f===0&&h.length()===0}function B(C,x){var k=i.get();k.context=t,k.release=I,k.value=C,k.callback=x||se,k.errorHandler=p,f===h.concurrency||h.paused?u?(u.next=k,u=k):(s=k,u=k,h.saturated()):(f++,e.call(t,k.value,k.worked))}function M(C,x){var k=i.get();k.context=t,k.release=I,k.value=C,k.callback=x||se,k.errorHandler=p,f===h.concurrency||h.paused?s?(k.next=s,s=k):(s=k,u=k,h.saturated()):(f++,e.call(t,k.value,k.worked))}function I(C){C&&i.release(C);var x=s;x?h.paused?f--:(u===s&&(u=null),s=x.next,x.next=null,e.call(t,x.value,x.worked),u===null&&h.empty()):--f===0&&h.drain()}function F(){s=null,u=null,h.drain=se}function U(){s=null,u=null,h.drain(),h.drain=se}function L(C){p=C}}function se(){}function yo(){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,i){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,i),t.release(t)}}function go(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function i(l,w){e.call(this,l).then(function(E){w(null,E)},w)}var s=fn(t,i,r),u=s.push,f=s.unshift;return s.push=p,s.unshift=h,s.drained=m,s;function p(l){var w=new Promise(function(E,T){u(l,function(_,B){if(_){T(_);return}E(B)})});return w.catch(se),w}function h(l){var w=new Promise(function(E,T){f(l,function(_,B){if(_){T(_);return}E(B)})});return w.catch(se),w}function m(){if(s.idle())return new Promise(function(E){E()});var l=s.drain,w=new Promise(function(E){s.drain=function(){l(),E()}});return w}}mr.exports=fn;mr.exports.promise=go;var dn=mr.exports,wr={exports:{}},nt=typeof Reflect=="object"?Reflect:null,kr=nt&&typeof nt.apply=="function"?nt.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},vt;nt&&typeof nt.ownKeys=="function"?vt=nt.ownKeys:Object.getOwnPropertySymbols?vt=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:vt=function(e){return Object.getOwnPropertyNames(e)};function mo(t){console&&console.warn&&console.warn(t)}var hn=Number.isNaN||function(e){return e!==e};function G(){G.init.call(this)}wr.exports=G;wr.exports.once=So;G.EventEmitter=G;G.prototype._events=void 0;G.prototype._eventsCount=0;G.prototype._maxListeners=void 0;var Pr=10;function Pt(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(G,"defaultMaxListeners",{enumerable:!0,get:function(){return Pr},set:function(t){if(typeof t!="number"||t<0||hn(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Pr=t}});G.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};G.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||hn(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 pn(t){return t._maxListeners===void 0?G.defaultMaxListeners:t._maxListeners}G.prototype.getMaxListeners=function(){return pn(this)};G.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);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 p=new Error("Unhandled error."+(f?" ("+f.message+")":""));throw p.context=f,p}var h=u[e];if(h===void 0)return!1;if(typeof h=="function")kr(h,this,r);else for(var m=h.length,l=bn(h,m),i=0;i<m;++i)kr(l[i],this,r);return!0};function yn(t,e,r,i){var s,u,f;if(Pt(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]=i?[r,f]:[f,r]:i?f.unshift(r):f.push(r),s=pn(t),s>0&&f.length>s&&!f.warned){f.warned=!0;var p=new Error("Possible EventEmitter memory leak detected. "+f.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");p.name="MaxListenersExceededWarning",p.emitter=t,p.type=e,p.count=f.length,mo(p)}return t}G.prototype.addListener=function(e,r){return yn(this,e,r,!1)};G.prototype.on=G.prototype.addListener;G.prototype.prependListener=function(e,r){return yn(this,e,r,!0)};function wo(){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 gn(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=wo.bind(i);return s.listener=r,i.wrapFn=s,s}G.prototype.once=function(e,r){return Pt(r),this.on(e,gn(this,e,r)),this};G.prototype.prependOnceListener=function(e,r){return Pt(r),this.prependListener(e,gn(this,e,r)),this};G.prototype.removeListener=function(e,r){var i,s,u,f,p;if(Pt(r),s=this._events,s===void 0)return this;if(i=s[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(u=-1,f=i.length-1;f>=0;f--)if(i[f]===r||i[f].listener===r){p=i[f].listener,u=f;break}if(u<0)return this;u===0?i.shift():bo(i,u),i.length===1&&(s[e]=i[0]),s.removeListener!==void 0&&this.emit("removeListener",e,p||r)}return this};G.prototype.off=G.prototype.removeListener;G.prototype.removeAllListeners=function(e){var r,i,s;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var u=Object.keys(i),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=i[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 mn(t,e,r){var i=t._events;if(i===void 0)return[];var s=i[e];return s===void 0?[]:typeof s=="function"?r?[s.listener||s]:[s]:r?vo(s):bn(s,s.length)}G.prototype.listeners=function(e){return mn(this,e,!0)};G.prototype.rawListeners=function(e){return mn(this,e,!1)};G.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):wn.call(t,e)};G.prototype.listenerCount=wn;function wn(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}G.prototype.eventNames=function(){return this._eventsCount>0?vt(this._events):[]};function bn(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function bo(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function vo(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function So(t,e){return new Promise(function(r,i){function s(f){t.removeListener(e,u),i(f)}function u(){typeof t.removeListener=="function"&&t.removeListener("error",s),r([].slice.call(arguments))}vn(t,e,u,{once:!0}),e!=="error"&&Ao(t,s,{once:!0})})}function Ao(t,e,r){typeof t.on=="function"&&vn(t,"error",e,r)}function vn(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function s(u){i.once&&t.removeEventListener(e,s),r(u)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Sn=wr.exports,Lt={},An={},En=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[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},Eo=En,br=function(){return Eo()&&!!Symbol.toStringTag},Lr=typeof Symbol<"u"&&Symbol,Io=En,To=function(){return typeof Lr!="function"||typeof Symbol!="function"||typeof Lr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Io()},Rr={foo:{}},Oo=Object,_o=function(){return{__proto__:Rr}.foo===Rr.foo&&!({__proto__:null}instanceof Oo)},Fo="Function.prototype.bind called on incompatible ",Co=Object.prototype.toString,xo=Math.max,Bo="[object Function]",Nr=function(e,r){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var u=0;u<r.length;u+=1)i[u+e.length]=r[u];return i},ko=function(e,r){for(var i=[],s=r||0,u=0;s<e.length;s+=1,u+=1)i[u]=e[s];return i},Po=function(t,e){for(var r="",i=0;i<t.length;i+=1)r+=t[i],i+1<t.length&&(r+=e);return r},Lo=function(e){var r=this;if(typeof r!="function"||Co.apply(r)!==Bo)throw new TypeError(Fo+r);for(var i=ko(arguments,1),s,u=function(){if(this instanceof s){var l=r.apply(this,Nr(i,arguments));return Object(l)===l?l:this}return r.apply(e,Nr(i,arguments))},f=xo(0,r.length-i.length),p=[],h=0;h<f;h++)p[h]="$"+h;if(s=Function("binder","return function ("+Po(p,",")+"){ return binder.apply(this,arguments); }")(u),r.prototype){var m=function(){};m.prototype=r.prototype,s.prototype=new m,m.prototype=null}return s},Ro=Lo,vr=Function.prototype.bind||Ro,No=Function.prototype.call,Do=Object.prototype.hasOwnProperty,$o=vr,Uo=$o.call(No,Do),$,ot=SyntaxError,In=Function,it=TypeError,Ut=function(t){try{return In('"use strict"; return ('+t+").constructor;")()}catch{}},qe=Object.getOwnPropertyDescriptor;if(qe)try{qe({},"")}catch{qe=null}var jt=function(){throw new it},jo=qe?function(){try{return arguments.callee,jt}catch{try{return qe(arguments,"callee").get}catch{return jt}}}():jt,We=To(),Mo=_o(),X=Object.getPrototypeOf||(Mo?function(t){return t.__proto__}:null),Je={},Vo=typeof Uint8Array>"u"||!X?$:X(Uint8Array),Qe={"%AggregateError%":typeof AggregateError>"u"?$:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$:ArrayBuffer,"%ArrayIteratorPrototype%":We&&X?X([][Symbol.iterator]()):$,"%AsyncFromSyncIteratorPrototype%":$,"%AsyncFunction%":Je,"%AsyncGenerator%":Je,"%AsyncGeneratorFunction%":Je,"%AsyncIteratorPrototype%":Je,"%Atomics%":typeof Atomics>"u"?$:Atomics,"%BigInt%":typeof BigInt>"u"?$:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$:FinalizationRegistry,"%Function%":In,"%GeneratorFunction%":Je,"%Int8Array%":typeof Int8Array>"u"?$:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":We&&X?X(X([][Symbol.iterator]())):$,"%JSON%":typeof JSON=="object"?JSON:$,"%Map%":typeof Map>"u"?$:Map,"%MapIteratorPrototype%":typeof Map>"u"||!We||!X?$:X(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$:Promise,"%Proxy%":typeof Proxy>"u"?$:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$:Set,"%SetIteratorPrototype%":typeof Set>"u"||!We||!X?$:X(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":We&&X?X(""[Symbol.iterator]()):$,"%Symbol%":We?Symbol:$,"%SyntaxError%":ot,"%ThrowTypeError%":jo,"%TypedArray%":Vo,"%TypeError%":it,"%Uint8Array%":typeof Uint8Array>"u"?$:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$:WeakSet};if(X)try{null.error}catch(t){var qo=X(X(t));Qe["%Error.prototype%"]=qo}var Qo=function t(e){var r;if(e==="%AsyncFunction%")r=Ut("async function () {}");else if(e==="%GeneratorFunction%")r=Ut("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Ut("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&X&&(r=X(s.prototype))}return Qe[e]=r,r},Dr={"%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"]},gt=vr,Ot=Uo,Go=gt.call(Function.call,Array.prototype.concat),zo=gt.call(Function.apply,Array.prototype.splice),$r=gt.call(Function.call,String.prototype.replace),_t=gt.call(Function.call,String.prototype.slice),Ko=gt.call(Function.call,RegExp.prototype.exec),Wo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ho=/\\(\\)?/g,Jo=function(e){var r=_t(e,0,1),i=_t(e,-1);if(r==="%"&&i!=="%")throw new ot("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new ot("invalid intrinsic syntax, expected opening `%`");var s=[];return $r(e,Wo,function(u,f,p,h){s[s.length]=p?$r(h,Ho,"$1"):f||u}),s},Yo=function(e,r){var i=e,s;if(Ot(Dr,i)&&(s=Dr[i],i="%"+s[0]+"%"),Ot(Qe,i)){var u=Qe[i];if(u===Je&&(u=Qo(i)),typeof u>"u"&&!r)throw new it("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:u}}throw new ot("intrinsic "+e+" does not exist!")},at=function(e,r){if(typeof e!="string"||e.length===0)throw new it("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new it('"allowMissing" argument must be a boolean');if(Ko(/^%?[^%]*%?$/,e)===null)throw new ot("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Jo(e),s=i.length>0?i[0]:"",u=Yo("%"+s+"%",r),f=u.name,p=u.value,h=!1,m=u.alias;m&&(s=m[0],zo(i,Go([0,1],m)));for(var l=1,w=!0;l<i.length;l+=1){var E=i[l],T=_t(E,0,1),_=_t(E,-1);if((T==='"'||T==="'"||T==="`"||_==='"'||_==="'"||_==="`")&&T!==_)throw new ot("property names with quotes must have matching quotes");if((E==="constructor"||!w)&&(h=!0),s+="."+E,f="%"+s+"%",Ot(Qe,f))p=Qe[f];else if(p!=null){if(!(E in p)){if(!r)throw new it("base intrinsic for "+e+" exists, but the property is not available.");return}if(qe&&l+1>=i.length){var B=qe(p,E);w=!!B,w&&"get"in B&&!("originalValue"in B.get)?p=B.get:p=p[E]}else w=Ot(p,E),p=p[E];w&&!h&&(Qe[f]=p)}}return p},Tn={exports:{}},Xo=at,tr=Xo("%Object.defineProperty%",!0),rr=function(){if(tr)try{return tr({},"a",{value:1}),!0}catch{return!1}return!1};rr.hasArrayLengthDefineBug=function(){if(!rr())return null;try{return tr([],"length",{value:1}).length!==1}catch{return!0}};var On=rr,Zo=at,St=Zo("%Object.getOwnPropertyDescriptor%",!0);if(St)try{St([],"length")}catch{St=null}var Sr=St,es=On(),Ar=at,ht=es&&Ar("%Object.defineProperty%",!0);if(ht)try{ht({},"a",{value:1})}catch{ht=!1}var ts=Ar("%SyntaxError%"),He=Ar("%TypeError%"),Ur=Sr,rs=function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new He("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new He("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new He("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new He("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new He("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new He("`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,p=arguments.length>6?arguments[6]:!1,h=!!Ur&&Ur(e,r);if(ht)ht(e,r,{configurable:f===null&&h?h.configurable:!f,enumerable:s===null&&h?h.enumerable:!s,value:i,writable:u===null&&h?h.writable:!u});else if(p||!s&&!u&&!f)e[r]=i;else throw new ts("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_n=at,jr=rs,ns=On(),Mr=Sr,Vr=_n("%TypeError%"),is=_n("%Math.floor%"),os=function(e,r){if(typeof e!="function")throw new Vr("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||is(r)!==r)throw new Vr("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in e&&Mr){var f=Mr(e,"length");f&&!f.configurable&&(s=!1),f&&!f.writable&&(u=!1)}return(s||u||!i)&&(ns?jr(e,"length",r,!0,!0):jr(e,"length",r)),e};(function(t){var e=vr,r=at,i=os,s=r("%TypeError%"),u=r("%Function.prototype.apply%"),f=r("%Function.prototype.call%"),p=r("%Reflect.apply%",!0)||e.call(f,u),h=r("%Object.defineProperty%",!0),m=r("%Math.max%");if(h)try{h({},"a",{value:1})}catch{h=null}t.exports=function(E){if(typeof E!="function")throw new s("a function is required");var T=p(e,f,arguments);return i(T,1+m(0,E.length-(arguments.length-1)),!0)};var l=function(){return p(e,u,arguments)};h?h(t.exports,"apply",{value:l}):t.exports.apply=l})(Tn);var Fn=Tn.exports,Cn=at,xn=Fn,ss=xn(Cn("String.prototype.indexOf")),Bn=function(e,r){var i=Cn(e,!!r);return typeof i=="function"&&ss(e,".prototype.")>-1?xn(i):i},as=br(),us=Bn,nr=us("Object.prototype.toString"),Rt=function(e){return as&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:nr(e)==="[object Arguments]"},kn=function(e){return Rt(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&nr(e)!=="[object Array]"&&nr(e.callee)==="[object Function]"},cs=function(){return Rt(arguments)}();Rt.isLegacyArguments=kn;var ls=cs?Rt:kn,fs=Object.prototype.toString,ds=Function.prototype.toString,hs=/^\s*(?:function)?\*/,Pn=br(),Mt=Object.getPrototypeOf,ps=function(){if(!Pn)return!1;try{return Function("return function*() {}")()}catch{}},Vt,ys=function(e){if(typeof e!="function")return!1;if(hs.test(ds.call(e)))return!0;if(!Pn){var r=fs.call(e);return r==="[object GeneratorFunction]"}if(!Mt)return!1;if(typeof Vt>"u"){var i=ps();Vt=i?Mt(i):!1}return Mt(e)===Vt},Ln=Function.prototype.toString,et=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,ir,At;if(typeof et=="function"&&typeof Object.defineProperty=="function")try{ir=Object.defineProperty({},"length",{get:function(){throw At}}),At={},et(function(){throw 42},null,ir)}catch(t){t!==At&&(et=null)}else et=null;var gs=/^\s*class\b/,or=function(e){try{var r=Ln.call(e);return gs.test(r)}catch{return!1}},qt=function(e){try{return or(e)?!1:(Ln.call(e),!0)}catch{return!1}},Et=Object.prototype.toString,ms="[object Object]",ws="[object Function]",bs="[object GeneratorFunction]",vs="[object HTMLAllCollection]",Ss="[object HTML document.all class]",As="[object HTMLCollection]",Es=typeof Symbol=="function"&&!!Symbol.toStringTag,Is=!(0 in[,]),sr=function(){return!1};if(typeof document=="object"){var Ts=document.all;Et.call(Ts)===Et.call(document.all)&&(sr=function(e){if((Is||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=Et.call(e);return(r===vs||r===Ss||r===As||r===ms)&&e("")==null}catch{}return!1})}var Os=et?function(e){if(sr(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{et(e,null,ir)}catch(r){if(r!==At)return!1}return!or(e)&&qt(e)}:function(e){if(sr(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Es)return qt(e);if(or(e))return!1;var r=Et.call(e);return r!==ws&&r!==bs&&!/^\[object HTML/.test(r)?!1:qt(e)},_s=Os,Fs=Object.prototype.toString,Rn=Object.prototype.hasOwnProperty,Cs=function(e,r,i){for(var s=0,u=e.length;s<u;s++)Rn.call(e,s)&&(i==null?r(e[s],s,e):r.call(i,e[s],s,e))},xs=function(e,r,i){for(var s=0,u=e.length;s<u;s++)i==null?r(e.charAt(s),s,e):r.call(i,e.charAt(s),s,e)},Bs=function(e,r,i){for(var s in e)Rn.call(e,s)&&(i==null?r(e[s],s,e):r.call(i,e[s],s,e))},ks=function(e,r,i){if(!_s(r))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=i),Fs.call(e)==="[object Array]"?Cs(e,r,s):typeof e=="string"?xs(e,r,s):Bs(e,r,s)},Ps=ks,Qt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],Ls=typeof globalThis>"u"?cn:globalThis,Rs=function(){for(var e=[],r=0;r<Qt.length;r++)typeof Ls[Qt[r]]=="function"&&(e[e.length]=Qt[r]);return e},Ft=Ps,Ns=Rs,qr=Fn,Er=Bn,It=Sr,Ds=Er("Object.prototype.toString"),Nn=br(),Qr=typeof globalThis>"u"?cn:globalThis,ar=Ns(),Ir=Er("String.prototype.slice"),Gt=Object.getPrototypeOf,$s=Er("Array.prototype.indexOf",!0)||function(e,r){for(var i=0;i<e.length;i+=1)if(e[i]===r)return i;return-1},Ct={__proto__:null};Nn&&It&&Gt?Ft(ar,function(t){var e=new Qr[t];if(Symbol.toStringTag in e){var r=Gt(e),i=It(r,Symbol.toStringTag);if(!i){var s=Gt(r);i=It(s,Symbol.toStringTag)}Ct["$"+t]=qr(i.get)}}):Ft(ar,function(t){var e=new Qr[t],r=e.slice||e.set;r&&(Ct["$"+t]=qr(r))});var Us=function(e){var r=!1;return Ft(Ct,function(i,s){if(!r)try{"$"+i(e)===s&&(r=Ir(s,1))}catch{}}),r},js=function(e){var r=!1;return Ft(Ct,function(i,s){if(!r)try{i(e),r=Ir(s,1)}catch{}}),r},Dn=function(e){if(!e||typeof e!="object")return!1;if(!Nn){var r=Ir(Ds(e),8,-1);return $s(ar,r)>-1?r:r!=="Object"?!1:js(e)}return It?Us(e):null},Ms=Dn,Vs=function(e){return!!Ms(e)};(function(t){var e=ls,r=ys,i=Dn,s=Vs;function u(A){return A.call.bind(A)}var f=typeof BigInt<"u",p=typeof Symbol<"u",h=u(Object.prototype.toString),m=u(Number.prototype.valueOf),l=u(String.prototype.valueOf),w=u(Boolean.prototype.valueOf);if(f)var E=u(BigInt.prototype.valueOf);if(p)var T=u(Symbol.prototype.valueOf);function _(A,lt){if(typeof A!="object")return!1;try{return lt(A),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=s;function B(A){return typeof Promise<"u"&&A instanceof Promise||A!==null&&typeof A=="object"&&typeof A.then=="function"&&typeof A.catch=="function"}t.isPromise=B;function M(A){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(A):s(A)||v(A)}t.isArrayBufferView=M;function I(A){return i(A)==="Uint8Array"}t.isUint8Array=I;function F(A){return i(A)==="Uint8ClampedArray"}t.isUint8ClampedArray=F;function U(A){return i(A)==="Uint16Array"}t.isUint16Array=U;function L(A){return i(A)==="Uint32Array"}t.isUint32Array=L;function C(A){return i(A)==="Int8Array"}t.isInt8Array=C;function x(A){return i(A)==="Int16Array"}t.isInt16Array=x;function k(A){return i(A)==="Int32Array"}t.isInt32Array=k;function q(A){return i(A)==="Float32Array"}t.isFloat32Array=q;function ie(A){return i(A)==="Float64Array"}t.isFloat64Array=ie;function we(A){return i(A)==="BigInt64Array"}t.isBigInt64Array=we;function be(A){return i(A)==="BigUint64Array"}t.isBigUint64Array=be;function ue(A){return h(A)==="[object Map]"}ue.working=typeof Map<"u"&&ue(new Map);function ct(A){return typeof Map>"u"?!1:ue.working?ue(A):A instanceof Map}t.isMap=ct;function he(A){return h(A)==="[object Set]"}he.working=typeof Set<"u"&&he(new Set);function Re(A){return typeof Set>"u"?!1:he.working?he(A):A instanceof Set}t.isSet=Re;function xe(A){return h(A)==="[object WeakMap]"}xe.working=typeof WeakMap<"u"&&xe(new WeakMap);function Ge(A){return typeof WeakMap>"u"?!1:xe.working?xe(A):A instanceof WeakMap}t.isWeakMap=Ge;function ve(A){return h(A)==="[object WeakSet]"}ve.working=typeof WeakSet<"u"&&ve(new WeakSet);function ce(A){return ve(A)}t.isWeakSet=ce;function Be(A){return h(A)==="[object ArrayBuffer]"}Be.working=typeof ArrayBuffer<"u"&&Be(new ArrayBuffer);function ze(A){return typeof ArrayBuffer>"u"?!1:Be.working?Be(A):A instanceof ArrayBuffer}t.isArrayBuffer=ze;function g(A){return h(A)==="[object DataView]"}g.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&g(new DataView(new ArrayBuffer(1),0,1));function v(A){return typeof DataView>"u"?!1:g.working?g(A):A instanceof DataView}t.isDataView=v;var S=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function O(A){return h(A)==="[object SharedArrayBuffer]"}function j(A){return typeof S>"u"?!1:(typeof O.working>"u"&&(O.working=O(new S)),O.working?O(A):A instanceof S)}t.isSharedArrayBuffer=j;function V(A){return h(A)==="[object AsyncFunction]"}t.isAsyncFunction=V;function R(A){return h(A)==="[object Map Iterator]"}t.isMapIterator=R;function D(A){return h(A)==="[object Set Iterator]"}t.isSetIterator=D;function Q(A){return h(A)==="[object Generator]"}t.isGeneratorObject=Q;function J(A){return h(A)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=J;function le(A){return _(A,m)}t.isNumberObject=le;function Ne(A){return _(A,l)}t.isStringObject=Ne;function ke(A){return _(A,w)}t.isBooleanObject=ke;function De(A){return f&&_(A,E)}t.isBigIntObject=De;function Se(A){return p&&_(A,T)}t.isSymbolObject=Se;function $e(A){return le(A)||Ne(A)||ke(A)||De(A)||Se(A)}t.isBoxedPrimitive=$e;function Nt(A){return typeof Uint8Array<"u"&&(ze(A)||j(A))}t.isAnyArrayBuffer=Nt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(A){Object.defineProperty(t,A,{enumerable:!1,value:function(){throw new Error(A+" is not supported in userland")}})})})(An);var qs=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"},ur={exports:{}};typeof Object.create=="function"?ur.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ur.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}};var Qs=ur.exports;(function(t){var e=Object.getOwnPropertyDescriptors||function(v){for(var S=Object.keys(v),O={},j=0;j<S.length;j++)O[S[j]]=Object.getOwnPropertyDescriptor(v,S[j]);return O},r=/%[sdj%]/g;t.format=function(g){if(!C(g)){for(var v=[],S=0;S<arguments.length;S++)v.push(f(arguments[S]));return v.join(" ")}for(var S=1,O=arguments,j=O.length,V=String(g).replace(r,function(D){if(D==="%%")return"%";if(S>=j)return D;switch(D){case"%s":return String(O[S++]);case"%d":return Number(O[S++]);case"%j":try{return JSON.stringify(O[S++])}catch{return"[Circular]"}default:return D}}),R=O[S];S<j;R=O[++S])F(R)||!ie(R)?V+=" "+R:V+=" "+f(R);return V},t.deprecate=function(g,v){if(typeof P<"u"&&P.noDeprecation===!0)return g;if(typeof P>"u")return function(){return t.deprecate(g,v).apply(this,arguments)};var S=!1;function O(){if(!S){if(P.throwDeprecation)throw new Error(v);P.traceDeprecation?console.trace(v):console.error(v),S=!0}return g.apply(this,arguments)}return O};var i={},s=/^$/;if(P.env.NODE_DEBUG){var u=P.env.NODE_DEBUG;u=u.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+u+"$","i")}t.debuglog=function(g){if(g=g.toUpperCase(),!i[g])if(s.test(g)){var v=P.pid;i[g]=function(){var S=t.format.apply(t,arguments);console.error("%s %d: %s",g,v,S)}}else i[g]=function(){};return i[g]};function f(g,v){var S={seen:[],stylize:h};return arguments.length>=3&&(S.depth=arguments[2]),arguments.length>=4&&(S.colors=arguments[3]),I(v)?S.showHidden=v:v&&t._extend(S,v),k(S.showHidden)&&(S.showHidden=!1),k(S.depth)&&(S.depth=2),k(S.colors)&&(S.colors=!1),k(S.customInspect)&&(S.customInspect=!0),S.colors&&(S.stylize=p),l(S,g,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 p(g,v){var S=f.styles[v];return S?"\x1B["+f.colors[S][0]+"m"+g+"\x1B["+f.colors[S][1]+"m":g}function h(g,v){return g}function m(g){var v={};return g.forEach(function(S,O){v[S]=!0}),v}function l(g,v,S){if(g.customInspect&&v&&ue(v.inspect)&&v.inspect!==t.inspect&&!(v.constructor&&v.constructor.prototype===v)){var O=v.inspect(S,g);return C(O)||(O=l(g,O,S)),O}var j=w(g,v);if(j)return j;var V=Object.keys(v),R=m(V);if(g.showHidden&&(V=Object.getOwnPropertyNames(v)),be(v)&&(V.indexOf("message")>=0||V.indexOf("description")>=0))return E(v);if(V.length===0){if(ue(v)){var D=v.name?": "+v.name:"";return g.stylize("[Function"+D+"]","special")}if(q(v))return g.stylize(RegExp.prototype.toString.call(v),"regexp");if(we(v))return g.stylize(Date.prototype.toString.call(v),"date");if(be(v))return E(v)}var Q="",J=!1,le=["{","}"];if(M(v)&&(J=!0,le=["[","]"]),ue(v)){var Ne=v.name?": "+v.name:"";Q=" [Function"+Ne+"]"}if(q(v)&&(Q=" "+RegExp.prototype.toString.call(v)),we(v)&&(Q=" "+Date.prototype.toUTCString.call(v)),be(v)&&(Q=" "+E(v)),V.length===0&&(!J||v.length==0))return le[0]+Q+le[1];if(S<0)return q(v)?g.stylize(RegExp.prototype.toString.call(v),"regexp"):g.stylize("[Object]","special");g.seen.push(v);var ke;return J?ke=T(g,v,S,R,V):ke=V.map(function(De){return _(g,v,S,R,De,J)}),g.seen.pop(),B(ke,Q,le)}function w(g,v){if(k(v))return g.stylize("undefined","undefined");if(C(v)){var S="'"+JSON.stringify(v).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(S,"string")}if(L(v))return g.stylize(""+v,"number");if(I(v))return g.stylize(""+v,"boolean");if(F(v))return g.stylize("null","null")}function E(g){return"["+Error.prototype.toString.call(g)+"]"}function T(g,v,S,O,j){for(var V=[],R=0,D=v.length;R<D;++R)ve(v,String(R))?V.push(_(g,v,S,O,String(R),!0)):V.push("");return j.forEach(function(Q){Q.match(/^\d+$/)||V.push(_(g,v,S,O,Q,!0))}),V}function _(g,v,S,O,j,V){var R,D,Q;if(Q=Object.getOwnPropertyDescriptor(v,j)||{value:v[j]},Q.get?Q.set?D=g.stylize("[Getter/Setter]","special"):D=g.stylize("[Getter]","special"):Q.set&&(D=g.stylize("[Setter]","special")),ve(O,j)||(R="["+j+"]"),D||(g.seen.indexOf(Q.value)<0?(F(S)?D=l(g,Q.value,null):D=l(g,Q.value,S-1),D.indexOf(`
7
+ */(function(t){const e=kt,r=hr,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=C,t.INSPECT_MAX_BYTES=50;const s=2147483647;t.kMaxLength=s;const{Uint8Array:u,ArrayBuffer:f,SharedArrayBuffer:p}=globalThis;l.TYPED_ARRAY_SUPPORT=h(),!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 h(){try{const a=new u(1),n={foo:function(){return 42}};return Object.setPrototypeOf(n,u.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 m(a){if(a>s)throw new RangeError('The value "'+a+'" is invalid for option "size"');const n=new u(a);return Object.setPrototypeOf(n,l.prototype),n}function l(a,n,o){if(typeof a=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _(a)}return w(a,n,o)}l.poolSize=8192;function w(a,n,o){if(typeof a=="string")return B(a,n);if(f.isView(a))return I(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(pe(a,f)||a&&pe(a.buffer,f)||typeof p<"u"&&(pe(a,p)||a&&pe(a.buffer,p)))return F(a,n,o);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,o);const d=U(a);if(d)return d;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof a[Symbol.toPrimitive]=="function")return l.from(a[Symbol.toPrimitive]("string"),n,o);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,o){return w(a,n,o)},Object.setPrototypeOf(l.prototype,u.prototype),Object.setPrototypeOf(l,u);function E(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 T(a,n,o){return E(a),a<=0?m(a):n!==void 0?typeof o=="string"?m(a).fill(n,o):m(a).fill(n):m(a)}l.alloc=function(a,n,o){return T(a,n,o)};function _(a){return E(a),m(a<0?0:L(a)|0)}l.allocUnsafe=function(a){return _(a)},l.allocUnsafeSlow=function(a){return _(a)};function B(a,n){if((typeof n!="string"||n==="")&&(n="utf8"),!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n);const o=x(a,n)|0;let c=m(o);const d=c.write(a,n);return d!==o&&(c=c.slice(0,d)),c}function M(a){const n=a.length<0?0:L(a.length)|0,o=m(n);for(let c=0;c<n;c+=1)o[c]=a[c]&255;return o}function I(a){if(pe(a,u)){const n=new u(a);return F(n.buffer,n.byteOffset,n.byteLength)}return M(a)}function F(a,n,o){if(n<0||a.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(a.byteLength<n+(o||0))throw new RangeError('"length" is outside of buffer bounds');let c;return n===void 0&&o===void 0?c=new u(a):o===void 0?c=new u(a,n):c=new u(a,n,o),Object.setPrototypeOf(c,l.prototype),c}function U(a){if(l.isBuffer(a)){const n=L(a.length)|0,o=m(n);return o.length===0||a.copy(o,0,0,n),o}if(a.length!==void 0)return typeof a.length!="number"||Dt(a.length)?m(0):M(a);if(a.type==="Buffer"&&Array.isArray(a.data))return M(a.data)}function L(a){if(a>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return a|0}function C(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,o){if(pe(n,u)&&(n=l.from(n,n.offset,n.byteLength)),pe(o,u)&&(o=l.from(o,o.offset,o.byteLength)),!l.isBuffer(n)||!l.isBuffer(o))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===o)return 0;let c=n.length,d=o.length;for(let y=0,b=Math.min(c,d);y<b;++y)if(n[y]!==o[y]){c=n[y],d=o[y];break}return c<d?-1:d<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,o){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(o===void 0)for(o=0,c=0;c<n.length;++c)o+=n[c].length;const d=l.allocUnsafe(o);let y=0;for(c=0;c<n.length;++c){let b=n[c];if(pe(b,u))y+b.length>d.length?(l.isBuffer(b)||(b=l.from(b)),b.copy(d,y)):u.prototype.set.call(d,b,y);else if(l.isBuffer(b))b.copy(d,y);else throw new TypeError('"list" argument must be an Array of Buffers');y+=b.length}return d};function x(a,n){if(l.isBuffer(a))return a.length;if(f.isView(a)||pe(a,f))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 o=a.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&o===0)return 0;let d=!1;for(;;)switch(n){case"ascii":case"latin1":case"binary":return o;case"utf8":case"utf-8":return lt(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return o*2;case"hex":return o>>>1;case"base64":return Fr(a).length;default:if(d)return c?-1:lt(a).length;n=(""+n).toLowerCase(),d=!0}}l.byteLength=x;function k(a,n,o){let c=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((o===void 0||o>this.length)&&(o=this.length),o<=0)||(o>>>=0,n>>>=0,o<=n))return"";for(a||(a="utf8");;)switch(a){case"hex":return g(this,n,o);case"utf8":case"utf-8":return Ge(this,n,o);case"ascii":return Be(this,n,o);case"latin1":case"binary":return ze(this,n,o);case"base64":return xe(this,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,n,o);default:if(c)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),c=!0}}l.prototype._isBuffer=!0;function q(a,n,o){const c=a[n];a[n]=a[o],a[o]=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 o=0;o<n;o+=2)q(this,o,o+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 o=0;o<n;o+=4)q(this,o,o+3),q(this,o+1,o+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 o=0;o<n;o+=8)q(this,o,o+7),q(this,o+1,o+6),q(this,o+2,o+5),q(this,o+3,o+4);return this},l.prototype.toString=function(){const n=this.length;return n===0?"":arguments.length===0?Ge(this,0,n):k.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 o=t.INSPECT_MAX_BYTES;return n=this.toString("hex",0,o).replace(/(.{2})/g,"$1 ").trim(),this.length>o&&(n+=" ... "),"<Buffer "+n+">"},i&&(l.prototype[i]=l.prototype.inspect),l.prototype.compare=function(n,o,c,d,y){if(pe(n,u)&&(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(o===void 0&&(o=0),c===void 0&&(c=n?n.length:0),d===void 0&&(d=0),y===void 0&&(y=this.length),o<0||c>n.length||d<0||y>this.length)throw new RangeError("out of range index");if(d>=y&&o>=c)return 0;if(d>=y)return-1;if(o>=c)return 1;if(o>>>=0,c>>>=0,d>>>=0,y>>>=0,this===n)return 0;let b=y-d,N=c-o;const W=Math.min(b,N),K=this.slice(d,y),H=n.slice(o,c);for(let z=0;z<W;++z)if(K[z]!==H[z]){b=K[z],N=H[z];break}return b<N?-1:N<b?1:0};function ie(a,n,o,c,d){if(a.length===0)return-1;if(typeof o=="string"?(c=o,o=0):o>2147483647?o=2147483647:o<-2147483648&&(o=-2147483648),o=+o,Dt(o)&&(o=d?0:a.length-1),o<0&&(o=a.length+o),o>=a.length){if(d)return-1;o=a.length-1}else if(o<0)if(d)o=0;else return-1;if(typeof n=="string"&&(n=l.from(n,c)),l.isBuffer(n))return n.length===0?-1:we(a,n,o,c,d);if(typeof n=="number")return n=n&255,typeof u.prototype.indexOf=="function"?d?u.prototype.indexOf.call(a,n,o):u.prototype.lastIndexOf.call(a,n,o):we(a,[n],o,c,d);throw new TypeError("val must be string, number or Buffer")}function we(a,n,o,c,d){let y=1,b=a.length,N=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,b/=2,N/=2,o/=2}function W(H,z){return y===1?H[z]:H.readUInt16BE(z*y)}let K;if(d){let H=-1;for(K=o;K<b;K++)if(W(a,K)===W(n,H===-1?0:K-H)){if(H===-1&&(H=K),K-H+1===N)return H*y}else H!==-1&&(K-=K-H),H=-1}else for(o+N>b&&(o=b-N),K=o;K>=0;K--){let H=!0;for(let z=0;z<N;z++)if(W(a,K+z)!==W(n,z)){H=!1;break}if(H)return K}return-1}l.prototype.includes=function(n,o,c){return this.indexOf(n,o,c)!==-1},l.prototype.indexOf=function(n,o,c){return ie(this,n,o,c,!0)},l.prototype.lastIndexOf=function(n,o,c){return ie(this,n,o,c,!1)};function be(a,n,o,c){o=Number(o)||0;const d=a.length-o;c?(c=Number(c),c>d&&(c=d)):c=d;const y=n.length;c>y/2&&(c=y/2);let b;for(b=0;b<c;++b){const N=parseInt(n.substr(b*2,2),16);if(Dt(N))return b;a[o+b]=N}return b}function ue(a,n,o,c){return mt(lt(n,a.length-o),a,o,c)}function ct(a,n,o,c){return mt(_r(n),a,o,c)}function he(a,n,o,c){return mt(Fr(n),a,o,c)}function Re(a,n,o,c){return mt(Vn(n,a.length-o),a,o,c)}l.prototype.write=function(n,o,c,d){if(o===void 0)d="utf8",c=this.length,o=0;else if(c===void 0&&typeof o=="string")d=o,c=this.length,o=0;else if(isFinite(o))o=o>>>0,isFinite(c)?(c=c>>>0,d===void 0&&(d="utf8")):(d=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const y=this.length-o;if((c===void 0||c>y)&&(c=y),n.length>0&&(c<0||o<0)||o>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");let b=!1;for(;;)switch(d){case"hex":return be(this,n,o,c);case"utf8":case"utf-8":return ue(this,n,o,c);case"ascii":case"latin1":case"binary":return ct(this,n,o,c);case"base64":return he(this,n,o,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Re(this,n,o,c);default:if(b)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),b=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function xe(a,n,o){return n===0&&o===a.length?e.fromByteArray(a):e.fromByteArray(a.slice(n,o))}function Ge(a,n,o){o=Math.min(a.length,o);const c=[];let d=n;for(;d<o;){const y=a[d];let b=null,N=y>239?4:y>223?3:y>191?2:1;if(d+N<=o){let W,K,H,z;switch(N){case 1:y<128&&(b=y);break;case 2:W=a[d+1],(W&192)===128&&(z=(y&31)<<6|W&63,z>127&&(b=z));break;case 3:W=a[d+1],K=a[d+2],(W&192)===128&&(K&192)===128&&(z=(y&15)<<12|(W&63)<<6|K&63,z>2047&&(z<55296||z>57343)&&(b=z));break;case 4:W=a[d+1],K=a[d+2],H=a[d+3],(W&192)===128&&(K&192)===128&&(H&192)===128&&(z=(y&15)<<18|(W&63)<<12|(K&63)<<6|H&63,z>65535&&z<1114112&&(b=z))}}b===null?(b=65533,N=1):b>65535&&(b-=65536,c.push(b>>>10&1023|55296),b=56320|b&1023),c.push(b),d+=N}return ce(c)}const ve=4096;function ce(a){const n=a.length;if(n<=ve)return String.fromCharCode.apply(String,a);let o="",c=0;for(;c<n;)o+=String.fromCharCode.apply(String,a.slice(c,c+=ve));return o}function Be(a,n,o){let c="";o=Math.min(a.length,o);for(let d=n;d<o;++d)c+=String.fromCharCode(a[d]&127);return c}function ze(a,n,o){let c="";o=Math.min(a.length,o);for(let d=n;d<o;++d)c+=String.fromCharCode(a[d]);return c}function g(a,n,o){const c=a.length;(!n||n<0)&&(n=0),(!o||o<0||o>c)&&(o=c);let d="";for(let y=n;y<o;++y)d+=qn[a[y]];return d}function v(a,n,o){const c=a.slice(n,o);let d="";for(let y=0;y<c.length-1;y+=2)d+=String.fromCharCode(c[y]+c[y+1]*256);return d}l.prototype.slice=function(n,o){const c=this.length;n=~~n,o=o===void 0?c:~~o,n<0?(n+=c,n<0&&(n=0)):n>c&&(n=c),o<0?(o+=c,o<0&&(o=0)):o>c&&(o=c),o<n&&(o=n);const d=this.subarray(n,o);return Object.setPrototypeOf(d,l.prototype),d};function S(a,n,o){if(a%1!==0||a<0)throw new RangeError("offset is not uint");if(a+n>o)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(n,o,c){n=n>>>0,o=o>>>0,c||S(n,o,this.length);let d=this[n],y=1,b=0;for(;++b<o&&(y*=256);)d+=this[n+b]*y;return d},l.prototype.readUintBE=l.prototype.readUIntBE=function(n,o,c){n=n>>>0,o=o>>>0,c||S(n,o,this.length);let d=this[n+--o],y=1;for(;o>0&&(y*=256);)d+=this[n+--o]*y;return d},l.prototype.readUint8=l.prototype.readUInt8=function(n,o){return n=n>>>0,o||S(n,1,this.length),this[n]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(n,o){return n=n>>>0,o||S(n,2,this.length),this[n]|this[n+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(n,o){return n=n>>>0,o||S(n,2,this.length),this[n]<<8|this[n+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(n,o){return n=n>>>0,o||S(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,o){return n=n>>>0,o||S(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,Se(n,"offset");const o=this[n],c=this[n+7];(o===void 0||c===void 0)&&$e(n,this.length-8);const d=o+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(d)+(BigInt(y)<<BigInt(32))}),l.prototype.readBigUInt64BE=Pe(function(n){n=n>>>0,Se(n,"offset");const o=this[n],c=this[n+7];(o===void 0||c===void 0)&&$e(n,this.length-8);const d=o*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(d)<<BigInt(32))+BigInt(y)}),l.prototype.readIntLE=function(n,o,c){n=n>>>0,o=o>>>0,c||S(n,o,this.length);let d=this[n],y=1,b=0;for(;++b<o&&(y*=256);)d+=this[n+b]*y;return y*=128,d>=y&&(d-=Math.pow(2,8*o)),d},l.prototype.readIntBE=function(n,o,c){n=n>>>0,o=o>>>0,c||S(n,o,this.length);let d=o,y=1,b=this[n+--d];for(;d>0&&(y*=256);)b+=this[n+--d]*y;return y*=128,b>=y&&(b-=Math.pow(2,8*o)),b},l.prototype.readInt8=function(n,o){return n=n>>>0,o||S(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},l.prototype.readInt16LE=function(n,o){n=n>>>0,o||S(n,2,this.length);const c=this[n]|this[n+1]<<8;return c&32768?c|4294901760:c},l.prototype.readInt16BE=function(n,o){n=n>>>0,o||S(n,2,this.length);const c=this[n+1]|this[n]<<8;return c&32768?c|4294901760:c},l.prototype.readInt32LE=function(n,o){return n=n>>>0,o||S(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},l.prototype.readInt32BE=function(n,o){return n=n>>>0,o||S(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,Se(n,"offset");const o=this[n],c=this[n+7];(o===void 0||c===void 0)&&$e(n,this.length-8);const d=this[n+4]+this[n+5]*2**8+this[n+6]*2**16+(c<<24);return(BigInt(d)<<BigInt(32))+BigInt(o+this[++n]*2**8+this[++n]*2**16+this[++n]*2**24)}),l.prototype.readBigInt64BE=Pe(function(n){n=n>>>0,Se(n,"offset");const o=this[n],c=this[n+7];(o===void 0||c===void 0)&&$e(n,this.length-8);const d=(o<<24)+this[++n]*2**16+this[++n]*2**8+this[++n];return(BigInt(d)<<BigInt(32))+BigInt(this[++n]*2**24+this[++n]*2**16+this[++n]*2**8+c)}),l.prototype.readFloatLE=function(n,o){return n=n>>>0,o||S(n,4,this.length),r.read(this,n,!0,23,4)},l.prototype.readFloatBE=function(n,o){return n=n>>>0,o||S(n,4,this.length),r.read(this,n,!1,23,4)},l.prototype.readDoubleLE=function(n,o){return n=n>>>0,o||S(n,8,this.length),r.read(this,n,!0,52,8)},l.prototype.readDoubleBE=function(n,o){return n=n>>>0,o||S(n,8,this.length),r.read(this,n,!1,52,8)};function O(a,n,o,c,d,y){if(!l.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>d||n<y)throw new RangeError('"value" argument is out of bounds');if(o+c>a.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(n,o,c,d){if(n=+n,o=o>>>0,c=c>>>0,!d){const N=Math.pow(2,8*c)-1;O(this,n,o,c,N,0)}let y=1,b=0;for(this[o]=n&255;++b<c&&(y*=256);)this[o+b]=n/y&255;return o+c},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(n,o,c,d){if(n=+n,o=o>>>0,c=c>>>0,!d){const N=Math.pow(2,8*c)-1;O(this,n,o,c,N,0)}let y=c-1,b=1;for(this[o+y]=n&255;--y>=0&&(b*=256);)this[o+y]=n/b&255;return o+c},l.prototype.writeUint8=l.prototype.writeUInt8=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,1,255,0),this[o]=n&255,o+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,2,65535,0),this[o]=n&255,this[o+1]=n>>>8,o+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,2,65535,0),this[o]=n>>>8,this[o+1]=n&255,o+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,4,4294967295,0),this[o+3]=n>>>24,this[o+2]=n>>>16,this[o+1]=n>>>8,this[o]=n&255,o+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,4,4294967295,0),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4};function j(a,n,o,c,d){De(n,c,d,a,o,7);let y=Number(n&BigInt(4294967295));a[o++]=y,y=y>>8,a[o++]=y,y=y>>8,a[o++]=y,y=y>>8,a[o++]=y;let b=Number(n>>BigInt(32)&BigInt(4294967295));return a[o++]=b,b=b>>8,a[o++]=b,b=b>>8,a[o++]=b,b=b>>8,a[o++]=b,o}function V(a,n,o,c,d){De(n,c,d,a,o,7);let y=Number(n&BigInt(4294967295));a[o+7]=y,y=y>>8,a[o+6]=y,y=y>>8,a[o+5]=y,y=y>>8,a[o+4]=y;let b=Number(n>>BigInt(32)&BigInt(4294967295));return a[o+3]=b,b=b>>8,a[o+2]=b,b=b>>8,a[o+1]=b,b=b>>8,a[o]=b,o+8}l.prototype.writeBigUInt64LE=Pe(function(n,o=0){return j(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Pe(function(n,o=0){return V(this,n,o,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(n,o,c,d){if(n=+n,o=o>>>0,!d){const W=Math.pow(2,8*c-1);O(this,n,o,c,W-1,-W)}let y=0,b=1,N=0;for(this[o]=n&255;++y<c&&(b*=256);)n<0&&N===0&&this[o+y-1]!==0&&(N=1),this[o+y]=(n/b>>0)-N&255;return o+c},l.prototype.writeIntBE=function(n,o,c,d){if(n=+n,o=o>>>0,!d){const W=Math.pow(2,8*c-1);O(this,n,o,c,W-1,-W)}let y=c-1,b=1,N=0;for(this[o+y]=n&255;--y>=0&&(b*=256);)n<0&&N===0&&this[o+y+1]!==0&&(N=1),this[o+y]=(n/b>>0)-N&255;return o+c},l.prototype.writeInt8=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,1,127,-128),n<0&&(n=255+n+1),this[o]=n&255,o+1},l.prototype.writeInt16LE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,2,32767,-32768),this[o]=n&255,this[o+1]=n>>>8,o+2},l.prototype.writeInt16BE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,2,32767,-32768),this[o]=n>>>8,this[o+1]=n&255,o+2},l.prototype.writeInt32LE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,4,2147483647,-2147483648),this[o]=n&255,this[o+1]=n>>>8,this[o+2]=n>>>16,this[o+3]=n>>>24,o+4},l.prototype.writeInt32BE=function(n,o,c){return n=+n,o=o>>>0,c||O(this,n,o,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[o]=n>>>24,this[o+1]=n>>>16,this[o+2]=n>>>8,this[o+3]=n&255,o+4},l.prototype.writeBigInt64LE=Pe(function(n,o=0){return j(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Pe(function(n,o=0){return V(this,n,o,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function R(a,n,o,c,d,y){if(o+c>a.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("Index out of range")}function D(a,n,o,c,d){return n=+n,o=o>>>0,d||R(a,n,o,4),r.write(a,n,o,c,23,4),o+4}l.prototype.writeFloatLE=function(n,o,c){return D(this,n,o,!0,c)},l.prototype.writeFloatBE=function(n,o,c){return D(this,n,o,!1,c)};function Q(a,n,o,c,d){return n=+n,o=o>>>0,d||R(a,n,o,8),r.write(a,n,o,c,52,8),o+8}l.prototype.writeDoubleLE=function(n,o,c){return Q(this,n,o,!0,c)},l.prototype.writeDoubleBE=function(n,o,c){return Q(this,n,o,!1,c)},l.prototype.copy=function(n,o,c,d){if(!l.isBuffer(n))throw new TypeError("argument should be a Buffer");if(c||(c=0),!d&&d!==0&&(d=this.length),o>=n.length&&(o=n.length),o||(o=0),d>0&&d<c&&(d=c),d===c||n.length===0||this.length===0)return 0;if(o<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),n.length-o<d-c&&(d=n.length-o+c);const y=d-c;return this===n&&typeof u.prototype.copyWithin=="function"?this.copyWithin(o,c,d):u.prototype.set.call(n,this.subarray(c,d),o),y},l.prototype.fill=function(n,o,c,d){if(typeof n=="string"){if(typeof o=="string"?(d=o,o=0,c=this.length):typeof c=="string"&&(d=c,c=this.length),d!==void 0&&typeof d!="string")throw new TypeError("encoding must be a string");if(typeof d=="string"&&!l.isEncoding(d))throw new TypeError("Unknown encoding: "+d);if(n.length===1){const b=n.charCodeAt(0);(d==="utf8"&&b<128||d==="latin1")&&(n=b)}}else typeof n=="number"?n=n&255:typeof n=="boolean"&&(n=Number(n));if(o<0||this.length<o||this.length<c)throw new RangeError("Out of range index");if(c<=o)return this;o=o>>>0,c=c===void 0?this.length:c>>>0,n||(n=0);let y;if(typeof n=="number")for(y=o;y<c;++y)this[y]=n;else{const b=l.isBuffer(n)?n:l.from(n,d),N=b.length;if(N===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(y=0;y<c-o;++y)this[y+o]=b[y%N]}return this};const J={};function le(a,n,o){J[a]=class extends o{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(d){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:d,writable:!0})}toString(){return`${this.name} [${a}]: ${this.message}`}}}le("ERR_BUFFER_OUT_OF_BOUNDS",function(a){return a?`${a} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),le("ERR_INVALID_ARG_TYPE",function(a,n){return`The "${a}" argument must be of type number. Received type ${typeof n}`},TypeError),le("ERR_OUT_OF_RANGE",function(a,n,o){let c=`The value of "${a}" is out of range.`,d=o;return Number.isInteger(o)&&Math.abs(o)>2**32?d=Ne(String(o)):typeof o=="bigint"&&(d=String(o),(o>BigInt(2)**BigInt(32)||o<-(BigInt(2)**BigInt(32)))&&(d=Ne(d)),d+="n"),c+=` It must be ${n}. Received ${d}`,c},RangeError);function Ne(a){let n="",o=a.length;const c=a[0]==="-"?1:0;for(;o>=c+4;o-=3)n=`_${a.slice(o-3,o)}${n}`;return`${a.slice(0,o)}${n}`}function ke(a,n,o){Se(n,"offset"),(a[n]===void 0||a[n+o]===void 0)&&$e(n,a.length-(o+1))}function De(a,n,o,c,d,y){if(a>o||a<n){const b=typeof n=="bigint"?"n":"";let N;throw y>3?n===0||n===BigInt(0)?N=`>= 0${b} and < 2${b} ** ${(y+1)*8}${b}`:N=`>= -(2${b} ** ${(y+1)*8-1}${b}) and < 2 ** ${(y+1)*8-1}${b}`:N=`>= ${n}${b} and <= ${o}${b}`,new J.ERR_OUT_OF_RANGE("value",N,a)}ke(c,d,y)}function Se(a,n){if(typeof a!="number")throw new J.ERR_INVALID_ARG_TYPE(n,"number",a)}function $e(a,n,o){throw Math.floor(a)!==a?(Se(a,o),new J.ERR_OUT_OF_RANGE(o||"offset","an integer",a)):n<0?new J.ERR_BUFFER_OUT_OF_BOUNDS:new J.ERR_OUT_OF_RANGE(o||"offset",`>= ${o?1:0} and <= ${n}`,a)}const Nt=/[^+/0-9A-Za-z-_]/g;function A(a){if(a=a.split("=")[0],a=a.trim().replace(Nt,""),a.length<2)return"";for(;a.length%4!==0;)a=a+"=";return a}function lt(a,n){n=n||1/0;let o;const c=a.length;let d=null;const y=[];for(let b=0;b<c;++b){if(o=a.charCodeAt(b),o>55295&&o<57344){if(!d){if(o>56319){(n-=3)>-1&&y.push(239,191,189);continue}else if(b+1===c){(n-=3)>-1&&y.push(239,191,189);continue}d=o;continue}if(o<56320){(n-=3)>-1&&y.push(239,191,189),d=o;continue}o=(d-55296<<10|o-56320)+65536}else d&&(n-=3)>-1&&y.push(239,191,189);if(d=null,o<128){if((n-=1)<0)break;y.push(o)}else if(o<2048){if((n-=2)<0)break;y.push(o>>6|192,o&63|128)}else if(o<65536){if((n-=3)<0)break;y.push(o>>12|224,o>>6&63|128,o&63|128)}else if(o<1114112){if((n-=4)<0)break;y.push(o>>18|240,o>>12&63|128,o>>6&63|128,o&63|128)}else throw new Error("Invalid code point")}return y}function _r(a){const n=[];for(let o=0;o<a.length;++o)n.push(a.charCodeAt(o)&255);return n}function Vn(a,n){let o,c,d;const y=[];for(let b=0;b<a.length&&!((n-=2)<0);++b)o=a.charCodeAt(b),c=o>>8,d=o%256,y.push(d),y.push(c);return y}function Fr(a){return e.toByteArray(A(a))}function mt(a,n,o,c){let d;for(d=0;d<c&&!(d+o>=n.length||d>=a.length);++d)n[d+o]=a[d];return d}function pe(a,n){return a instanceof n||a!=null&&a.constructor!=null&&a.constructor.name!=null&&a.constructor.name===n.name}function Dt(a){return a!==a}const qn=function(){const a="0123456789abcdef",n=new Array(256);for(let o=0;o<16;++o){const c=o*16;for(let d=0;d<16;++d)n[c+d]=a[o]+a[d]}return n}();function Pe(a){return typeof BigInt>"u"?Qn:a}function Qn(){throw new Error("BigInt not supported")}})(an);const xr=an.Buffer;var cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ui(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pr={exports:{}};const ji=Object.getPrototypeOf({});function yr(t){function e(I){return I!=="constructor"&&I!=="prototype"&&I!=="__proto__"}function r(I){let F=0;const U=I.length,L=new Array(U);for(F=0;F<U;++F)L[F]=T(I[F]);return L}function i(I){const F={};if(h&&Object.getPrototypeOf(I)!==ji)return h(I);const U=p(I);let L,C,x;for(L=0,C=U.length;L<C;++L)e(x=U[L])&&(F[x]=T(I[x]));return F}function s(I,F){const U=I.length,L=F.length;let C=0;const x=new Array(U+L);for(C=0;C<U;++C)x[C]=T(I[C]);for(C=0;C<L;++C)x[C+U]=T(F[C]);return x}const u=Object.prototype.propertyIsEnumerable;function f(I){const F=Object.keys(I),U=Object.getOwnPropertySymbols(I);for(let L=0,C=U.length;L<C;++L)u.call(I,U[L])&&F.push(U[L]);return F}const p=t&&t.symbols?f:Object.keys,h=typeof t?.cloneProtoObject=="function"?t.cloneProtoObject:void 0;function m(I){return typeof I=="object"&&I!==null&&!(I instanceof RegExp)&&!(I instanceof Date)}function l(I){return typeof I!="object"||I===null}const w=typeof xr<"u"?I=>typeof I!="object"||I===null||I instanceof RegExp||I instanceof Date||I instanceof xr:I=>typeof I!="object"||I===null||I instanceof RegExp||I instanceof Date,E=t&&typeof t.mergeArray=="function"?t.mergeArray({clone:T,deepmerge:B,getKeys:p,isMergeableObject:m}):s;function T(I){return m(I)?Array.isArray(I)?r(I):i(I):I}function _(I,F){const U={},L=p(I),C=p(F);let x,k,q;for(x=0,k=L.length;x<k;++x)e(q=L[x])&&C.indexOf(q)===-1&&(U[q]=T(I[q]));for(x=0,k=C.length;x<k;++x)e(q=C[x])&&(q in I&&(L.indexOf(q)!==-1&&(U[q]=B(I[q],F[q])),!0)||(U[q]=T(F[q])));return U}function B(I,F){const U=Array.isArray(F),L=Array.isArray(I);return l(F)?F:w(I)?T(F):U&&L?E(I,F):U!==L?T(F):_(I,F)}function M(){switch(arguments.length){case 0:return{};case 1:return T(arguments[0]);case 2:return B(arguments[0],arguments[1])}let I;for(let F=0,U=arguments.length;F<U;++F)I=B(I,arguments[F]);return I}return t&&t.all?M:B}pr.exports=yr;pr.exports.default=yr;var Mi=pr.exports.deepmerge=yr;const Vi=t=>(e,r)=>{let i=0;const s=e.length,u=r.length,f=Math.max(s,u),p=new Array(f);for(i=0;i<f;++i)i<u?p[i]=t.deepmerge(e[i],r[i]):p[i]=t.clone(e[i]);return p},qi=Mi({mergeArray:Vi}),Qi=(t,e,r)=>{const i=_e.computed([e,r],(f,p)=>{if(f){const h=p.data?.find(m=>m.id===f);if(h)return h;console.error("Feed list is not loaded yet. Issue with the opened question.")}}),s=Le({data:void 0,loading:void 0,error:void 0});return i.subscribe(async f=>{if(f&&f.type==="question"){s.setKey("loading",!0);const p=await sn(f.id,t);s.set({data:p,loading:!1});return}s.set({data:void 0,loading:!1})}),{$store:i,$extendedStore:s,updateExtendedQuestion:f=>{const p=s.get().data;if(p&&f?.answers)for(const h of f.answers)h.youVoted!==!0&&delete h.youVoted;s.set({data:qi(p,f)})}}};var Ve;(function(t){t.ALLOWED="allowed",t.DISALLOWED="disallowed"})(Ve||(Ve={}));class Gi{slStreamId;organizationId;userId;interactiveAllowed;openedQuestionId;openedQuestion;activeQuestionId;feedList;moderationId;moderation;feedSubscription;questionSubscription;notifications;log;constructor(e){this.log=on("gamification-background"),this.slStreamId=e.stores.slStreamId.getAtomStore(),this.organizationId=e.stores.organizationSettings.getAtomStore(),this.userId=e.stores.user.getAtomStore(),this.moderationId=new ae(ne(void 0),"moderationId").getStore(),this.interactiveAllowed=new ae(ne(Ve.DISALLOWED),"interactiveAllowed").getStore(),this.openedQuestionId=new ae(ne(void 0),"openedQuestionId").getStore(),this.notifications=e.notifications,this.moderation=new de(Oi(this.slStreamId,e.transport),"gamification:moderation"),this.feedList=new de(xi(this.slStreamId,this.interactiveAllowed,e.transport),"gamification:feedList"),this.activeQuestionId=new de(_i(this.slStreamId,e.transport),"gamification:activeQuestionId"),this.openedQuestion=Qi(e.transport,this.openedQuestionId,this.feedList.getStore()),this.openedQuestionId.listen(r=>{this.log.debug({questionId:r},"received question"),r?(this.questionSubscription=Ci(r,e.transport),this.questionSubscription.addListener("feed-subscription-opened-question",i=>{window.requestAnimationFrame(()=>{this.openedQuestion.updateExtendedQuestion(i.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 i=this.activeQuestionId.getStore();i&&i.mutate(r.data?.attributes)})}),this.feedSubscription.addListener("moderation update",r=>{window.requestAnimationFrame(()=>{r.data?.attributes?.question===void 0&&r.data?.attributes?.moderation&&this.moderation.invalidate()})}),this.feedSubscription.connect(),this.interactiveAllowed.listen(()=>{window.requestAnimationFrame(()=>{this.activeQuestionId.invalidate()})})}getCurrentSessionId=e=>{const r=e.eventId||this.slStreamId.get()||"",i=e.userId||this.userId.get()||"",s=e.organizationId||this.organizationId.get()||"",u=e.entity||"",f=e.prefix||"";return[s,r,i,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 zi{notificationsList;notifications;store;timeouts;waitingQueue;activeQueue;options;logger;constructor(e){this.options=e,this.logger=on("notifications"),this.store=new Map,this.timeouts=new Map,this.waitingQueue=new Set,this.activeQueue=new Set,this.notifications=new ae(ne(new Map),"notifications-queue"),this.notificationsList=this.notifications.getStore()}addToQueue=e=>{if(this.store.has(e.id)){this.logger.debug({notification:e},"skip existed notification: %o");return}const r=e.close,i=e.action;if(this.store.set(e.id,{...e,close:(...s)=>{r&&r(...s),this.closeNotification(e.id)},action:(...s)=>{i&&i(...s),this.closeNotification(e.id)}}),this.waitingQueue.add(e.id),this.activeQueue.size===this.options.concurrency){const[s]=this.activeQueue;if(this.store.get(s)?.persistent!==!0)this.closeNotification(s);else{const[f]=this.waitingQueue;this.waitingQueue.size>1&&this.closeNotification(f),this.tickWaitingQueue()}}else 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 i=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,delay:r.autoHideDuration||5e3},"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,i),this.logger.debug({notificationId:e},"active queue tick completed"),this.tickWaitingQueue()};closeNotification=e=>{const r=new Map(this.notifications.getValue()),i=r.get(e);if(i){i.hiding=!(this.waitingQueue.size>=this.options.concurrency),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 Tt;(function(t){t.OPENED="opened"})(Tt||(Tt={}));class Ki extends dr{constructor(){super("notification")}setOpened=e=>{this.write(Tt.OPENED,e,"true")};isOpened=e=>this.read(Tt.OPENED,e);clearNotification=()=>{this.clear()}}var Me;(function(t){t[t.ONBOARDING=1]="ONBOARDING",t[t.QUESTION=2]="QUESTION",t[t.QUESTION_RESOLVED=3]="QUESTION_RESOLVED"})(Me||(Me={}));class Wi{queue;storage;constructor(e={}){this.storage=new Ki,this.queue=new zi({concurrency:1,animationDelay:1600,...e})}add=e=>{this.storage.isOpened(e.id)||this.queue.addToQueue(e)};close=(e,r=!0)=>{this.queue.closeNotification(e),r&&this.markAsViewed(e)};getQueueStore=()=>this.queue.notificationsList;markAsViewed=e=>{this.storage.setOpened(e)}}const Hi=(t,e,r)=>{t.notifications=new Wi,t.addNotification=t.notifications.add,t.sdk.getNotificationsStore=()=>t.notifications.getQueueStore(),r()},Ji=(t,e)=>{const{client:r}=t.createPromiseClient(Fe.Feed,{method:"submitAnswer"});return r.submitAnswer({data:e})},Yi=(t,e)=>{const{client:r}=t.createPromiseClient(Fe.Feed,{method:"submitInplay"});return r.submitInplay({data:{eventId:+e}})},Xi=(t,e)=>{const{client:r}=t.createPromiseClient(Fe.Feed,{method:"skipQuestion"});return r.skipQuestion({data:{id:e}})};var Ze;(function(t){t.ONBOARDING="onboarding",t.ONBOARDING_IO="onboarding_io"})(Ze||(Ze={}));class ln extends dr{constructor(){super("gamification")}saveOnboardingStatus=({userId:e,eventId:r,organizationId:i},s)=>{this.write(Ze.ONBOARDING,i,e,r,s)};getOnboardingStatus=({userId:e,eventId:r,organizationId:i})=>this.read(Ze.ONBOARDING,i,e,r);setOnboardingInstantOpen=({userId:e,eventId:r,organizationId:i})=>{const s=this.generateKey([Ze.ONBOARDING_IO,i,e,r]);window.sessionStorage.setItem(s,"1")};getOnboardingInstantOpen=({userId:e,eventId:r,organizationId:i})=>{const s=this.generateKey([Ze.ONBOARDING_IO,i,e,r]);return window.sessionStorage.getItem(s)}}const Br={pageSize:10},Zi=(t,e,r,i,s)=>{let u=0;const f=ne({pageSize:s?.pageSize||Br.pageSize,page:0}),p=Le({data:[],key:Date.now(),hasMore:!0,loading:void 0,error:void 0}),h=Ii(t),m=async()=>{const E=e.get(),T=i.getStore().get().data?.map(_=>_.slId)||[];if(E&&T?.length){const _=r.get();_&&T.push(_),p.setKey("loading",!0),p.setKey("data",[]);const B={eventId:E,usersIds:T,pagination:{page:0,pageSize:s?.pageSize||Br.pageSize}},M=await h(B);p.set({data:M.data.map(I=>I.attributes),hasMore:!0,key:Date.now(),loading:!1}),M.meta&&(u=Math.round(M.meta.count/M.meta.pageSize)),f.set(B.pagination)}},l=()=>{m()},w=E=>{const T=f.get(),_=E||T.page+1;_<=u&&f.set({...T,page:_})};return _e.onMount(p,()=>{const E=e.listen(m),T=i.listen(m),_=f.listen(async B=>{const M=e.get();if(B.page>0&&M)if(B.page<u){p.setKey("loading",!0);const F=await h({eventId:M,pagination:B}),U=p.get().data||[];p.set({data:[...U,...F.data.map(L=>L.attributes)],key:p.get().key,loading:!1,hasMore:!0})}else p.setKey("hasMore",!1)});return()=>{E(),T(),_()}}),{$store:p,fetchMore:w,invalidate:l}},eo=(t,e)=>{const{client:r,queryKey:i}=t.createPromiseClient(yt.Client,{method:"generateDeepLink",params:e});return t.nanoquery.createFetcherStore(i,{fetcher:async(s,u,f)=>f?(await r.generateDeepLink({data:{eventId:f}})).data?.attributes:{}})},to=(t,{web:e,mobile:r})=>{const{client:i}=t.createPromiseClient(Wn.LinksClient,{method:"generate"});return i.generate({web:e,mobile:r})},ro=(t,e,r)=>{const i=Le({});return _e.onMount(i,()=>eo(t,[e]).subscribe(async({data:f,error:p,loading:h})=>{const m=p?"https://masters.com":f?.url;if(!h&&m){i.setKey("loading",!0);let l=window.location.search,w=window.location.hash;if(l&&w||w){const _=new URLSearchParams(l);_.append("slprms",`sl_eid=${e.get()}:sl_uid=${r.get()}`),l=`?${_.toString()}`}else w=`#slprms::${`sl_eid=${e.get()}:sl_uid=${r.get()}`}`;const E=window.location.origin+window.location.pathname+l+w,T=await to(t,{web:E,mobile:m});i.set({data:T.data?.link,loading:!1})}else i.setKey("loading",!0)})),{$store:i,fetch}};var ee;(function(t){t.Unset="unset",t.Required="required",t.Optional="optional",t.Completed="completed",t.Disabled="disabled",t.Unavailable="unavailable"})(ee||(ee={}));const no=(t,e,r,i)=>{const{inplayGame:s}=t.featureSettings.get(),u=e.getCurrentSessionId({prefix:"onboarding"});s&&r.add({type:Me.ONBOARDING,id:u,action:t.openFeature,persistent:!0,autoHideDuration:1e6,data:{questionType:re.QuestionType.UNSET,onboarding:{...s,instantOpen:!i.getOnboardingInstantOpen({userId:e.userId.get()||"",organizationId:e.organizationId.get()||"",eventId:e.slStreamId.get()||""})}}})},wt=(t,e,r,i,s,u)=>{try{const f=e.userId.get();if(!f)return;if(s.getOnboardingStatus({userId:f,organizationId:e.organizationId.get()||"",eventId:e.slStreamId.get()||""})===ee.Completed){t.set(ee.Completed);for(const E of u)E();return}const h=e.moderation.getStore().value?.data,m=r.featureSettings.get().inplayGame;if(h===void 0||m===void 0)return;const l=h?.options?.onboardingEnabled,w=m?.titleCard?.optIn;l?w?t.set(ee.Required):t.set(ee.Optional):(w?t.set(ee.Unavailable):t.set(ee.Disabled),i.close(e.getCurrentSessionId({prefix:"onboarding"}),!1))}catch(f){console.error(f)}},io=(t,e,r,i)=>{let s=!1;const u=new ln,f=ne(ee.Unset);f.subscribe(m=>{m!==ee.Unset&&((m===ee.Optional||m===ee.Required)&&s===!1&&(no(t,e,i,u),s=!0),m===ee.Completed&&e.activeQuestionId.invalidate(),u.setOnboardingInstantOpen({userId:e.userId.get()||"",organizationId:e.organizationId.get()||"",eventId:e.slStreamId.get()||""}))});const p=[];return wt(f,e,t,i,u,p),f.get()!==ee.Completed&&(p.push(e.userId.listen(m=>{m&&wt(f,e,t,i,u,p)})),p.push(e.moderation.listen(m=>{m.data&&wt(f,e,t,i,u,p)})),p.push(t.featureSettings.listen(m=>{m&&wt(f,e,t,i,u,p)}))),{$store:f,submitInplay:async()=>{const m=e.slStreamId.get();if(m){await Yi(r,m),f.set(ee.Completed),u.saveOnboardingStatus({organizationId:e.organizationId.get()||"",userId:e.userId.get()||"",eventId:m},ee.Completed);const l=e.getCurrentSessionId({prefix:"onboarding"});i.close(l)}}}},oo=new Set([re.QuestionType.POLL,re.QuestionType.PREDICTION,re.QuestionType.TRIVIA]);class so extends nn{userSummary;feedList;friends;leaderboardId;leaderboardList;deepLink;onboardingStatus;openedQuestion;currentUserId;openedUser;closeFeature;openFeature;notifications;transport;background;storage;constructor(e,r,i){super(e,r),this.background=new Gi(i),this.storage=new ln,this.userSummary=new de(Ei(this.background.slStreamId,this.background.userId,i.transport),"gamification:userSummary"),this.feedList=this.background.feedList,this.friends=new de(Ti(this.background.userId,i.transport),"gamification:friends"),this.currentUserId=this.background.userId,this.openedUser=ne(void 0),this.leaderboardId=new ae(ne(this.settings.getValue("pinnedLeaderboardId")),"pinnedLeaderboardId").getStore(),this.onboardingStatus=io(this,this.background,i.transport,i.notifications),this.notifications=i.notifications,this.transport=i.transport,this.closeFeature=()=>i.sdk.closeFeature(!0),this.openFeature=()=>i.sdk.openFeature(Te.SdkOverlayType.GAMES),this.openedQuestion=this.background.openedQuestion,this.deepLink=ro(this.transport,this.background.slStreamId,this.background.userId),this.leaderboardList=Zi(this.transport,this.background.slStreamId,this.background.userId,this.friends),this.status.subscribe(s=>{s===rt.Ready?this.connect(i.transport):this.disconnect()}),this.userSummary.listen(s=>{this.leaderboardList.$store.lc!==0&&s?.data?.summary&&window.requestAnimationFrame(()=>{this.leaderboardList.invalidate()})}),this.background.activeQuestionId.listen(this.showInApp),this.onboardingStatus.$store.listen(this.checkInteractiveFlag),this.background.moderation.getStore().listen(this.checkInteractiveFlag),this.settings.subscribe(this.checkInteractiveFlag)}get isInteractiveAllowed(){return this.background.interactiveAllowed.get()===Ve.ALLOWED}checkInteractiveFlag=()=>{const e=this.onboardingStatus.$store.get(),r=this.background.moderation.getStore().value?.data?.options?.onboardingEnabled,i=this.settings.getValues().inplayGame?.titleCard?.optIn,s=e===ee.Completed,u=!r||s||i!==!0;this.background.interactiveAllowed.set(u?Ve.ALLOWED:Ve.DISALLOWED)};connect=e=>{this.userSummary.invalidate(),this.leaderboardList.invalidate(),this.feedList.invalidate(),this.friends.invalidate(),this.background.feedSubscription.addListener("feed-subscription-prediction-close",r=>{this.isInteractiveAllowed&&window.requestAnimationFrame(async()=>{const i=r.data?.attributes?.question;if(!i)return;const{status:s,type:u,id:f}=i;if(s===re.QuestionStatus.RESOLVED&&u===re.QuestionType.PREDICTION){const p=this.background.getCurrentSessionId({prefix:`notification-id:${f}`}),h=await sn(f,e),m=h?.answers.find(({correct:w})=>w),l=h?.answers.find(({youVoted:w})=>w);if(!l)return;this.notifications.add({type:Me.QUESTION_RESOLVED,action:()=>this.openQuestion(f),close:()=>this.closeQuestion(f),autoHideDuration:m?.youVoted?15e3:12e3,id:p,data:{questionType:re.QuestionType.PREDICTION,question:{title:m?.youVoted?`Congratulations! You answered correctly! You won ${m.points} pts!`:`Better luck next time! Correct: ${m?.text}!`,votedAnswer:{title:l?.text,points:l?.points},correctAnswerTitle:m?.text,correct:m?.youVoted,predictionResult:s===re.QuestionStatus.RESOLVED,questionTitle:h?.subject}}}),this.userSummary.invalidate()}})}),this.background.feedSubscription.addListener("feed-subscription-questions-list",()=>{window.requestAnimationFrame(()=>{this.feedList?.invalidate()})})};disconnect=()=>{this.background.feedSubscription.removeListener("feed-subscription-questions-list")};submitAnswer=async(e,r)=>{await Ji(this.transport,{questionId:e,answerId:r}),this.feedList.invalidate(),this.userSummary.invalidate()};skipQuestion=async e=>{await Xi(this.transport,e),this.feedList.invalidate(),this.userSummary.invalidate()};openQuestion=e=>(this.openFeature(),this.notifications.close(this.background.getCurrentSessionId({prefix:"notification",entity:e})),this.background.openQuestion(e));closeQuestion=e=>this.background.closeQuestion(e);openUser=e=>{const r=this.leaderboardList.$store.get().data?.find(i=>i.userId===e);this.openedUser.set(r)};closeUser=()=>{this.openedUser.set(void 0)};showInApp=e=>{const r=this.onboardingStatus.$store.get();if(e&&e.data&&r&&r!==ee.Unset&&e.data.question?.id!==void 0&&e.data.question.notification!==void 0&&e.data.question?.bypassNotifications?.inAppSilence!==re.SilenceSetting.ON&&e.data.question.status===re.QuestionStatus.ACTIVE){if(oo.has(e.data.question.type))this.isInteractiveAllowed&&this.notifications.add({type:Me.QUESTION,action:()=>e.data?.question&&this.openQuestion(e.data.question.id),close:()=>e.data?.question&&this.closeQuestion(e.data.question.id),autoHideDuration:1e3*60,id:this.background.getCurrentSessionId({prefix:"notification",entity:e.data.question.id}),data:{questionType:e.data.question.type,question:{title:e.data.question.notification.title}}});else if(e.data.question.type===re.QuestionType.FACTOID){const i=e.data.question.options?.options.value,s={heading:e.data.question.notification.title,body:e.data.question.notification.body,image:i?.image,video:{id:i?.video?.id||"",url:i?.video?.url||"",thumbnailUrl:i?.video?.thumbnailUrl||""},webLink:{label:"",url:""}};this.notifications.add({type:Me.QUESTION,action:()=>e.data?.question&&this.openQuestion(e.data.question.id),close:()=>e.data?.question&&this.closeQuestion(e.data.question.id),autoHideDuration:1e3*120,id:this.background.getCurrentSessionId({prefix:"notification",entity:e.data.question.id}),data:{questionType:e.data.question.type,insight:s}})}else if(e.data.question.type===re.QuestionType.TWEET){const i=e.data.question.options?.options.value,s={title:e.data.question.notification?.title,body:e.data.question.notification?.body,image:e.data.question.notification?.image,account:i?.tweetMeta?.account||"",accountVerified:!!i?.tweetMeta?.accountVerified};this.notifications.add({type:Me.QUESTION,action:()=>e.data?.question&&this.openQuestion(e.data.question.id),close:()=>e.data?.question&&this.closeQuestion(e.data.question.id),autoHideDuration:1e3*120,id:this.background.getCurrentSessionId({prefix:"notification",entity:e.data.question.id}),data:{questionType:e.data.question.type,tweet:s}})}}}}const ao={[Te.SdkOverlayType.GAMES]:!0};class uo extends nn{constructor(e,r){super(e,r)}}const co=(t,e,r)=>t.type===Te.SdkOverlayType.GAMES?new so(t,e,r):new uo(t,e),lo=(t,e,r)=>{t.features=new Map,t.activeFeature=new ae(ne(Te.SdkOverlayType.UNSET),"activeFeature"),t.sdk.getFeatures=()=>t.features,t.sdk.getFeature=i=>t.features.get(i),t.sdk.getActiveFeature=()=>t.activeFeature.getStore(),t.sdk.openFeature=i=>{t.activeFeature.setValue(i)},t.sdk.closeFeature=(i=!1)=>{if(i){const s=t.activeFeature.getValue();t.activeFeature.setValue(Te.SdkOverlayType.UNSET),s&&t.features.delete(s)}},t.initFeature=(i,s=Ee.ORGANIZATION)=>{if(i.type in ao&&!t.features.has(i.type)){const u=co(i,s,t);t.features.set(i.type,u)}},t.updateFeature=(i,s)=>{t.features.get(i.type)?.update(i,s)},t.destroyFeature=i=>{t.features.delete(i.type)},t.reinitializeFeatures=async()=>{const i=await t.stores.organizationSettings.getValue();t.features.clear();for(const s of i?.overlays||[])t.initFeature(s,Ee.ORGANIZATION)},t.stores.providerStreamId.listen(i=>{i||t.reinitializeFeatures()}),t.storeSubscribe=()=>{const i=(u,f)=>{if(f?.overlays&&!(t.contextConfig?.skipOrganizationSettings&&u===Ee.ORGANIZATION))for(const p of f.overlays)p.sdkEnable===!0&&(t.features.has(p.type)?t.updateFeature(p,u):t.initFeature(p,u))},s={organizationSettings:u=>{if(u.data)try{i(Ee.ORGANIZATION,u.data)}catch(f){console.log(f)}},streamSettings:u=>{if(u.data)try{i(Ee.STREAM,u.data)}catch(f){console.log(f)}}};t.store.subscribe(s)},r()};var gr={exports:{}},mr={exports:{}};function fo(t){var e=new t,r=e;function i(){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:i,release:s}}var ho=fo,po=ho;function fn(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 i=po(yo),s=null,u=null,f=0,p=null,h={push:B,drain:se,saturated:se,pause:l,paused:!1,concurrency:r,running:m,resume:T,idle:_,length:w,getQueue:E,unshift:M,empty:se,kill:F,killAndDrain:U,error:L};return h;function m(){return f}function l(){h.paused=!0}function w(){for(var C=s,x=0;C;)C=C.next,x++;return x}function E(){for(var C=s,x=[];C;)x.push(C.value),C=C.next;return x}function T(){if(h.paused){h.paused=!1;for(var C=0;C<h.concurrency;C++)f++,I()}}function _(){return f===0&&h.length()===0}function B(C,x){var k=i.get();k.context=t,k.release=I,k.value=C,k.callback=x||se,k.errorHandler=p,f===h.concurrency||h.paused?u?(u.next=k,u=k):(s=k,u=k,h.saturated()):(f++,e.call(t,k.value,k.worked))}function M(C,x){var k=i.get();k.context=t,k.release=I,k.value=C,k.callback=x||se,k.errorHandler=p,f===h.concurrency||h.paused?s?(k.next=s,s=k):(s=k,u=k,h.saturated()):(f++,e.call(t,k.value,k.worked))}function I(C){C&&i.release(C);var x=s;x?h.paused?f--:(u===s&&(u=null),s=x.next,x.next=null,e.call(t,x.value,x.worked),u===null&&h.empty()):--f===0&&h.drain()}function F(){s=null,u=null,h.drain=se}function U(){s=null,u=null,h.drain(),h.drain=se}function L(C){p=C}}function se(){}function yo(){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,i){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,i),t.release(t)}}function go(t,e,r){typeof t=="function"&&(r=e,e=t,t=null);function i(l,w){e.call(this,l).then(function(E){w(null,E)},w)}var s=fn(t,i,r),u=s.push,f=s.unshift;return s.push=p,s.unshift=h,s.drained=m,s;function p(l){var w=new Promise(function(E,T){u(l,function(_,B){if(_){T(_);return}E(B)})});return w.catch(se),w}function h(l){var w=new Promise(function(E,T){f(l,function(_,B){if(_){T(_);return}E(B)})});return w.catch(se),w}function m(){if(s.idle())return new Promise(function(E){E()});var l=s.drain,w=new Promise(function(E){s.drain=function(){l(),E()}});return w}}mr.exports=fn;mr.exports.promise=go;var dn=mr.exports,wr={exports:{}},nt=typeof Reflect=="object"?Reflect:null,kr=nt&&typeof nt.apply=="function"?nt.apply:function(e,r,i){return Function.prototype.apply.call(e,r,i)},vt;nt&&typeof nt.ownKeys=="function"?vt=nt.ownKeys:Object.getOwnPropertySymbols?vt=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:vt=function(e){return Object.getOwnPropertyNames(e)};function mo(t){console&&console.warn&&console.warn(t)}var hn=Number.isNaN||function(e){return e!==e};function G(){G.init.call(this)}wr.exports=G;wr.exports.once=So;G.EventEmitter=G;G.prototype._events=void 0;G.prototype._eventsCount=0;G.prototype._maxListeners=void 0;var Pr=10;function Pt(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(G,"defaultMaxListeners",{enumerable:!0,get:function(){return Pr},set:function(t){if(typeof t!="number"||t<0||hn(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Pr=t}});G.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};G.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||hn(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 pn(t){return t._maxListeners===void 0?G.defaultMaxListeners:t._maxListeners}G.prototype.getMaxListeners=function(){return pn(this)};G.prototype.emit=function(e){for(var r=[],i=1;i<arguments.length;i++)r.push(arguments[i]);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 p=new Error("Unhandled error."+(f?" ("+f.message+")":""));throw p.context=f,p}var h=u[e];if(h===void 0)return!1;if(typeof h=="function")kr(h,this,r);else for(var m=h.length,l=bn(h,m),i=0;i<m;++i)kr(l[i],this,r);return!0};function yn(t,e,r,i){var s,u,f;if(Pt(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]=i?[r,f]:[f,r]:i?f.unshift(r):f.push(r),s=pn(t),s>0&&f.length>s&&!f.warned){f.warned=!0;var p=new Error("Possible EventEmitter memory leak detected. "+f.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");p.name="MaxListenersExceededWarning",p.emitter=t,p.type=e,p.count=f.length,mo(p)}return t}G.prototype.addListener=function(e,r){return yn(this,e,r,!1)};G.prototype.on=G.prototype.addListener;G.prototype.prependListener=function(e,r){return yn(this,e,r,!0)};function wo(){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 gn(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},s=wo.bind(i);return s.listener=r,i.wrapFn=s,s}G.prototype.once=function(e,r){return Pt(r),this.on(e,gn(this,e,r)),this};G.prototype.prependOnceListener=function(e,r){return Pt(r),this.prependListener(e,gn(this,e,r)),this};G.prototype.removeListener=function(e,r){var i,s,u,f,p;if(Pt(r),s=this._events,s===void 0)return this;if(i=s[e],i===void 0)return this;if(i===r||i.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,i.listener||r));else if(typeof i!="function"){for(u=-1,f=i.length-1;f>=0;f--)if(i[f]===r||i[f].listener===r){p=i[f].listener,u=f;break}if(u<0)return this;u===0?i.shift():bo(i,u),i.length===1&&(s[e]=i[0]),s.removeListener!==void 0&&this.emit("removeListener",e,p||r)}return this};G.prototype.off=G.prototype.removeListener;G.prototype.removeAllListeners=function(e){var r,i,s;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var u=Object.keys(i),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=i[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 mn(t,e,r){var i=t._events;if(i===void 0)return[];var s=i[e];return s===void 0?[]:typeof s=="function"?r?[s.listener||s]:[s]:r?vo(s):bn(s,s.length)}G.prototype.listeners=function(e){return mn(this,e,!0)};G.prototype.rawListeners=function(e){return mn(this,e,!1)};G.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):wn.call(t,e)};G.prototype.listenerCount=wn;function wn(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}G.prototype.eventNames=function(){return this._eventsCount>0?vt(this._events):[]};function bn(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function bo(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function vo(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function So(t,e){return new Promise(function(r,i){function s(f){t.removeListener(e,u),i(f)}function u(){typeof t.removeListener=="function"&&t.removeListener("error",s),r([].slice.call(arguments))}vn(t,e,u,{once:!0}),e!=="error"&&Ao(t,s,{once:!0})})}function Ao(t,e,r){typeof t.on=="function"&&vn(t,"error",e,r)}function vn(t,e,r,i){if(typeof t.on=="function")i.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function s(u){i.once&&t.removeEventListener(e,s),r(u)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Sn=wr.exports,Lt={},An={},En=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},r=Symbol("test"),i=Object(r);if(typeof r=="string"||Object.prototype.toString.call(r)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[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},Eo=En,br=function(){return Eo()&&!!Symbol.toStringTag},Lr=typeof Symbol<"u"&&Symbol,Io=En,To=function(){return typeof Lr!="function"||typeof Symbol!="function"||typeof Lr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Io()},Rr={foo:{}},Oo=Object,_o=function(){return{__proto__:Rr}.foo===Rr.foo&&!({__proto__:null}instanceof Oo)},Fo="Function.prototype.bind called on incompatible ",Co=Object.prototype.toString,xo=Math.max,Bo="[object Function]",Nr=function(e,r){for(var i=[],s=0;s<e.length;s+=1)i[s]=e[s];for(var u=0;u<r.length;u+=1)i[u+e.length]=r[u];return i},ko=function(e,r){for(var i=[],s=r||0,u=0;s<e.length;s+=1,u+=1)i[u]=e[s];return i},Po=function(t,e){for(var r="",i=0;i<t.length;i+=1)r+=t[i],i+1<t.length&&(r+=e);return r},Lo=function(e){var r=this;if(typeof r!="function"||Co.apply(r)!==Bo)throw new TypeError(Fo+r);for(var i=ko(arguments,1),s,u=function(){if(this instanceof s){var l=r.apply(this,Nr(i,arguments));return Object(l)===l?l:this}return r.apply(e,Nr(i,arguments))},f=xo(0,r.length-i.length),p=[],h=0;h<f;h++)p[h]="$"+h;if(s=Function("binder","return function ("+Po(p,",")+"){ return binder.apply(this,arguments); }")(u),r.prototype){var m=function(){};m.prototype=r.prototype,s.prototype=new m,m.prototype=null}return s},Ro=Lo,vr=Function.prototype.bind||Ro,No=Function.prototype.call,Do=Object.prototype.hasOwnProperty,$o=vr,Uo=$o.call(No,Do),$,ot=SyntaxError,In=Function,it=TypeError,Ut=function(t){try{return In('"use strict"; return ('+t+").constructor;")()}catch{}},qe=Object.getOwnPropertyDescriptor;if(qe)try{qe({},"")}catch{qe=null}var jt=function(){throw new it},jo=qe?function(){try{return arguments.callee,jt}catch{try{return qe(arguments,"callee").get}catch{return jt}}}():jt,We=To(),Mo=_o(),X=Object.getPrototypeOf||(Mo?function(t){return t.__proto__}:null),Je={},Vo=typeof Uint8Array>"u"||!X?$:X(Uint8Array),Qe={"%AggregateError%":typeof AggregateError>"u"?$:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$:ArrayBuffer,"%ArrayIteratorPrototype%":We&&X?X([][Symbol.iterator]()):$,"%AsyncFromSyncIteratorPrototype%":$,"%AsyncFunction%":Je,"%AsyncGenerator%":Je,"%AsyncGeneratorFunction%":Je,"%AsyncIteratorPrototype%":Je,"%Atomics%":typeof Atomics>"u"?$:Atomics,"%BigInt%":typeof BigInt>"u"?$:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$:FinalizationRegistry,"%Function%":In,"%GeneratorFunction%":Je,"%Int8Array%":typeof Int8Array>"u"?$:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":We&&X?X(X([][Symbol.iterator]())):$,"%JSON%":typeof JSON=="object"?JSON:$,"%Map%":typeof Map>"u"?$:Map,"%MapIteratorPrototype%":typeof Map>"u"||!We||!X?$:X(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$:Promise,"%Proxy%":typeof Proxy>"u"?$:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$:Set,"%SetIteratorPrototype%":typeof Set>"u"||!We||!X?$:X(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":We&&X?X(""[Symbol.iterator]()):$,"%Symbol%":We?Symbol:$,"%SyntaxError%":ot,"%ThrowTypeError%":jo,"%TypedArray%":Vo,"%TypeError%":it,"%Uint8Array%":typeof Uint8Array>"u"?$:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$:WeakSet};if(X)try{null.error}catch(t){var qo=X(X(t));Qe["%Error.prototype%"]=qo}var Qo=function t(e){var r;if(e==="%AsyncFunction%")r=Ut("async function () {}");else if(e==="%GeneratorFunction%")r=Ut("function* () {}");else if(e==="%AsyncGeneratorFunction%")r=Ut("async function* () {}");else if(e==="%AsyncGenerator%"){var i=t("%AsyncGeneratorFunction%");i&&(r=i.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=t("%AsyncGenerator%");s&&X&&(r=X(s.prototype))}return Qe[e]=r,r},Dr={"%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"]},gt=vr,Ot=Uo,Go=gt.call(Function.call,Array.prototype.concat),zo=gt.call(Function.apply,Array.prototype.splice),$r=gt.call(Function.call,String.prototype.replace),_t=gt.call(Function.call,String.prototype.slice),Ko=gt.call(Function.call,RegExp.prototype.exec),Wo=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Ho=/\\(\\)?/g,Jo=function(e){var r=_t(e,0,1),i=_t(e,-1);if(r==="%"&&i!=="%")throw new ot("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&r!=="%")throw new ot("invalid intrinsic syntax, expected opening `%`");var s=[];return $r(e,Wo,function(u,f,p,h){s[s.length]=p?$r(h,Ho,"$1"):f||u}),s},Yo=function(e,r){var i=e,s;if(Ot(Dr,i)&&(s=Dr[i],i="%"+s[0]+"%"),Ot(Qe,i)){var u=Qe[i];if(u===Je&&(u=Qo(i)),typeof u>"u"&&!r)throw new it("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:i,value:u}}throw new ot("intrinsic "+e+" does not exist!")},at=function(e,r){if(typeof e!="string"||e.length===0)throw new it("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new it('"allowMissing" argument must be a boolean');if(Ko(/^%?[^%]*%?$/,e)===null)throw new ot("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=Jo(e),s=i.length>0?i[0]:"",u=Yo("%"+s+"%",r),f=u.name,p=u.value,h=!1,m=u.alias;m&&(s=m[0],zo(i,Go([0,1],m)));for(var l=1,w=!0;l<i.length;l+=1){var E=i[l],T=_t(E,0,1),_=_t(E,-1);if((T==='"'||T==="'"||T==="`"||_==='"'||_==="'"||_==="`")&&T!==_)throw new ot("property names with quotes must have matching quotes");if((E==="constructor"||!w)&&(h=!0),s+="."+E,f="%"+s+"%",Ot(Qe,f))p=Qe[f];else if(p!=null){if(!(E in p)){if(!r)throw new it("base intrinsic for "+e+" exists, but the property is not available.");return}if(qe&&l+1>=i.length){var B=qe(p,E);w=!!B,w&&"get"in B&&!("originalValue"in B.get)?p=B.get:p=p[E]}else w=Ot(p,E),p=p[E];w&&!h&&(Qe[f]=p)}}return p},Tn={exports:{}},Xo=at,tr=Xo("%Object.defineProperty%",!0),rr=function(){if(tr)try{return tr({},"a",{value:1}),!0}catch{return!1}return!1};rr.hasArrayLengthDefineBug=function(){if(!rr())return null;try{return tr([],"length",{value:1}).length!==1}catch{return!0}};var On=rr,Zo=at,St=Zo("%Object.getOwnPropertyDescriptor%",!0);if(St)try{St([],"length")}catch{St=null}var Sr=St,es=On(),Ar=at,ht=es&&Ar("%Object.defineProperty%",!0);if(ht)try{ht({},"a",{value:1})}catch{ht=!1}var ts=Ar("%SyntaxError%"),He=Ar("%TypeError%"),Ur=Sr,rs=function(e,r,i){if(!e||typeof e!="object"&&typeof e!="function")throw new He("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new He("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new He("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new He("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new He("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new He("`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,p=arguments.length>6?arguments[6]:!1,h=!!Ur&&Ur(e,r);if(ht)ht(e,r,{configurable:f===null&&h?h.configurable:!f,enumerable:s===null&&h?h.enumerable:!s,value:i,writable:u===null&&h?h.writable:!u});else if(p||!s&&!u&&!f)e[r]=i;else throw new ts("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_n=at,jr=rs,ns=On(),Mr=Sr,Vr=_n("%TypeError%"),is=_n("%Math.floor%"),os=function(e,r){if(typeof e!="function")throw new Vr("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||is(r)!==r)throw new Vr("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in e&&Mr){var f=Mr(e,"length");f&&!f.configurable&&(s=!1),f&&!f.writable&&(u=!1)}return(s||u||!i)&&(ns?jr(e,"length",r,!0,!0):jr(e,"length",r)),e};(function(t){var e=vr,r=at,i=os,s=r("%TypeError%"),u=r("%Function.prototype.apply%"),f=r("%Function.prototype.call%"),p=r("%Reflect.apply%",!0)||e.call(f,u),h=r("%Object.defineProperty%",!0),m=r("%Math.max%");if(h)try{h({},"a",{value:1})}catch{h=null}t.exports=function(E){if(typeof E!="function")throw new s("a function is required");var T=p(e,f,arguments);return i(T,1+m(0,E.length-(arguments.length-1)),!0)};var l=function(){return p(e,u,arguments)};h?h(t.exports,"apply",{value:l}):t.exports.apply=l})(Tn);var Fn=Tn.exports,Cn=at,xn=Fn,ss=xn(Cn("String.prototype.indexOf")),Bn=function(e,r){var i=Cn(e,!!r);return typeof i=="function"&&ss(e,".prototype.")>-1?xn(i):i},as=br(),us=Bn,nr=us("Object.prototype.toString"),Rt=function(e){return as&&e&&typeof e=="object"&&Symbol.toStringTag in e?!1:nr(e)==="[object Arguments]"},kn=function(e){return Rt(e)?!0:e!==null&&typeof e=="object"&&typeof e.length=="number"&&e.length>=0&&nr(e)!=="[object Array]"&&nr(e.callee)==="[object Function]"},cs=function(){return Rt(arguments)}();Rt.isLegacyArguments=kn;var ls=cs?Rt:kn,fs=Object.prototype.toString,ds=Function.prototype.toString,hs=/^\s*(?:function)?\*/,Pn=br(),Mt=Object.getPrototypeOf,ps=function(){if(!Pn)return!1;try{return Function("return function*() {}")()}catch{}},Vt,ys=function(e){if(typeof e!="function")return!1;if(hs.test(ds.call(e)))return!0;if(!Pn){var r=fs.call(e);return r==="[object GeneratorFunction]"}if(!Mt)return!1;if(typeof Vt>"u"){var i=ps();Vt=i?Mt(i):!1}return Mt(e)===Vt},Ln=Function.prototype.toString,et=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,ir,At;if(typeof et=="function"&&typeof Object.defineProperty=="function")try{ir=Object.defineProperty({},"length",{get:function(){throw At}}),At={},et(function(){throw 42},null,ir)}catch(t){t!==At&&(et=null)}else et=null;var gs=/^\s*class\b/,or=function(e){try{var r=Ln.call(e);return gs.test(r)}catch{return!1}},qt=function(e){try{return or(e)?!1:(Ln.call(e),!0)}catch{return!1}},Et=Object.prototype.toString,ms="[object Object]",ws="[object Function]",bs="[object GeneratorFunction]",vs="[object HTMLAllCollection]",Ss="[object HTML document.all class]",As="[object HTMLCollection]",Es=typeof Symbol=="function"&&!!Symbol.toStringTag,Is=!(0 in[,]),sr=function(){return!1};if(typeof document=="object"){var Ts=document.all;Et.call(Ts)===Et.call(document.all)&&(sr=function(e){if((Is||!e)&&(typeof e>"u"||typeof e=="object"))try{var r=Et.call(e);return(r===vs||r===Ss||r===As||r===ms)&&e("")==null}catch{}return!1})}var Os=et?function(e){if(sr(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;try{et(e,null,ir)}catch(r){if(r!==At)return!1}return!or(e)&&qt(e)}:function(e){if(sr(e))return!0;if(!e||typeof e!="function"&&typeof e!="object")return!1;if(Es)return qt(e);if(or(e))return!1;var r=Et.call(e);return r!==ws&&r!==bs&&!/^\[object HTML/.test(r)?!1:qt(e)},_s=Os,Fs=Object.prototype.toString,Rn=Object.prototype.hasOwnProperty,Cs=function(e,r,i){for(var s=0,u=e.length;s<u;s++)Rn.call(e,s)&&(i==null?r(e[s],s,e):r.call(i,e[s],s,e))},xs=function(e,r,i){for(var s=0,u=e.length;s<u;s++)i==null?r(e.charAt(s),s,e):r.call(i,e.charAt(s),s,e)},Bs=function(e,r,i){for(var s in e)Rn.call(e,s)&&(i==null?r(e[s],s,e):r.call(i,e[s],s,e))},ks=function(e,r,i){if(!_s(r))throw new TypeError("iterator must be a function");var s;arguments.length>=3&&(s=i),Fs.call(e)==="[object Array]"?Cs(e,r,s):typeof e=="string"?xs(e,r,s):Bs(e,r,s)},Ps=ks,Qt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],Ls=typeof globalThis>"u"?cn:globalThis,Rs=function(){for(var e=[],r=0;r<Qt.length;r++)typeof Ls[Qt[r]]=="function"&&(e[e.length]=Qt[r]);return e},Ft=Ps,Ns=Rs,qr=Fn,Er=Bn,It=Sr,Ds=Er("Object.prototype.toString"),Nn=br(),Qr=typeof globalThis>"u"?cn:globalThis,ar=Ns(),Ir=Er("String.prototype.slice"),Gt=Object.getPrototypeOf,$s=Er("Array.prototype.indexOf",!0)||function(e,r){for(var i=0;i<e.length;i+=1)if(e[i]===r)return i;return-1},Ct={__proto__:null};Nn&&It&&Gt?Ft(ar,function(t){var e=new Qr[t];if(Symbol.toStringTag in e){var r=Gt(e),i=It(r,Symbol.toStringTag);if(!i){var s=Gt(r);i=It(s,Symbol.toStringTag)}Ct["$"+t]=qr(i.get)}}):Ft(ar,function(t){var e=new Qr[t],r=e.slice||e.set;r&&(Ct["$"+t]=qr(r))});var Us=function(e){var r=!1;return Ft(Ct,function(i,s){if(!r)try{"$"+i(e)===s&&(r=Ir(s,1))}catch{}}),r},js=function(e){var r=!1;return Ft(Ct,function(i,s){if(!r)try{i(e),r=Ir(s,1)}catch{}}),r},Dn=function(e){if(!e||typeof e!="object")return!1;if(!Nn){var r=Ir(Ds(e),8,-1);return $s(ar,r)>-1?r:r!=="Object"?!1:js(e)}return It?Us(e):null},Ms=Dn,Vs=function(e){return!!Ms(e)};(function(t){var e=ls,r=ys,i=Dn,s=Vs;function u(A){return A.call.bind(A)}var f=typeof BigInt<"u",p=typeof Symbol<"u",h=u(Object.prototype.toString),m=u(Number.prototype.valueOf),l=u(String.prototype.valueOf),w=u(Boolean.prototype.valueOf);if(f)var E=u(BigInt.prototype.valueOf);if(p)var T=u(Symbol.prototype.valueOf);function _(A,lt){if(typeof A!="object")return!1;try{return lt(A),!0}catch{return!1}}t.isArgumentsObject=e,t.isGeneratorFunction=r,t.isTypedArray=s;function B(A){return typeof Promise<"u"&&A instanceof Promise||A!==null&&typeof A=="object"&&typeof A.then=="function"&&typeof A.catch=="function"}t.isPromise=B;function M(A){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(A):s(A)||v(A)}t.isArrayBufferView=M;function I(A){return i(A)==="Uint8Array"}t.isUint8Array=I;function F(A){return i(A)==="Uint8ClampedArray"}t.isUint8ClampedArray=F;function U(A){return i(A)==="Uint16Array"}t.isUint16Array=U;function L(A){return i(A)==="Uint32Array"}t.isUint32Array=L;function C(A){return i(A)==="Int8Array"}t.isInt8Array=C;function x(A){return i(A)==="Int16Array"}t.isInt16Array=x;function k(A){return i(A)==="Int32Array"}t.isInt32Array=k;function q(A){return i(A)==="Float32Array"}t.isFloat32Array=q;function ie(A){return i(A)==="Float64Array"}t.isFloat64Array=ie;function we(A){return i(A)==="BigInt64Array"}t.isBigInt64Array=we;function be(A){return i(A)==="BigUint64Array"}t.isBigUint64Array=be;function ue(A){return h(A)==="[object Map]"}ue.working=typeof Map<"u"&&ue(new Map);function ct(A){return typeof Map>"u"?!1:ue.working?ue(A):A instanceof Map}t.isMap=ct;function he(A){return h(A)==="[object Set]"}he.working=typeof Set<"u"&&he(new Set);function Re(A){return typeof Set>"u"?!1:he.working?he(A):A instanceof Set}t.isSet=Re;function xe(A){return h(A)==="[object WeakMap]"}xe.working=typeof WeakMap<"u"&&xe(new WeakMap);function Ge(A){return typeof WeakMap>"u"?!1:xe.working?xe(A):A instanceof WeakMap}t.isWeakMap=Ge;function ve(A){return h(A)==="[object WeakSet]"}ve.working=typeof WeakSet<"u"&&ve(new WeakSet);function ce(A){return ve(A)}t.isWeakSet=ce;function Be(A){return h(A)==="[object ArrayBuffer]"}Be.working=typeof ArrayBuffer<"u"&&Be(new ArrayBuffer);function ze(A){return typeof ArrayBuffer>"u"?!1:Be.working?Be(A):A instanceof ArrayBuffer}t.isArrayBuffer=ze;function g(A){return h(A)==="[object DataView]"}g.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&g(new DataView(new ArrayBuffer(1),0,1));function v(A){return typeof DataView>"u"?!1:g.working?g(A):A instanceof DataView}t.isDataView=v;var S=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function O(A){return h(A)==="[object SharedArrayBuffer]"}function j(A){return typeof S>"u"?!1:(typeof O.working>"u"&&(O.working=O(new S)),O.working?O(A):A instanceof S)}t.isSharedArrayBuffer=j;function V(A){return h(A)==="[object AsyncFunction]"}t.isAsyncFunction=V;function R(A){return h(A)==="[object Map Iterator]"}t.isMapIterator=R;function D(A){return h(A)==="[object Set Iterator]"}t.isSetIterator=D;function Q(A){return h(A)==="[object Generator]"}t.isGeneratorObject=Q;function J(A){return h(A)==="[object WebAssembly.Module]"}t.isWebAssemblyCompiledModule=J;function le(A){return _(A,m)}t.isNumberObject=le;function Ne(A){return _(A,l)}t.isStringObject=Ne;function ke(A){return _(A,w)}t.isBooleanObject=ke;function De(A){return f&&_(A,E)}t.isBigIntObject=De;function Se(A){return p&&_(A,T)}t.isSymbolObject=Se;function $e(A){return le(A)||Ne(A)||ke(A)||De(A)||Se(A)}t.isBoxedPrimitive=$e;function Nt(A){return typeof Uint8Array<"u"&&(ze(A)||j(A))}t.isAnyArrayBuffer=Nt,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(A){Object.defineProperty(t,A,{enumerable:!1,value:function(){throw new Error(A+" is not supported in userland")}})})})(An);var qs=function(e){return e&&typeof e=="object"&&typeof e.copy=="function"&&typeof e.fill=="function"&&typeof e.readUInt8=="function"},ur={exports:{}};typeof Object.create=="function"?ur.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ur.exports=function(e,r){if(r){e.super_=r;var i=function(){};i.prototype=r.prototype,e.prototype=new i,e.prototype.constructor=e}};var Qs=ur.exports;(function(t){var e=Object.getOwnPropertyDescriptors||function(v){for(var S=Object.keys(v),O={},j=0;j<S.length;j++)O[S[j]]=Object.getOwnPropertyDescriptor(v,S[j]);return O},r=/%[sdj%]/g;t.format=function(g){if(!C(g)){for(var v=[],S=0;S<arguments.length;S++)v.push(f(arguments[S]));return v.join(" ")}for(var S=1,O=arguments,j=O.length,V=String(g).replace(r,function(D){if(D==="%%")return"%";if(S>=j)return D;switch(D){case"%s":return String(O[S++]);case"%d":return Number(O[S++]);case"%j":try{return JSON.stringify(O[S++])}catch{return"[Circular]"}default:return D}}),R=O[S];S<j;R=O[++S])F(R)||!ie(R)?V+=" "+R:V+=" "+f(R);return V},t.deprecate=function(g,v){if(typeof P<"u"&&P.noDeprecation===!0)return g;if(typeof P>"u")return function(){return t.deprecate(g,v).apply(this,arguments)};var S=!1;function O(){if(!S){if(P.throwDeprecation)throw new Error(v);P.traceDeprecation?console.trace(v):console.error(v),S=!0}return g.apply(this,arguments)}return O};var i={},s=/^$/;if(P.env.NODE_DEBUG){var u=P.env.NODE_DEBUG;u=u.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),s=new RegExp("^"+u+"$","i")}t.debuglog=function(g){if(g=g.toUpperCase(),!i[g])if(s.test(g)){var v=P.pid;i[g]=function(){var S=t.format.apply(t,arguments);console.error("%s %d: %s",g,v,S)}}else i[g]=function(){};return i[g]};function f(g,v){var S={seen:[],stylize:h};return arguments.length>=3&&(S.depth=arguments[2]),arguments.length>=4&&(S.colors=arguments[3]),I(v)?S.showHidden=v:v&&t._extend(S,v),k(S.showHidden)&&(S.showHidden=!1),k(S.depth)&&(S.depth=2),k(S.colors)&&(S.colors=!1),k(S.customInspect)&&(S.customInspect=!0),S.colors&&(S.stylize=p),l(S,g,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 p(g,v){var S=f.styles[v];return S?"\x1B["+f.colors[S][0]+"m"+g+"\x1B["+f.colors[S][1]+"m":g}function h(g,v){return g}function m(g){var v={};return g.forEach(function(S,O){v[S]=!0}),v}function l(g,v,S){if(g.customInspect&&v&&ue(v.inspect)&&v.inspect!==t.inspect&&!(v.constructor&&v.constructor.prototype===v)){var O=v.inspect(S,g);return C(O)||(O=l(g,O,S)),O}var j=w(g,v);if(j)return j;var V=Object.keys(v),R=m(V);if(g.showHidden&&(V=Object.getOwnPropertyNames(v)),be(v)&&(V.indexOf("message")>=0||V.indexOf("description")>=0))return E(v);if(V.length===0){if(ue(v)){var D=v.name?": "+v.name:"";return g.stylize("[Function"+D+"]","special")}if(q(v))return g.stylize(RegExp.prototype.toString.call(v),"regexp");if(we(v))return g.stylize(Date.prototype.toString.call(v),"date");if(be(v))return E(v)}var Q="",J=!1,le=["{","}"];if(M(v)&&(J=!0,le=["[","]"]),ue(v)){var Ne=v.name?": "+v.name:"";Q=" [Function"+Ne+"]"}if(q(v)&&(Q=" "+RegExp.prototype.toString.call(v)),we(v)&&(Q=" "+Date.prototype.toUTCString.call(v)),be(v)&&(Q=" "+E(v)),V.length===0&&(!J||v.length==0))return le[0]+Q+le[1];if(S<0)return q(v)?g.stylize(RegExp.prototype.toString.call(v),"regexp"):g.stylize("[Object]","special");g.seen.push(v);var ke;return J?ke=T(g,v,S,R,V):ke=V.map(function(De){return _(g,v,S,R,De,J)}),g.seen.pop(),B(ke,Q,le)}function w(g,v){if(k(v))return g.stylize("undefined","undefined");if(C(v)){var S="'"+JSON.stringify(v).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return g.stylize(S,"string")}if(L(v))return g.stylize(""+v,"number");if(I(v))return g.stylize(""+v,"boolean");if(F(v))return g.stylize("null","null")}function E(g){return"["+Error.prototype.toString.call(g)+"]"}function T(g,v,S,O,j){for(var V=[],R=0,D=v.length;R<D;++R)ve(v,String(R))?V.push(_(g,v,S,O,String(R),!0)):V.push("");return j.forEach(function(Q){Q.match(/^\d+$/)||V.push(_(g,v,S,O,Q,!0))}),V}function _(g,v,S,O,j,V){var R,D,Q;if(Q=Object.getOwnPropertyDescriptor(v,j)||{value:v[j]},Q.get?Q.set?D=g.stylize("[Getter/Setter]","special"):D=g.stylize("[Getter]","special"):Q.set&&(D=g.stylize("[Setter]","special")),ve(O,j)||(R="["+j+"]"),D||(g.seen.indexOf(Q.value)<0?(F(S)?D=l(g,Q.value,null):D=l(g,Q.value,S-1),D.indexOf(`
8
8
  `)>-1&&(V?D=D.split(`
9
9
  `).map(function(J){return" "+J}).join(`
10
10
  `).slice(2):D=`
package/lib/es/index.js CHANGED
@@ -2532,7 +2532,7 @@ class po extends cn {
2532
2532
  type: je.QUESTION_RESOLVED,
2533
2533
  action: () => this.openQuestion(f),
2534
2534
  close: () => this.closeQuestion(f),
2535
- autoHideDuration: 35e3,
2535
+ autoHideDuration: m?.youVoted ? 15e3 : 12e3,
2536
2536
  id: p,
2537
2537
  data: {
2538
2538
  questionType: fe.PREDICTION,
@@ -2608,7 +2608,7 @@ class po extends cn {
2608
2608
  const i = e.data.question.options?.options.value, s = {
2609
2609
  heading: e.data.question.notification.title,
2610
2610
  body: e.data.question.notification.body,
2611
- image: i.image,
2611
+ image: i?.image,
2612
2612
  video: {
2613
2613
  id: i?.video?.id || "",
2614
2614
  url: i?.video?.url || "",
@@ -2632,9 +2632,9 @@ class po extends cn {
2632
2632
  });
2633
2633
  } else if (e.data.question.type === fe.TWEET) {
2634
2634
  const i = e.data.question.options?.options.value, s = {
2635
- title: e.data.question.notification.title,
2636
- body: e.data.question.notification.body,
2637
- image: e.data.question.notification.image,
2635
+ title: e.data.question.notification?.title,
2636
+ body: e.data.question.notification?.body,
2637
+ image: e.data.question.notification?.image,
2638
2638
  account: i?.tweetMeta?.account || "",
2639
2639
  accountVerified: !!i?.tweetMeta?.accountVerified
2640
2640
  };
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "@connectrpc/connect-web": "^1.3.0",
6
6
  "@nanostores/logger": "^0.2.4",
7
7
  "@nanostores/query": "^0.2.8",
8
- "@streamlayer/sl-eslib": "^5.63.3",
8
+ "@streamlayer/sl-eslib": "^5.64.1",
9
9
  "microdiff": "^1.3.2",
10
10
  "nanostores": "^0.9.5",
11
11
  "pino": "^8.17.2"
@@ -25,17 +25,17 @@
25
25
  "devDependencies": {
26
26
  "avvio": "^8.2.1",
27
27
  "tslib": "^2.6.2",
28
- "@streamlayer/feature-gamification": "^0.35.0",
29
- "@streamlayer/sdk-web-api": "^0.20.0",
30
- "@streamlayer/sdk-web-core": "^0.18.1",
31
- "@streamlayer/sdk-web-features": "^0.11.15",
32
- "@streamlayer/sdk-web-interfaces": "^0.20.0",
33
- "@streamlayer/sdk-web-logger": "^0.5.11",
34
- "@streamlayer/sdk-web-notifications": "^0.13.6",
35
- "@streamlayer/sdk-web-storage": "^0.3.11",
36
- "@streamlayer/sdk-web-types": "^0.21.0"
28
+ "@streamlayer/feature-gamification": "^0.35.1",
29
+ "@streamlayer/sdk-web-api": "^0.20.1",
30
+ "@streamlayer/sdk-web-core": "^0.18.2",
31
+ "@streamlayer/sdk-web-features": "^0.11.16",
32
+ "@streamlayer/sdk-web-interfaces": "^0.20.1",
33
+ "@streamlayer/sdk-web-logger": "^0.5.12",
34
+ "@streamlayer/sdk-web-notifications": "^0.13.7",
35
+ "@streamlayer/sdk-web-storage": "^0.3.12",
36
+ "@streamlayer/sdk-web-types": "^0.21.1"
37
37
  },
38
- "version": "0.30.1",
38
+ "version": "0.30.2",
39
39
  "type": "module",
40
40
  "main": "./src/index.js",
41
41
  "typings": "./src/index.d.ts"