@imtbl/audience 2.20.1-alpha.0 → 2.20.1-alpha.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.
@@ -1,6 +1,6 @@
1
- var mn=Object.create;var lt=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var vn=Object.getOwnPropertyNames;var bn=Object.getPrototypeOf,En=Object.prototype.hasOwnProperty;var ft=(r,i)=>()=>(r&&(i=r(r=0)),i);var In=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var _n=(r,i,s,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of vn(i))!En.call(r,c)&&c!==s&&lt(r,c,{get:()=>i[c],enumerable:!(f=wn(i,c))||f.enumerable});return r};var An=(r,i,s)=>(s=r!=null?mn(bn(r)):{},_n(lt(s,"default",{value:r,enumerable:!0}),r));var B=ft(()=>{});var T=ft(()=>{});var yt=In(se=>{T();B();Object.defineProperty(se,"__esModule",{value:!0});se.clearGlobalNamespace=se.getGlobalisedValue=void 0;var Bn="globalise__singleton__",Tn={},pt=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:Tn,kn=(r,i)=>{if(typeof r!="string")throw "Invalid namespace key";if(typeof i!="string")throw "Invalid item key"},dt=r=>`${Bn}${r}`,gt=r=>{let i=pt(),s=dt(r);return i[s]||(i[s]={}),i[s]},Un=(r,i)=>gt(r)[i]||void 0,On=(r,i,s)=>{let f=gt(r);f[i]=s;},Pn=(r,i,s)=>{kn(r,i);let f=Un(r,i);return f!==void 0?f:(On(r,i,s),s)};se.getGlobalisedValue=Pn;var Nn=r=>{let i=pt(),s=dt(r);i[s]!==void 0&&delete i[s];};se.clearGlobalNamespace=Nn;});T();B();T();B();T();B();T();B();T();B();T();B();var Oe=class{constructor(i=0,s=0,f=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=i,this.resetTtl=f,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(i){if(this.has(i)){let s=this.items[i];delete this.items[i],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(i=this.keys()){return i.map(s=>[s,this.get(s)])}evict(i=!1){if(i||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(i){let s;return this.has(i)&&(s=this.items[i].expiry),s}get(i){let s;if(this.has(i)){let f=this.items[i];this.ttl>0&&f.expiry<=Date.now()?this.delete(i):(s=f.value,this.set(i,s,!0));}return s}has(i){return i in this.items}keys(){let i=[],s=this.first;for(;s!==null;)i.push(s.key),s=s.next;return i}set(i,s,f=!1,c=this.resetTtl){let p;if(f||this.has(i)){if(p=this.items[i],p.value=s,f===!1&&c&&(p.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==p){let a=this.last,g=p.next,y=p.prev;this.first===p&&(this.first=p.next),p.next=null,p.prev=this.last,a.next=p,y!==null&&(y.next=g),g!==null&&(g.prev=y);}}else this.max>0&&this.size===this.max&&this.evict(!0),p=this.items[i]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:i,prev:this.last,next:null,value:s},++this.size===1?this.first=p:this.last.next=p;return this.last=p,this}values(i=this.keys()){return i.map(s=>this.get(s))}};function ht(r=1e3,i=0,s=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(i)||i<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new Oe(r,i,s)}var Sn={max:1e3},ct=(r,i={})=>{let{cache:s,cacheKeyResolver:f=Pe,onHit:c,lruOptions:p={}}=i,a={...Sn,...p},g=s||ht(a.max,a.ttl);function y(...x){let v=f(...x),w=g.get(v);if(g.has(v))return c&&c(v,w,g),w;let d=r.apply(this,x);return g.set(v,d),d}return y._cache=g,y},Pe=(...r)=>r.length===0?"no-args":r.map(i=>i===void 0?"undefined":i===null?"null":Array.isArray(i)?`[${Pe(...i)}]`:typeof i=="object"?`{${Pe(...xn(i))}}`:JSON.stringify(i)).join(","),xn=r=>Object.entries(r).sort((i,s)=>i[0]<s[0]?-1:1);var Ge=An(yt()),Rn=Object.defineProperty,Cn=(r,i)=>{for(var s in i)Rn(r,s,{get:i[s],enumerable:!0});};function qe(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}var q=[],oe=!1,J,be=-1;function Ln(){!oe||!J||(oe=!1,J.length?q=J.concat(q):be=-1,q.length&&It());}function It(){if(!oe){var r=setTimeout(Ln,0);oe=!0;for(var i=q.length;i;){for(J=q,q=[];++be<i;)J&&J[be].run();be=-1,i=q.length;}J=null,oe=!1,clearTimeout(r);}}function Mn(r){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];q.push(new _t(r,i)),q.length===1&&!oe&&setTimeout(It,0);}function _t(r,i){this.fun=r,this.array=i;}_t.prototype.run=function(){this.fun.apply(null,this.array);};var $n="browser",Dn="x64",Fn="browser",jn={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Gn=["/usr/bin/node"],qn=[],Vn="v16.8.0",Kn={},zn=function(r,i){console.warn((i?i+": ":"")+r);},Hn=function(r){qe("binding");},Wn=function(r){return 0},Yn=function(){return "/"},Jn=function(r){},Xn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function R(){}var Qn=R,Zn=[];function er(r){qe("_linkedBinding");}var tr={},nr=!1,rr={};function ir(r){qe("dlopen");}function sr(){return []}function or(){return []}var ar=R,ur=R,Ve=function(){return {}},lr=Ve,fr=Ve,hr=R,cr=R,pr=R,dr={};function gr(r,i){if(!r)throw new Error(i||"assertion error")}var yr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},mr=R,wr=R;function vr(){return !1}var br=R,Er=R,Ir=R,_r=R,Ar=R,Sr=void 0,xr=void 0,Br=void 0,Tr=R,kr=2,Ur=1,Or="/bin/usr/node",Pr=9229,Nr="node",Rr=[],Cr=R,K={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};K.now===void 0&&(Ne=Date.now(),K.timing&&K.timing.navigationStart&&(Ne=K.timing.navigationStart),K.now=()=>Date.now()-Ne);var Ne;function Lr(){return K.now()/1e3}var Ce=1e9;function Le(r){var i=Math.floor((Date.now()-K.now())*.001),s=K.now()*.001,f=Math.floor(s)+i,c=Math.floor(s%1*1e9);return r&&(f=f-r[0],c=c-r[1],c<0&&(f--,c+=Ce)),[f,c]}Le.bigint=function(r){var i=Le(r);return typeof BigInt>"u"?i[0]*Ce+i[1]:BigInt(i[0]*Ce)+BigInt(i[1])};var Mr=10,$r={},Dr=0;function z(){return Me}var Fr=z,jr=z,Gr=z,qr=z,Vr=z,Kr=R,zr=z,Hr=z;function Wr(r){return []}var Me={version:Vn,versions:Kn,arch:Dn,platform:Fn,release:Xn,_rawDebug:Qn,moduleLoadList:Zn,binding:Hn,_linkedBinding:er,_events:$r,_eventsCount:Dr,_maxListeners:Mr,on:z,addListener:Fr,once:jr,off:Gr,removeListener:qr,removeAllListeners:Vr,emit:Kr,prependListener:zr,prependOnceListener:Hr,listeners:Wr,domain:tr,_exiting:nr,config:rr,dlopen:ir,uptime:Lr,_getActiveRequests:sr,_getActiveHandles:or,reallyExit:ar,_kill:ur,cpuUsage:Ve,resourceUsage:lr,memoryUsage:fr,kill:hr,exit:cr,openStdin:pr,allowedNodeEnvironmentFlags:dr,assert:gr,features:yr,_fatalExceptions:mr,setUncaughtExceptionCaptureCallback:wr,hasUncaughtExceptionCaptureCallback:vr,emitWarning:zn,nextTick:Mn,_tickCallback:br,_debugProcess:Er,_debugEnd:Ir,_startProfilerIdleNotifier:_r,_stopProfilerIdleNotifier:Ar,stdout:Sr,stdin:Br,stderr:xr,abort:Tr,umask:Wn,chdir:Jn,cwd:Yn,env:jn,title:$n,argv:Gn,execArgv:qn,pid:kr,ppid:Ur,execPath:Or,debugPort:Pr,hrtime:Le,argv0:Nr,_preload_modules:Rr,setSourceMapsEnabled:Cr},pe={},mt=!1;function Yr(){if(mt)return pe;mt=!0,pe.byteLength=g,pe.toByteArray=x,pe.fromByteArray=b;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,p=f.length;c<p;++c)r[c]=f[c],i[f.charCodeAt(c)]=c;i[45]=62,i[95]=63;function a(d){var m=d.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=d.indexOf("=");E===-1&&(E=m);var S=E===m?0:4-E%4;return [E,S]}function g(d){var m=a(d),E=m[0],S=m[1];return (E+S)*3/4-S}function y(d,m,E){return (m+E)*3/4-E}function x(d){var m,E=a(d),S=E[0],N=E[1],k=new s(y(d,S,N)),L=0,$=N>0?S-4:S,C;for(C=0;C<$;C+=4)m=i[d.charCodeAt(C)]<<18|i[d.charCodeAt(C+1)]<<12|i[d.charCodeAt(C+2)]<<6|i[d.charCodeAt(C+3)],k[L++]=m>>16&255,k[L++]=m>>8&255,k[L++]=m&255;return N===2&&(m=i[d.charCodeAt(C)]<<2|i[d.charCodeAt(C+1)]>>4,k[L++]=m&255),N===1&&(m=i[d.charCodeAt(C)]<<10|i[d.charCodeAt(C+1)]<<4|i[d.charCodeAt(C+2)]>>2,k[L++]=m>>8&255,k[L++]=m&255),k}function v(d){return r[d>>18&63]+r[d>>12&63]+r[d>>6&63]+r[d&63]}function w(d,m,E){for(var S,N=[],k=m;k<E;k+=3)S=(d[k]<<16&16711680)+(d[k+1]<<8&65280)+(d[k+2]&255),N.push(v(S));return N.join("")}function b(d){for(var m,E=d.length,S=E%3,N=[],k=16383,L=0,$=E-S;L<$;L+=k)N.push(w(d,L,L+k>$?$:L+k));return S===1?(m=d[E-1],N.push(r[m>>2]+r[m<<4&63]+"==")):S===2&&(m=(d[E-2]<<8)+d[E-1],N.push(r[m>>10]+r[m>>4&63]+r[m<<2&63]+"=")),N.join("")}return pe}var ve={},wt=!1;function Jr(){return wt?ve:(wt=!0,ve.read=function(r,i,s,f,c){var p,a,g=c*8-f-1,y=(1<<g)-1,x=y>>1,v=-7,w=s?c-1:0,b=s?-1:1,d=r[i+w];for(w+=b,p=d&(1<<-v)-1,d>>=-v,v+=g;v>0;p=p*256+r[i+w],w+=b,v-=8);for(a=p&(1<<-v)-1,p>>=-v,v+=f;v>0;a=a*256+r[i+w],w+=b,v-=8);if(p===0)p=1-x;else {if(p===y)return a?NaN:(d?-1:1)*(1/0);a=a+Math.pow(2,f),p=p-x;}return (d?-1:1)*a*Math.pow(2,p-f)},ve.write=function(r,i,s,f,c,p){var a,g,y,x=p*8-c-1,v=(1<<x)-1,w=v>>1,b=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=f?0:p-1,m=f?1:-1,E=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(g=isNaN(i)?1:0,a=v):(a=Math.floor(Math.log(i)/Math.LN2),i*(y=Math.pow(2,-a))<1&&(a--,y*=2),a+w>=1?i+=b/y:i+=b*Math.pow(2,1-w),i*y>=2&&(a++,y/=2),a+w>=v?(g=0,a=v):a+w>=1?(g=(i*y-1)*Math.pow(2,c),a=a+w):(g=i*Math.pow(2,w-1)*Math.pow(2,c),a=0));c>=8;r[s+d]=g&255,d+=m,g/=256,c-=8);for(a=a<<c|g,x+=c;x>0;r[s+d]=a&255,d+=m,a/=256,x-=8);r[s+d-m]|=E*128;},ve)}var Y={},vt=!1;function Xr(){if(vt)return Y;vt=!0;let r=Yr(),i=Jr(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Y.Buffer=a,Y.SlowBuffer=N,Y.INSPECT_MAX_BYTES=50;let f=2147483647;Y.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=c(),!a.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 c(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return !1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function p(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(e)}return g(e,t,n)}a.poolSize=8192;function g(e,t,n){if(typeof e=="string")return w(e,t);if(ArrayBuffer.isView(e))return d(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return m(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let u=E(e);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,t,n){return g(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function y(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function x(e,t,n){return y(e),e<=0?p(e):t!==void 0?typeof n=="string"?p(e).fill(t,n):p(e).fill(t):p(e)}a.alloc=function(e,t,n){return x(e,t,n)};function v(e){return y(e),p(e<0?0:S(e)|0)}a.allocUnsafe=function(e){return v(e)},a.allocUnsafeSlow=function(e){return v(e)};function w(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=k(e,t)|0,o=p(n),u=o.write(e,t);return u!==n&&(o=o.slice(0,u)),o}function b(e){let t=e.length<0?0:S(e.length)|0,n=p(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function d(e){if(F(e,Uint8Array)){let t=new Uint8Array(e);return m(t.buffer,t.byteOffset,t.byteLength)}return b(e)}function m(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return t===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,n),Object.setPrototypeOf(o,a.prototype),o}function E(e){if(a.isBuffer(e)){let t=S(e.length)|0,n=p(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!="number"||Ue(e.length)?p(0):b(e);if(e.type==="Buffer"&&Array.isArray(e.data))return b(e.data)}function S(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function N(e){return +e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype},a.compare=function(e,t){if(F(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,o=t.length;for(let u=0,l=Math.min(n,o);u<l;++u)if(e[u]!==t[u]){n=e[u],o=t[u];break}return n<o?-1:o<n?1:0},a.isEncoding=function(e){switch(String(e).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}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=a.allocUnsafe(t),u=0;for(n=0;n<e.length;++n){let l=e[n];if(F(l,Uint8Array))u+l.length>o.length?(a.isBuffer(l)||(l=a.from(l)),l.copy(o,u)):Uint8Array.prototype.set.call(o,l,u);else if(a.isBuffer(l))l.copy(o,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=l.length;}return o};function k(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let u=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ke(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return ut(e).length;default:if(u)return o?-1:ke(e).length;t=(""+t).toLowerCase(),u=!0;}}a.byteLength=k;function L(e,t,n){let o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return "";for(e||(e="utf8");;)switch(e){case"hex":return un(this,t,n);case"utf8":case"utf-8":return Ze(this,t,n);case"ascii":return on(this,t,n);case"latin1":case"binary":return an(this,t,n);case"base64":return rn(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ln(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0;}}a.prototype._isBuffer=!0;function $(e,t,n){let o=e[t];e[t]=e[n],e[n]=o;}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)$(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)$(this,t,t+3),$(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)$(this,t,t+7),$(this,t+1,t+6),$(this,t+2,t+5),$(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ze(this,0,e):L.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=Y.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,o,u){if(F(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),u===void 0&&(u=this.length),t<0||n>e.length||o<0||u>this.length)throw new RangeError("out of range index");if(o>=u&&t>=n)return 0;if(o>=u)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,u>>>=0,this===e)return 0;let l=u-o,h=n-t,_=Math.min(l,h),P=this.slice(o,u),A=e.slice(t,n);for(let I=0;I<_;++I)if(P[I]!==A[I]){l=P[I],h=A[I];break}return l<h?-1:h<l?1:0};function C(e,t,n,o,u){if(e.length===0)return -1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ue(n)&&(n=u?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(u)return -1;n=e.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:Qe(e,t,n,o,u);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?u?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Qe(e,[t],n,o,u);throw new TypeError("val must be string, number or Buffer")}function Qe(e,t,n,o,u){let l=1,h=e.length,_=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return -1;l=2,h/=2,_/=2,n/=2;}function P(I,U){return l===1?I[U]:I.readUInt16BE(U*l)}let A;if(u){let I=-1;for(A=n;A<h;A++)if(P(e,A)===P(t,I===-1?0:A-I)){if(I===-1&&(I=A),A-I+1===_)return I*l}else I!==-1&&(A-=A-I),I=-1;}else for(n+_>h&&(n=h-_),A=n;A>=0;A--){let I=!0;for(let U=0;U<_;U++)if(P(e,A+U)!==P(t,U)){I=!1;break}if(I)return A}return -1}a.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},a.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)};function Qt(e,t,n,o){n=Number(n)||0;let u=e.length-n;o?(o=Number(o),o>u&&(o=u)):o=u;let l=t.length;o>l/2&&(o=l/2);let h;for(h=0;h<o;++h){let _=parseInt(t.substr(h*2,2),16);if(Ue(_))return h;e[n+h]=_;}return h}function Zt(e,t,n,o){return we(ke(t,e.length-n),e,n,o)}function en(e,t,n,o){return we(pn(t),e,n,o)}function tn(e,t,n,o){return we(ut(t),e,n,o)}function nn(e,t,n,o){return we(dn(t,e.length-n),e,n,o)}a.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((n===void 0||n>u)&&(n=u),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let l=!1;for(;;)switch(o){case"hex":return Qt(this,e,t,n);case"utf8":case"utf-8":return Zt(this,e,t,n);case"ascii":case"latin1":case"binary":return en(this,e,t,n);case"base64":return tn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nn(this,e,t,n);default:if(l)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),l=!0;}},a.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function rn(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function Ze(e,t,n){n=Math.min(e.length,n);let o=[],u=t;for(;u<n;){let l=e[u],h=null,_=l>239?4:l>223?3:l>191?2:1;if(u+_<=n){let P,A,I,U;switch(_){case 1:l<128&&(h=l);break;case 2:P=e[u+1],(P&192)===128&&(U=(l&31)<<6|P&63,U>127&&(h=U));break;case 3:P=e[u+1],A=e[u+2],(P&192)===128&&(A&192)===128&&(U=(l&15)<<12|(P&63)<<6|A&63,U>2047&&(U<55296||U>57343)&&(h=U));break;case 4:P=e[u+1],A=e[u+2],I=e[u+3],(P&192)===128&&(A&192)===128&&(I&192)===128&&(U=(l&15)<<18|(P&63)<<12|(A&63)<<6|I&63,U>65535&&U<1114112&&(h=U));}}h===null?(h=65533,_=1):h>65535&&(h-=65536,o.push(h>>>10&1023|55296),h=56320|h&1023),o.push(h),u+=_;}return sn(o)}let et=4096;function sn(e){let t=e.length;if(t<=et)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=et));return n}function on(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]&127);return o}function an(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]);return o}function un(e,t,n){let o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);let u="";for(let l=t;l<n;++l)u+=gn[e[l]];return u}function ln(e,t,n){let o=e.slice(t,n),u="";for(let l=0;l<o.length-1;l+=2)u+=String.fromCharCode(o[l]+o[l+1]*256);return u}a.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let o=this.subarray(e,t);return Object.setPrototypeOf(o,a.prototype),o};function O(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e+--t],u=1;for(;t>0&&(u*=256);)o+=this[e+--t]*u;return o},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||O(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||O(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||O(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=V(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let o=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(u)<<BigInt(32))}),a.prototype.readBigUInt64BE=V(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let o=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(u)}),a.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*t)),o},a.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=t,u=1,l=this[e+--o];for(;o>0&&(u*=256);)l+=this[e+--o]*u;return u*=128,l>=u&&(l-=Math.pow(2,8*t)),l},a.prototype.readInt8=function(e,t){return e=e>>>0,t||O(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||O(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||O(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=V(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=V(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let o=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||O(e,8,this.length),i.read(this,e,!1,52,8)};function M(e,t,n,o,u,l){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>u||t<l)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let h=Math.pow(2,8*n)-1;M(this,e,t,n,h,0);}let u=1,l=0;for(this[t]=e&255;++l<n&&(u*=256);)this[t+l]=e/u&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let h=Math.pow(2,8*n)-1;M(this,e,t,n,h,0);}let u=n-1,l=1;for(this[t+u]=e&255;--u>=0&&(l*=256);)this[t+u]=e/l&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function tt(e,t,n,o,u){at(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l;let h=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=h,h=h>>8,e[n++]=h,h=h>>8,e[n++]=h,h=h>>8,e[n++]=h,n}function nt(e,t,n,o,u){at(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n+7]=l,l=l>>8,e[n+6]=l,l=l>>8,e[n+5]=l,l=l>>8,e[n+4]=l;let h=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=h,h=h>>8,e[n+2]=h,h=h>>8,e[n+1]=h,h=h>>8,e[n]=h,n+8}a.prototype.writeBigUInt64LE=V(function(e,t=0){return tt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=V(function(e,t=0){return nt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let _=Math.pow(2,8*n-1);M(this,e,t,n,_-1,-_);}let u=0,l=1,h=0;for(this[t]=e&255;++u<n&&(l*=256);)e<0&&h===0&&this[t+u-1]!==0&&(h=1),this[t+u]=(e/l>>0)-h&255;return t+n},a.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let _=Math.pow(2,8*n-1);M(this,e,t,n,_-1,-_);}let u=n-1,l=1,h=0;for(this[t+u]=e&255;--u>=0&&(l*=256);)e<0&&h===0&&this[t+u+1]!==0&&(h=1),this[t+u]=(e/l>>0)-h&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=V(function(e,t=0){return tt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=V(function(e,t=0){return nt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rt(e,t,n,o,u,l){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function it(e,t,n,o,u){return t=+t,n=n>>>0,u||rt(e,t,n,4),i.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(e,t,n){return it(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return it(this,e,t,!1,n)};function st(e,t,n,o,u){return t=+t,n=n>>>0,u||rt(e,t,n,8),i.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(e,t,n){return st(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return st(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,o){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let u=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),u},a.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let l=e.charCodeAt(0);(o==="utf8"&&l<128||o==="latin1")&&(e=l);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<n;++u)this[u]=e;else {let l=a.isBuffer(e)?e:a.from(e,o),h=l.length;if(h===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<n-t;++u)this[u+t]=l[u%h];}return this};let re={};function Te(e,t,n){re[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name;}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Te("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),Te("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,u=n;return Number.isInteger(n)&&Math.abs(n)>2**32?u=ot(String(n)):typeof n=="bigint"&&(u=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(u=ot(u)),u+="n"),o+=` It must be ${t}. Received ${u}`,o},RangeError);function ot(e){let t="",n=e.length,o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return `${e.slice(0,n)}${t}`}function fn(e,t,n){ie(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&ce(t,e.length-(n+1));}function at(e,t,n,o,u,l){if(e>n||e<t){let h=typeof t=="bigint"?"n":"",_;throw t===0||t===BigInt(0)?_=`>= 0${h} and < 2${h} ** ${(l+1)*8}${h}`:_=`>= -(2${h} ** ${(l+1)*8-1}${h}) and < 2 ** ${(l+1)*8-1}${h}`,new re.ERR_OUT_OF_RANGE("value",_,e)}fn(o,u,l);}function ie(e,t){if(typeof e!="number")throw new re.ERR_INVALID_ARG_TYPE(t,"number",e)}function ce(e,t,n){throw Math.floor(e)!==e?(ie(e,n),new re.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new re.ERR_BUFFER_OUT_OF_BOUNDS:new re.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}let hn=/[^+/0-9A-Za-z-_]/g;function cn(e){if(e=e.split("=")[0],e=e.trim().replace(hn,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function ke(e,t){t=t||1/0;let n,o=e.length,u=null,l=[];for(let h=0;h<o;++h){if(n=e.charCodeAt(h),n>55295&&n<57344){if(!u){if(n>56319){(t-=3)>-1&&l.push(239,191,189);continue}else if(h+1===o){(t-=3)>-1&&l.push(239,191,189);continue}u=n;continue}if(n<56320){(t-=3)>-1&&l.push(239,191,189),u=n;continue}n=(u-55296<<10|n-56320)+65536;}else u&&(t-=3)>-1&&l.push(239,191,189);if(u=null,n<128){if((t-=1)<0)break;l.push(n);}else if(n<2048){if((t-=2)<0)break;l.push(n>>6|192,n&63|128);}else if(n<65536){if((t-=3)<0)break;l.push(n>>12|224,n>>6&63|128,n&63|128);}else if(n<1114112){if((t-=4)<0)break;l.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128);}else throw new Error("Invalid code point")}return l}function pn(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function dn(e,t){let n,o,u,l=[];for(let h=0;h<e.length&&!((t-=2)<0);++h)n=e.charCodeAt(h),o=n>>8,u=n%256,l.push(u),l.push(o);return l}function ut(e){return r.toByteArray(cn(e))}function we(e,t,n,o){let u;for(u=0;u<o&&!(u+n>=t.length||u>=e.length);++u)t[u+n]=e[u];return u}function F(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ue(e){return e!==e}let gn=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let o=n*16;for(let u=0;u<16;++u)t[o+u]=e[n]+e[u];}return t}();function V(e){return typeof BigInt>"u"?yn:e}function yn(){throw new Error("BigInt not supported")}return Y}var ee=Xr();ee.Buffer;ee.SlowBuffer;ee.INSPECT_MAX_BYTES;ee.kMaxLength;var bt=ee.Buffer;ee.INSPECT_MAX_BYTES;ee.kMaxLength;var Qr={};Cn(Qr,{deleteItem:()=>ni,getItem:()=>$e,setItem:()=>Ie});var Ee=()=>typeof window>"u",At=()=>!Ee(),Zr="__IMX-",Ke=()=>At()&&window.localStorage,ei=r=>{if(r!==null)try{return JSON.parse(r)}catch{return r}},ti=r=>typeof r=="string"?r:JSON.stringify(r),ze=r=>`${Zr}${r}`;function $e(r){if(Ke())return ei(window.localStorage.getItem(ze(r)))}var Ie=(r,i)=>Ke()?(window.localStorage.setItem(ze(r),ti(i)),!0):!1,ni=r=>Ke()?(window.localStorage.removeItem(ze(r)),!0):!1,De=0,ri=r=>{let i=parseInt(r,10)*1e3,s=new Date(i),f=new Date;return De=s.getTime()-f.getTime(),De},ii=()=>{let r=new Date().getTime()+De;return new Date(r).toISOString()},si=(r=>(r.RUNTIME_ID="rid",r.PASSPORT_CLIENT_ID="passportClientId",r.ENVIRONMENT="env",r.PUBLISHABLE_API_KEY="pak",r.IDENTITY="uid",r.DOMAIN="domain",r.SDK_VERSION="sdkVersion",r))(si||{}),oi="https://api.immutable.com",ai=r=>{if(typeof bt<"u")return bt.from(r,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(r)));throw new Error("Base64 encoding not supported in this environment")};async function St(r,i){let s=JSON.stringify(i),f={payload:ai(s)},c=await fetch(`${oi}${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!c.ok){let p=await c.text().catch(()=>"");throw new Error(`Request failed (${c.status}): ${p||c.statusText}`)}return c.json()}var X,Q,ui=()=>{X=$e("metrics-events")||[],Q=$e("metrics-runtime")||{};};ui();var Z=(r,i)=>{Q={...Q,[r]:i},Ie("metrics-runtime",Q);},Fe=r=>{if(Q[r]!==void 0)return Q[r]},li=()=>Q,fi=()=>X,hi=r=>{X.push(r),Ie("metrics-events",X);},ci=r=>{X=X.slice(r),Ie("metrics-events",X);},xt=r=>{let i=[];return Object.entries(r).forEach(([s,f])=>{(typeof s=="string"||typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&i.push([s,f.toString()]);}),i},Re="2.20.1-alpha.0",pi=()=>Ee()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",di=()=>{if(Ee())return "";let r;try{window.self!==window.top&&(r=pi());}catch{}return r||(r=window.location.hostname),r},gi=()=>{if(Z("sdkVersion",Re),Ee())return {browser:"nodejs",sdkVersion:Re};let r=di();return r&&Z("domain",r),{sdkVersion:Re,browser:window.navigator.userAgent,domain:r,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},je=!1,yi=()=>je,mi=async()=>{je=!0;try{let r=xt(gi()),i=Fe("rid"),s=Fe("uid"),f=await St("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:s}}),{runtimeId:c,sTime:p}=f;Z("rid",c),ri(p);}catch{je=!1;}};function D(r,i){return (...s)=>{try{let f=r(...s);return f instanceof Promise?f.catch(()=>i):f}catch{return i}}}function wi(){return At()||typeof Me>"u"?!1:Me.env.JEST_WORKER_ID!==void 0}var vi=D(wi,!1),Bt="imtbl__metrics",bi=5e3,Ei=1e3,de=(r,i)=>(0, Ge.getGlobalisedValue)(Bt,r,i),Ii=(r,i)=>{let s=ct(i,{lruOptions:{ttl:bi,max:Ei}});return (0, Ge.getGlobalisedValue)(Bt,r,s)},_i=5e3,Ai=(r,i,s)=>{let f={event:`${r}.${i}`,time:ii(),...s&&{properties:xt(s)}};hi(f);},te=D(Ii("track",Ai)),Si=async()=>{if(yi()===!1){await mi();return}let r=fi();if(r.length===0)return;let i=r.length,s=li();await St("/v1/sdk/metrics",{version:1,data:{events:r,details:s}})instanceof Error||ci(i);},xi=D(Si),Tt=async()=>{await xi(),setTimeout(Tt,_i);},Et=!1,Bi=()=>{Et||(Et=!0,Tt());};vi()||D(de("startFlushing",Bi))();var Ri=(r,i,s,f)=>{let{message:c}=s,p=s.stack||"",{cause:a}=s;a instanceof Error&&(p=`${p}
1
+ var vn=Object.create;var pt=Object.defineProperty;var En=Object.getOwnPropertyDescriptor;var In=Object.getOwnPropertyNames;var _n=Object.getPrototypeOf,An=Object.prototype.hasOwnProperty;var gt=(r,i)=>()=>(r&&(i=r(r=0)),i);var Sn=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var xn=(r,i,s,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of In(i))!An.call(r,h)&&h!==s&&pt(r,h,{get:()=>i[h],enumerable:!(f=En(i,h))||f.enumerable});return r};var Bn=(r,i,s)=>(s=r!=null?vn(_n(r)):{},xn(pt(s,"default",{value:r,enumerable:!0}),r));var A=gt(()=>{});var S=gt(()=>{});var _t=Sn(ce=>{S();A();Object.defineProperty(ce,"__esModule",{value:!0});ce.clearGlobalNamespace=ce.getGlobalisedValue=void 0;var Un="globalise__singleton__",On={},vt=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:On,Pn=(r,i)=>{if(typeof r!="string")throw "Invalid namespace key";if(typeof i!="string")throw "Invalid item key"},Et=r=>`${Un}${r}`,It=r=>{let i=vt(),s=Et(r);return i[s]||(i[s]={}),i[s]},Nn=(r,i)=>It(r)[i]||void 0,Rn=(r,i,s)=>{let f=It(r);f[i]=s;},Cn=(r,i,s)=>{Pn(r,i);let f=Nn(r,i);return f!==void 0?f:(Rn(r,i,s),s)};ce.getGlobalisedValue=Cn;var Ln=r=>{let i=vt(),s=Et(r);i[s]!==void 0&&delete i[s];};ce.clearGlobalNamespace=Ln;});S();A();S();A();S();A();S();A();var Oe="https://api.immutable.com",mt="/v1/audience/messages",yt="/v1/audience/tracking-consent",z="imtbl_anon_id",H="_imtbl_sid",Pe="session_start",Ne="session_end",q=()=>typeof window<"u"&&typeof document<"u",W=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let i=Math.trunc(Math.random()*16);return (r==="x"?i:i%4+8).toString(16)}),Re=()=>new Date().toISOString();function le(r){if(!q())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function fe(r,i,s,f){if(!q())return;let h=window.location.protocol==="https:"?"; Secure":"",d=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${s}; SameSite=Lax${d}${h}`;}function he(r,i){fe(r,"",0,i);}function ye(r){let i=le(z);if(i)return i;let s=W();return fe(z,s,63072e3,r),s}function Ce(r,i){fe(z,r,63072e3,i);}S();A();S();A();S();A();var Le=class{constructor(i=0,s=0,f=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=i,this.resetTtl=f,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(i){if(this.has(i)){let s=this.items[i];delete this.items[i],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(i=this.keys()){return i.map(s=>[s,this.get(s)])}evict(i=!1){if(i||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(i){let s;return this.has(i)&&(s=this.items[i].expiry),s}get(i){let s;if(this.has(i)){let f=this.items[i];this.ttl>0&&f.expiry<=Date.now()?this.delete(i):(s=f.value,this.set(i,s,!0));}return s}has(i){return i in this.items}keys(){let i=[],s=this.first;for(;s!==null;)i.push(s.key),s=s.next;return i}set(i,s,f=!1,h=this.resetTtl){let d;if(f||this.has(i)){if(d=this.items[i],d.value=s,f===!1&&h&&(d.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==d){let a=this.last,g=d.next,m=d.prev;this.first===d&&(this.first=d.next),d.next=null,d.prev=this.last,a.next=d,m!==null&&(m.next=g),g!==null&&(g.prev=m);}}else this.max>0&&this.size===this.max&&this.evict(!0),d=this.items[i]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:i,prev:this.last,next:null,value:s},++this.size===1?this.first=d:this.last.next=d;return this.last=d,this}values(i=this.keys()){return i.map(s=>this.get(s))}};function wt(r=1e3,i=0,s=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(i)||i<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new Le(r,i,s)}var Tn={max:1e3},bt=(r,i={})=>{let{cache:s,cacheKeyResolver:f=Me,onHit:h,lruOptions:d={}}=i,a={...Tn,...d},g=s||wt(a.max,a.ttl);function m(...B){let b=f(...B),w=g.get(b);if(g.has(b))return h&&h(b,w,g),w;let p=r.apply(this,B);return g.set(b,p),p}return m._cache=g,m},Me=(...r)=>r.length===0?"no-args":r.map(i=>i===void 0?"undefined":i===null?"null":Array.isArray(i)?`[${Me(...i)}]`:typeof i=="object"?`{${Me(...kn(i))}}`:JSON.stringify(i)).join(","),kn=r=>Object.entries(r).sort((i,s)=>i[0]<s[0]?-1:1);var He=Bn(_t()),Mn=Object.defineProperty,$n=(r,i)=>{for(var s in i)Mn(r,s,{get:i[s],enumerable:!0});};function We(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}var V=[],de=!1,ee,_e=-1;function Dn(){!de||!ee||(de=!1,ee.length?V=ee.concat(V):_e=-1,V.length&&kt());}function kt(){if(!de){var r=setTimeout(Dn,0);de=!0;for(var i=V.length;i;){for(ee=V,V=[];++_e<i;)ee&&ee[_e].run();_e=-1,i=V.length;}ee=null,de=!1,clearTimeout(r);}}function Fn(r){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];V.push(new Ut(r,i)),V.length===1&&!de&&setTimeout(kt,0);}function Ut(r,i){this.fun=r,this.array=i;}Ut.prototype.run=function(){this.fun.apply(null,this.array);};var jn="browser",Gn="x64",qn="browser",Vn={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Kn=["/usr/bin/node"],zn=[],Hn="v16.8.0",Wn={},Yn=function(r,i){console.warn((i?i+": ":"")+r);},Jn=function(r){We("binding");},Xn=function(r){return 0},Qn=function(){return "/"},Zn=function(r){},er={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function R(){}var tr=R,nr=[];function rr(r){We("_linkedBinding");}var ir={},sr=!1,or={};function ar(r){We("dlopen");}function ur(){return []}function lr(){return []}var fr=R,hr=R,Ye=function(){return {}},cr=Ye,dr=Ye,pr=R,gr=R,mr=R,yr={};function wr(r,i){if(!r)throw new Error(i||"assertion error")}var br={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},vr=R,Er=R;function Ir(){return !1}var _r=R,Ar=R,Sr=R,xr=R,Br=R,Tr=void 0,kr=void 0,Ur=void 0,Or=R,Pr=2,Nr=1,Rr="/bin/usr/node",Cr=9229,Lr="node",Mr=[],$r=R,Y={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Y.now===void 0&&($e=Date.now(),Y.timing&&Y.timing.navigationStart&&($e=Y.timing.navigationStart),Y.now=()=>Date.now()-$e);var $e;function Dr(){return Y.now()/1e3}var Fe=1e9;function je(r){var i=Math.floor((Date.now()-Y.now())*.001),s=Y.now()*.001,f=Math.floor(s)+i,h=Math.floor(s%1*1e9);return r&&(f=f-r[0],h=h-r[1],h<0&&(f--,h+=Fe)),[f,h]}je.bigint=function(r){var i=je(r);return typeof BigInt>"u"?i[0]*Fe+i[1]:BigInt(i[0]*Fe)+BigInt(i[1])};var Fr=10,jr={},Gr=0;function J(){return Ge}var qr=J,Vr=J,Kr=J,zr=J,Hr=J,Wr=R,Yr=J,Jr=J;function Xr(r){return []}var Ge={version:Hn,versions:Wn,arch:Gn,platform:qn,release:er,_rawDebug:tr,moduleLoadList:nr,binding:Jn,_linkedBinding:rr,_events:jr,_eventsCount:Gr,_maxListeners:Fr,on:J,addListener:qr,once:Vr,off:Kr,removeListener:zr,removeAllListeners:Hr,emit:Wr,prependListener:Yr,prependOnceListener:Jr,listeners:Xr,domain:ir,_exiting:sr,config:or,dlopen:ar,uptime:Dr,_getActiveRequests:ur,_getActiveHandles:lr,reallyExit:fr,_kill:hr,cpuUsage:Ye,resourceUsage:cr,memoryUsage:dr,kill:pr,exit:gr,openStdin:mr,allowedNodeEnvironmentFlags:yr,assert:wr,features:br,_fatalExceptions:vr,setUncaughtExceptionCaptureCallback:Er,hasUncaughtExceptionCaptureCallback:Ir,emitWarning:Yn,nextTick:Fn,_tickCallback:_r,_debugProcess:Ar,_debugEnd:Sr,_startProfilerIdleNotifier:xr,_stopProfilerIdleNotifier:Br,stdout:Tr,stdin:Ur,stderr:kr,abort:Or,umask:Xn,chdir:Zn,cwd:Qn,env:Vn,title:jn,argv:Kn,execArgv:zn,pid:Pr,ppid:Nr,execPath:Rr,debugPort:Cr,hrtime:je,argv0:Lr,_preload_modules:Mr,setSourceMapsEnabled:$r},we={},At=!1;function Qr(){if(At)return we;At=!0,we.byteLength=g,we.toByteArray=B,we.fromByteArray=v;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,d=f.length;h<d;++h)r[h]=f[h],i[f.charCodeAt(h)]=h;i[45]=62,i[95]=63;function a(p){var y=p.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=p.indexOf("=");E===-1&&(E=y);var T=E===y?0:4-E%4;return [E,T]}function g(p){var y=a(p),E=y[0],T=y[1];return (E+T)*3/4-T}function m(p,y,E){return (y+E)*3/4-E}function B(p){var y,E=a(p),T=E[0],N=E[1],k=new s(m(p,T,N)),L=0,$=N>0?T-4:T,C;for(C=0;C<$;C+=4)y=i[p.charCodeAt(C)]<<18|i[p.charCodeAt(C+1)]<<12|i[p.charCodeAt(C+2)]<<6|i[p.charCodeAt(C+3)],k[L++]=y>>16&255,k[L++]=y>>8&255,k[L++]=y&255;return N===2&&(y=i[p.charCodeAt(C)]<<2|i[p.charCodeAt(C+1)]>>4,k[L++]=y&255),N===1&&(y=i[p.charCodeAt(C)]<<10|i[p.charCodeAt(C+1)]<<4|i[p.charCodeAt(C+2)]>>2,k[L++]=y>>8&255,k[L++]=y&255),k}function b(p){return r[p>>18&63]+r[p>>12&63]+r[p>>6&63]+r[p&63]}function w(p,y,E){for(var T,N=[],k=y;k<E;k+=3)T=(p[k]<<16&16711680)+(p[k+1]<<8&65280)+(p[k+2]&255),N.push(b(T));return N.join("")}function v(p){for(var y,E=p.length,T=E%3,N=[],k=16383,L=0,$=E-T;L<$;L+=k)N.push(w(p,L,L+k>$?$:L+k));return T===1?(y=p[E-1],N.push(r[y>>2]+r[y<<4&63]+"==")):T===2&&(y=(p[E-2]<<8)+p[E-1],N.push(r[y>>10]+r[y>>4&63]+r[y<<2&63]+"=")),N.join("")}return we}var Ie={},St=!1;function Zr(){return St?Ie:(St=!0,Ie.read=function(r,i,s,f,h){var d,a,g=h*8-f-1,m=(1<<g)-1,B=m>>1,b=-7,w=s?h-1:0,v=s?-1:1,p=r[i+w];for(w+=v,d=p&(1<<-b)-1,p>>=-b,b+=g;b>0;d=d*256+r[i+w],w+=v,b-=8);for(a=d&(1<<-b)-1,d>>=-b,b+=f;b>0;a=a*256+r[i+w],w+=v,b-=8);if(d===0)d=1-B;else {if(d===m)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,f),d=d-B;}return (p?-1:1)*a*Math.pow(2,d-f)},Ie.write=function(r,i,s,f,h,d){var a,g,m,B=d*8-h-1,b=(1<<B)-1,w=b>>1,v=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=f?0:d-1,y=f?1:-1,E=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(g=isNaN(i)?1:0,a=b):(a=Math.floor(Math.log(i)/Math.LN2),i*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+w>=1?i+=v/m:i+=v*Math.pow(2,1-w),i*m>=2&&(a++,m/=2),a+w>=b?(g=0,a=b):a+w>=1?(g=(i*m-1)*Math.pow(2,h),a=a+w):(g=i*Math.pow(2,w-1)*Math.pow(2,h),a=0));h>=8;r[s+p]=g&255,p+=y,g/=256,h-=8);for(a=a<<h|g,B+=h;B>0;r[s+p]=a&255,p+=y,a/=256,B-=8);r[s+p-y]|=E*128;},Ie)}var Z={},xt=!1;function ei(){if(xt)return Z;xt=!0;let r=Qr(),i=Zr(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Z.Buffer=a,Z.SlowBuffer=N,Z.INSPECT_MAX_BYTES=50;let f=2147483647;Z.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=h(),!a.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{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return !1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function d(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return b(e)}return g(e,t,n)}a.poolSize=8192;function g(e,t,n){if(typeof e=="string")return w(e,t);if(ArrayBuffer.isView(e))return p(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(G(e,SharedArrayBuffer)||e&&G(e.buffer,SharedArrayBuffer)))return y(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let u=E(e);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,t,n){return g(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function m(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function B(e,t,n){return m(e),e<=0?d(e):t!==void 0?typeof n=="string"?d(e).fill(t,n):d(e).fill(t):d(e)}a.alloc=function(e,t,n){return B(e,t,n)};function b(e){return m(e),d(e<0?0:T(e)|0)}a.allocUnsafe=function(e){return b(e)},a.allocUnsafeSlow=function(e){return b(e)};function w(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=k(e,t)|0,o=d(n),u=o.write(e,t);return u!==n&&(o=o.slice(0,u)),o}function v(e){let t=e.length<0?0:T(e.length)|0,n=d(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function p(e){if(G(e,Uint8Array)){let t=new Uint8Array(e);return y(t.buffer,t.byteOffset,t.byteLength)}return v(e)}function y(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return t===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,n),Object.setPrototypeOf(o,a.prototype),o}function E(e){if(a.isBuffer(e)){let t=T(e.length)|0,n=d(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!="number"||Ue(e.length)?d(0):v(e);if(e.type==="Buffer"&&Array.isArray(e.data))return v(e.data)}function T(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function N(e){return +e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype},a.compare=function(e,t){if(G(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),G(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,o=t.length;for(let u=0,l=Math.min(n,o);u<l;++u)if(e[u]!==t[u]){n=e[u],o=t[u];break}return n<o?-1:o<n?1:0},a.isEncoding=function(e){switch(String(e).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}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=a.allocUnsafe(t),u=0;for(n=0;n<e.length;++n){let l=e[n];if(G(l,Uint8Array))u+l.length>o.length?(a.isBuffer(l)||(l=a.from(l)),l.copy(o,u)):Uint8Array.prototype.set.call(o,l,u);else if(a.isBuffer(l))l.copy(o,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=l.length;}return o};function k(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let u=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ke(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return dt(e).length;default:if(u)return o?-1:ke(e).length;t=(""+t).toLowerCase(),u=!0;}}a.byteLength=k;function L(e,t,n){let o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return "";for(e||(e="utf8");;)switch(e){case"hex":return hn(this,t,n);case"utf8":case"utf-8":return it(this,t,n);case"ascii":return ln(this,t,n);case"latin1":case"binary":return fn(this,t,n);case"base64":return an(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return cn(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0;}}a.prototype._isBuffer=!0;function $(e,t,n){let o=e[t];e[t]=e[n],e[n]=o;}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)$(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)$(this,t,t+3),$(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)$(this,t,t+7),$(this,t+1,t+6),$(this,t+2,t+5),$(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?it(this,0,e):L.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=Z.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,o,u){if(G(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),u===void 0&&(u=this.length),t<0||n>e.length||o<0||u>this.length)throw new RangeError("out of range index");if(o>=u&&t>=n)return 0;if(o>=u)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,u>>>=0,this===e)return 0;let l=u-o,c=n-t,_=Math.min(l,c),P=this.slice(o,u),x=e.slice(t,n);for(let I=0;I<_;++I)if(P[I]!==x[I]){l=P[I],c=x[I];break}return l<c?-1:c<l?1:0};function C(e,t,n,o,u){if(e.length===0)return -1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ue(n)&&(n=u?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(u)return -1;n=e.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:rt(e,t,n,o,u);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?u?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):rt(e,[t],n,o,u);throw new TypeError("val must be string, number or Buffer")}function rt(e,t,n,o,u){let l=1,c=e.length,_=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return -1;l=2,c/=2,_/=2,n/=2;}function P(I,U){return l===1?I[U]:I.readUInt16BE(U*l)}let x;if(u){let I=-1;for(x=n;x<c;x++)if(P(e,x)===P(t,I===-1?0:x-I)){if(I===-1&&(I=x),x-I+1===_)return I*l}else I!==-1&&(x-=x-I),I=-1;}else for(n+_>c&&(n=c-_),x=n;x>=0;x--){let I=!0;for(let U=0;U<_;U++)if(P(e,x+U)!==P(t,U)){I=!1;break}if(I)return x}return -1}a.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},a.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)};function tn(e,t,n,o){n=Number(n)||0;let u=e.length-n;o?(o=Number(o),o>u&&(o=u)):o=u;let l=t.length;o>l/2&&(o=l/2);let c;for(c=0;c<o;++c){let _=parseInt(t.substr(c*2,2),16);if(Ue(_))return c;e[n+c]=_;}return c}function nn(e,t,n,o){return Ee(ke(t,e.length-n),e,n,o)}function rn(e,t,n,o){return Ee(mn(t),e,n,o)}function sn(e,t,n,o){return Ee(dt(t),e,n,o)}function on(e,t,n,o){return Ee(yn(t,e.length-n),e,n,o)}a.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((n===void 0||n>u)&&(n=u),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let l=!1;for(;;)switch(o){case"hex":return tn(this,e,t,n);case"utf8":case"utf-8":return nn(this,e,t,n);case"ascii":case"latin1":case"binary":return rn(this,e,t,n);case"base64":return sn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return on(this,e,t,n);default:if(l)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),l=!0;}},a.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function an(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function it(e,t,n){n=Math.min(e.length,n);let o=[],u=t;for(;u<n;){let l=e[u],c=null,_=l>239?4:l>223?3:l>191?2:1;if(u+_<=n){let P,x,I,U;switch(_){case 1:l<128&&(c=l);break;case 2:P=e[u+1],(P&192)===128&&(U=(l&31)<<6|P&63,U>127&&(c=U));break;case 3:P=e[u+1],x=e[u+2],(P&192)===128&&(x&192)===128&&(U=(l&15)<<12|(P&63)<<6|x&63,U>2047&&(U<55296||U>57343)&&(c=U));break;case 4:P=e[u+1],x=e[u+2],I=e[u+3],(P&192)===128&&(x&192)===128&&(I&192)===128&&(U=(l&15)<<18|(P&63)<<12|(x&63)<<6|I&63,U>65535&&U<1114112&&(c=U));}}c===null?(c=65533,_=1):c>65535&&(c-=65536,o.push(c>>>10&1023|55296),c=56320|c&1023),o.push(c),u+=_;}return un(o)}let st=4096;function un(e){let t=e.length;if(t<=st)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=st));return n}function ln(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]&127);return o}function fn(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]);return o}function hn(e,t,n){let o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);let u="";for(let l=t;l<n;++l)u+=wn[e[l]];return u}function cn(e,t,n){let o=e.slice(t,n),u="";for(let l=0;l<o.length-1;l+=2)u+=String.fromCharCode(o[l]+o[l+1]*256);return u}a.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let o=this.subarray(e,t);return Object.setPrototypeOf(o,a.prototype),o};function O(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e+--t],u=1;for(;t>0&&(u*=256);)o+=this[e+--t]*u;return o},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||O(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||O(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||O(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=K(function(e){e=e>>>0,ue(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&me(e,this.length-8);let o=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(u)<<BigInt(32))}),a.prototype.readBigUInt64BE=K(function(e){e=e>>>0,ue(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&me(e,this.length-8);let o=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(u)}),a.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*t)),o},a.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=t,u=1,l=this[e+--o];for(;o>0&&(u*=256);)l+=this[e+--o]*u;return u*=128,l>=u&&(l-=Math.pow(2,8*t)),l},a.prototype.readInt8=function(e,t){return e=e>>>0,t||O(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||O(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||O(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=K(function(e){e=e>>>0,ue(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&me(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=K(function(e){e=e>>>0,ue(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&me(e,this.length-8);let o=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||O(e,8,this.length),i.read(this,e,!1,52,8)};function M(e,t,n,o,u,l){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>u||t<l)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let c=Math.pow(2,8*n)-1;M(this,e,t,n,c,0);}let u=1,l=0;for(this[t]=e&255;++l<n&&(u*=256);)this[t+l]=e/u&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let c=Math.pow(2,8*n)-1;M(this,e,t,n,c,0);}let u=n-1,l=1;for(this[t+u]=e&255;--u>=0&&(l*=256);)this[t+u]=e/l&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ot(e,t,n,o,u){ct(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l;let c=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=c,c=c>>8,e[n++]=c,c=c>>8,e[n++]=c,c=c>>8,e[n++]=c,n}function at(e,t,n,o,u){ct(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n+7]=l,l=l>>8,e[n+6]=l,l=l>>8,e[n+5]=l,l=l>>8,e[n+4]=l;let c=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=c,c=c>>8,e[n+2]=c,c=c>>8,e[n+1]=c,c=c>>8,e[n]=c,n+8}a.prototype.writeBigUInt64LE=K(function(e,t=0){return ot(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=K(function(e,t=0){return at(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let _=Math.pow(2,8*n-1);M(this,e,t,n,_-1,-_);}let u=0,l=1,c=0;for(this[t]=e&255;++u<n&&(l*=256);)e<0&&c===0&&this[t+u-1]!==0&&(c=1),this[t+u]=(e/l>>0)-c&255;return t+n},a.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let _=Math.pow(2,8*n-1);M(this,e,t,n,_-1,-_);}let u=n-1,l=1,c=0;for(this[t+u]=e&255;--u>=0&&(l*=256);)e<0&&c===0&&this[t+u+1]!==0&&(c=1),this[t+u]=(e/l>>0)-c&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=K(function(e,t=0){return ot(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=K(function(e,t=0){return at(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ut(e,t,n,o,u,l){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function lt(e,t,n,o,u){return t=+t,n=n>>>0,u||ut(e,t,n,4),i.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(e,t,n){return lt(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return lt(this,e,t,!1,n)};function ft(e,t,n,o,u){return t=+t,n=n>>>0,u||ut(e,t,n,8),i.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(e,t,n){return ft(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return ft(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,o){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let u=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),u},a.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let l=e.charCodeAt(0);(o==="utf8"&&l<128||o==="latin1")&&(e=l);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<n;++u)this[u]=e;else {let l=a.isBuffer(e)?e:a.from(e,o),c=l.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<n-t;++u)this[u+t]=l[u%c];}return this};let ae={};function Te(e,t,n){ae[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name;}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Te("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),Te("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,u=n;return Number.isInteger(n)&&Math.abs(n)>2**32?u=ht(String(n)):typeof n=="bigint"&&(u=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(u=ht(u)),u+="n"),o+=` It must be ${t}. Received ${u}`,o},RangeError);function ht(e){let t="",n=e.length,o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return `${e.slice(0,n)}${t}`}function dn(e,t,n){ue(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&me(t,e.length-(n+1));}function ct(e,t,n,o,u,l){if(e>n||e<t){let c=typeof t=="bigint"?"n":"",_;throw t===0||t===BigInt(0)?_=`>= 0${c} and < 2${c} ** ${(l+1)*8}${c}`:_=`>= -(2${c} ** ${(l+1)*8-1}${c}) and < 2 ** ${(l+1)*8-1}${c}`,new ae.ERR_OUT_OF_RANGE("value",_,e)}dn(o,u,l);}function ue(e,t){if(typeof e!="number")throw new ae.ERR_INVALID_ARG_TYPE(t,"number",e)}function me(e,t,n){throw Math.floor(e)!==e?(ue(e,n),new ae.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new ae.ERR_BUFFER_OUT_OF_BOUNDS:new ae.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}let pn=/[^+/0-9A-Za-z-_]/g;function gn(e){if(e=e.split("=")[0],e=e.trim().replace(pn,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function ke(e,t){t=t||1/0;let n,o=e.length,u=null,l=[];for(let c=0;c<o;++c){if(n=e.charCodeAt(c),n>55295&&n<57344){if(!u){if(n>56319){(t-=3)>-1&&l.push(239,191,189);continue}else if(c+1===o){(t-=3)>-1&&l.push(239,191,189);continue}u=n;continue}if(n<56320){(t-=3)>-1&&l.push(239,191,189),u=n;continue}n=(u-55296<<10|n-56320)+65536;}else u&&(t-=3)>-1&&l.push(239,191,189);if(u=null,n<128){if((t-=1)<0)break;l.push(n);}else if(n<2048){if((t-=2)<0)break;l.push(n>>6|192,n&63|128);}else if(n<65536){if((t-=3)<0)break;l.push(n>>12|224,n>>6&63|128,n&63|128);}else if(n<1114112){if((t-=4)<0)break;l.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128);}else throw new Error("Invalid code point")}return l}function mn(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function yn(e,t){let n,o,u,l=[];for(let c=0;c<e.length&&!((t-=2)<0);++c)n=e.charCodeAt(c),o=n>>8,u=n%256,l.push(u),l.push(o);return l}function dt(e){return r.toByteArray(gn(e))}function Ee(e,t,n,o){let u;for(u=0;u<o&&!(u+n>=t.length||u>=e.length);++u)t[u+n]=e[u];return u}function G(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ue(e){return e!==e}let wn=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let o=n*16;for(let u=0;u<16;++u)t[o+u]=e[n]+e[u];}return t}();function K(e){return typeof BigInt>"u"?bn:e}function bn(){throw new Error("BigInt not supported")}return Z}var ie=ei();ie.Buffer;ie.SlowBuffer;ie.INSPECT_MAX_BYTES;ie.kMaxLength;var Bt=ie.Buffer;ie.INSPECT_MAX_BYTES;ie.kMaxLength;var ti={};$n(ti,{deleteItem:()=>si,getItem:()=>qe,setItem:()=>Se});var Ae=()=>typeof window>"u",Ot=()=>!Ae(),ni="__IMX-",Je=()=>Ot()&&window.localStorage,ri=r=>{if(r!==null)try{return JSON.parse(r)}catch{return r}},ii=r=>typeof r=="string"?r:JSON.stringify(r),Xe=r=>`${ni}${r}`;function qe(r){if(Je())return ri(window.localStorage.getItem(Xe(r)))}var Se=(r,i)=>Je()?(window.localStorage.setItem(Xe(r),ii(i)),!0):!1,si=r=>Je()?(window.localStorage.removeItem(Xe(r)),!0):!1,Ve=0,oi=r=>{let i=parseInt(r,10)*1e3,s=new Date(i),f=new Date;return Ve=s.getTime()-f.getTime(),Ve},ai=()=>{let r=new Date().getTime()+Ve;return new Date(r).toISOString()},ui=(r=>(r.RUNTIME_ID="rid",r.PASSPORT_CLIENT_ID="passportClientId",r.ENVIRONMENT="env",r.PUBLISHABLE_API_KEY="pak",r.IDENTITY="uid",r.DOMAIN="domain",r.SDK_VERSION="sdkVersion",r))(ui||{}),li="https://api.immutable.com",fi=r=>{if(typeof Bt<"u")return Bt.from(r,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(r)));throw new Error("Base64 encoding not supported in this environment")};async function Pt(r,i){let s=JSON.stringify(i),f={payload:fi(s)},h=await fetch(`${li}${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok){let d=await h.text().catch(()=>"");throw new Error(`Request failed (${h.status}): ${d||h.statusText}`)}return h.json()}var te,ne,hi=()=>{te=qe("metrics-events")||[],ne=qe("metrics-runtime")||{};};hi();var re=(r,i)=>{ne={...ne,[r]:i},Se("metrics-runtime",ne);},Ke=r=>{if(ne[r]!==void 0)return ne[r]},ci=()=>ne,di=()=>te,pi=r=>{te.push(r),Se("metrics-events",te);},gi=r=>{te=te.slice(r),Se("metrics-events",te);},Nt=r=>{let i=[];return Object.entries(r).forEach(([s,f])=>{(typeof s=="string"||typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&i.push([s,f.toString()]);}),i},De="2.20.1-alpha.2",mi=()=>Ae()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",yi=()=>{if(Ae())return "";let r;try{window.self!==window.top&&(r=mi());}catch{}return r||(r=window.location.hostname),r},wi=()=>{if(re("sdkVersion",De),Ae())return {browser:"nodejs",sdkVersion:De};let r=yi();return r&&re("domain",r),{sdkVersion:De,browser:window.navigator.userAgent,domain:r,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},ze=!1,bi=()=>ze,vi=async()=>{ze=!0;try{let r=Nt(wi()),i=Ke("rid"),s=Ke("uid"),f=await Pt("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:s}}),{runtimeId:h,sTime:d}=f;re("rid",h),oi(d);}catch{ze=!1;}};function D(r,i){return (...s)=>{try{let f=r(...s);return f instanceof Promise?f.catch(()=>i):f}catch{return i}}}function Ei(){return Ot()||typeof Ge>"u"?!1:Ge.env.JEST_WORKER_ID!==void 0}var Ii=D(Ei,!1),Rt="imtbl__metrics",_i=5e3,Ai=1e3,be=(r,i)=>(0, He.getGlobalisedValue)(Rt,r,i),Si=(r,i)=>{let s=bt(i,{lruOptions:{ttl:_i,max:Ai}});return (0, He.getGlobalisedValue)(Rt,r,s)},xi=5e3,Bi=(r,i,s)=>{let f={event:`${r}.${i}`,time:ai(),...s&&{properties:Nt(s)}};pi(f);},se=D(Si("track",Bi)),Ti=async()=>{if(bi()===!1){await vi();return}let r=di();if(r.length===0)return;let i=r.length,s=ci();await Pt("/v1/sdk/metrics",{version:1,data:{events:r,details:s}})instanceof Error||gi(i);},ki=D(Ti),Ct=async()=>{await ki(),setTimeout(Ct,xi);},Tt=!1,Ui=()=>{Tt||(Tt=!0,Ct());};Ii()||D(be("startFlushing",Ui))();var Mi=(r,i,s,f)=>{let{message:h}=s,d=s.stack||"",{cause:a}=s;a instanceof Error&&(d=`${d}
2
2
  Cause: ${a.message}
3
- ${a.stack}`),te(r,`trackError_${i}`,{...f||{},errorMessage:c,errorStack:p,isTrackError:!0});},kt=D(Ri),Mi=r=>{Z("env",r);};D(de("setEnvironment",Mi));var $i=r=>{Z("passportClientId",r);};D(de("setPassportClientId",$i));var Di=r=>{Z("pak",r);};D(de("setPublishableApiKey",Di));D(de("getDetail",Fe));var Fi={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},Pt="https://api.immutable.com",ji="/v1/audience/messages",Gi="/v1/audience/tracking-consent",le="imtbl_anon_id",ue="_imtbl_sid",Nt="session_start",Rt="session_end",ge=()=>typeof window<"u"&&typeof document<"u",fe=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let i=Math.trunc(Math.random()*16);return (r==="x"?i:i%4+8).toString(16)}),Ct=()=>new Date().toISOString();function Se(r){if(!ge())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function Ae(r,i,s,f){if(!ge())return;let c=window.location.protocol==="https:"?"; Secure":"",p=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${s}; SameSite=Lax${p}${c}`;}function ye(r,i){Ae(r,"",0,i);}function xe(r){let i=Se(le);if(i)return i;let s=fe();return Ae(le,s,63072e3,r),s}var _e=class extends Error{status;endpoint;body;constructor(r){super(`audience transport failed: ${r.status||"network error"} ${r.endpoint}`,r.cause!==void 0?{cause:r.cause}:void 0),this.name="TransportError",this.status=r.status,this.endpoint=r.endpoint,this.body=r.body;}},ae=class extends Error{code;status;endpoint;responseBody;cause;constructor(r){super(r.message),this.name="AudienceError",this.code=r.code,this.status=r.status,this.endpoint=r.endpoint,this.responseBody=r.responseBody,this.cause=r.cause;}};function Lt(r,i,s){if(r.status===0)return new ae({code:"NETWORK_ERROR",message:i==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:r.endpoint,cause:r.cause});if(r.status>=200&&r.status<300){let f=r.body,c=f?.rejected??0,p=f?.accepted??0;return new ae({code:"VALIDATION_REJECTED",message:`Backend rejected ${c} of ${c+p} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return r.status===429?new ae({code:"RATE_LIMITED",message:i==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:r.status,endpoint:r.endpoint,responseBody:r.body}):r.status>=400&&r.status<500?new ae({code:i==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush rejected with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body}):new ae({code:i==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush failed with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body,cause:r.cause})}function Mt(r,i){if(r)try{r(i);}catch{}}var qi=3e4;function Vi(r){let i=r.get?.("retry-after");if(!i)return null;let s=Number(i.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let f=new Date(i);if(!Number.isNaN(f.getTime())){let c=f.getTime()-Date.now();return c>0?c:null}return null}async function Ut(r){let i=r.headers?.get?.("content-type")??"";try{return i.includes("application/json")?await r.json():await r.text()}catch{return}}var We=async(r,i,s,f)=>{let c=new AbortController,p=setTimeout(()=>c.abort(),qi);try{let a=await fetch(r,{method:f?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(s),keepalive:f?.keepalive,signal:c.signal});if(a.status===429){te("audience","transport_send_failed",{status:429});let y=Vi(a.headers);return {ok:!1,error:new _e({status:429,endpoint:r}),...y!==null?{retryAfterMs:y}:{}}}if(!a.ok){let y=await Ut(a);return te("audience","transport_send_failed",{status:a.status}),{ok:!1,error:new _e({status:a.status,endpoint:r,body:y})}}let g=await Ut(a);if(typeof g=="object"&&g!==null&&"rejected"in g){let y=g.rejected??0;if(y>0)return te("audience","transport_partial_rejected",{status:a.status,rejected:y}),{ok:!1,error:new _e({status:a.status,endpoint:r,body:g})}}return {ok:!0}}catch(a){let g=new _e({status:0,endpoint:r,cause:a});return kt("audience","transport_send",g),{ok:!1,error:g}}finally{clearTimeout(p);}},Ye="__imtbl_audience_";function Je(){try{return ge()&&typeof localStorage<"u"}catch{return !1}}function Ki(r,i=Ye){if(Je())try{let s=localStorage.getItem(`${i}${r}`);return s?JSON.parse(s):void 0}catch{return}}function zi(r,i,s=Ye){if(Je())try{localStorage.setItem(`${s}${r}`,JSON.stringify(i));}catch{}}function Hi(r,i=Ye){if(Je())try{localStorage.removeItem(`${i}${r}`);}catch{}}var He="queue",Ot=100,$t=class{constructor(r,i,s){this.send=r,this.publishableKey=i,this.endpointUrl=`${s?.baseUrl??Pt}${ji}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let f=Ki(He,this.storagePrefix)??[];this.messages=s?.staleFilter?f.filter(s.staleFilter):f;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;consecutiveFailures=0;nextAttemptAt=0;start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(r){this.messages.push(r),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let r=this.messages.slice(0,Ot),i={messages:r},s=await this.send(this.endpointUrl,this.publishableKey,i),f;!s.ok&&s.error&&(f=Lt(s.error,"flush",r.length));let c=f?.code==="VALIDATION_REJECTED";s.ok||c?(this.messages=this.messages.slice(r.length),this.persist(),this.resetBackoff()):f&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,r.length),f&&Mt(this.onError,f);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let r=this.messages.slice(0,Ot),i={messages:r};this.send(this.endpointUrl,this.publishableKey,i,{keepalive:!0}),this.messages=this.messages.slice(r.length),this.persist();}purge(r){this.messages=this.messages.filter(i=>!r(i)),this.persist();}transform(r){this.messages=this.messages.map(r),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],Hi(He,this.storagePrefix);}registerUnload(){!ge()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let r=Date.now();r<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=r+this.backoffDelayMs());}setBackoffUntil(r){this.consecutiveFailures++,this.nextAttemptAt=r;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){zi(He,this.messages,this.storagePrefix);}},Wi="2.20.1-alpha.0";function Dt(r="@imtbl/audience",i=Wi){let s={library:r,libraryVersion:i};return ge()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ft(r){let i=new Date(r).getTime();if(Number.isNaN(i))return !1;let s=Date.now();return i<=s+864e5&&i>=s-2592e6}function jt(r,i,s,f){return r!==s||i!==f}function me(r,i=256){return r.length>i?r.slice(0,i):r}function he(r){let i=Se(ue);if(i)return Ae(ue,i,1800,r),{sessionId:i,isNew:!1};let s=fe();return Ae(ue,s,1800,r),{sessionId:s,isNew:!0}}var Gt=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],qt=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Vt="__imtbl_attribution";function Yi(r){let i;try{i=new URL(r).searchParams;}catch{return {}}let s={};for(let c of [...Gt,...qt]){let p=i.get(c);p&&(s[c]=p);}let f=i.get("referral_code");return f&&(s.referral_code=f),s}function Ji(){try{let r=sessionStorage.getItem(Vt);return r?JSON.parse(r):null}catch{return null}}function Xi(r){try{sessionStorage.setItem(Vt,JSON.stringify(r));}catch{}}function Kt(){let r=typeof window<"u"&&window.location?Yi(window.location.href):{},i=typeof document<"u"&&document.referrer||void 0,s=qt.some(c=>c in r),f=Gt.some(c=>c in r);return {...r,referrer:i,touchpoint_type:s||f?"click":void 0}}function zt(){let r=Ji();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,s={...Kt(),landing_page:i};return Xi(s),s}function Ht(){return Kt()}function H(r){return r!=="none"}function ne(r){return r==="full"}function Wt(r,i,s,f,c,p,a,g){let y=p??"none",x={none:0,anonymous:1,full:2};function v(w){let b=`${g??Pt}${Gi}`;i(b,s,{anonymousId:f,status:w,source:c},{method:"PUT",keepalive:!0}).then(d=>{!d.ok&&d.error&&Mt(a,Lt(d.error,"consent"));});}return {get level(){return y},setLevel(w){w!==y&&(x[w]<x[y]&&(w==="none"?r.purge(()=>!0):w==="anonymous"&&(r.purge(b=>b.type==="identify"||b.type==="alias"),r.transform(b=>{if("userId"in b){let{userId:d,...m}=b;return m}return b}))),y=w,v(w));}}}T();B();T();B();var Yt="@imtbl/audience",Jt="2.20.1-alpha.0",W="[audience]",Xt="WebSDK";var Be=class{enabled;constructor(i=!1){this.enabled=i;}logEvent(i,s){this.enabled&&console.log(`${W} ${i}`,s);}logFlush(i,s){this.enabled&&console.log(`${W} flush ${i?"ok":"failed"} (${s} messages)`);}logConsent(i,s){this.enabled&&console.log(`${W} consent ${i} \u2192 ${s}`);}logWarning(i){this.enabled&&console.warn(`${W} ${i}`);}};var Qi=new Set(["sign_up","link_clicked"]),Xe=class r{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;constructor(i){let{cookieDomain:s,publishableKey:f}=i,c=i.consent??"none",p=Xt;this.cookieDomain=s,this.testMode=i.testMode??!1,this.debug=new Be(i.debug??!1);let a=!1;H(c)?(this.anonymousId=xe(s),a=this.startSession()):this.anonymousId=Se(le)??fe(),this.queue=new $t(We,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(g,y)=>this.debug.logFlush(g,y),onError:i.onError,staleFilter:g=>Ft(g.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Wt(this.queue,We,f,this.anonymousId,p,c,i.onError,i.baseUrl),this.attribution=zt(),this.isTrackingDisabled()||(this.queue.start(),a&&this.trackSessionStart());}static init(i){if(!i.publishableKey?.trim())throw new Error(`${W} publishableKey is required`);return r.liveInstances>0&&console.warn(`${W} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),r.liveInstances+=1,new r(i)}isTrackingDisabled(){return !H(this.consent.level)}effectiveUserId(){return ne(this.consent.level)?this.userId:void 0}startSession(){let i=he(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:fe(),eventTimestamp:Ct(),anonymousId:this.anonymousId,surface:"web",context:Dt(Yt,Jt),...this.testMode&&{test:!0}}}enqueue(i,s){this.queue.enqueue(s),this.debug.logEvent(i,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:Nt,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Rt,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;he(this.cookieDomain);let s={session_id:this.sessionId,...i};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(i,...s){if(this.isTrackingDisabled())return;he(this.cookieDomain);let[f]=s,c={session_id:this.sessionId,...Qi.has(i)?Ht():{},...f};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:me(i),properties:c,userId:this.effectiveUserId()});}identify(i,s,f){if(!ne(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}he(this.cookieDomain);let c=me(i);this.userId=c,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:c,identityType:s,traits:f});}alias(i,s){if(!ne(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!jt(i.id,i.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}he(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:me(i.id),fromType:i.identityType,toId:me(s.id),toType:s.identityType});}setConsent(i){let s=this.consent.level;if(i===s)return;this.debug.logConsent(s,i);let f=!H(s)&&H(i);if(f&&(this.anonymousId=xe(this.cookieDomain)),H(i)||this.queue.stop(),this.consent.setLevel(i),H(i)?ne(s)&&!ne(i)&&(this.userId=void 0):(ye(le,this.cookieDomain),ye(ue,this.cookieDomain)),f){this.isFirstPage=!0;let c=this.startSession();this.queue.start(),c&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),ye(le,this.cookieDomain),ye(ue,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=fe(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=xe(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),r.liveInstances=Math.max(0,r.liveInstances-1));}};T();B();var Zi={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked"};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
3
+ ${a.stack}`),se(r,`trackError_${i}`,{...f||{},errorMessage:h,errorStack:d,isTrackError:!0});},Lt=D(Mi),Fi=r=>{re("env",r);};D(be("setEnvironment",Fi));var ji=r=>{re("passportClientId",r);};D(be("setPassportClientId",ji));var Gi=r=>{re("pak",r);};D(be("setPublishableApiKey",Gi));D(be("getDetail",Ke));var qi={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},xe=class extends Error{status;endpoint;body;constructor(r){super(`audience transport failed: ${r.status||"network error"} ${r.endpoint}`,r.cause!==void 0?{cause:r.cause}:void 0),this.name="TransportError",this.status=r.status,this.endpoint=r.endpoint,this.body=r.body;}},pe=class extends Error{code;status;endpoint;responseBody;cause;constructor(r){super(r.message),this.name="AudienceError",this.code=r.code,this.status=r.status,this.endpoint=r.endpoint,this.responseBody=r.responseBody,this.cause=r.cause;}};function Dt(r,i,s){if(r.status===0)return new pe({code:"NETWORK_ERROR",message:i==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:r.endpoint,cause:r.cause});if(r.status>=200&&r.status<300){let f=r.body,h=f?.rejected??0,d=f?.accepted??0;return new pe({code:"VALIDATION_REJECTED",message:`Backend rejected ${h} of ${h+d} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return r.status===429?new pe({code:"RATE_LIMITED",message:i==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:r.status,endpoint:r.endpoint,responseBody:r.body}):r.status>=400&&r.status<500?new pe({code:i==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush rejected with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body}):new pe({code:i==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush failed with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body,cause:r.cause})}function Ft(r,i){if(r)try{r(i);}catch{}}var Vi=3e4;function Ki(r){let i=r.get?.("retry-after");if(!i)return null;let s=Number(i.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let f=new Date(i);if(!Number.isNaN(f.getTime())){let h=f.getTime()-Date.now();return h>0?h:null}return null}async function Mt(r){let i=r.headers?.get?.("content-type")??"";try{return i.includes("application/json")?await r.json():await r.text()}catch{return}}var Ze=async(r,i,s,f)=>{let h=new AbortController,d=setTimeout(()=>h.abort(),Vi);try{let a=await fetch(r,{method:f?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(s),keepalive:f?.keepalive,signal:h.signal});if(a.status===429){se("audience","transport_send_failed",{status:429});let m=Ki(a.headers);return {ok:!1,error:new xe({status:429,endpoint:r}),...m!==null?{retryAfterMs:m}:{}}}if(!a.ok){let m=await Mt(a);return se("audience","transport_send_failed",{status:a.status}),{ok:!1,error:new xe({status:a.status,endpoint:r,body:m})}}let g=await Mt(a);if(typeof g=="object"&&g!==null&&"rejected"in g){let m=g.rejected??0;if(m>0)return se("audience","transport_partial_rejected",{status:a.status,rejected:m}),{ok:!1,error:new xe({status:a.status,endpoint:r,body:g})}}return {ok:!0}}catch(a){let g=new xe({status:0,endpoint:r,cause:a});return Lt("audience","transport_send",g),{ok:!1,error:g}}finally{clearTimeout(d);}},et="__imtbl_audience_";function tt(){try{return q()&&typeof localStorage<"u"}catch{return !1}}function zi(r,i=et){if(tt())try{let s=localStorage.getItem(`${i}${r}`);return s?JSON.parse(s):void 0}catch{return}}function Hi(r,i,s=et){if(tt())try{localStorage.setItem(`${s}${r}`,JSON.stringify(i));}catch{}}function Wi(r,i=et){if(tt())try{localStorage.removeItem(`${i}${r}`);}catch{}}var Qe="queue",$t=100,jt=class{constructor(r,i,s){this.send=r,this.publishableKey=i,this.endpointUrl=`${s?.baseUrl??Oe}${mt}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let f=zi(Qe,this.storagePrefix)??[];this.messages=s?.staleFilter?f.filter(s.staleFilter):f;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;consecutiveFailures=0;nextAttemptAt=0;start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(r){this.messages.push(r),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let r=this.messages.slice(0,$t),i={messages:r},s=await this.send(this.endpointUrl,this.publishableKey,i),f;!s.ok&&s.error&&(f=Dt(s.error,"flush",r.length));let h=f?.code==="VALIDATION_REJECTED";s.ok||h?(this.messages=this.messages.slice(r.length),this.persist(),this.resetBackoff()):f&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,r.length),f&&Ft(this.onError,f);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let r=this.messages.slice(0,$t),i={messages:r};this.send(this.endpointUrl,this.publishableKey,i,{keepalive:!0}),this.messages=this.messages.slice(r.length),this.persist();}purge(r){this.messages=this.messages.filter(i=>!r(i)),this.persist();}transform(r){this.messages=this.messages.map(r),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],Wi(Qe,this.storagePrefix);}registerUnload(){!q()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let r=Date.now();r<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=r+this.backoffDelayMs());}setBackoffUntil(r){this.consecutiveFailures++,this.nextAttemptAt=r;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Hi(Qe,this.messages,this.storagePrefix);}},Yi="2.20.1-alpha.2";function Gt(r="@imtbl/audience",i=Yi){let s={library:r,libraryVersion:i};return q()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function qt(r){let i=new Date(r).getTime();if(Number.isNaN(i))return !1;let s=Date.now();return i<=s+864e5&&i>=s-2592e6}function Vt(r,i,s,f){return r!==s||i!==f}function ve(r,i=256){return r.length>i?r.slice(0,i):r}function ge(r){let i=le(H);if(i)return fe(H,i,1800,r),{sessionId:i,isNew:!1};let s=W();return fe(H,s,1800,r),{sessionId:s,isNew:!0}}var Kt=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],zt=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Ht="__imtbl_attribution";function Ji(r){let i;try{i=new URL(r).searchParams;}catch{return {}}let s={};for(let h of [...Kt,...zt]){let d=i.get(h);d&&(s[h]=d);}let f=i.get("referral_code");return f&&(s.referral_code=f),s}function Xi(){try{let r=sessionStorage.getItem(Ht);return r?JSON.parse(r):null}catch{return null}}function Qi(r){try{sessionStorage.setItem(Ht,JSON.stringify(r));}catch{}}function Wt(){let r=typeof window<"u"&&window.location?Ji(window.location.href):{},i=typeof document<"u"&&document.referrer||void 0,s=zt.some(h=>h in r),f=Kt.some(h=>h in r);return {...r,referrer:i,touchpoint_type:s||f?"click":void 0}}function Yt(){let r=Xi();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,s={...Wt(),landing_page:i};return Qi(s),s}function Jt(){return Wt()}function X(r){return r!=="none"}function oe(r){return r==="full"}function Xt(r,i,s,f,h,d,a,g){let m=d??"none",B={none:0,anonymous:1,full:2};function b(w){let v=`${g??Oe}${yt}`;i(v,s,{anonymousId:f,status:w,source:h},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&Ft(a,Dt(p.error,"consent"));});}return {get level(){return m},setLevel(w){w!==m&&(B[w]<B[m]&&(w==="none"?r.purge(()=>!0):w==="anonymous"&&(r.purge(v=>v.type==="identify"||v.type==="alias"),r.transform(v=>{if("userId"in v){let{userId:p,...y}=v;return y}return v}))),m=w,b(w));}}}S();A();S();A();S();A();var Qt="@imtbl/audience",Zt="2.20.1-alpha.2",Q="[audience]",en="WebSDK";var Be=class{enabled;constructor(i=!1){this.enabled=i;}logEvent(i,s){this.enabled&&console.log(`${Q} ${i}`,s);}logFlush(i,s){this.enabled&&console.log(`${Q} flush ${i?"ok":"failed"} (${s} messages)`);}logConsent(i,s){this.enabled&&console.log(`${Q} consent ${i} \u2192 ${s}`);}logWarning(i){this.enabled&&console.warn(`${Q} ${i}`);}};var Zi=new Set(["sign_up","link_clicked"]),nt=class r{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;static UUID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;static readAndStripAidParam(){if(!q())return null;let i=new URLSearchParams(window.location.search),s=i.get("imtbl_aid");if(s!==null){i.delete("imtbl_aid");let f=i.toString(),h=`${window.location.pathname}${f?`?${f}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",h);}return s&&r.UUID_RE.test(s)?s:null}constructor(i){let{cookieDomain:s,publishableKey:f}=i,h=i.consent??"none",d=en;this.cookieDomain=s,this.testMode=i.testMode??!1,this.debug=new Be(i.debug??!1);let a=r.readAndStripAidParam(),g=!1;X(h)?(a?(Ce(a,s),this.anonymousId=a):this.anonymousId=ye(s),g=this.startSession()):this.anonymousId=le(z)??W(),this.queue=new jt(Ze,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(m,B)=>this.debug.logFlush(m,B),onError:i.onError,staleFilter:m=>qt(m.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Xt(this.queue,Ze,f,this.anonymousId,d,h,i.onError,i.baseUrl),this.attribution=Yt(),this.isTrackingDisabled()||(this.queue.start(),g&&this.trackSessionStart());}static init(i){if(!i.publishableKey?.trim())throw new Error(`${Q} publishableKey is required`);return r.liveInstances>0&&console.warn(`${Q} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),r.liveInstances+=1,new r(i)}getAnonymousId(){return this.anonymousId}isTrackingDisabled(){return !X(this.consent.level)}effectiveUserId(){return oe(this.consent.level)?this.userId:void 0}startSession(){let i=ge(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:W(),eventTimestamp:Re(),anonymousId:this.anonymousId,surface:"web",context:Gt(Qt,Zt),...this.testMode&&{test:!0}}}enqueue(i,s){this.queue.enqueue(s),this.debug.logEvent(i,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:Pe,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Ne,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;ge(this.cookieDomain);let s={session_id:this.sessionId,...i};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(i,...s){if(this.isTrackingDisabled())return;ge(this.cookieDomain);let[f]=s,h={session_id:this.sessionId,...Zi.has(i)?Jt():{},...f};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:ve(i),properties:h,userId:this.effectiveUserId()});}identify(i,s,f){if(!oe(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}ge(this.cookieDomain);let h=ve(i);this.userId=h,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:h,identityType:s,traits:f});}alias(i,s){if(!oe(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Vt(i.id,i.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}ge(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:ve(i.id),fromType:i.identityType,toId:ve(s.id),toType:s.identityType});}setConsent(i){let s=this.consent.level;if(i===s)return;this.debug.logConsent(s,i);let f=!X(s)&&X(i);if(f&&(this.anonymousId=ye(this.cookieDomain)),X(i)||this.queue.stop(),this.consent.setLevel(i),X(i)?oe(s)&&!oe(i)&&(this.userId=void 0):(he(z,this.cookieDomain),he(H,this.cookieDomain)),f){this.isFirstPage=!0;let h=this.startSession();this.queue.start(),h&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),he(z,this.cookieDomain),he(H,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=W(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=ye(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),r.liveInstances=Math.max(0,r.liveInstances-1));}};S();A();var es={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked",BUTTON_CLICKED:"button_clicked"};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
4
4
  /*! Bundled license information:
5
5
 
6
6
  tiny-lru/dist/tiny-lru.js:
@@ -13,4 +13,4 @@ tiny-lru/dist/tiny-lru.js:
13
13
  *)
14
14
  */
15
15
 
16
- export { Xe as Audience, ae as AudienceError, Zi as AudienceEvents, Fi as IdentityType, ne as canIdentify, H as canTrack };
16
+ export { nt as Audience, pe as AudienceError, es as AudienceEvents, qi as IdentityType, oe as canIdentify, X as canTrack };
@@ -1,9 +1,9 @@
1
1
  (function () {
2
2
  'use strict';
3
3
 
4
- var wn=Object.create;var Oe=Object.defineProperty;var bn=Object.getOwnPropertyDescriptor;var vn=Object.getOwnPropertyNames;var En=Object.getPrototypeOf,In=Object.prototype.hasOwnProperty;var An=(r,i,s)=>i in r?Oe(r,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[i]=s;var _n=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var Sn=(r,i,s,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of vn(i))!In.call(r,h)&&h!==s&&Oe(r,h,{get:()=>i[h],enumerable:!(f=bn(i,h))||f.enumerable});return r};var Bn=(r,i,s)=>(s=r!=null?wn(En(r)):{},Sn(Oe(s,"default",{value:r,enumerable:!0}),r));var b=(r,i,s)=>An(r,typeof i!="symbol"?i+"":i,s);var gt=_n(re=>{Object.defineProperty(re,"__esModule",{value:!0});re.clearGlobalNamespace=re.getGlobalisedValue=void 0;var kn="globalise__singleton__",Un={},ct=()=>typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:Un,On=(r,i)=>{if(typeof r!="string")throw "Invalid namespace key";if(typeof i!="string")throw "Invalid item key"},dt=r=>`${kn}${r}`,pt=r=>{let i=ct(),s=dt(r);return i[s]||(i[s]={}),i[s]},Nn=(r,i)=>pt(r)[i]||void 0,Rn=(r,i,s)=>{let f=pt(r);f[i]=s;},Cn=(r,i,s)=>{On(r,i);let f=Nn(r,i);return f!==void 0?f:(Rn(r,i,s),s)};re.getGlobalisedValue=Cn;var Ln=r=>{let i=ct(),s=dt(r);i[s]!==void 0&&delete i[s];};re.clearGlobalNamespace=Ln;});var Ne=class{constructor(i=0,s=0,f=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=i,this.resetTtl=f,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(i){if(this.has(i)){let s=this.items[i];delete this.items[i],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(i=this.keys()){return i.map(s=>[s,this.get(s)])}evict(i=!1){if(i||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(i){let s;return this.has(i)&&(s=this.items[i].expiry),s}get(i){let s;if(this.has(i)){let f=this.items[i];this.ttl>0&&f.expiry<=Date.now()?this.delete(i):(s=f.value,this.set(i,s,!0));}return s}has(i){return i in this.items}keys(){let i=[],s=this.first;for(;s!==null;)i.push(s.key),s=s.next;return i}set(i,s,f=!1,h=this.resetTtl){let c;if(f||this.has(i)){if(c=this.items[i],c.value=s,f===!1&&h&&(c.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==c){let a=this.last,y=c.next,g=c.prev;this.first===c&&(this.first=c.next),c.next=null,c.prev=this.last,a.next=c,g!==null&&(g.next=y),y!==null&&(y.prev=g);}}else this.max>0&&this.size===this.max&&this.evict(!0),c=this.items[i]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:i,prev:this.last,next:null,value:s},++this.size===1?this.first=c:this.last.next=c;return this.last=c,this}values(i=this.keys()){return i.map(s=>this.get(s))}};function ft(r=1e3,i=0,s=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(i)||i<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new Ne(r,i,s)}var xn={max:1e3},ht=(r,i={})=>{let{cache:s,cacheKeyResolver:f=Re,onHit:h,lruOptions:c={}}=i,a={...xn,...c},y=s||ft(a.max,a.ttl);function g(...E){let m=f(...E),v=y.get(m);if(y.has(m))return h&&h(m,v,y),v;let p=r.apply(this,E);return y.set(m,p),p}return g._cache=y,g},Re=(...r)=>r.length===0?"no-args":r.map(i=>i===void 0?"undefined":i===null?"null":Array.isArray(i)?`[${Re(...i)}]`:typeof i=="object"?`{${Re(...Tn(i))}}`:JSON.stringify(i)).join(","),Tn=r=>Object.entries(r).sort((i,s)=>i[0]<s[0]?-1:1);var qe=Bn(gt()),Pn=Object.defineProperty,Mn=(r,i)=>{for(var s in i)Pn(r,s,{get:i[s],enumerable:!0});};function Ve(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}var F=[],se=!1,W,be=-1;function $n(){!se||!W||(se=!1,W.length?F=W.concat(F):be=-1,F.length&&Et());}function Et(){if(!se){var r=setTimeout($n,0);se=!0;for(var i=F.length;i;){for(W=F,F=[];++be<i;)W&&W[be].run();be=-1,i=F.length;}W=null,se=!1,clearTimeout(r);}}function Dn(r){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];F.push(new It(r,i)),F.length===1&&!se&&setTimeout(Et,0);}function It(r,i){this.fun=r,this.array=i;}It.prototype.run=function(){this.fun.apply(null,this.array);};var Fn="browser",jn="x64",Gn="browser",qn={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Vn=["/usr/bin/node"],Kn=[],zn="v16.8.0",Yn={},Hn=function(r,i){console.warn((i?i+": ":"")+r);},Wn=function(r){Ve("binding");},Jn=function(r){return 0},Xn=function(){return "/"},Qn=function(r){},Zn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function R(){}var ei=R,ti=[];function ni(r){Ve("_linkedBinding");}var ii={},ri=!1,si={};function oi(r){Ve("dlopen");}function ai(){return []}function ui(){return []}var li=R,fi=R,Ke=function(){return {}},hi=Ke,ci=Ke,di=R,pi=R,gi=R,yi={};function mi(r,i){if(!r)throw new Error(i||"assertion error")}var wi={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},bi=R,vi=R;function Ei(){return !1}var Ii=R,Ai=R,_i=R,Si=R,Bi=R,xi=void 0,Ti=void 0,ki=void 0,Ui=R,Oi=2,Ni=1,Ri="/bin/usr/node",Ci=9229,Li="node",Pi=[],Mi=R,q={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};q.now===void 0&&(Ce=Date.now(),q.timing&&q.timing.navigationStart&&(Ce=q.timing.navigationStart),q.now=()=>Date.now()-Ce);var Ce;function $i(){return q.now()/1e3}var Pe=1e9;function Me(r){var i=Math.floor((Date.now()-q.now())*.001),s=q.now()*.001,f=Math.floor(s)+i,h=Math.floor(s%1*1e9);return r&&(f=f-r[0],h=h-r[1],h<0&&(f--,h+=Pe)),[f,h]}Me.bigint=function(r){var i=Me(r);return typeof BigInt>"u"?i[0]*Pe+i[1]:BigInt(i[0]*Pe)+BigInt(i[1])};var Di=10,Fi={},ji=0;function V(){return $e}var Gi=V,qi=V,Vi=V,Ki=V,zi=V,Yi=R,Hi=V,Wi=V;function Ji(r){return []}var $e={version:zn,versions:Yn,arch:jn,platform:Gn,release:Zn,_rawDebug:ei,moduleLoadList:ti,binding:Wn,_linkedBinding:ni,_events:Fi,_eventsCount:ji,_maxListeners:Di,on:V,addListener:Gi,once:qi,off:Vi,removeListener:Ki,removeAllListeners:zi,emit:Yi,prependListener:Hi,prependOnceListener:Wi,listeners:Ji,domain:ii,_exiting:ri,config:si,dlopen:oi,uptime:$i,_getActiveRequests:ai,_getActiveHandles:ui,reallyExit:li,_kill:fi,cpuUsage:Ke,resourceUsage:hi,memoryUsage:ci,kill:di,exit:pi,openStdin:gi,allowedNodeEnvironmentFlags:yi,assert:mi,features:wi,_fatalExceptions:bi,setUncaughtExceptionCaptureCallback:vi,hasUncaughtExceptionCaptureCallback:Ei,emitWarning:Hn,nextTick:Dn,_tickCallback:Ii,_debugProcess:Ai,_debugEnd:_i,_startProfilerIdleNotifier:Si,_stopProfilerIdleNotifier:Bi,stdout:xi,stdin:ki,stderr:Ti,abort:Ui,umask:Jn,chdir:Qn,cwd:Xn,env:qn,title:Fn,argv:Vn,execArgv:Kn,pid:Oi,ppid:Ni,execPath:Ri,debugPort:Ci,hrtime:Me,argv0:Li,_preload_modules:Pi,setSourceMapsEnabled:Mi},he={},yt=!1;function Xi(){if(yt)return he;yt=!0,he.byteLength=y,he.toByteArray=E,he.fromByteArray=I;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,c=f.length;h<c;++h)r[h]=f[h],i[f.charCodeAt(h)]=h;i[45]=62,i[95]=63;function a(p){var w=p.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var A=p.indexOf("=");A===-1&&(A=w);var x=A===w?0:4-A%4;return [A,x]}function y(p){var w=a(p),A=w[0],x=w[1];return (A+x)*3/4-x}function g(p,w,A){return (w+A)*3/4-A}function E(p){var w,A=a(p),x=A[0],N=A[1],T=new s(g(p,x,N)),L=0,M=N>0?x-4:x,C;for(C=0;C<M;C+=4)w=i[p.charCodeAt(C)]<<18|i[p.charCodeAt(C+1)]<<12|i[p.charCodeAt(C+2)]<<6|i[p.charCodeAt(C+3)],T[L++]=w>>16&255,T[L++]=w>>8&255,T[L++]=w&255;return N===2&&(w=i[p.charCodeAt(C)]<<2|i[p.charCodeAt(C+1)]>>4,T[L++]=w&255),N===1&&(w=i[p.charCodeAt(C)]<<10|i[p.charCodeAt(C+1)]<<4|i[p.charCodeAt(C+2)]>>2,T[L++]=w>>8&255,T[L++]=w&255),T}function m(p){return r[p>>18&63]+r[p>>12&63]+r[p>>6&63]+r[p&63]}function v(p,w,A){for(var x,N=[],T=w;T<A;T+=3)x=(p[T]<<16&16711680)+(p[T+1]<<8&65280)+(p[T+2]&255),N.push(m(x));return N.join("")}function I(p){for(var w,A=p.length,x=A%3,N=[],T=16383,L=0,M=A-x;L<M;L+=T)N.push(v(p,L,L+T>M?M:L+T));return x===1?(w=p[A-1],N.push(r[w>>2]+r[w<<4&63]+"==")):x===2&&(w=(p[A-2]<<8)+p[A-1],N.push(r[w>>10]+r[w>>4&63]+r[w<<2&63]+"=")),N.join("")}return he}var we={},mt=!1;function Qi(){return mt?we:(mt=!0,we.read=function(r,i,s,f,h){var c,a,y=h*8-f-1,g=(1<<y)-1,E=g>>1,m=-7,v=s?h-1:0,I=s?-1:1,p=r[i+v];for(v+=I,c=p&(1<<-m)-1,p>>=-m,m+=y;m>0;c=c*256+r[i+v],v+=I,m-=8);for(a=c&(1<<-m)-1,c>>=-m,m+=f;m>0;a=a*256+r[i+v],v+=I,m-=8);if(c===0)c=1-E;else {if(c===g)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,f),c=c-E;}return (p?-1:1)*a*Math.pow(2,c-f)},we.write=function(r,i,s,f,h,c){var a,y,g,E=c*8-h-1,m=(1<<E)-1,v=m>>1,I=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=f?0:c-1,w=f?1:-1,A=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(y=isNaN(i)?1:0,a=m):(a=Math.floor(Math.log(i)/Math.LN2),i*(g=Math.pow(2,-a))<1&&(a--,g*=2),a+v>=1?i+=I/g:i+=I*Math.pow(2,1-v),i*g>=2&&(a++,g/=2),a+v>=m?(y=0,a=m):a+v>=1?(y=(i*g-1)*Math.pow(2,h),a=a+v):(y=i*Math.pow(2,v-1)*Math.pow(2,h),a=0));h>=8;r[s+p]=y&255,p+=w,y/=256,h-=8);for(a=a<<h|y,E+=h;E>0;r[s+p]=a&255,p+=w,a/=256,E-=8);r[s+p-w]|=A*128;},we)}var H={},wt=!1;function Zi(){if(wt)return H;wt=!0;let r=Xi(),i=Qi(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;H.Buffer=a,H.SlowBuffer=N,H.INSPECT_MAX_BYTES=50;let f=2147483647;H.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=h(),!a.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{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch(e){return !1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function c(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(e)}return y(e,t,n)}a.poolSize=8192;function y(e,t,n){if(typeof e=="string")return v(e,t);if(ArrayBuffer.isView(e))return p(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(D(e,ArrayBuffer)||e&&D(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(D(e,SharedArrayBuffer)||e&&D(e.buffer,SharedArrayBuffer)))return w(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let u=A(e);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,t,n){return y(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function g(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function E(e,t,n){return g(e),e<=0?c(e):t!==void 0?typeof n=="string"?c(e).fill(t,n):c(e).fill(t):c(e)}a.alloc=function(e,t,n){return E(e,t,n)};function m(e){return g(e),c(e<0?0:x(e)|0)}a.allocUnsafe=function(e){return m(e)},a.allocUnsafeSlow=function(e){return m(e)};function v(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=T(e,t)|0,o=c(n),u=o.write(e,t);return u!==n&&(o=o.slice(0,u)),o}function I(e){let t=e.length<0?0:x(e.length)|0,n=c(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function p(e){if(D(e,Uint8Array)){let t=new Uint8Array(e);return w(t.buffer,t.byteOffset,t.byteLength)}return I(e)}function w(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return t===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,n),Object.setPrototypeOf(o,a.prototype),o}function A(e){if(a.isBuffer(e)){let t=x(e.length)|0,n=c(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!="number"||Ue(e.length)?c(0):I(e);if(e.type==="Buffer"&&Array.isArray(e.data))return I(e.data)}function x(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function N(e){return +e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype},a.compare=function(e,t){if(D(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),D(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,o=t.length;for(let u=0,l=Math.min(n,o);u<l;++u)if(e[u]!==t[u]){n=e[u],o=t[u];break}return n<o?-1:o<n?1:0},a.isEncoding=function(e){switch(String(e).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}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=a.allocUnsafe(t),u=0;for(n=0;n<e.length;++n){let l=e[n];if(D(l,Uint8Array))u+l.length>o.length?(a.isBuffer(l)||(l=a.from(l)),l.copy(o,u)):Uint8Array.prototype.set.call(o,l,u);else if(a.isBuffer(l))l.copy(o,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=l.length;}return o};function T(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||D(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let u=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ke(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return lt(e).length;default:if(u)return o?-1:ke(e).length;t=(""+t).toLowerCase(),u=!0;}}a.byteLength=T;function L(e,t,n){let o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return "";for(e||(e="utf8");;)switch(e){case"hex":return ln(this,t,n);case"utf8":case"utf-8":return et(this,t,n);case"ascii":return an(this,t,n);case"latin1":case"binary":return un(this,t,n);case"base64":return sn(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fn(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0;}}a.prototype._isBuffer=!0;function M(e,t,n){let o=e[t];e[t]=e[n],e[n]=o;}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)M(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)M(this,t,t+3),M(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)M(this,t,t+7),M(this,t+1,t+6),M(this,t+2,t+5),M(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?et(this,0,e):L.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=H.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,o,u){if(D(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),u===void 0&&(u=this.length),t<0||n>e.length||o<0||u>this.length)throw new RangeError("out of range index");if(o>=u&&t>=n)return 0;if(o>=u)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,u>>>=0,this===e)return 0;let l=u-o,d=n-t,S=Math.min(l,d),O=this.slice(o,u),B=e.slice(t,n);for(let _=0;_<S;++_)if(O[_]!==B[_]){l=O[_],d=B[_];break}return l<d?-1:d<l?1:0};function C(e,t,n,o,u){if(e.length===0)return -1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ue(n)&&(n=u?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(u)return -1;n=e.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:Ze(e,t,n,o,u);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?u?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Ze(e,[t],n,o,u);throw new TypeError("val must be string, number or Buffer")}function Ze(e,t,n,o,u){let l=1,d=e.length,S=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return -1;l=2,d/=2,S/=2,n/=2;}function O(_,k){return l===1?_[k]:_.readUInt16BE(k*l)}let B;if(u){let _=-1;for(B=n;B<d;B++)if(O(e,B)===O(t,_===-1?0:B-_)){if(_===-1&&(_=B),B-_+1===S)return _*l}else _!==-1&&(B-=B-_),_=-1;}else for(n+S>d&&(n=d-S),B=n;B>=0;B--){let _=!0;for(let k=0;k<S;k++)if(O(e,B+k)!==O(t,k)){_=!1;break}if(_)return B}return -1}a.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},a.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)};function Zt(e,t,n,o){n=Number(n)||0;let u=e.length-n;o?(o=Number(o),o>u&&(o=u)):o=u;let l=t.length;o>l/2&&(o=l/2);let d;for(d=0;d<o;++d){let S=parseInt(t.substr(d*2,2),16);if(Ue(S))return d;e[n+d]=S;}return d}function en(e,t,n,o){return me(ke(t,e.length-n),e,n,o)}function tn(e,t,n,o){return me(pn(t),e,n,o)}function nn(e,t,n,o){return me(lt(t),e,n,o)}function rn(e,t,n,o){return me(gn(t,e.length-n),e,n,o)}a.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((n===void 0||n>u)&&(n=u),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let l=!1;for(;;)switch(o){case"hex":return Zt(this,e,t,n);case"utf8":case"utf-8":return en(this,e,t,n);case"ascii":case"latin1":case"binary":return tn(this,e,t,n);case"base64":return nn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rn(this,e,t,n);default:if(l)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),l=!0;}},a.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function sn(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function et(e,t,n){n=Math.min(e.length,n);let o=[],u=t;for(;u<n;){let l=e[u],d=null,S=l>239?4:l>223?3:l>191?2:1;if(u+S<=n){let O,B,_,k;switch(S){case 1:l<128&&(d=l);break;case 2:O=e[u+1],(O&192)===128&&(k=(l&31)<<6|O&63,k>127&&(d=k));break;case 3:O=e[u+1],B=e[u+2],(O&192)===128&&(B&192)===128&&(k=(l&15)<<12|(O&63)<<6|B&63,k>2047&&(k<55296||k>57343)&&(d=k));break;case 4:O=e[u+1],B=e[u+2],_=e[u+3],(O&192)===128&&(B&192)===128&&(_&192)===128&&(k=(l&15)<<18|(O&63)<<12|(B&63)<<6|_&63,k>65535&&k<1114112&&(d=k));}}d===null?(d=65533,S=1):d>65535&&(d-=65536,o.push(d>>>10&1023|55296),d=56320|d&1023),o.push(d),u+=S;}return on(o)}let tt=4096;function on(e){let t=e.length;if(t<=tt)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=tt));return n}function an(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]&127);return o}function un(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]);return o}function ln(e,t,n){let o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);let u="";for(let l=t;l<n;++l)u+=yn[e[l]];return u}function fn(e,t,n){let o=e.slice(t,n),u="";for(let l=0;l<o.length-1;l+=2)u+=String.fromCharCode(o[l]+o[l+1]*256);return u}a.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let o=this.subarray(e,t);return Object.setPrototypeOf(o,a.prototype),o};function U(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e+--t],u=1;for(;t>0&&(u*=256);)o+=this[e+--t]*u;return o},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||U(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||U(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||U(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=G(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let o=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(u)<<BigInt(32))}),a.prototype.readBigUInt64BE=G(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let o=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(u)}),a.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*t)),o},a.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=t,u=1,l=this[e+--o];for(;o>0&&(u*=256);)l+=this[e+--o]*u;return u*=128,l>=u&&(l-=Math.pow(2,8*t)),l},a.prototype.readInt8=function(e,t){return e=e>>>0,t||U(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||U(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||U(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=G(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=G(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let o=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||U(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||U(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||U(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||U(e,8,this.length),i.read(this,e,!1,52,8)};function P(e,t,n,o,u,l){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>u||t<l)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let d=Math.pow(2,8*n)-1;P(this,e,t,n,d,0);}let u=1,l=0;for(this[t]=e&255;++l<n&&(u*=256);)this[t+l]=e/u&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let d=Math.pow(2,8*n)-1;P(this,e,t,n,d,0);}let u=n-1,l=1;for(this[t+u]=e&255;--u>=0&&(l*=256);)this[t+u]=e/l&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function nt(e,t,n,o,u){ut(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l;let d=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=d,d=d>>8,e[n++]=d,d=d>>8,e[n++]=d,d=d>>8,e[n++]=d,n}function it(e,t,n,o,u){ut(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n+7]=l,l=l>>8,e[n+6]=l,l=l>>8,e[n+5]=l,l=l>>8,e[n+4]=l;let d=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=d,d=d>>8,e[n+2]=d,d=d>>8,e[n+1]=d,d=d>>8,e[n]=d,n+8}a.prototype.writeBigUInt64LE=G(function(e,t=0){return nt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=G(function(e,t=0){return it(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let S=Math.pow(2,8*n-1);P(this,e,t,n,S-1,-S);}let u=0,l=1,d=0;for(this[t]=e&255;++u<n&&(l*=256);)e<0&&d===0&&this[t+u-1]!==0&&(d=1),this[t+u]=(e/l>>0)-d&255;return t+n},a.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let S=Math.pow(2,8*n-1);P(this,e,t,n,S-1,-S);}let u=n-1,l=1,d=0;for(this[t+u]=e&255;--u>=0&&(l*=256);)e<0&&d===0&&this[t+u+1]!==0&&(d=1),this[t+u]=(e/l>>0)-d&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=G(function(e,t=0){return nt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=G(function(e,t=0){return it(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rt(e,t,n,o,u,l){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function st(e,t,n,o,u){return t=+t,n=n>>>0,u||rt(e,t,n,4),i.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(e,t,n){return st(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return st(this,e,t,!1,n)};function ot(e,t,n,o,u){return t=+t,n=n>>>0,u||rt(e,t,n,8),i.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(e,t,n){return ot(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return ot(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,o){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let u=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),u},a.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let l=e.charCodeAt(0);(o==="utf8"&&l<128||o==="latin1")&&(e=l);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<n;++u)this[u]=e;else {let l=a.isBuffer(e)?e:a.from(e,o),d=l.length;if(d===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<n-t;++u)this[u+t]=l[u%d];}return this};let ne={};function Te(e,t,n){ne[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name;}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Te("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),Te("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,u=n;return Number.isInteger(n)&&Math.abs(n)>2**32?u=at(String(n)):typeof n=="bigint"&&(u=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(u=at(u)),u+="n"),o+=` It must be ${t}. Received ${u}`,o},RangeError);function at(e){let t="",n=e.length,o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return `${e.slice(0,n)}${t}`}function hn(e,t,n){ie(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&fe(t,e.length-(n+1));}function ut(e,t,n,o,u,l){if(e>n||e<t){let d=typeof t=="bigint"?"n":"",S;throw t===0||t===BigInt(0)?S=`>= 0${d} and < 2${d} ** ${(l+1)*8}${d}`:S=`>= -(2${d} ** ${(l+1)*8-1}${d}) and < 2 ** ${(l+1)*8-1}${d}`,new ne.ERR_OUT_OF_RANGE("value",S,e)}hn(o,u,l);}function ie(e,t){if(typeof e!="number")throw new ne.ERR_INVALID_ARG_TYPE(t,"number",e)}function fe(e,t,n){throw Math.floor(e)!==e?(ie(e,n),new ne.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new ne.ERR_BUFFER_OUT_OF_BOUNDS:new ne.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}let cn=/[^+/0-9A-Za-z-_]/g;function dn(e){if(e=e.split("=")[0],e=e.trim().replace(cn,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function ke(e,t){t=t||1/0;let n,o=e.length,u=null,l=[];for(let d=0;d<o;++d){if(n=e.charCodeAt(d),n>55295&&n<57344){if(!u){if(n>56319){(t-=3)>-1&&l.push(239,191,189);continue}else if(d+1===o){(t-=3)>-1&&l.push(239,191,189);continue}u=n;continue}if(n<56320){(t-=3)>-1&&l.push(239,191,189),u=n;continue}n=(u-55296<<10|n-56320)+65536;}else u&&(t-=3)>-1&&l.push(239,191,189);if(u=null,n<128){if((t-=1)<0)break;l.push(n);}else if(n<2048){if((t-=2)<0)break;l.push(n>>6|192,n&63|128);}else if(n<65536){if((t-=3)<0)break;l.push(n>>12|224,n>>6&63|128,n&63|128);}else if(n<1114112){if((t-=4)<0)break;l.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128);}else throw new Error("Invalid code point")}return l}function pn(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function gn(e,t){let n,o,u,l=[];for(let d=0;d<e.length&&!((t-=2)<0);++d)n=e.charCodeAt(d),o=n>>8,u=n%256,l.push(u),l.push(o);return l}function lt(e){return r.toByteArray(dn(e))}function me(e,t,n,o){let u;for(u=0;u<o&&!(u+n>=t.length||u>=e.length);++u)t[u+n]=e[u];return u}function D(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ue(e){return e!==e}let yn=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let o=n*16;for(let u=0;u<16;++u)t[o+u]=e[n]+e[u];}return t}();function G(e){return typeof BigInt>"u"?mn:e}function mn(){throw new Error("BigInt not supported")}return H}var Z=Zi();Z.Buffer;Z.SlowBuffer;Z.INSPECT_MAX_BYTES;Z.kMaxLength;var bt=Z.Buffer;Z.INSPECT_MAX_BYTES;Z.kMaxLength;var er={};Mn(er,{deleteItem:()=>rr,getItem:()=>De,setItem:()=>Ee});var ve=()=>typeof window>"u",At=()=>!ve(),tr="__IMX-",ze=()=>At()&&window.localStorage,nr=r=>{if(r!==null)try{return JSON.parse(r)}catch(i){return r}},ir=r=>typeof r=="string"?r:JSON.stringify(r),Ye=r=>`${tr}${r}`;function De(r){if(ze())return nr(window.localStorage.getItem(Ye(r)))}var Ee=(r,i)=>ze()?(window.localStorage.setItem(Ye(r),ir(i)),!0):!1,rr=r=>ze()?(window.localStorage.removeItem(Ye(r)),!0):!1,Fe=0,sr=r=>{let i=parseInt(r,10)*1e3,s=new Date(i),f=new Date;return Fe=s.getTime()-f.getTime(),Fe},or=()=>{let r=new Date().getTime()+Fe;return new Date(r).toISOString()},ar=(r=>(r.RUNTIME_ID="rid",r.PASSPORT_CLIENT_ID="passportClientId",r.ENVIRONMENT="env",r.PUBLISHABLE_API_KEY="pak",r.IDENTITY="uid",r.DOMAIN="domain",r.SDK_VERSION="sdkVersion",r))(ar||{}),ur="https://api.immutable.com",lr=r=>{if(typeof bt<"u")return bt.from(r,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(r)));throw new Error("Base64 encoding not supported in this environment")};async function _t(r,i){let s=JSON.stringify(i),f={payload:lr(s)},h=await fetch(`${ur}${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok){let c=await h.text().catch(()=>"");throw new Error(`Request failed (${h.status}): ${c||h.statusText}`)}return h.json()}var J,X,fr=()=>{J=De("metrics-events")||[],X=De("metrics-runtime")||{};};fr();var Q=(r,i)=>{X={...X,[r]:i},Ee("metrics-runtime",X);},je=r=>{if(X[r]!==void 0)return X[r]},hr=()=>X,cr=()=>J,dr=r=>{J.push(r),Ee("metrics-events",J);},pr=r=>{J=J.slice(r),Ee("metrics-events",J);},St=r=>{let i=[];return Object.entries(r).forEach(([s,f])=>{(typeof s=="string"||typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&i.push([s,f.toString()]);}),i},Le="2.20.1-alpha.0",gr=()=>ve()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",yr=()=>{if(ve())return "";let r;try{window.self!==window.top&&(r=gr());}catch(i){}return r||(r=window.location.hostname),r},mr=()=>{if(Q("sdkVersion",Le),ve())return {browser:"nodejs",sdkVersion:Le};let r=yr();return r&&Q("domain",r),{sdkVersion:Le,browser:window.navigator.userAgent,domain:r,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},Ge=!1,wr=()=>Ge,br=async()=>{Ge=!0;try{let r=St(mr()),i=je("rid"),s=je("uid"),f=await _t("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:s}}),{runtimeId:h,sTime:c}=f;Q("rid",h),sr(c);}catch(r){Ge=!1;}};function $(r,i){return (...s)=>{try{let f=r(...s);return f instanceof Promise?f.catch(()=>i):f}catch(f){return i}}}function vr(){return At()||typeof $e>"u"?!1:$e.env.JEST_WORKER_ID!==void 0}var Er=$(vr,!1),Bt="imtbl__metrics",Ir=5e3,Ar=1e3,ce=(r,i)=>(0, qe.getGlobalisedValue)(Bt,r,i),_r=(r,i)=>{let s=ht(i,{lruOptions:{ttl:Ir,max:Ar}});return (0, qe.getGlobalisedValue)(Bt,r,s)},Sr=5e3,Br=(r,i,s)=>{let f={event:`${r}.${i}`,time:or(),...s&&{properties:St(s)}};dr(f);},ee=$(_r("track",Br)),xr=async()=>{if(wr()===!1){await br();return}let r=cr();if(r.length===0)return;let i=r.length,s=hr();await _t("/v1/sdk/metrics",{version:1,data:{events:r,details:s}})instanceof Error||pr(i);},Tr=$(xr),xt=async()=>{await Tr(),setTimeout(xt,Sr);},vt=!1,kr=()=>{vt||(vt=!0,xt());};Er()||$(ce("startFlushing",kr))();var Pr=(r,i,s,f)=>{let{message:h}=s,c=s.stack||"",{cause:a}=s;a instanceof Error&&(c=`${c}
4
+ var En=Object.create;var Oe=Object.defineProperty;var In=Object.getOwnPropertyDescriptor;var An=Object.getOwnPropertyNames;var _n=Object.getPrototypeOf,Sn=Object.prototype.hasOwnProperty;var Bn=(r,i,s)=>i in r?Oe(r,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[i]=s;var xn=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var Tn=(r,i,s,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of An(i))!Sn.call(r,h)&&h!==s&&Oe(r,h,{get:()=>i[h],enumerable:!(f=In(i,h))||f.enumerable});return r};var kn=(r,i,s)=>(s=r!=null?En(_n(r)):{},Tn(Oe(s,"default",{value:r,enumerable:!0}),r));var w=(r,i,s)=>Bn(r,typeof i!="symbol"?i+"":i,s);var It=xn(he=>{Object.defineProperty(he,"__esModule",{value:!0});he.clearGlobalNamespace=he.getGlobalisedValue=void 0;var Nn="globalise__singleton__",Rn={},bt=()=>typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:Rn,Cn=(r,i)=>{if(typeof r!="string")throw "Invalid namespace key";if(typeof i!="string")throw "Invalid item key"},vt=r=>`${Nn}${r}`,Et=r=>{let i=bt(),s=vt(r);return i[s]||(i[s]={}),i[s]},Ln=(r,i)=>Et(r)[i]||void 0,Pn=(r,i,s)=>{let f=Et(r);f[i]=s;},Mn=(r,i,s)=>{Cn(r,i);let f=Ln(r,i);return f!==void 0?f:(Pn(r,i,s),s)};he.getGlobalisedValue=Mn;var $n=r=>{let i=bt(),s=vt(r);i[s]!==void 0&&delete i[s];};he.clearGlobalNamespace=$n;});var Ne="https://api.immutable.com",gt="/v1/audience/messages",mt="/v1/audience/tracking-consent",K="imtbl_anon_id",z="_imtbl_sid",Re="session_start",Ce="session_end",j=()=>typeof window<"u"&&typeof document<"u",Y=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let i=Math.trunc(Math.random()*16);return (r==="x"?i:i%4+8).toString(16)}),Le=()=>new Date().toISOString();function ue(r){if(!j())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function le(r,i,s,f){if(!j())return;let h=window.location.protocol==="https:"?"; Secure":"",c=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${s}; SameSite=Lax${c}${h}`;}function fe(r,i){le(r,"",0,i);}function ge(r){let i=ue(K);if(i)return i;let s=Y();return le(K,s,63072e3,r),s}function Pe(r,i){le(K,r,63072e3,i);}var Me=class{constructor(i=0,s=0,f=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=i,this.resetTtl=f,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(i){if(this.has(i)){let s=this.items[i];delete this.items[i],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(i=this.keys()){return i.map(s=>[s,this.get(s)])}evict(i=!1){if(i||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(i){let s;return this.has(i)&&(s=this.items[i].expiry),s}get(i){let s;if(this.has(i)){let f=this.items[i];this.ttl>0&&f.expiry<=Date.now()?this.delete(i):(s=f.value,this.set(i,s,!0));}return s}has(i){return i in this.items}keys(){let i=[],s=this.first;for(;s!==null;)i.push(s.key),s=s.next;return i}set(i,s,f=!1,h=this.resetTtl){let c;if(f||this.has(i)){if(c=this.items[i],c.value=s,f===!1&&h&&(c.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==c){let a=this.last,m=c.next,g=c.prev;this.first===c&&(this.first=c.next),c.next=null,c.prev=this.last,a.next=c,g!==null&&(g.next=m),m!==null&&(m.prev=g);}}else this.max>0&&this.size===this.max&&this.evict(!0),c=this.items[i]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:i,prev:this.last,next:null,value:s},++this.size===1?this.first=c:this.last.next=c;return this.last=c,this}values(i=this.keys()){return i.map(s=>this.get(s))}};function yt(r=1e3,i=0,s=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(i)||i<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new Me(r,i,s)}var Un={max:1e3},wt=(r,i={})=>{let{cache:s,cacheKeyResolver:f=$e,onHit:h,lruOptions:c={}}=i,a={...Un,...c},m=s||yt(a.max,a.ttl);function g(...I){let y=f(...I),v=m.get(y);if(m.has(y))return h&&h(y,v,m),v;let p=r.apply(this,I);return m.set(y,p),p}return g._cache=m,g},$e=(...r)=>r.length===0?"no-args":r.map(i=>i===void 0?"undefined":i===null?"null":Array.isArray(i)?`[${$e(...i)}]`:typeof i=="object"?`{${$e(...On(i))}}`:JSON.stringify(i)).join(","),On=r=>Object.entries(r).sort((i,s)=>i[0]<s[0]?-1:1);var He=kn(It()),Dn=Object.defineProperty,Fn=(r,i)=>{for(var s in i)Dn(r,s,{get:i[s],enumerable:!0});};function We(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}var G=[],ce=!1,Z,Ie=-1;function jn(){!ce||!Z||(ce=!1,Z.length?G=Z.concat(G):Ie=-1,G.length&&Tt());}function Tt(){if(!ce){var r=setTimeout(jn,0);ce=!0;for(var i=G.length;i;){for(Z=G,G=[];++Ie<i;)Z&&Z[Ie].run();Ie=-1,i=G.length;}Z=null,ce=!1,clearTimeout(r);}}function Gn(r){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];G.push(new kt(r,i)),G.length===1&&!ce&&setTimeout(Tt,0);}function kt(r,i){this.fun=r,this.array=i;}kt.prototype.run=function(){this.fun.apply(null,this.array);};var qn="browser",Vn="x64",Kn="browser",zn={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Yn=["/usr/bin/node"],Hn=[],Wn="v16.8.0",Jn={},Xn=function(r,i){console.warn((i?i+": ":"")+r);},Qn=function(r){We("binding");},Zn=function(r){return 0},ei=function(){return "/"},ti=function(r){},ni={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function R(){}var ii=R,ri=[];function si(r){We("_linkedBinding");}var oi={},ai=!1,ui={};function li(r){We("dlopen");}function fi(){return []}function hi(){return []}var ci=R,di=R,Je=function(){return {}},pi=Je,gi=Je,mi=R,yi=R,wi=R,bi={};function vi(r,i){if(!r)throw new Error(i||"assertion error")}var Ei={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Ii=R,Ai=R;function _i(){return !1}var Si=R,Bi=R,xi=R,Ti=R,ki=R,Ui=void 0,Oi=void 0,Ni=void 0,Ri=R,Ci=2,Li=1,Pi="/bin/usr/node",Mi=9229,$i="node",Di=[],Fi=R,H={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};H.now===void 0&&(De=Date.now(),H.timing&&H.timing.navigationStart&&(De=H.timing.navigationStart),H.now=()=>Date.now()-De);var De;function ji(){return H.now()/1e3}var je=1e9;function Ge(r){var i=Math.floor((Date.now()-H.now())*.001),s=H.now()*.001,f=Math.floor(s)+i,h=Math.floor(s%1*1e9);return r&&(f=f-r[0],h=h-r[1],h<0&&(f--,h+=je)),[f,h]}Ge.bigint=function(r){var i=Ge(r);return typeof BigInt>"u"?i[0]*je+i[1]:BigInt(i[0]*je)+BigInt(i[1])};var Gi=10,qi={},Vi=0;function W(){return qe}var Ki=W,zi=W,Yi=W,Hi=W,Wi=W,Ji=R,Xi=W,Qi=W;function Zi(r){return []}var qe={version:Wn,versions:Jn,arch:Vn,platform:Kn,release:ni,_rawDebug:ii,moduleLoadList:ri,binding:Qn,_linkedBinding:si,_events:qi,_eventsCount:Vi,_maxListeners:Gi,on:W,addListener:Ki,once:zi,off:Yi,removeListener:Hi,removeAllListeners:Wi,emit:Ji,prependListener:Xi,prependOnceListener:Qi,listeners:Zi,domain:oi,_exiting:ai,config:ui,dlopen:li,uptime:ji,_getActiveRequests:fi,_getActiveHandles:hi,reallyExit:ci,_kill:di,cpuUsage:Je,resourceUsage:pi,memoryUsage:gi,kill:mi,exit:yi,openStdin:wi,allowedNodeEnvironmentFlags:bi,assert:vi,features:Ei,_fatalExceptions:Ii,setUncaughtExceptionCaptureCallback:Ai,hasUncaughtExceptionCaptureCallback:_i,emitWarning:Xn,nextTick:Gn,_tickCallback:Si,_debugProcess:Bi,_debugEnd:xi,_startProfilerIdleNotifier:Ti,_stopProfilerIdleNotifier:ki,stdout:Ui,stdin:Ni,stderr:Oi,abort:Ri,umask:Zn,chdir:ti,cwd:ei,env:zn,title:qn,argv:Yn,execArgv:Hn,pid:Ci,ppid:Li,execPath:Pi,debugPort:Mi,hrtime:Ge,argv0:$i,_preload_modules:Di,setSourceMapsEnabled:Fi},me={},At=!1;function er(){if(At)return me;At=!0,me.byteLength=m,me.toByteArray=I,me.fromByteArray=E;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,c=f.length;h<c;++h)r[h]=f[h],i[f.charCodeAt(h)]=h;i[45]=62,i[95]=63;function a(p){var b=p.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var A=p.indexOf("=");A===-1&&(A=b);var x=A===b?0:4-A%4;return [A,x]}function m(p){var b=a(p),A=b[0],x=b[1];return (A+x)*3/4-x}function g(p,b,A){return (b+A)*3/4-A}function I(p){var b,A=a(p),x=A[0],N=A[1],T=new s(g(p,x,N)),L=0,M=N>0?x-4:x,C;for(C=0;C<M;C+=4)b=i[p.charCodeAt(C)]<<18|i[p.charCodeAt(C+1)]<<12|i[p.charCodeAt(C+2)]<<6|i[p.charCodeAt(C+3)],T[L++]=b>>16&255,T[L++]=b>>8&255,T[L++]=b&255;return N===2&&(b=i[p.charCodeAt(C)]<<2|i[p.charCodeAt(C+1)]>>4,T[L++]=b&255),N===1&&(b=i[p.charCodeAt(C)]<<10|i[p.charCodeAt(C+1)]<<4|i[p.charCodeAt(C+2)]>>2,T[L++]=b>>8&255,T[L++]=b&255),T}function y(p){return r[p>>18&63]+r[p>>12&63]+r[p>>6&63]+r[p&63]}function v(p,b,A){for(var x,N=[],T=b;T<A;T+=3)x=(p[T]<<16&16711680)+(p[T+1]<<8&65280)+(p[T+2]&255),N.push(y(x));return N.join("")}function E(p){for(var b,A=p.length,x=A%3,N=[],T=16383,L=0,M=A-x;L<M;L+=T)N.push(v(p,L,L+T>M?M:L+T));return x===1?(b=p[A-1],N.push(r[b>>2]+r[b<<4&63]+"==")):x===2&&(b=(p[A-2]<<8)+p[A-1],N.push(r[b>>10]+r[b>>4&63]+r[b<<2&63]+"=")),N.join("")}return me}var Ee={},_t=!1;function tr(){return _t?Ee:(_t=!0,Ee.read=function(r,i,s,f,h){var c,a,m=h*8-f-1,g=(1<<m)-1,I=g>>1,y=-7,v=s?h-1:0,E=s?-1:1,p=r[i+v];for(v+=E,c=p&(1<<-y)-1,p>>=-y,y+=m;y>0;c=c*256+r[i+v],v+=E,y-=8);for(a=c&(1<<-y)-1,c>>=-y,y+=f;y>0;a=a*256+r[i+v],v+=E,y-=8);if(c===0)c=1-I;else {if(c===g)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,f),c=c-I;}return (p?-1:1)*a*Math.pow(2,c-f)},Ee.write=function(r,i,s,f,h,c){var a,m,g,I=c*8-h-1,y=(1<<I)-1,v=y>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=f?0:c-1,b=f?1:-1,A=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(m=isNaN(i)?1:0,a=y):(a=Math.floor(Math.log(i)/Math.LN2),i*(g=Math.pow(2,-a))<1&&(a--,g*=2),a+v>=1?i+=E/g:i+=E*Math.pow(2,1-v),i*g>=2&&(a++,g/=2),a+v>=y?(m=0,a=y):a+v>=1?(m=(i*g-1)*Math.pow(2,h),a=a+v):(m=i*Math.pow(2,v-1)*Math.pow(2,h),a=0));h>=8;r[s+p]=m&255,p+=b,m/=256,h-=8);for(a=a<<h|m,I+=h;I>0;r[s+p]=a&255,p+=b,a/=256,I-=8);r[s+p-b]|=A*128;},Ee)}var Q={},St=!1;function nr(){if(St)return Q;St=!0;let r=er(),i=tr(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Q.Buffer=a,Q.SlowBuffer=N,Q.INSPECT_MAX_BYTES=50;let f=2147483647;Q.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=h(),!a.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{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch(e){return !1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function c(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(e)}return m(e,t,n)}a.poolSize=8192;function m(e,t,n){if(typeof e=="string")return v(e,t);if(ArrayBuffer.isView(e))return p(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return b(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let u=A(e);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,t,n){return m(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function g(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function I(e,t,n){return g(e),e<=0?c(e):t!==void 0?typeof n=="string"?c(e).fill(t,n):c(e).fill(t):c(e)}a.alloc=function(e,t,n){return I(e,t,n)};function y(e){return g(e),c(e<0?0:x(e)|0)}a.allocUnsafe=function(e){return y(e)},a.allocUnsafeSlow=function(e){return y(e)};function v(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=T(e,t)|0,o=c(n),u=o.write(e,t);return u!==n&&(o=o.slice(0,u)),o}function E(e){let t=e.length<0?0:x(e.length)|0,n=c(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function p(e){if(F(e,Uint8Array)){let t=new Uint8Array(e);return b(t.buffer,t.byteOffset,t.byteLength)}return E(e)}function b(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return t===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,n),Object.setPrototypeOf(o,a.prototype),o}function A(e){if(a.isBuffer(e)){let t=x(e.length)|0,n=c(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!="number"||Ue(e.length)?c(0):E(e);if(e.type==="Buffer"&&Array.isArray(e.data))return E(e.data)}function x(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function N(e){return +e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype},a.compare=function(e,t){if(F(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,o=t.length;for(let u=0,l=Math.min(n,o);u<l;++u)if(e[u]!==t[u]){n=e[u],o=t[u];break}return n<o?-1:o<n?1:0},a.isEncoding=function(e){switch(String(e).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}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=a.allocUnsafe(t),u=0;for(n=0;n<e.length;++n){let l=e[n];if(F(l,Uint8Array))u+l.length>o.length?(a.isBuffer(l)||(l=a.from(l)),l.copy(o,u)):Uint8Array.prototype.set.call(o,l,u);else if(a.isBuffer(l))l.copy(o,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=l.length;}return o};function T(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let u=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ke(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return pt(e).length;default:if(u)return o?-1:ke(e).length;t=(""+t).toLowerCase(),u=!0;}}a.byteLength=T;function L(e,t,n){let o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return "";for(e||(e="utf8");;)switch(e){case"hex":return cn(this,t,n);case"utf8":case"utf-8":return st(this,t,n);case"ascii":return fn(this,t,n);case"latin1":case"binary":return hn(this,t,n);case"base64":return un(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dn(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0;}}a.prototype._isBuffer=!0;function M(e,t,n){let o=e[t];e[t]=e[n],e[n]=o;}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)M(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)M(this,t,t+3),M(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)M(this,t,t+7),M(this,t+1,t+6),M(this,t+2,t+5),M(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?st(this,0,e):L.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=Q.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,o,u){if(F(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),u===void 0&&(u=this.length),t<0||n>e.length||o<0||u>this.length)throw new RangeError("out of range index");if(o>=u&&t>=n)return 0;if(o>=u)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,u>>>=0,this===e)return 0;let l=u-o,d=n-t,S=Math.min(l,d),O=this.slice(o,u),B=e.slice(t,n);for(let _=0;_<S;++_)if(O[_]!==B[_]){l=O[_],d=B[_];break}return l<d?-1:d<l?1:0};function C(e,t,n,o,u){if(e.length===0)return -1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ue(n)&&(n=u?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(u)return -1;n=e.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:rt(e,t,n,o,u);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?u?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):rt(e,[t],n,o,u);throw new TypeError("val must be string, number or Buffer")}function rt(e,t,n,o,u){let l=1,d=e.length,S=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return -1;l=2,d/=2,S/=2,n/=2;}function O(_,k){return l===1?_[k]:_.readUInt16BE(k*l)}let B;if(u){let _=-1;for(B=n;B<d;B++)if(O(e,B)===O(t,_===-1?0:B-_)){if(_===-1&&(_=B),B-_+1===S)return _*l}else _!==-1&&(B-=B-_),_=-1;}else for(n+S>d&&(n=d-S),B=n;B>=0;B--){let _=!0;for(let k=0;k<S;k++)if(O(e,B+k)!==O(t,k)){_=!1;break}if(_)return B}return -1}a.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},a.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)};function nn(e,t,n,o){n=Number(n)||0;let u=e.length-n;o?(o=Number(o),o>u&&(o=u)):o=u;let l=t.length;o>l/2&&(o=l/2);let d;for(d=0;d<o;++d){let S=parseInt(t.substr(d*2,2),16);if(Ue(S))return d;e[n+d]=S;}return d}function rn(e,t,n,o){return ve(ke(t,e.length-n),e,n,o)}function sn(e,t,n,o){return ve(yn(t),e,n,o)}function on(e,t,n,o){return ve(pt(t),e,n,o)}function an(e,t,n,o){return ve(wn(t,e.length-n),e,n,o)}a.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((n===void 0||n>u)&&(n=u),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let l=!1;for(;;)switch(o){case"hex":return nn(this,e,t,n);case"utf8":case"utf-8":return rn(this,e,t,n);case"ascii":case"latin1":case"binary":return sn(this,e,t,n);case"base64":return on(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return an(this,e,t,n);default:if(l)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),l=!0;}},a.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function un(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function st(e,t,n){n=Math.min(e.length,n);let o=[],u=t;for(;u<n;){let l=e[u],d=null,S=l>239?4:l>223?3:l>191?2:1;if(u+S<=n){let O,B,_,k;switch(S){case 1:l<128&&(d=l);break;case 2:O=e[u+1],(O&192)===128&&(k=(l&31)<<6|O&63,k>127&&(d=k));break;case 3:O=e[u+1],B=e[u+2],(O&192)===128&&(B&192)===128&&(k=(l&15)<<12|(O&63)<<6|B&63,k>2047&&(k<55296||k>57343)&&(d=k));break;case 4:O=e[u+1],B=e[u+2],_=e[u+3],(O&192)===128&&(B&192)===128&&(_&192)===128&&(k=(l&15)<<18|(O&63)<<12|(B&63)<<6|_&63,k>65535&&k<1114112&&(d=k));}}d===null?(d=65533,S=1):d>65535&&(d-=65536,o.push(d>>>10&1023|55296),d=56320|d&1023),o.push(d),u+=S;}return ln(o)}let ot=4096;function ln(e){let t=e.length;if(t<=ot)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=ot));return n}function fn(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]&127);return o}function hn(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]);return o}function cn(e,t,n){let o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);let u="";for(let l=t;l<n;++l)u+=bn[e[l]];return u}function dn(e,t,n){let o=e.slice(t,n),u="";for(let l=0;l<o.length-1;l+=2)u+=String.fromCharCode(o[l]+o[l+1]*256);return u}a.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let o=this.subarray(e,t);return Object.setPrototypeOf(o,a.prototype),o};function U(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e+--t],u=1;for(;t>0&&(u*=256);)o+=this[e+--t]*u;return o},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||U(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||U(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||U(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=V(function(e){e=e>>>0,ae(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&pe(e,this.length-8);let o=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(u)<<BigInt(32))}),a.prototype.readBigUInt64BE=V(function(e){e=e>>>0,ae(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&pe(e,this.length-8);let o=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(u)}),a.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*t)),o},a.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=t,u=1,l=this[e+--o];for(;o>0&&(u*=256);)l+=this[e+--o]*u;return u*=128,l>=u&&(l-=Math.pow(2,8*t)),l},a.prototype.readInt8=function(e,t){return e=e>>>0,t||U(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||U(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||U(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=V(function(e){e=e>>>0,ae(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&pe(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=V(function(e){e=e>>>0,ae(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&pe(e,this.length-8);let o=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||U(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||U(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||U(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||U(e,8,this.length),i.read(this,e,!1,52,8)};function P(e,t,n,o,u,l){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>u||t<l)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let d=Math.pow(2,8*n)-1;P(this,e,t,n,d,0);}let u=1,l=0;for(this[t]=e&255;++l<n&&(u*=256);)this[t+l]=e/u&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let d=Math.pow(2,8*n)-1;P(this,e,t,n,d,0);}let u=n-1,l=1;for(this[t+u]=e&255;--u>=0&&(l*=256);)this[t+u]=e/l&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function at(e,t,n,o,u){dt(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l;let d=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=d,d=d>>8,e[n++]=d,d=d>>8,e[n++]=d,d=d>>8,e[n++]=d,n}function ut(e,t,n,o,u){dt(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n+7]=l,l=l>>8,e[n+6]=l,l=l>>8,e[n+5]=l,l=l>>8,e[n+4]=l;let d=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=d,d=d>>8,e[n+2]=d,d=d>>8,e[n+1]=d,d=d>>8,e[n]=d,n+8}a.prototype.writeBigUInt64LE=V(function(e,t=0){return at(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=V(function(e,t=0){return ut(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let S=Math.pow(2,8*n-1);P(this,e,t,n,S-1,-S);}let u=0,l=1,d=0;for(this[t]=e&255;++u<n&&(l*=256);)e<0&&d===0&&this[t+u-1]!==0&&(d=1),this[t+u]=(e/l>>0)-d&255;return t+n},a.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let S=Math.pow(2,8*n-1);P(this,e,t,n,S-1,-S);}let u=n-1,l=1,d=0;for(this[t+u]=e&255;--u>=0&&(l*=256);)e<0&&d===0&&this[t+u+1]!==0&&(d=1),this[t+u]=(e/l>>0)-d&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=V(function(e,t=0){return at(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=V(function(e,t=0){return ut(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lt(e,t,n,o,u,l){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ft(e,t,n,o,u){return t=+t,n=n>>>0,u||lt(e,t,n,4),i.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(e,t,n){return ft(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return ft(this,e,t,!1,n)};function ht(e,t,n,o,u){return t=+t,n=n>>>0,u||lt(e,t,n,8),i.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(e,t,n){return ht(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return ht(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,o){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let u=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),u},a.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let l=e.charCodeAt(0);(o==="utf8"&&l<128||o==="latin1")&&(e=l);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<n;++u)this[u]=e;else {let l=a.isBuffer(e)?e:a.from(e,o),d=l.length;if(d===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<n-t;++u)this[u+t]=l[u%d];}return this};let oe={};function Te(e,t,n){oe[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name;}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Te("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),Te("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,u=n;return Number.isInteger(n)&&Math.abs(n)>2**32?u=ct(String(n)):typeof n=="bigint"&&(u=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(u=ct(u)),u+="n"),o+=` It must be ${t}. Received ${u}`,o},RangeError);function ct(e){let t="",n=e.length,o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return `${e.slice(0,n)}${t}`}function pn(e,t,n){ae(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&pe(t,e.length-(n+1));}function dt(e,t,n,o,u,l){if(e>n||e<t){let d=typeof t=="bigint"?"n":"",S;throw t===0||t===BigInt(0)?S=`>= 0${d} and < 2${d} ** ${(l+1)*8}${d}`:S=`>= -(2${d} ** ${(l+1)*8-1}${d}) and < 2 ** ${(l+1)*8-1}${d}`,new oe.ERR_OUT_OF_RANGE("value",S,e)}pn(o,u,l);}function ae(e,t){if(typeof e!="number")throw new oe.ERR_INVALID_ARG_TYPE(t,"number",e)}function pe(e,t,n){throw Math.floor(e)!==e?(ae(e,n),new oe.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new oe.ERR_BUFFER_OUT_OF_BOUNDS:new oe.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}let gn=/[^+/0-9A-Za-z-_]/g;function mn(e){if(e=e.split("=")[0],e=e.trim().replace(gn,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function ke(e,t){t=t||1/0;let n,o=e.length,u=null,l=[];for(let d=0;d<o;++d){if(n=e.charCodeAt(d),n>55295&&n<57344){if(!u){if(n>56319){(t-=3)>-1&&l.push(239,191,189);continue}else if(d+1===o){(t-=3)>-1&&l.push(239,191,189);continue}u=n;continue}if(n<56320){(t-=3)>-1&&l.push(239,191,189),u=n;continue}n=(u-55296<<10|n-56320)+65536;}else u&&(t-=3)>-1&&l.push(239,191,189);if(u=null,n<128){if((t-=1)<0)break;l.push(n);}else if(n<2048){if((t-=2)<0)break;l.push(n>>6|192,n&63|128);}else if(n<65536){if((t-=3)<0)break;l.push(n>>12|224,n>>6&63|128,n&63|128);}else if(n<1114112){if((t-=4)<0)break;l.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128);}else throw new Error("Invalid code point")}return l}function yn(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function wn(e,t){let n,o,u,l=[];for(let d=0;d<e.length&&!((t-=2)<0);++d)n=e.charCodeAt(d),o=n>>8,u=n%256,l.push(u),l.push(o);return l}function pt(e){return r.toByteArray(mn(e))}function ve(e,t,n,o){let u;for(u=0;u<o&&!(u+n>=t.length||u>=e.length);++u)t[u+n]=e[u];return u}function F(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ue(e){return e!==e}let bn=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let o=n*16;for(let u=0;u<16;++u)t[o+u]=e[n]+e[u];}return t}();function V(e){return typeof BigInt>"u"?vn:e}function vn(){throw new Error("BigInt not supported")}return Q}var ie=nr();ie.Buffer;ie.SlowBuffer;ie.INSPECT_MAX_BYTES;ie.kMaxLength;var Bt=ie.Buffer;ie.INSPECT_MAX_BYTES;ie.kMaxLength;var ir={};Fn(ir,{deleteItem:()=>ar,getItem:()=>Ve,setItem:()=>_e});var Ae=()=>typeof window>"u",Ut=()=>!Ae(),rr="__IMX-",Xe=()=>Ut()&&window.localStorage,sr=r=>{if(r!==null)try{return JSON.parse(r)}catch(i){return r}},or=r=>typeof r=="string"?r:JSON.stringify(r),Qe=r=>`${rr}${r}`;function Ve(r){if(Xe())return sr(window.localStorage.getItem(Qe(r)))}var _e=(r,i)=>Xe()?(window.localStorage.setItem(Qe(r),or(i)),!0):!1,ar=r=>Xe()?(window.localStorage.removeItem(Qe(r)),!0):!1,Ke=0,ur=r=>{let i=parseInt(r,10)*1e3,s=new Date(i),f=new Date;return Ke=s.getTime()-f.getTime(),Ke},lr=()=>{let r=new Date().getTime()+Ke;return new Date(r).toISOString()},fr=(r=>(r.RUNTIME_ID="rid",r.PASSPORT_CLIENT_ID="passportClientId",r.ENVIRONMENT="env",r.PUBLISHABLE_API_KEY="pak",r.IDENTITY="uid",r.DOMAIN="domain",r.SDK_VERSION="sdkVersion",r))(fr||{}),hr="https://api.immutable.com",cr=r=>{if(typeof Bt<"u")return Bt.from(r,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(r)));throw new Error("Base64 encoding not supported in this environment")};async function Ot(r,i){let s=JSON.stringify(i),f={payload:cr(s)},h=await fetch(`${hr}${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok){let c=await h.text().catch(()=>"");throw new Error(`Request failed (${h.status}): ${c||h.statusText}`)}return h.json()}var ee,te,dr=()=>{ee=Ve("metrics-events")||[],te=Ve("metrics-runtime")||{};};dr();var ne=(r,i)=>{te={...te,[r]:i},_e("metrics-runtime",te);},ze=r=>{if(te[r]!==void 0)return te[r]},pr=()=>te,gr=()=>ee,mr=r=>{ee.push(r),_e("metrics-events",ee);},yr=r=>{ee=ee.slice(r),_e("metrics-events",ee);},Nt=r=>{let i=[];return Object.entries(r).forEach(([s,f])=>{(typeof s=="string"||typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&i.push([s,f.toString()]);}),i},Fe="2.20.1-alpha.2",wr=()=>Ae()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",br=()=>{if(Ae())return "";let r;try{window.self!==window.top&&(r=wr());}catch(i){}return r||(r=window.location.hostname),r},vr=()=>{if(ne("sdkVersion",Fe),Ae())return {browser:"nodejs",sdkVersion:Fe};let r=br();return r&&ne("domain",r),{sdkVersion:Fe,browser:window.navigator.userAgent,domain:r,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},Ye=!1,Er=()=>Ye,Ir=async()=>{Ye=!0;try{let r=Nt(vr()),i=ze("rid"),s=ze("uid"),f=await Ot("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:s}}),{runtimeId:h,sTime:c}=f;ne("rid",h),ur(c);}catch(r){Ye=!1;}};function $(r,i){return (...s)=>{try{let f=r(...s);return f instanceof Promise?f.catch(()=>i):f}catch(f){return i}}}function Ar(){return Ut()||typeof qe>"u"?!1:qe.env.JEST_WORKER_ID!==void 0}var _r=$(Ar,!1),Rt="imtbl__metrics",Sr=5e3,Br=1e3,ye=(r,i)=>(0, He.getGlobalisedValue)(Rt,r,i),xr=(r,i)=>{let s=wt(i,{lruOptions:{ttl:Sr,max:Br}});return (0, He.getGlobalisedValue)(Rt,r,s)},Tr=5e3,kr=(r,i,s)=>{let f={event:`${r}.${i}`,time:lr(),...s&&{properties:Nt(s)}};mr(f);},re=$(xr("track",kr)),Ur=async()=>{if(Er()===!1){await Ir();return}let r=gr();if(r.length===0)return;let i=r.length,s=pr();await Ot("/v1/sdk/metrics",{version:1,data:{events:r,details:s}})instanceof Error||yr(i);},Or=$(Ur),Ct=async()=>{await Or(),setTimeout(Ct,Tr);},xt=!1,Nr=()=>{xt||(xt=!0,Ct());};_r()||$(ye("startFlushing",Nr))();var Dr=(r,i,s,f)=>{let{message:h}=s,c=s.stack||"",{cause:a}=s;a instanceof Error&&(c=`${c}
5
5
  Cause: ${a.message}
6
- ${a.stack}`),ee(r,`trackError_${i}`,{...f||{},errorMessage:h,errorStack:c,isTrackError:!0});},Tt=$(Pr),Dr=r=>{Q("env",r);};$(ce("setEnvironment",Dr));var Fr=r=>{Q("passportClientId",r);};$(ce("setPassportClientId",Fr));var jr=r=>{Q("pak",r);};$(ce("setPublishableApiKey",jr));$(ce("getDetail",je));var Ot={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},Nt="https://api.immutable.com",Gr="/v1/audience/messages",qr="/v1/audience/tracking-consent",ae="imtbl_anon_id",oe="_imtbl_sid",Rt="session_start",Ct="session_end",de=()=>typeof window<"u"&&typeof document<"u",ue=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let i=Math.trunc(Math.random()*16);return (r==="x"?i:i%4+8).toString(16)}),Lt=()=>new Date().toISOString();function _e(r){if(!de())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function Ae(r,i,s,f){if(!de())return;let h=window.location.protocol==="https:"?"; Secure":"",c=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${s}; SameSite=Lax${c}${h}`;}function pe(r,i){Ae(r,"",0,i);}function Se(r){let i=_e(ae);if(i)return i;let s=ue();return Ae(ae,s,63072e3,r),s}var Ie=class extends Error{constructor(i){super(`audience transport failed: ${i.status||"network error"} ${i.endpoint}`,i.cause!==void 0?{cause:i.cause}:void 0);b(this,"status");b(this,"endpoint");b(this,"body");this.name="TransportError",this.status=i.status,this.endpoint=i.endpoint,this.body=i.body;}},te=class extends Error{constructor(i){super(i.message);b(this,"code");b(this,"status");b(this,"endpoint");b(this,"responseBody");b(this,"cause");this.name="AudienceError",this.code=i.code,this.status=i.status,this.endpoint=i.endpoint,this.responseBody=i.responseBody,this.cause=i.cause;}};function Pt(r,i,s){var f,h;if(r.status===0)return new te({code:"NETWORK_ERROR",message:i==="flush"?`Network error sending ${s!=null?s:0} messages`:"Network error syncing consent",status:0,endpoint:r.endpoint,cause:r.cause});if(r.status>=200&&r.status<300){let c=r.body,a=(f=c==null?void 0:c.rejected)!=null?f:0,y=(h=c==null?void 0:c.accepted)!=null?h:0;return new te({code:"VALIDATION_REJECTED",message:`Backend rejected ${a} of ${a+y} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return r.status===429?new te({code:"RATE_LIMITED",message:i==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:r.status,endpoint:r.endpoint,responseBody:r.body}):r.status>=400&&r.status<500?new te({code:i==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush rejected with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body}):new te({code:i==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush failed with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body,cause:r.cause})}function Mt(r,i){if(r)try{r(i);}catch(s){}}var Vr=3e4;function Kr(r){var h;let i=(h=r.get)==null?void 0:h.call(r,"retry-after");if(!i)return null;let s=Number(i.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let f=new Date(i);if(!Number.isNaN(f.getTime())){let c=f.getTime()-Date.now();return c>0?c:null}return null}async function kt(r){var s,f,h;let i=(h=(f=(s=r.headers)==null?void 0:s.get)==null?void 0:f.call(s,"content-type"))!=null?h:"";try{return i.includes("application/json")?await r.json():await r.text()}catch(c){return}}var We=async(r,i,s,f)=>{var a,y;let h=new AbortController,c=setTimeout(()=>h.abort(),Vr);try{let g=await fetch(r,{method:(a=f==null?void 0:f.method)!=null?a:"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(s),keepalive:f==null?void 0:f.keepalive,signal:h.signal});if(g.status===429){ee("audience","transport_send_failed",{status:429});let m=Kr(g.headers);return {ok:!1,error:new Ie({status:429,endpoint:r}),...m!==null?{retryAfterMs:m}:{}}}if(!g.ok){let m=await kt(g);return ee("audience","transport_send_failed",{status:g.status}),{ok:!1,error:new Ie({status:g.status,endpoint:r,body:m})}}let E=await kt(g);if(typeof E=="object"&&E!==null&&"rejected"in E){let m=(y=E.rejected)!=null?y:0;if(m>0)return ee("audience","transport_partial_rejected",{status:g.status,rejected:m}),{ok:!1,error:new Ie({status:g.status,endpoint:r,body:E})}}return {ok:!0}}catch(g){let E=new Ie({status:0,endpoint:r,cause:g});return Tt("audience","transport_send",E),{ok:!1,error:E}}finally{clearTimeout(c);}},Je="__imtbl_audience_";function Xe(){try{return de()&&typeof localStorage<"u"}catch(r){return !1}}function zr(r,i=Je){if(Xe())try{let s=localStorage.getItem(`${i}${r}`);return s?JSON.parse(s):void 0}catch(s){return}}function Yr(r,i,s=Je){if(Xe())try{localStorage.setItem(`${s}${r}`,JSON.stringify(i));}catch(f){}}function Hr(r,i=Je){if(Xe())try{localStorage.removeItem(`${i}${r}`);}catch(s){}}var He="queue",Ut=100,$t=class{constructor(r,i,s){b(this,"messages");b(this,"timer",null);b(this,"flushing",!1);b(this,"unloadBound",!1);b(this,"visibilityHandler");b(this,"pagehideHandler");b(this,"onFlush");b(this,"onError");b(this,"storagePrefix");b(this,"endpointUrl");b(this,"flushIntervalMs");b(this,"flushSize");b(this,"consecutiveFailures",0);b(this,"nextAttemptAt",0);var h,c,a,y;this.send=r,this.publishableKey=i,this.endpointUrl=`${(h=s==null?void 0:s.baseUrl)!=null?h:Nt}${Gr}`,this.flushIntervalMs=(c=s==null?void 0:s.flushIntervalMs)!=null?c:5e3,this.flushSize=(a=s==null?void 0:s.flushSize)!=null?a:20,this.onFlush=s==null?void 0:s.onFlush,this.onError=s==null?void 0:s.onError,this.storagePrefix=s==null?void 0:s.storagePrefix;let f=(y=zr(He,this.storagePrefix))!=null?y:[];this.messages=s!=null&&s.staleFilter?f.filter(s.staleFilter):f;}start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(r){this.messages.push(r),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){var r;if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let i=this.messages.slice(0,Ut),s={messages:i},f=await this.send(this.endpointUrl,this.publishableKey,s),h;!f.ok&&f.error&&(h=Pt(f.error,"flush",i.length));let c=(h==null?void 0:h.code)==="VALIDATION_REJECTED";f.ok||c?(this.messages=this.messages.slice(i.length),this.persist(),this.resetBackoff()):h&&(f.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+f.retryAfterMs):this.recordFailure()),(r=this.onFlush)==null||r.call(this,f.ok,i.length),h&&Mt(this.onError,h);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let r=this.messages.slice(0,Ut),i={messages:r};this.send(this.endpointUrl,this.publishableKey,i,{keepalive:!0}),this.messages=this.messages.slice(r.length),this.persist();}purge(r){this.messages=this.messages.filter(i=>!r(i)),this.persist();}transform(r){this.messages=this.messages.map(r),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],Hr(He,this.storagePrefix);}registerUnload(){!de()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let r=Date.now();r<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=r+this.backoffDelayMs());}setBackoffUntil(r){this.consecutiveFailures++,this.nextAttemptAt=r;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Yr(He,this.messages,this.storagePrefix);}},Wr="2.20.1-alpha.0";function Dt(r="@imtbl/audience",i=Wr){let s={library:r,libraryVersion:i};return de()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ft(r){let i=new Date(r).getTime();if(Number.isNaN(i))return !1;let s=Date.now();return i<=s+864e5&&i>=s-2592e6}function jt(r,i,s,f){return r!==s||i!==f}function ge(r,i=256){return r.length>i?r.slice(0,i):r}function le(r){let i=_e(oe);if(i)return Ae(oe,i,1800,r),{sessionId:i,isNew:!1};let s=ue();return Ae(oe,s,1800,r),{sessionId:s,isNew:!0}}var Gt=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],qt=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Vt="__imtbl_attribution";function Jr(r){let i;try{i=new URL(r).searchParams;}catch(h){return {}}let s={};for(let h of [...Gt,...qt]){let c=i.get(h);c&&(s[h]=c);}let f=i.get("referral_code");return f&&(s.referral_code=f),s}function Xr(){try{let r=sessionStorage.getItem(Vt);return r?JSON.parse(r):null}catch(r){return null}}function Qr(r){try{sessionStorage.setItem(Vt,JSON.stringify(r));}catch(i){}}function Kt(){let r=typeof window<"u"&&window.location?Jr(window.location.href):{},i=typeof document<"u"&&document.referrer||void 0,s=qt.some(h=>h in r),f=Gt.some(h=>h in r);return {...r,referrer:i,touchpoint_type:s||f?"click":void 0}}function zt(){let r=Xr();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,s={...Kt(),landing_page:i};return Qr(s),s}function Yt(){return Kt()}function j(r){return r!=="none"}function K(r){return r==="full"}function Ht(r,i,s,f,h,c,a,y){let g=c!=null?c:"none",E={none:0,anonymous:1,full:2};function m(v){let I=`${y!=null?y:Nt}${qr}`;i(I,s,{anonymousId:f,status:v,source:h},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&Mt(a,Pt(p.error,"consent"));});}return {get level(){return g},setLevel(v){v!==g&&(E[v]<E[g]&&(v==="none"?r.purge(()=>!0):v==="anonymous"&&(r.purge(I=>I.type==="identify"||I.type==="alias"),r.transform(I=>{if("userId"in I){let{userId:p,...w}=I;return w}return I}))),g=v,m(v));}}}var Wt="@imtbl/audience",Be="2.20.1-alpha.0",z="[audience]",Jt="WebSDK";var xe=class{constructor(i=!1){b(this,"enabled");this.enabled=i;}logEvent(i,s){this.enabled&&console.log(`${z} ${i}`,s);}logFlush(i,s){this.enabled&&console.log(`${z} flush ${i?"ok":"failed"} (${s} messages)`);}logConsent(i,s){this.enabled&&console.log(`${z} consent ${i} \u2192 ${s}`);}logWarning(i){this.enabled&&console.warn(`${z} ${i}`);}};var Zr=new Set(["sign_up","link_clicked"]),Y=class Y{constructor(i){b(this,"queue");b(this,"consent");b(this,"attribution");b(this,"debug");b(this,"cookieDomain");b(this,"testMode");b(this,"anonymousId");b(this,"sessionId");b(this,"sessionStartTime");b(this,"userId");b(this,"isFirstPage",!0);b(this,"destroyed",!1);var y,g,E,m;let{cookieDomain:s,publishableKey:f}=i,h=(y=i.consent)!=null?y:"none",c=Jt;this.cookieDomain=s,this.testMode=(g=i.testMode)!=null?g:!1,this.debug=new xe((E=i.debug)!=null?E:!1);let a=!1;j(h)?(this.anonymousId=Se(s),a=this.startSession()):this.anonymousId=(m=_e(ae))!=null?m:ue(),this.queue=new $t(We,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(v,I)=>this.debug.logFlush(v,I),onError:i.onError,staleFilter:v=>Ft(v.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Ht(this.queue,We,f,this.anonymousId,c,h,i.onError,i.baseUrl),this.attribution=zt(),this.isTrackingDisabled()||(this.queue.start(),a&&this.trackSessionStart());}static init(i){var s;if(!((s=i.publishableKey)!=null&&s.trim()))throw new Error(`${z} publishableKey is required`);return Y.liveInstances>0&&console.warn(`${z} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),Y.liveInstances+=1,new Y(i)}isTrackingDisabled(){return !j(this.consent.level)}effectiveUserId(){return K(this.consent.level)?this.userId:void 0}startSession(){let i=le(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:ue(),eventTimestamp:Lt(),anonymousId:this.anonymousId,surface:"web",context:Dt(Wt,Be),...this.testMode&&{test:!0}}}enqueue(i,s){this.queue.enqueue(s),this.debug.logEvent(i,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:Rt,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Ct,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;le(this.cookieDomain);let s={session_id:this.sessionId,...i};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(i,...s){if(this.isTrackingDisabled())return;le(this.cookieDomain);let[f]=s,h={session_id:this.sessionId,...Zr.has(i)?Yt():{},...f};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:ge(i),properties:h,userId:this.effectiveUserId()});}identify(i,s,f){if(!K(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}le(this.cookieDomain);let h=ge(i);this.userId=h,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:h,identityType:s,traits:f});}alias(i,s){if(!K(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!jt(i.id,i.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}le(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:ge(i.id),fromType:i.identityType,toId:ge(s.id),toType:s.identityType});}setConsent(i){let s=this.consent.level;if(i===s)return;this.debug.logConsent(s,i);let f=!j(s)&&j(i);if(f&&(this.anonymousId=Se(this.cookieDomain)),j(i)||this.queue.stop(),this.consent.setLevel(i),j(i)?K(s)&&!K(i)&&(this.userId=void 0):(pe(ae,this.cookieDomain),pe(oe,this.cookieDomain)),f){this.isFirstPage=!0;let h=this.startSession();this.queue.start(),h&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),pe(ae,this.cookieDomain),pe(oe,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=ue(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=Se(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),Y.liveInstances=Math.max(0,Y.liveInstances-1));}};b(Y,"liveInstances",0);var ye=Y;var Xt={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked"};var Qe=typeof globalThis!="undefined"?globalThis:window,Qt;if(Qe.ImmutableAudience){let r=(Qt=Qe.ImmutableAudience.version)!=null?Qt:"unknown";console.warn(`[@imtbl/audience] CDN bundle loaded twice; keeping v${r}. Remove the old <script> tag to load a different version.`);}else Qe.ImmutableAudience={init:ye.init.bind(ye),AudienceError:te,AudienceEvents:Xt,IdentityType:Ot,canIdentify:K,canTrack:j,version:Be};
6
+ ${a.stack}`),re(r,`trackError_${i}`,{...f||{},errorMessage:h,errorStack:c,isTrackError:!0});},Lt=$(Dr),Gr=r=>{ne("env",r);};$(ye("setEnvironment",Gr));var qr=r=>{ne("passportClientId",r);};$(ye("setPassportClientId",qr));var Vr=r=>{ne("pak",r);};$(ye("setPublishableApiKey",Vr));$(ye("getDetail",ze));var $t={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},Se=class extends Error{constructor(i){super(`audience transport failed: ${i.status||"network error"} ${i.endpoint}`,i.cause!==void 0?{cause:i.cause}:void 0);w(this,"status");w(this,"endpoint");w(this,"body");this.name="TransportError",this.status=i.status,this.endpoint=i.endpoint,this.body=i.body;}},se=class extends Error{constructor(i){super(i.message);w(this,"code");w(this,"status");w(this,"endpoint");w(this,"responseBody");w(this,"cause");this.name="AudienceError",this.code=i.code,this.status=i.status,this.endpoint=i.endpoint,this.responseBody=i.responseBody,this.cause=i.cause;}};function Dt(r,i,s){var f,h;if(r.status===0)return new se({code:"NETWORK_ERROR",message:i==="flush"?`Network error sending ${s!=null?s:0} messages`:"Network error syncing consent",status:0,endpoint:r.endpoint,cause:r.cause});if(r.status>=200&&r.status<300){let c=r.body,a=(f=c==null?void 0:c.rejected)!=null?f:0,m=(h=c==null?void 0:c.accepted)!=null?h:0;return new se({code:"VALIDATION_REJECTED",message:`Backend rejected ${a} of ${a+m} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return r.status===429?new se({code:"RATE_LIMITED",message:i==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:r.status,endpoint:r.endpoint,responseBody:r.body}):r.status>=400&&r.status<500?new se({code:i==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush rejected with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body}):new se({code:i==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush failed with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body,cause:r.cause})}function Ft(r,i){if(r)try{r(i);}catch(s){}}var Kr=3e4;function zr(r){var h;let i=(h=r.get)==null?void 0:h.call(r,"retry-after");if(!i)return null;let s=Number(i.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let f=new Date(i);if(!Number.isNaN(f.getTime())){let c=f.getTime()-Date.now();return c>0?c:null}return null}async function Pt(r){var s,f,h;let i=(h=(f=(s=r.headers)==null?void 0:s.get)==null?void 0:f.call(s,"content-type"))!=null?h:"";try{return i.includes("application/json")?await r.json():await r.text()}catch(c){return}}var et=async(r,i,s,f)=>{var a,m;let h=new AbortController,c=setTimeout(()=>h.abort(),Kr);try{let g=await fetch(r,{method:(a=f==null?void 0:f.method)!=null?a:"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(s),keepalive:f==null?void 0:f.keepalive,signal:h.signal});if(g.status===429){re("audience","transport_send_failed",{status:429});let y=zr(g.headers);return {ok:!1,error:new Se({status:429,endpoint:r}),...y!==null?{retryAfterMs:y}:{}}}if(!g.ok){let y=await Pt(g);return re("audience","transport_send_failed",{status:g.status}),{ok:!1,error:new Se({status:g.status,endpoint:r,body:y})}}let I=await Pt(g);if(typeof I=="object"&&I!==null&&"rejected"in I){let y=(m=I.rejected)!=null?m:0;if(y>0)return re("audience","transport_partial_rejected",{status:g.status,rejected:y}),{ok:!1,error:new Se({status:g.status,endpoint:r,body:I})}}return {ok:!0}}catch(g){let I=new Se({status:0,endpoint:r,cause:g});return Lt("audience","transport_send",I),{ok:!1,error:I}}finally{clearTimeout(c);}},tt="__imtbl_audience_";function nt(){try{return j()&&typeof localStorage<"u"}catch(r){return !1}}function Yr(r,i=tt){if(nt())try{let s=localStorage.getItem(`${i}${r}`);return s?JSON.parse(s):void 0}catch(s){return}}function Hr(r,i,s=tt){if(nt())try{localStorage.setItem(`${s}${r}`,JSON.stringify(i));}catch(f){}}function Wr(r,i=tt){if(nt())try{localStorage.removeItem(`${i}${r}`);}catch(s){}}var Ze="queue",Mt=100,jt=class{constructor(r,i,s){w(this,"messages");w(this,"timer",null);w(this,"flushing",!1);w(this,"unloadBound",!1);w(this,"visibilityHandler");w(this,"pagehideHandler");w(this,"onFlush");w(this,"onError");w(this,"storagePrefix");w(this,"endpointUrl");w(this,"flushIntervalMs");w(this,"flushSize");w(this,"consecutiveFailures",0);w(this,"nextAttemptAt",0);var h,c,a,m;this.send=r,this.publishableKey=i,this.endpointUrl=`${(h=s==null?void 0:s.baseUrl)!=null?h:Ne}${gt}`,this.flushIntervalMs=(c=s==null?void 0:s.flushIntervalMs)!=null?c:5e3,this.flushSize=(a=s==null?void 0:s.flushSize)!=null?a:20,this.onFlush=s==null?void 0:s.onFlush,this.onError=s==null?void 0:s.onError,this.storagePrefix=s==null?void 0:s.storagePrefix;let f=(m=Yr(Ze,this.storagePrefix))!=null?m:[];this.messages=s!=null&&s.staleFilter?f.filter(s.staleFilter):f;}start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(r){this.messages.push(r),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){var r;if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let i=this.messages.slice(0,Mt),s={messages:i},f=await this.send(this.endpointUrl,this.publishableKey,s),h;!f.ok&&f.error&&(h=Dt(f.error,"flush",i.length));let c=(h==null?void 0:h.code)==="VALIDATION_REJECTED";f.ok||c?(this.messages=this.messages.slice(i.length),this.persist(),this.resetBackoff()):h&&(f.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+f.retryAfterMs):this.recordFailure()),(r=this.onFlush)==null||r.call(this,f.ok,i.length),h&&Ft(this.onError,h);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let r=this.messages.slice(0,Mt),i={messages:r};this.send(this.endpointUrl,this.publishableKey,i,{keepalive:!0}),this.messages=this.messages.slice(r.length),this.persist();}purge(r){this.messages=this.messages.filter(i=>!r(i)),this.persist();}transform(r){this.messages=this.messages.map(r),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],Wr(Ze,this.storagePrefix);}registerUnload(){!j()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let r=Date.now();r<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=r+this.backoffDelayMs());}setBackoffUntil(r){this.consecutiveFailures++,this.nextAttemptAt=r;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Hr(Ze,this.messages,this.storagePrefix);}},Jr="2.20.1-alpha.2";function Gt(r="@imtbl/audience",i=Jr){let s={library:r,libraryVersion:i};return j()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function qt(r){let i=new Date(r).getTime();if(Number.isNaN(i))return !1;let s=Date.now();return i<=s+864e5&&i>=s-2592e6}function Vt(r,i,s,f){return r!==s||i!==f}function we(r,i=256){return r.length>i?r.slice(0,i):r}function de(r){let i=ue(z);if(i)return le(z,i,1800,r),{sessionId:i,isNew:!1};let s=Y();return le(z,s,1800,r),{sessionId:s,isNew:!0}}var Kt=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],zt=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Yt="__imtbl_attribution";function Xr(r){let i;try{i=new URL(r).searchParams;}catch(h){return {}}let s={};for(let h of [...Kt,...zt]){let c=i.get(h);c&&(s[h]=c);}let f=i.get("referral_code");return f&&(s.referral_code=f),s}function Qr(){try{let r=sessionStorage.getItem(Yt);return r?JSON.parse(r):null}catch(r){return null}}function Zr(r){try{sessionStorage.setItem(Yt,JSON.stringify(r));}catch(i){}}function Ht(){let r=typeof window<"u"&&window.location?Xr(window.location.href):{},i=typeof document<"u"&&document.referrer||void 0,s=zt.some(h=>h in r),f=Kt.some(h=>h in r);return {...r,referrer:i,touchpoint_type:s||f?"click":void 0}}function Wt(){let r=Qr();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,s={...Ht(),landing_page:i};return Zr(s),s}function Jt(){return Ht()}function q(r){return r!=="none"}function J(r){return r==="full"}function Xt(r,i,s,f,h,c,a,m){let g=c!=null?c:"none",I={none:0,anonymous:1,full:2};function y(v){let E=`${m!=null?m:Ne}${mt}`;i(E,s,{anonymousId:f,status:v,source:h},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&Ft(a,Dt(p.error,"consent"));});}return {get level(){return g},setLevel(v){v!==g&&(I[v]<I[g]&&(v==="none"?r.purge(()=>!0):v==="anonymous"&&(r.purge(E=>E.type==="identify"||E.type==="alias"),r.transform(E=>{if("userId"in E){let{userId:p,...b}=E;return b}return E}))),g=v,y(v));}}}var Qt="@imtbl/audience",Be="2.20.1-alpha.2",X="[audience]",Zt="WebSDK";var xe=class{constructor(i=!1){w(this,"enabled");this.enabled=i;}logEvent(i,s){this.enabled&&console.log(`${X} ${i}`,s);}logFlush(i,s){this.enabled&&console.log(`${X} flush ${i?"ok":"failed"} (${s} messages)`);}logConsent(i,s){this.enabled&&console.log(`${X} consent ${i} \u2192 ${s}`);}logWarning(i){this.enabled&&console.warn(`${X} ${i}`);}};var es=new Set(["sign_up","link_clicked"]),D=class D{constructor(i){w(this,"queue");w(this,"consent");w(this,"attribution");w(this,"debug");w(this,"cookieDomain");w(this,"testMode");w(this,"anonymousId");w(this,"sessionId");w(this,"sessionStartTime");w(this,"userId");w(this,"isFirstPage",!0);w(this,"destroyed",!1);var g,I,y,v;let{cookieDomain:s,publishableKey:f}=i,h=(g=i.consent)!=null?g:"none",c=Zt;this.cookieDomain=s,this.testMode=(I=i.testMode)!=null?I:!1,this.debug=new xe((y=i.debug)!=null?y:!1);let a=D.readAndStripAidParam(),m=!1;q(h)?(a?(Pe(a,s),this.anonymousId=a):this.anonymousId=ge(s),m=this.startSession()):this.anonymousId=(v=ue(K))!=null?v:Y(),this.queue=new jt(et,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(E,p)=>this.debug.logFlush(E,p),onError:i.onError,staleFilter:E=>qt(E.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Xt(this.queue,et,f,this.anonymousId,c,h,i.onError,i.baseUrl),this.attribution=Wt(),this.isTrackingDisabled()||(this.queue.start(),m&&this.trackSessionStart());}static readAndStripAidParam(){if(!j())return null;let i=new URLSearchParams(window.location.search),s=i.get("imtbl_aid");if(s!==null){i.delete("imtbl_aid");let f=i.toString(),h=`${window.location.pathname}${f?`?${f}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",h);}return s&&D.UUID_RE.test(s)?s:null}static init(i){var s;if(!((s=i.publishableKey)!=null&&s.trim()))throw new Error(`${X} publishableKey is required`);return D.liveInstances>0&&console.warn(`${X} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),D.liveInstances+=1,new D(i)}getAnonymousId(){return this.anonymousId}isTrackingDisabled(){return !q(this.consent.level)}effectiveUserId(){return J(this.consent.level)?this.userId:void 0}startSession(){let i=de(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:Y(),eventTimestamp:Le(),anonymousId:this.anonymousId,surface:"web",context:Gt(Qt,Be),...this.testMode&&{test:!0}}}enqueue(i,s){this.queue.enqueue(s),this.debug.logEvent(i,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:Re,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Ce,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;de(this.cookieDomain);let s={session_id:this.sessionId,...i};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(i,...s){if(this.isTrackingDisabled())return;de(this.cookieDomain);let[f]=s,h={session_id:this.sessionId,...es.has(i)?Jt():{},...f};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:we(i),properties:h,userId:this.effectiveUserId()});}identify(i,s,f){if(!J(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}de(this.cookieDomain);let h=we(i);this.userId=h,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:h,identityType:s,traits:f});}alias(i,s){if(!J(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Vt(i.id,i.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}de(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:we(i.id),fromType:i.identityType,toId:we(s.id),toType:s.identityType});}setConsent(i){let s=this.consent.level;if(i===s)return;this.debug.logConsent(s,i);let f=!q(s)&&q(i);if(f&&(this.anonymousId=ge(this.cookieDomain)),q(i)||this.queue.stop(),this.consent.setLevel(i),q(i)?J(s)&&!J(i)&&(this.userId=void 0):(fe(K,this.cookieDomain),fe(z,this.cookieDomain)),f){this.isFirstPage=!0;let h=this.startSession();this.queue.start(),h&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),fe(K,this.cookieDomain),fe(z,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=Y(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=ge(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),D.liveInstances=Math.max(0,D.liveInstances-1));}};w(D,"liveInstances",0),w(D,"UUID_RE",/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);var be=D;var en={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked",BUTTON_CLICKED:"button_clicked"};var it=typeof globalThis!="undefined"?globalThis:window,tn;if(it.ImmutableAudience){let r=(tn=it.ImmutableAudience.version)!=null?tn:"unknown";console.warn(`[@imtbl/audience] CDN bundle loaded twice; keeping v${r}. Remove the old <script> tag to load a different version.`);}else it.ImmutableAudience={init:be.init.bind(be),AudienceError:se,AudienceEvents:en,IdentityType:$t,canIdentify:J,canTrack:q,version:Be};
7
7
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
8
8
  /*! Bundled license information:
9
9
 
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var je=Object.create;var ie=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var qe=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var Ve=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var He=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Be(t))!Ke.call(e,r)&&r!==s&&ie(e,r,{get:()=>t[r],enumerable:!(i=Ge(t,r))||i.enumerable});return e};var ze=(e,t,s)=>(s=e!=null?je(qe(e)):{},He(ie(s,"default",{value:e,enumerable:!0}),e));var ue=Ve(E=>{Object.defineProperty(E,"__esModule",{value:!0});E.clearGlobalNamespace=E.getGlobalisedValue=void 0;var Ye="globalise__singleton__",Xe={},oe=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:Xe,Qe=(e,t)=>{if(typeof e!="string")throw "Invalid namespace key";if(typeof t!="string")throw "Invalid item key"},ae=e=>`${Ye}${e}`,le=e=>{let t=oe(),s=ae(e);return t[s]||(t[s]={}),t[s]},Ze=(e,t)=>le(e)[t]||void 0,et=(e,t,s)=>{let i=le(e);i[t]=s;},tt=(e,t,s)=>{Qe(e,t);let i=Ze(e,t);return i!==void 0?i:(et(e,t,s),s)};E.getGlobalisedValue=tt;var st=e=>{let t=oe(),s=ae(e);t[s]!==void 0&&delete t[s];};E.clearGlobalNamespace=st;});var j=class{constructor(t=0,s=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){let s=this.items[t];delete this.items[t],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(t=this.keys()){return t.map(s=>[s,this.get(s)])}evict(t=!1){if(t||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(t){let s;return this.has(t)&&(s=this.items[t].expiry),s}get(t){let s;if(this.has(t)){let i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(s=i.value,this.set(t,s,!0));}return s}has(t){return t in this.items}keys(){let t=[],s=this.first;for(;s!==null;)t.push(s.key),s=s.next;return t}set(t,s,i=!1,r=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=s,i===!1&&r&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){let o=this.last,a=n.next,l=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,o.next=n,l!==null&&(l.next=a),a!==null&&(a.prev=l);}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:s},++this.size===1?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map(s=>this.get(s))}};function re(e=1e3,t=0,s=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new j(e,t,s)}var We={max:1e3},ne=(e,t={})=>{let{cache:s,cacheKeyResolver:i=G,onHit:r,lruOptions:n={}}=t,o={...We,...n},a=s||re(o.max,o.ttl);function l(...h){let f=i(...h),c=a.get(f);if(a.has(f))return r&&r(f,c,a),c;let p=e.apply(this,h);return a.set(f,p),p}return l._cache=a,l},G=(...e)=>e.length===0?"no-args":e.map(t=>t===void 0?"undefined":t===null?"null":Array.isArray(t)?`[${G(...t)}]`:typeof t=="object"?`{${G(...Je(t))}}`:JSON.stringify(t)).join(","),Je=e=>Object.entries(e).sort((t,s)=>t[0]<s[0]?-1:1);var z=ze(ue()),it=Object.defineProperty,rt=(e,t)=>{for(var s in t)it(e,s,{get:t[s],enumerable:!0});},nt={};rt(nt,{deleteItem:()=>ut,getItem:()=>q,setItem:()=>C});var D=()=>typeof window>"u",de=()=>!D(),ot="__IMX-",W=()=>de()&&window.localStorage,at=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},lt=e=>typeof e=="string"?e:JSON.stringify(e),J=e=>`${ot}${e}`;function q(e){if(W())return at(window.localStorage.getItem(J(e)))}var C=(e,t)=>W()?(window.localStorage.setItem(J(e),lt(t)),!0):!1,ut=e=>W()?(window.localStorage.removeItem(J(e)),!0):!1,K=0,ct=e=>{let t=parseInt(e,10)*1e3,s=new Date(t),i=new Date;return K=s.getTime()-i.getTime(),K},dt=()=>{let e=new Date().getTime()+K;return new Date(e).toISOString()},ht=(e=>(e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion",e))(ht||{}),pt="https://api.immutable.com",ft=e=>{if(typeof Buffer<"u")return Buffer.from(e,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(e)));throw new Error("Base64 encoding not supported in this environment")};async function he(e,t){let s=JSON.stringify(t),i={payload:ft(s)},r=await fetch(`${pt}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok){let n=await r.text().catch(()=>"");throw new Error(`Request failed (${r.status}): ${n||r.statusText}`)}return r.json()}var y,v,mt=()=>{y=q("metrics-events")||[],v=q("metrics-runtime")||{};};mt();var w=(e,t)=>{v={...v,[e]:t},C("metrics-runtime",v);},V=e=>{if(v[e]!==void 0)return v[e]},gt=()=>v,yt=()=>y,vt=e=>{y.push(e),C("metrics-events",y);},wt=e=>{y=y.slice(e),C("metrics-events",y);},pe=e=>{let t=[];return Object.entries(e).forEach(([s,i])=>{(typeof s=="string"||typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&t.push([s,i.toString()]);}),t},B="2.20.1-alpha.0",bt=()=>D()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",It=()=>{if(D())return "";let e;try{window.self!==window.top&&(e=bt());}catch{}return e||(e=window.location.hostname),e},Et=()=>{if(w("sdkVersion",B),D())return {browser:"nodejs",sdkVersion:B};let e=It();return e&&w("domain",e),{sdkVersion:B,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},H=!1,St=()=>H,_t=async()=>{H=!0;try{let e=pe(Et()),t=V("rid"),s=V("uid"),i=await he("/v1/sdk/initialise",{version:1,data:{runtimeDetails:e,runtimeId:t,uId:s}}),{runtimeId:r,sTime:n}=i;w("rid",r),ct(n);}catch{H=!1;}};function d(e,t){return (...s)=>{try{let i=e(...s);return i instanceof Promise?i.catch(()=>t):i}catch{return t}}}function xt(){return de()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var kt=d(xt,!1),fe="imtbl__metrics",At=5e3,Tt=1e3,T=(e,t)=>(0, z.getGlobalisedValue)(fe,e,t),Pt=(e,t)=>{let s=ne(t,{lruOptions:{ttl:At,max:Tt}});return (0, z.getGlobalisedValue)(fe,e,s)},Nt=5e3,Ot=(e,t,s)=>{let i={event:`${e}.${t}`,time:dt(),...s&&{properties:pe(s)}};vt(i);},b=d(Pt("track",Ot)),Dt=async()=>{if(St()===!1){await _t();return}let e=yt();if(e.length===0)return;let t=e.length,s=gt();await he("/v1/sdk/metrics",{version:1,data:{events:e,details:s}})instanceof Error||wt(t);},Ct=d(Dt),me=async()=>{await Ct(),setTimeout(me,Nt);},ce=!1,$t=()=>{ce||(ce=!0,me());};kt()||d(T("startFlushing",$t))();var Gt=(e,t,s,i)=>{let{message:r}=s,n=s.stack||"",{cause:o}=s;o instanceof Error&&(n=`${n}
3
+ var qe=Object.create;var le=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var He=Object.getPrototypeOf,ze=Object.prototype.hasOwnProperty;var We=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Je=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ve(t))!ze.call(e,r)&&r!==s&&le(e,r,{get:()=>t[r],enumerable:!(i=Ke(t,r))||i.enumerable});return e};var Ye=(e,t,s)=>(s=e!=null?qe(He(e)):{},Je(le(s,"default",{value:e,enumerable:!0}),e));var ge=We(T=>{Object.defineProperty(T,"__esModule",{value:!0});T.clearGlobalNamespace=T.getGlobalisedValue=void 0;var Ze="globalise__singleton__",et={},pe=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:et,tt=(e,t)=>{if(typeof e!="string")throw "Invalid namespace key";if(typeof t!="string")throw "Invalid item key"},fe=e=>`${Ze}${e}`,me=e=>{let t=pe(),s=fe(e);return t[s]||(t[s]={}),t[s]},st=(e,t)=>me(e)[t]||void 0,it=(e,t,s)=>{let i=me(e);i[t]=s;},rt=(e,t,s)=>{tt(e,t);let i=st(e,t);return i!==void 0?i:(it(e,t,s),s)};T.getGlobalisedValue=rt;var nt=e=>{let t=pe(),s=fe(e);t[s]!==void 0&&delete t[s];};T.clearGlobalNamespace=nt;});var j="https://api.immutable.com",ue="/v1/audience/messages",ce="/v1/audience/tracking-consent",g="imtbl_anon_id",y="_imtbl_sid",B="session_start",G="session_end",f=()=>typeof window<"u"&&typeof document<"u",v=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return (e==="x"?t:t%4+8).toString(16)}),q=()=>new Date().toISOString();function k(e){if(!f())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function A(e,t,s,i){if(!f())return;let r=window.location.protocol==="https:"?"; Secure":"",n=i?`; domain=${i}`:"";document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${s}; SameSite=Lax${n}${r}`;}function P(e,t){A(e,"",0,t);}function D(e){let t=k(g);if(t)return t;let s=v();return A(g,s,63072e3,e),s}function K(e,t){A(g,e,63072e3,t);}var V=class{constructor(t=0,s=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){let s=this.items[t];delete this.items[t],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(t=this.keys()){return t.map(s=>[s,this.get(s)])}evict(t=!1){if(t||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(t){let s;return this.has(t)&&(s=this.items[t].expiry),s}get(t){let s;if(this.has(t)){let i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(s=i.value,this.set(t,s,!0));}return s}has(t){return t in this.items}keys(){let t=[],s=this.first;for(;s!==null;)t.push(s.key),s=s.next;return t}set(t,s,i=!1,r=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=s,i===!1&&r&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){let o=this.last,l=n.next,a=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,o.next=n,a!==null&&(a.next=l),l!==null&&(l.prev=a);}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:s},++this.size===1?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map(s=>this.get(s))}};function de(e=1e3,t=0,s=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new V(e,t,s)}var Xe={max:1e3},he=(e,t={})=>{let{cache:s,cacheKeyResolver:i=H,onHit:r,lruOptions:n={}}=t,o={...Xe,...n},l=s||de(o.max,o.ttl);function a(...h){let m=i(...h),c=l.get(m);if(l.has(m))return r&&r(m,c,l),c;let p=e.apply(this,h);return l.set(m,p),p}return a._cache=l,a},H=(...e)=>e.length===0?"no-args":e.map(t=>t===void 0?"undefined":t===null?"null":Array.isArray(t)?`[${H(...t)}]`:typeof t=="object"?`{${H(...Qe(t))}}`:JSON.stringify(t)).join(","),Qe=e=>Object.entries(e).sort((t,s)=>t[0]<s[0]?-1:1);var Q=Ye(ge()),ot=Object.defineProperty,at=(e,t)=>{for(var s in t)ot(e,s,{get:t[s],enumerable:!0});},lt={};at(lt,{deleteItem:()=>ht,getItem:()=>W,setItem:()=>M});var R=()=>typeof window>"u",ve=()=>!R(),ut="__IMX-",Z=()=>ve()&&window.localStorage,ct=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},dt=e=>typeof e=="string"?e:JSON.stringify(e),ee=e=>`${ut}${e}`;function W(e){if(Z())return ct(window.localStorage.getItem(ee(e)))}var M=(e,t)=>Z()?(window.localStorage.setItem(ee(e),dt(t)),!0):!1,ht=e=>Z()?(window.localStorage.removeItem(ee(e)),!0):!1,J=0,pt=e=>{let t=parseInt(e,10)*1e3,s=new Date(t),i=new Date;return J=s.getTime()-i.getTime(),J},ft=()=>{let e=new Date().getTime()+J;return new Date(e).toISOString()},mt=(e=>(e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion",e))(mt||{}),gt="https://api.immutable.com",yt=e=>{if(typeof Buffer<"u")return Buffer.from(e,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(e)));throw new Error("Base64 encoding not supported in this environment")};async function we(e,t){let s=JSON.stringify(t),i={payload:yt(s)},r=await fetch(`${gt}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok){let n=await r.text().catch(()=>"");throw new Error(`Request failed (${r.status}): ${n||r.statusText}`)}return r.json()}var I,E,vt=()=>{I=W("metrics-events")||[],E=W("metrics-runtime")||{};};vt();var S=(e,t)=>{E={...E,[e]:t},M("metrics-runtime",E);},Y=e=>{if(E[e]!==void 0)return E[e]},wt=()=>E,bt=()=>I,It=e=>{I.push(e),M("metrics-events",I);},Et=e=>{I=I.slice(e),M("metrics-events",I);},be=e=>{let t=[];return Object.entries(e).forEach(([s,i])=>{(typeof s=="string"||typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&t.push([s,i.toString()]);}),t},z="2.20.1-alpha.2",St=()=>R()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",_t=()=>{if(R())return "";let e;try{window.self!==window.top&&(e=St());}catch{}return e||(e=window.location.hostname),e},xt=()=>{if(S("sdkVersion",z),R())return {browser:"nodejs",sdkVersion:z};let e=_t();return e&&S("domain",e),{sdkVersion:z,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},X=!1,kt=()=>X,At=async()=>{X=!0;try{let e=be(xt()),t=Y("rid"),s=Y("uid"),i=await we("/v1/sdk/initialise",{version:1,data:{runtimeDetails:e,runtimeId:t,uId:s}}),{runtimeId:r,sTime:n}=i;S("rid",r),pt(n);}catch{X=!1;}};function d(e,t){return (...s)=>{try{let i=e(...s);return i instanceof Promise?i.catch(()=>t):i}catch{return t}}}function Pt(){return ve()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var Tt=d(Pt,!1),Ie="imtbl__metrics",Nt=5e3,Ot=1e3,C=(e,t)=>(0, Q.getGlobalisedValue)(Ie,e,t),Dt=(e,t)=>{let s=he(t,{lruOptions:{ttl:Nt,max:Ot}});return (0, Q.getGlobalisedValue)(Ie,e,s)},Ct=5e3,$t=(e,t,s)=>{let i={event:`${e}.${t}`,time:ft(),...s&&{properties:be(s)}};It(i);},_=d(Dt("track",$t)),Rt=async()=>{if(kt()===!1){await At();return}let e=bt();if(e.length===0)return;let t=e.length,s=wt();await we("/v1/sdk/metrics",{version:1,data:{events:e,details:s}})instanceof Error||Et(t);},Mt=d(Rt),Ee=async()=>{await Mt(),setTimeout(Ee,Ct);},ye=!1,Ut=()=>{ye||(ye=!0,Ee());};Tt()||d(C("startFlushing",Ut))();var Kt=(e,t,s,i)=>{let{message:r}=s,n=s.stack||"",{cause:o}=s;o instanceof Error&&(n=`${n}
4
4
  Cause: ${o.message}
5
- ${o.stack}`),b(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},ge=d(Gt),Kt=e=>{w("env",e);};d(T("setEnvironment",Kt));var Vt=e=>{w("passportClientId",e);};d(T("setPassportClientId",Vt));var Ht=e=>{w("pak",e);};d(T("setPublishableApiKey",Ht));d(T("getDetail",V));var zt={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},we="https://api.immutable.com",Wt="/v1/audience/messages",Jt="/v1/audience/tracking-consent",x="imtbl_anon_id",_="_imtbl_sid",be="session_start",Ie="session_end",P=()=>typeof window<"u"&&typeof document<"u",k=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return (e==="x"?t:t%4+8).toString(16)}),Ee=()=>new Date().toISOString();function M(e){if(!P())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function R(e,t,s,i){if(!P())return;let r=window.location.protocol==="https:"?"; Secure":"",n=i?`; domain=${i}`:"";document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${s}; SameSite=Lax${n}${r}`;}function N(e,t){R(e,"",0,t);}function L(e){let t=M(x);if(t)return t;let s=k();return R(x,s,63072e3,e),s}var $=class extends Error{status;endpoint;body;constructor(e){super(`audience transport failed: ${e.status||"network error"} ${e.endpoint}`,e.cause!==void 0?{cause:e.cause}:void 0),this.name="TransportError",this.status=e.status,this.endpoint=e.endpoint,this.body=e.body;}},S=class extends Error{code;status;endpoint;responseBody;cause;constructor(e){super(e.message),this.name="AudienceError",this.code=e.code,this.status=e.status,this.endpoint=e.endpoint,this.responseBody=e.responseBody,this.cause=e.cause;}};function Se(e,t,s){if(e.status===0)return new S({code:"NETWORK_ERROR",message:t==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:e.endpoint,cause:e.cause});if(e.status>=200&&e.status<300){let i=e.body,r=i?.rejected??0,n=i?.accepted??0;return new S({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return e.status===429?new S({code:"RATE_LIMITED",message:t==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:e.status,endpoint:e.endpoint,responseBody:e.body}):e.status>=400&&e.status<500?new S({code:t==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush rejected with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body}):new S({code:t==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush failed with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body,cause:e.cause})}function _e(e,t){if(e)try{e(t);}catch{}}var Yt=3e4;function Xt(e){let t=e.get?.("retry-after");if(!t)return null;let s=Number(t.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let i=new Date(t);if(!Number.isNaN(i.getTime())){let r=i.getTime()-Date.now();return r>0?r:null}return null}async function ye(e){let t=e.headers?.get?.("content-type")??"";try{return t.includes("application/json")?await e.json():await e.text()}catch{return}}var X=async(e,t,s,i)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),Yt);try{let o=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive,signal:r.signal});if(o.status===429){b("audience","transport_send_failed",{status:429});let l=Xt(o.headers);return {ok:!1,error:new $({status:429,endpoint:e}),...l!==null?{retryAfterMs:l}:{}}}if(!o.ok){let l=await ye(o);return b("audience","transport_send_failed",{status:o.status}),{ok:!1,error:new $({status:o.status,endpoint:e,body:l})}}let a=await ye(o);if(typeof a=="object"&&a!==null&&"rejected"in a){let l=a.rejected??0;if(l>0)return b("audience","transport_partial_rejected",{status:o.status,rejected:l}),{ok:!1,error:new $({status:o.status,endpoint:e,body:a})}}return {ok:!0}}catch(o){let a=new $({status:0,endpoint:e,cause:o});return ge("audience","transport_send",a),{ok:!1,error:a}}finally{clearTimeout(n);}},Q="__imtbl_audience_";function Z(){try{return P()&&typeof localStorage<"u"}catch{return !1}}function Qt(e,t=Q){if(Z())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function Zt(e,t,s=Q){if(Z())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function es(e,t=Q){if(Z())try{localStorage.removeItem(`${t}${e}`);}catch{}}var Y="queue",ve=100,xe=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??we}${Wt}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let i=Qt(Y,this.storagePrefix)??[];this.messages=s?.staleFilter?i.filter(s.staleFilter):i;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;consecutiveFailures=0;nextAttemptAt=0;start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(e){this.messages.push(e),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let e=this.messages.slice(0,ve),t={messages:e},s=await this.send(this.endpointUrl,this.publishableKey,t),i;!s.ok&&s.error&&(i=Se(s.error,"flush",e.length));let r=i?.code==="VALIDATION_REJECTED";s.ok||r?(this.messages=this.messages.slice(e.length),this.persist(),this.resetBackoff()):i&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,e.length),i&&_e(this.onError,i);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let e=this.messages.slice(0,ve),t={messages:e};this.send(this.endpointUrl,this.publishableKey,t,{keepalive:!0}),this.messages=this.messages.slice(e.length),this.persist();}purge(e){this.messages=this.messages.filter(t=>!e(t)),this.persist();}transform(e){this.messages=this.messages.map(e),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],es(Y,this.storagePrefix);}registerUnload(){!P()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let e=Date.now();e<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=e+this.backoffDelayMs());}setBackoffUntil(e){this.consecutiveFailures++,this.nextAttemptAt=e;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Zt(Y,this.messages,this.storagePrefix);}},ts="2.20.1-alpha.0";function ke(e="@imtbl/audience",t=ts){let s={library:e,libraryVersion:t};return P()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ae(e){let t=new Date(e).getTime();if(Number.isNaN(t))return !1;let s=Date.now();return t<=s+864e5&&t>=s-2592e6}function Te(e,t,s,i){return e!==s||t!==i}function O(e,t=256){return e.length>t?e.slice(0,t):e}function A(e){let t=M(_);if(t)return R(_,t,1800,e),{sessionId:t,isNew:!1};let s=k();return R(_,s,1800,e),{sessionId:s,isNew:!0}}var Pe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Ne=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Oe="__imtbl_attribution";function ss(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...Pe,...Ne]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function is(){try{let e=sessionStorage.getItem(Oe);return e?JSON.parse(e):null}catch{return null}}function rs(e){try{sessionStorage.setItem(Oe,JSON.stringify(e));}catch{}}function De(){let e=typeof window<"u"&&window.location?ss(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=Ne.some(r=>r in e),i=Pe.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function Ce(){let e=is();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...De(),landing_page:t};return rs(s),s}function $e(){return De()}function m(e){return e!=="none"}function I(e){return e==="full"}function Re(e,t,s,i,r,n,o,a){let l=n??"none",h={none:0,anonymous:1,full:2};function f(c){let u=`${a??we}${Jt}`;t(u,s,{anonymousId:i,status:c,source:r},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&_e(o,Se(p.error,"consent"));});}return {get level(){return l},setLevel(c){c!==l&&(h[c]<h[l]&&(c==="none"?e.purge(()=>!0):c==="anonymous"&&(e.purge(u=>u.type==="identify"||u.type==="alias"),e.transform(u=>{if("userId"in u){let{userId:p,...F}=u;return F}return u}))),l=c,f(c));}}}var Me="@imtbl/audience",Le="2.20.1-alpha.0",g="[audience]",Ue="WebSDK";var U=class{enabled;constructor(t=!1){this.enabled=t;}logEvent(t,s){this.enabled&&console.log(`${g} ${t}`,s);}logFlush(t,s){this.enabled&&console.log(`${g} flush ${t?"ok":"failed"} (${s} messages)`);}logConsent(t,s){this.enabled&&console.log(`${g} consent ${t} \u2192 ${s}`);}logWarning(t){this.enabled&&console.warn(`${g} ${t}`);}};var ns=new Set(["sign_up","link_clicked"]),ee=class e{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;constructor(t){let{cookieDomain:s,publishableKey:i}=t,r=t.consent??"none",n=Ue;this.cookieDomain=s,this.testMode=t.testMode??!1,this.debug=new U(t.debug??!1);let o=!1;m(r)?(this.anonymousId=L(s),o=this.startSession()):this.anonymousId=M(x)??k(),this.queue=new xe(X,i,{baseUrl:t.baseUrl,flushIntervalMs:t.flushInterval,flushSize:t.flushSize,onFlush:(a,l)=>this.debug.logFlush(a,l),onError:t.onError,staleFilter:a=>Ae(a.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Re(this.queue,X,i,this.anonymousId,n,r,t.onError,t.baseUrl),this.attribution=Ce(),this.isTrackingDisabled()||(this.queue.start(),o&&this.trackSessionStart());}static init(t){if(!t.publishableKey?.trim())throw new Error(`${g} publishableKey is required`);return e.liveInstances>0&&console.warn(`${g} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),e.liveInstances+=1,new e(t)}isTrackingDisabled(){return !m(this.consent.level)}effectiveUserId(){return I(this.consent.level)?this.userId:void 0}startSession(){let t=A(this.cookieDomain);return this.sessionId=t.sessionId,this.sessionStartTime=Date.now(),t.isNew}baseMessage(){return {messageId:k(),eventTimestamp:Ee(),anonymousId:this.anonymousId,surface:"web",context:ke(Me,Le),...this.testMode&&{test:!0}}}enqueue(t,s){this.queue.enqueue(s),this.debug.logEvent(t,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:be,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Ie,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(t){if(this.isTrackingDisabled())return;A(this.cookieDomain);let s={session_id:this.sessionId,...t};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(t,...s){if(this.isTrackingDisabled())return;A(this.cookieDomain);let[i]=s,r={session_id:this.sessionId,...ns.has(t)?$e():{},...i};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:O(t),properties:r,userId:this.effectiveUserId()});}identify(t,s,i){if(!I(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}A(this.cookieDomain);let r=O(t);this.userId=r,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:r,identityType:s,traits:i});}alias(t,s){if(!I(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Te(t.id,t.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}A(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:O(t.id),fromType:t.identityType,toId:O(s.id),toType:s.identityType});}setConsent(t){let s=this.consent.level;if(t===s)return;this.debug.logConsent(s,t);let i=!m(s)&&m(t);if(i&&(this.anonymousId=L(this.cookieDomain)),m(t)||this.queue.stop(),this.consent.setLevel(t),m(t)?I(s)&&!I(t)&&(this.userId=void 0):(N(x,this.cookieDomain),N(_,this.cookieDomain)),i){this.isFirstPage=!0;let r=this.startSession();this.queue.start(),r&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),N(x,this.cookieDomain),N(_,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=k(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=L(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),e.liveInstances=Math.max(0,e.liveInstances-1));}};var os={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked"};/*! Bundled license information:
5
+ ${o.stack}`),_(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},Se=d(Kt),zt=e=>{S("env",e);};d(C("setEnvironment",zt));var Wt=e=>{S("passportClientId",e);};d(C("setPassportClientId",Wt));var Jt=e=>{S("pak",e);};d(C("setPublishableApiKey",Jt));d(C("getDetail",Y));var Yt={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},U=class extends Error{status;endpoint;body;constructor(e){super(`audience transport failed: ${e.status||"network error"} ${e.endpoint}`,e.cause!==void 0?{cause:e.cause}:void 0),this.name="TransportError",this.status=e.status,this.endpoint=e.endpoint,this.body=e.body;}},N=class extends Error{code;status;endpoint;responseBody;cause;constructor(e){super(e.message),this.name="AudienceError",this.code=e.code,this.status=e.status,this.endpoint=e.endpoint,this.responseBody=e.responseBody,this.cause=e.cause;}};function ke(e,t,s){if(e.status===0)return new N({code:"NETWORK_ERROR",message:t==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:e.endpoint,cause:e.cause});if(e.status>=200&&e.status<300){let i=e.body,r=i?.rejected??0,n=i?.accepted??0;return new N({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return e.status===429?new N({code:"RATE_LIMITED",message:t==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:e.status,endpoint:e.endpoint,responseBody:e.body}):e.status>=400&&e.status<500?new N({code:t==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush rejected with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body}):new N({code:t==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush failed with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body,cause:e.cause})}function Ae(e,t){if(e)try{e(t);}catch{}}var Xt=3e4;function Qt(e){let t=e.get?.("retry-after");if(!t)return null;let s=Number(t.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let i=new Date(t);if(!Number.isNaN(i.getTime())){let r=i.getTime()-Date.now();return r>0?r:null}return null}async function _e(e){let t=e.headers?.get?.("content-type")??"";try{return t.includes("application/json")?await e.json():await e.text()}catch{return}}var se=async(e,t,s,i)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),Xt);try{let o=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive,signal:r.signal});if(o.status===429){_("audience","transport_send_failed",{status:429});let a=Qt(o.headers);return {ok:!1,error:new U({status:429,endpoint:e}),...a!==null?{retryAfterMs:a}:{}}}if(!o.ok){let a=await _e(o);return _("audience","transport_send_failed",{status:o.status}),{ok:!1,error:new U({status:o.status,endpoint:e,body:a})}}let l=await _e(o);if(typeof l=="object"&&l!==null&&"rejected"in l){let a=l.rejected??0;if(a>0)return _("audience","transport_partial_rejected",{status:o.status,rejected:a}),{ok:!1,error:new U({status:o.status,endpoint:e,body:l})}}return {ok:!0}}catch(o){let l=new U({status:0,endpoint:e,cause:o});return Se("audience","transport_send",l),{ok:!1,error:l}}finally{clearTimeout(n);}},ie="__imtbl_audience_";function re(){try{return f()&&typeof localStorage<"u"}catch{return !1}}function Zt(e,t=ie){if(re())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function es(e,t,s=ie){if(re())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function ts(e,t=ie){if(re())try{localStorage.removeItem(`${t}${e}`);}catch{}}var te="queue",xe=100,Pe=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??j}${ue}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let i=Zt(te,this.storagePrefix)??[];this.messages=s?.staleFilter?i.filter(s.staleFilter):i;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;consecutiveFailures=0;nextAttemptAt=0;start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(e){this.messages.push(e),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let e=this.messages.slice(0,xe),t={messages:e},s=await this.send(this.endpointUrl,this.publishableKey,t),i;!s.ok&&s.error&&(i=ke(s.error,"flush",e.length));let r=i?.code==="VALIDATION_REJECTED";s.ok||r?(this.messages=this.messages.slice(e.length),this.persist(),this.resetBackoff()):i&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,e.length),i&&Ae(this.onError,i);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let e=this.messages.slice(0,xe),t={messages:e};this.send(this.endpointUrl,this.publishableKey,t,{keepalive:!0}),this.messages=this.messages.slice(e.length),this.persist();}purge(e){this.messages=this.messages.filter(t=>!e(t)),this.persist();}transform(e){this.messages=this.messages.map(e),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],ts(te,this.storagePrefix);}registerUnload(){!f()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let e=Date.now();e<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=e+this.backoffDelayMs());}setBackoffUntil(e){this.consecutiveFailures++,this.nextAttemptAt=e;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){es(te,this.messages,this.storagePrefix);}},ss="2.20.1-alpha.2";function Te(e="@imtbl/audience",t=ss){let s={library:e,libraryVersion:t};return f()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ne(e){let t=new Date(e).getTime();if(Number.isNaN(t))return !1;let s=Date.now();return t<=s+864e5&&t>=s-2592e6}function Oe(e,t,s,i){return e!==s||t!==i}function $(e,t=256){return e.length>t?e.slice(0,t):e}function O(e){let t=k(y);if(t)return A(y,t,1800,e),{sessionId:t,isNew:!1};let s=v();return A(y,s,1800,e),{sessionId:s,isNew:!0}}var De=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Ce=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],$e="__imtbl_attribution";function is(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...De,...Ce]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function rs(){try{let e=sessionStorage.getItem($e);return e?JSON.parse(e):null}catch{return null}}function ns(e){try{sessionStorage.setItem($e,JSON.stringify(e));}catch{}}function Re(){let e=typeof window<"u"&&window.location?is(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=Ce.some(r=>r in e),i=De.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function Me(){let e=rs();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...Re(),landing_page:t};return ns(s),s}function Ue(){return Re()}function w(e){return e!=="none"}function x(e){return e==="full"}function Le(e,t,s,i,r,n,o,l){let a=n??"none",h={none:0,anonymous:1,full:2};function m(c){let u=`${l??j}${ce}`;t(u,s,{anonymousId:i,status:c,source:r},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&Ae(o,ke(p.error,"consent"));});}return {get level(){return a},setLevel(c){c!==a&&(h[c]<h[a]&&(c==="none"?e.purge(()=>!0):c==="anonymous"&&(e.purge(u=>u.type==="identify"||u.type==="alias"),e.transform(u=>{if("userId"in u){let{userId:p,...F}=u;return F}return u}))),a=c,m(c));}}}var Fe="@imtbl/audience",je="2.20.1-alpha.2",b="[audience]",Be="WebSDK";var L=class{enabled;constructor(t=!1){this.enabled=t;}logEvent(t,s){this.enabled&&console.log(`${b} ${t}`,s);}logFlush(t,s){this.enabled&&console.log(`${b} flush ${t?"ok":"failed"} (${s} messages)`);}logConsent(t,s){this.enabled&&console.log(`${b} consent ${t} \u2192 ${s}`);}logWarning(t){this.enabled&&console.warn(`${b} ${t}`);}};var os=new Set(["sign_up","link_clicked"]),ne=class e{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;static UUID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;static readAndStripAidParam(){if(!f())return null;let t=new URLSearchParams(window.location.search),s=t.get("imtbl_aid");if(s!==null){t.delete("imtbl_aid");let i=t.toString(),r=`${window.location.pathname}${i?`?${i}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",r);}return s&&e.UUID_RE.test(s)?s:null}constructor(t){let{cookieDomain:s,publishableKey:i}=t,r=t.consent??"none",n=Be;this.cookieDomain=s,this.testMode=t.testMode??!1,this.debug=new L(t.debug??!1);let o=e.readAndStripAidParam(),l=!1;w(r)?(o?(K(o,s),this.anonymousId=o):this.anonymousId=D(s),l=this.startSession()):this.anonymousId=k(g)??v(),this.queue=new Pe(se,i,{baseUrl:t.baseUrl,flushIntervalMs:t.flushInterval,flushSize:t.flushSize,onFlush:(a,h)=>this.debug.logFlush(a,h),onError:t.onError,staleFilter:a=>Ne(a.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Le(this.queue,se,i,this.anonymousId,n,r,t.onError,t.baseUrl),this.attribution=Me(),this.isTrackingDisabled()||(this.queue.start(),l&&this.trackSessionStart());}static init(t){if(!t.publishableKey?.trim())throw new Error(`${b} publishableKey is required`);return e.liveInstances>0&&console.warn(`${b} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),e.liveInstances+=1,new e(t)}getAnonymousId(){return this.anonymousId}isTrackingDisabled(){return !w(this.consent.level)}effectiveUserId(){return x(this.consent.level)?this.userId:void 0}startSession(){let t=O(this.cookieDomain);return this.sessionId=t.sessionId,this.sessionStartTime=Date.now(),t.isNew}baseMessage(){return {messageId:v(),eventTimestamp:q(),anonymousId:this.anonymousId,surface:"web",context:Te(Fe,je),...this.testMode&&{test:!0}}}enqueue(t,s){this.queue.enqueue(s),this.debug.logEvent(t,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:B,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:G,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(t){if(this.isTrackingDisabled())return;O(this.cookieDomain);let s={session_id:this.sessionId,...t};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(t,...s){if(this.isTrackingDisabled())return;O(this.cookieDomain);let[i]=s,r={session_id:this.sessionId,...os.has(t)?Ue():{},...i};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:$(t),properties:r,userId:this.effectiveUserId()});}identify(t,s,i){if(!x(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}O(this.cookieDomain);let r=$(t);this.userId=r,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:r,identityType:s,traits:i});}alias(t,s){if(!x(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Oe(t.id,t.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}O(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:$(t.id),fromType:t.identityType,toId:$(s.id),toType:s.identityType});}setConsent(t){let s=this.consent.level;if(t===s)return;this.debug.logConsent(s,t);let i=!w(s)&&w(t);if(i&&(this.anonymousId=D(this.cookieDomain)),w(t)||this.queue.stop(),this.consent.setLevel(t),w(t)?x(s)&&!x(t)&&(this.userId=void 0):(P(g,this.cookieDomain),P(y,this.cookieDomain)),i){this.isFirstPage=!0;let r=this.startSession();this.queue.start(),r&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),P(g,this.cookieDomain),P(y,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=v(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=D(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),e.liveInstances=Math.max(0,e.liveInstances-1));}};var as={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked",BUTTON_CLICKED:"button_clicked"};/*! Bundled license information:
6
6
 
7
7
  tiny-lru/dist/tiny-lru.js:
8
8
  (**
@@ -14,9 +14,9 @@ tiny-lru/dist/tiny-lru.js:
14
14
  *)
15
15
  */
16
16
 
17
- exports.Audience = ee;
18
- exports.AudienceError = S;
19
- exports.AudienceEvents = os;
20
- exports.IdentityType = zt;
21
- exports.canIdentify = I;
22
- exports.canTrack = m;
17
+ exports.Audience = ne;
18
+ exports.AudienceError = N;
19
+ exports.AudienceEvents = as;
20
+ exports.IdentityType = Yt;
21
+ exports.canIdentify = x;
22
+ exports.canTrack = w;
@@ -1,6 +1,6 @@
1
- var je=Object.create;var ie=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var qe=Object.getPrototypeOf,Ke=Object.prototype.hasOwnProperty;var Ve=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var He=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Be(t))!Ke.call(e,r)&&r!==s&&ie(e,r,{get:()=>t[r],enumerable:!(i=Ge(t,r))||i.enumerable});return e};var ze=(e,t,s)=>(s=e!=null?je(qe(e)):{},He(ie(s,"default",{value:e,enumerable:!0}),e));var ue=Ve(E=>{Object.defineProperty(E,"__esModule",{value:!0});E.clearGlobalNamespace=E.getGlobalisedValue=void 0;var Ye="globalise__singleton__",Xe={},oe=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:Xe,Qe=(e,t)=>{if(typeof e!="string")throw "Invalid namespace key";if(typeof t!="string")throw "Invalid item key"},ae=e=>`${Ye}${e}`,le=e=>{let t=oe(),s=ae(e);return t[s]||(t[s]={}),t[s]},Ze=(e,t)=>le(e)[t]||void 0,et=(e,t,s)=>{let i=le(e);i[t]=s;},tt=(e,t,s)=>{Qe(e,t);let i=Ze(e,t);return i!==void 0?i:(et(e,t,s),s)};E.getGlobalisedValue=tt;var st=e=>{let t=oe(),s=ae(e);t[s]!==void 0&&delete t[s];};E.clearGlobalNamespace=st;});var j=class{constructor(t=0,s=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){let s=this.items[t];delete this.items[t],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(t=this.keys()){return t.map(s=>[s,this.get(s)])}evict(t=!1){if(t||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(t){let s;return this.has(t)&&(s=this.items[t].expiry),s}get(t){let s;if(this.has(t)){let i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(s=i.value,this.set(t,s,!0));}return s}has(t){return t in this.items}keys(){let t=[],s=this.first;for(;s!==null;)t.push(s.key),s=s.next;return t}set(t,s,i=!1,r=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=s,i===!1&&r&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){let o=this.last,a=n.next,l=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,o.next=n,l!==null&&(l.next=a),a!==null&&(a.prev=l);}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:s},++this.size===1?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map(s=>this.get(s))}};function re(e=1e3,t=0,s=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new j(e,t,s)}var We={max:1e3},ne=(e,t={})=>{let{cache:s,cacheKeyResolver:i=G,onHit:r,lruOptions:n={}}=t,o={...We,...n},a=s||re(o.max,o.ttl);function l(...h){let f=i(...h),c=a.get(f);if(a.has(f))return r&&r(f,c,a),c;let p=e.apply(this,h);return a.set(f,p),p}return l._cache=a,l},G=(...e)=>e.length===0?"no-args":e.map(t=>t===void 0?"undefined":t===null?"null":Array.isArray(t)?`[${G(...t)}]`:typeof t=="object"?`{${G(...Je(t))}}`:JSON.stringify(t)).join(","),Je=e=>Object.entries(e).sort((t,s)=>t[0]<s[0]?-1:1);var z=ze(ue()),it=Object.defineProperty,rt=(e,t)=>{for(var s in t)it(e,s,{get:t[s],enumerable:!0});},nt={};rt(nt,{deleteItem:()=>ut,getItem:()=>q,setItem:()=>C});var D=()=>typeof window>"u",de=()=>!D(),ot="__IMX-",W=()=>de()&&window.localStorage,at=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},lt=e=>typeof e=="string"?e:JSON.stringify(e),J=e=>`${ot}${e}`;function q(e){if(W())return at(window.localStorage.getItem(J(e)))}var C=(e,t)=>W()?(window.localStorage.setItem(J(e),lt(t)),!0):!1,ut=e=>W()?(window.localStorage.removeItem(J(e)),!0):!1,K=0,ct=e=>{let t=parseInt(e,10)*1e3,s=new Date(t),i=new Date;return K=s.getTime()-i.getTime(),K},dt=()=>{let e=new Date().getTime()+K;return new Date(e).toISOString()},ht=(e=>(e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion",e))(ht||{}),pt="https://api.immutable.com",ft=e=>{if(typeof Buffer<"u")return Buffer.from(e,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(e)));throw new Error("Base64 encoding not supported in this environment")};async function he(e,t){let s=JSON.stringify(t),i={payload:ft(s)},r=await fetch(`${pt}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok){let n=await r.text().catch(()=>"");throw new Error(`Request failed (${r.status}): ${n||r.statusText}`)}return r.json()}var y,v,mt=()=>{y=q("metrics-events")||[],v=q("metrics-runtime")||{};};mt();var w=(e,t)=>{v={...v,[e]:t},C("metrics-runtime",v);},V=e=>{if(v[e]!==void 0)return v[e]},gt=()=>v,yt=()=>y,vt=e=>{y.push(e),C("metrics-events",y);},wt=e=>{y=y.slice(e),C("metrics-events",y);},pe=e=>{let t=[];return Object.entries(e).forEach(([s,i])=>{(typeof s=="string"||typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&t.push([s,i.toString()]);}),t},B="2.20.1-alpha.0",bt=()=>D()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",It=()=>{if(D())return "";let e;try{window.self!==window.top&&(e=bt());}catch{}return e||(e=window.location.hostname),e},Et=()=>{if(w("sdkVersion",B),D())return {browser:"nodejs",sdkVersion:B};let e=It();return e&&w("domain",e),{sdkVersion:B,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},H=!1,St=()=>H,_t=async()=>{H=!0;try{let e=pe(Et()),t=V("rid"),s=V("uid"),i=await he("/v1/sdk/initialise",{version:1,data:{runtimeDetails:e,runtimeId:t,uId:s}}),{runtimeId:r,sTime:n}=i;w("rid",r),ct(n);}catch{H=!1;}};function d(e,t){return (...s)=>{try{let i=e(...s);return i instanceof Promise?i.catch(()=>t):i}catch{return t}}}function xt(){return de()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var kt=d(xt,!1),fe="imtbl__metrics",At=5e3,Tt=1e3,T=(e,t)=>(0, z.getGlobalisedValue)(fe,e,t),Pt=(e,t)=>{let s=ne(t,{lruOptions:{ttl:At,max:Tt}});return (0, z.getGlobalisedValue)(fe,e,s)},Nt=5e3,Ot=(e,t,s)=>{let i={event:`${e}.${t}`,time:dt(),...s&&{properties:pe(s)}};vt(i);},b=d(Pt("track",Ot)),Dt=async()=>{if(St()===!1){await _t();return}let e=yt();if(e.length===0)return;let t=e.length,s=gt();await he("/v1/sdk/metrics",{version:1,data:{events:e,details:s}})instanceof Error||wt(t);},Ct=d(Dt),me=async()=>{await Ct(),setTimeout(me,Nt);},ce=!1,$t=()=>{ce||(ce=!0,me());};kt()||d(T("startFlushing",$t))();var Gt=(e,t,s,i)=>{let{message:r}=s,n=s.stack||"",{cause:o}=s;o instanceof Error&&(n=`${n}
1
+ var qe=Object.create;var le=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var He=Object.getPrototypeOf,ze=Object.prototype.hasOwnProperty;var We=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Je=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ve(t))!ze.call(e,r)&&r!==s&&le(e,r,{get:()=>t[r],enumerable:!(i=Ke(t,r))||i.enumerable});return e};var Ye=(e,t,s)=>(s=e!=null?qe(He(e)):{},Je(le(s,"default",{value:e,enumerable:!0}),e));var ge=We(T=>{Object.defineProperty(T,"__esModule",{value:!0});T.clearGlobalNamespace=T.getGlobalisedValue=void 0;var Ze="globalise__singleton__",et={},pe=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:et,tt=(e,t)=>{if(typeof e!="string")throw "Invalid namespace key";if(typeof t!="string")throw "Invalid item key"},fe=e=>`${Ze}${e}`,me=e=>{let t=pe(),s=fe(e);return t[s]||(t[s]={}),t[s]},st=(e,t)=>me(e)[t]||void 0,it=(e,t,s)=>{let i=me(e);i[t]=s;},rt=(e,t,s)=>{tt(e,t);let i=st(e,t);return i!==void 0?i:(it(e,t,s),s)};T.getGlobalisedValue=rt;var nt=e=>{let t=pe(),s=fe(e);t[s]!==void 0&&delete t[s];};T.clearGlobalNamespace=nt;});var j="https://api.immutable.com",ue="/v1/audience/messages",ce="/v1/audience/tracking-consent",g="imtbl_anon_id",y="_imtbl_sid",B="session_start",G="session_end",f=()=>typeof window<"u"&&typeof document<"u",v=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return (e==="x"?t:t%4+8).toString(16)}),q=()=>new Date().toISOString();function k(e){if(!f())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function A(e,t,s,i){if(!f())return;let r=window.location.protocol==="https:"?"; Secure":"",n=i?`; domain=${i}`:"";document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${s}; SameSite=Lax${n}${r}`;}function P(e,t){A(e,"",0,t);}function D(e){let t=k(g);if(t)return t;let s=v();return A(g,s,63072e3,e),s}function K(e,t){A(g,e,63072e3,t);}var V=class{constructor(t=0,s=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){let s=this.items[t];delete this.items[t],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(t=this.keys()){return t.map(s=>[s,this.get(s)])}evict(t=!1){if(t||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(t){let s;return this.has(t)&&(s=this.items[t].expiry),s}get(t){let s;if(this.has(t)){let i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(s=i.value,this.set(t,s,!0));}return s}has(t){return t in this.items}keys(){let t=[],s=this.first;for(;s!==null;)t.push(s.key),s=s.next;return t}set(t,s,i=!1,r=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=s,i===!1&&r&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){let o=this.last,l=n.next,a=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,o.next=n,a!==null&&(a.next=l),l!==null&&(l.prev=a);}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:s},++this.size===1?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map(s=>this.get(s))}};function de(e=1e3,t=0,s=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new V(e,t,s)}var Xe={max:1e3},he=(e,t={})=>{let{cache:s,cacheKeyResolver:i=H,onHit:r,lruOptions:n={}}=t,o={...Xe,...n},l=s||de(o.max,o.ttl);function a(...h){let m=i(...h),c=l.get(m);if(l.has(m))return r&&r(m,c,l),c;let p=e.apply(this,h);return l.set(m,p),p}return a._cache=l,a},H=(...e)=>e.length===0?"no-args":e.map(t=>t===void 0?"undefined":t===null?"null":Array.isArray(t)?`[${H(...t)}]`:typeof t=="object"?`{${H(...Qe(t))}}`:JSON.stringify(t)).join(","),Qe=e=>Object.entries(e).sort((t,s)=>t[0]<s[0]?-1:1);var Q=Ye(ge()),ot=Object.defineProperty,at=(e,t)=>{for(var s in t)ot(e,s,{get:t[s],enumerable:!0});},lt={};at(lt,{deleteItem:()=>ht,getItem:()=>W,setItem:()=>M});var R=()=>typeof window>"u",ve=()=>!R(),ut="__IMX-",Z=()=>ve()&&window.localStorage,ct=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},dt=e=>typeof e=="string"?e:JSON.stringify(e),ee=e=>`${ut}${e}`;function W(e){if(Z())return ct(window.localStorage.getItem(ee(e)))}var M=(e,t)=>Z()?(window.localStorage.setItem(ee(e),dt(t)),!0):!1,ht=e=>Z()?(window.localStorage.removeItem(ee(e)),!0):!1,J=0,pt=e=>{let t=parseInt(e,10)*1e3,s=new Date(t),i=new Date;return J=s.getTime()-i.getTime(),J},ft=()=>{let e=new Date().getTime()+J;return new Date(e).toISOString()},mt=(e=>(e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion",e))(mt||{}),gt="https://api.immutable.com",yt=e=>{if(typeof Buffer<"u")return Buffer.from(e,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(e)));throw new Error("Base64 encoding not supported in this environment")};async function we(e,t){let s=JSON.stringify(t),i={payload:yt(s)},r=await fetch(`${gt}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok){let n=await r.text().catch(()=>"");throw new Error(`Request failed (${r.status}): ${n||r.statusText}`)}return r.json()}var I,E,vt=()=>{I=W("metrics-events")||[],E=W("metrics-runtime")||{};};vt();var S=(e,t)=>{E={...E,[e]:t},M("metrics-runtime",E);},Y=e=>{if(E[e]!==void 0)return E[e]},wt=()=>E,bt=()=>I,It=e=>{I.push(e),M("metrics-events",I);},Et=e=>{I=I.slice(e),M("metrics-events",I);},be=e=>{let t=[];return Object.entries(e).forEach(([s,i])=>{(typeof s=="string"||typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&t.push([s,i.toString()]);}),t},z="2.20.1-alpha.2",St=()=>R()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",_t=()=>{if(R())return "";let e;try{window.self!==window.top&&(e=St());}catch{}return e||(e=window.location.hostname),e},xt=()=>{if(S("sdkVersion",z),R())return {browser:"nodejs",sdkVersion:z};let e=_t();return e&&S("domain",e),{sdkVersion:z,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},X=!1,kt=()=>X,At=async()=>{X=!0;try{let e=be(xt()),t=Y("rid"),s=Y("uid"),i=await we("/v1/sdk/initialise",{version:1,data:{runtimeDetails:e,runtimeId:t,uId:s}}),{runtimeId:r,sTime:n}=i;S("rid",r),pt(n);}catch{X=!1;}};function d(e,t){return (...s)=>{try{let i=e(...s);return i instanceof Promise?i.catch(()=>t):i}catch{return t}}}function Pt(){return ve()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var Tt=d(Pt,!1),Ie="imtbl__metrics",Nt=5e3,Ot=1e3,C=(e,t)=>(0, Q.getGlobalisedValue)(Ie,e,t),Dt=(e,t)=>{let s=he(t,{lruOptions:{ttl:Nt,max:Ot}});return (0, Q.getGlobalisedValue)(Ie,e,s)},Ct=5e3,$t=(e,t,s)=>{let i={event:`${e}.${t}`,time:ft(),...s&&{properties:be(s)}};It(i);},_=d(Dt("track",$t)),Rt=async()=>{if(kt()===!1){await At();return}let e=bt();if(e.length===0)return;let t=e.length,s=wt();await we("/v1/sdk/metrics",{version:1,data:{events:e,details:s}})instanceof Error||Et(t);},Mt=d(Rt),Ee=async()=>{await Mt(),setTimeout(Ee,Ct);},ye=!1,Ut=()=>{ye||(ye=!0,Ee());};Tt()||d(C("startFlushing",Ut))();var Kt=(e,t,s,i)=>{let{message:r}=s,n=s.stack||"",{cause:o}=s;o instanceof Error&&(n=`${n}
2
2
  Cause: ${o.message}
3
- ${o.stack}`),b(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},ge=d(Gt),Kt=e=>{w("env",e);};d(T("setEnvironment",Kt));var Vt=e=>{w("passportClientId",e);};d(T("setPassportClientId",Vt));var Ht=e=>{w("pak",e);};d(T("setPublishableApiKey",Ht));d(T("getDetail",V));var zt={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},we="https://api.immutable.com",Wt="/v1/audience/messages",Jt="/v1/audience/tracking-consent",x="imtbl_anon_id",_="_imtbl_sid",be="session_start",Ie="session_end",P=()=>typeof window<"u"&&typeof document<"u",k=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return (e==="x"?t:t%4+8).toString(16)}),Ee=()=>new Date().toISOString();function M(e){if(!P())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function R(e,t,s,i){if(!P())return;let r=window.location.protocol==="https:"?"; Secure":"",n=i?`; domain=${i}`:"";document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${s}; SameSite=Lax${n}${r}`;}function N(e,t){R(e,"",0,t);}function L(e){let t=M(x);if(t)return t;let s=k();return R(x,s,63072e3,e),s}var $=class extends Error{status;endpoint;body;constructor(e){super(`audience transport failed: ${e.status||"network error"} ${e.endpoint}`,e.cause!==void 0?{cause:e.cause}:void 0),this.name="TransportError",this.status=e.status,this.endpoint=e.endpoint,this.body=e.body;}},S=class extends Error{code;status;endpoint;responseBody;cause;constructor(e){super(e.message),this.name="AudienceError",this.code=e.code,this.status=e.status,this.endpoint=e.endpoint,this.responseBody=e.responseBody,this.cause=e.cause;}};function Se(e,t,s){if(e.status===0)return new S({code:"NETWORK_ERROR",message:t==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:e.endpoint,cause:e.cause});if(e.status>=200&&e.status<300){let i=e.body,r=i?.rejected??0,n=i?.accepted??0;return new S({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return e.status===429?new S({code:"RATE_LIMITED",message:t==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:e.status,endpoint:e.endpoint,responseBody:e.body}):e.status>=400&&e.status<500?new S({code:t==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush rejected with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body}):new S({code:t==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush failed with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body,cause:e.cause})}function _e(e,t){if(e)try{e(t);}catch{}}var Yt=3e4;function Xt(e){let t=e.get?.("retry-after");if(!t)return null;let s=Number(t.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let i=new Date(t);if(!Number.isNaN(i.getTime())){let r=i.getTime()-Date.now();return r>0?r:null}return null}async function ye(e){let t=e.headers?.get?.("content-type")??"";try{return t.includes("application/json")?await e.json():await e.text()}catch{return}}var X=async(e,t,s,i)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),Yt);try{let o=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive,signal:r.signal});if(o.status===429){b("audience","transport_send_failed",{status:429});let l=Xt(o.headers);return {ok:!1,error:new $({status:429,endpoint:e}),...l!==null?{retryAfterMs:l}:{}}}if(!o.ok){let l=await ye(o);return b("audience","transport_send_failed",{status:o.status}),{ok:!1,error:new $({status:o.status,endpoint:e,body:l})}}let a=await ye(o);if(typeof a=="object"&&a!==null&&"rejected"in a){let l=a.rejected??0;if(l>0)return b("audience","transport_partial_rejected",{status:o.status,rejected:l}),{ok:!1,error:new $({status:o.status,endpoint:e,body:a})}}return {ok:!0}}catch(o){let a=new $({status:0,endpoint:e,cause:o});return ge("audience","transport_send",a),{ok:!1,error:a}}finally{clearTimeout(n);}},Q="__imtbl_audience_";function Z(){try{return P()&&typeof localStorage<"u"}catch{return !1}}function Qt(e,t=Q){if(Z())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function Zt(e,t,s=Q){if(Z())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function es(e,t=Q){if(Z())try{localStorage.removeItem(`${t}${e}`);}catch{}}var Y="queue",ve=100,xe=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??we}${Wt}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let i=Qt(Y,this.storagePrefix)??[];this.messages=s?.staleFilter?i.filter(s.staleFilter):i;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;consecutiveFailures=0;nextAttemptAt=0;start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(e){this.messages.push(e),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let e=this.messages.slice(0,ve),t={messages:e},s=await this.send(this.endpointUrl,this.publishableKey,t),i;!s.ok&&s.error&&(i=Se(s.error,"flush",e.length));let r=i?.code==="VALIDATION_REJECTED";s.ok||r?(this.messages=this.messages.slice(e.length),this.persist(),this.resetBackoff()):i&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,e.length),i&&_e(this.onError,i);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let e=this.messages.slice(0,ve),t={messages:e};this.send(this.endpointUrl,this.publishableKey,t,{keepalive:!0}),this.messages=this.messages.slice(e.length),this.persist();}purge(e){this.messages=this.messages.filter(t=>!e(t)),this.persist();}transform(e){this.messages=this.messages.map(e),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],es(Y,this.storagePrefix);}registerUnload(){!P()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let e=Date.now();e<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=e+this.backoffDelayMs());}setBackoffUntil(e){this.consecutiveFailures++,this.nextAttemptAt=e;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Zt(Y,this.messages,this.storagePrefix);}},ts="2.20.1-alpha.0";function ke(e="@imtbl/audience",t=ts){let s={library:e,libraryVersion:t};return P()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ae(e){let t=new Date(e).getTime();if(Number.isNaN(t))return !1;let s=Date.now();return t<=s+864e5&&t>=s-2592e6}function Te(e,t,s,i){return e!==s||t!==i}function O(e,t=256){return e.length>t?e.slice(0,t):e}function A(e){let t=M(_);if(t)return R(_,t,1800,e),{sessionId:t,isNew:!1};let s=k();return R(_,s,1800,e),{sessionId:s,isNew:!0}}var Pe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Ne=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Oe="__imtbl_attribution";function ss(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...Pe,...Ne]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function is(){try{let e=sessionStorage.getItem(Oe);return e?JSON.parse(e):null}catch{return null}}function rs(e){try{sessionStorage.setItem(Oe,JSON.stringify(e));}catch{}}function De(){let e=typeof window<"u"&&window.location?ss(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=Ne.some(r=>r in e),i=Pe.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function Ce(){let e=is();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...De(),landing_page:t};return rs(s),s}function $e(){return De()}function m(e){return e!=="none"}function I(e){return e==="full"}function Re(e,t,s,i,r,n,o,a){let l=n??"none",h={none:0,anonymous:1,full:2};function f(c){let u=`${a??we}${Jt}`;t(u,s,{anonymousId:i,status:c,source:r},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&_e(o,Se(p.error,"consent"));});}return {get level(){return l},setLevel(c){c!==l&&(h[c]<h[l]&&(c==="none"?e.purge(()=>!0):c==="anonymous"&&(e.purge(u=>u.type==="identify"||u.type==="alias"),e.transform(u=>{if("userId"in u){let{userId:p,...F}=u;return F}return u}))),l=c,f(c));}}}var Me="@imtbl/audience",Le="2.20.1-alpha.0",g="[audience]",Ue="WebSDK";var U=class{enabled;constructor(t=!1){this.enabled=t;}logEvent(t,s){this.enabled&&console.log(`${g} ${t}`,s);}logFlush(t,s){this.enabled&&console.log(`${g} flush ${t?"ok":"failed"} (${s} messages)`);}logConsent(t,s){this.enabled&&console.log(`${g} consent ${t} \u2192 ${s}`);}logWarning(t){this.enabled&&console.warn(`${g} ${t}`);}};var ns=new Set(["sign_up","link_clicked"]),ee=class e{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;constructor(t){let{cookieDomain:s,publishableKey:i}=t,r=t.consent??"none",n=Ue;this.cookieDomain=s,this.testMode=t.testMode??!1,this.debug=new U(t.debug??!1);let o=!1;m(r)?(this.anonymousId=L(s),o=this.startSession()):this.anonymousId=M(x)??k(),this.queue=new xe(X,i,{baseUrl:t.baseUrl,flushIntervalMs:t.flushInterval,flushSize:t.flushSize,onFlush:(a,l)=>this.debug.logFlush(a,l),onError:t.onError,staleFilter:a=>Ae(a.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Re(this.queue,X,i,this.anonymousId,n,r,t.onError,t.baseUrl),this.attribution=Ce(),this.isTrackingDisabled()||(this.queue.start(),o&&this.trackSessionStart());}static init(t){if(!t.publishableKey?.trim())throw new Error(`${g} publishableKey is required`);return e.liveInstances>0&&console.warn(`${g} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),e.liveInstances+=1,new e(t)}isTrackingDisabled(){return !m(this.consent.level)}effectiveUserId(){return I(this.consent.level)?this.userId:void 0}startSession(){let t=A(this.cookieDomain);return this.sessionId=t.sessionId,this.sessionStartTime=Date.now(),t.isNew}baseMessage(){return {messageId:k(),eventTimestamp:Ee(),anonymousId:this.anonymousId,surface:"web",context:ke(Me,Le),...this.testMode&&{test:!0}}}enqueue(t,s){this.queue.enqueue(s),this.debug.logEvent(t,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:be,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Ie,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(t){if(this.isTrackingDisabled())return;A(this.cookieDomain);let s={session_id:this.sessionId,...t};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(t,...s){if(this.isTrackingDisabled())return;A(this.cookieDomain);let[i]=s,r={session_id:this.sessionId,...ns.has(t)?$e():{},...i};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:O(t),properties:r,userId:this.effectiveUserId()});}identify(t,s,i){if(!I(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}A(this.cookieDomain);let r=O(t);this.userId=r,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:r,identityType:s,traits:i});}alias(t,s){if(!I(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Te(t.id,t.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}A(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:O(t.id),fromType:t.identityType,toId:O(s.id),toType:s.identityType});}setConsent(t){let s=this.consent.level;if(t===s)return;this.debug.logConsent(s,t);let i=!m(s)&&m(t);if(i&&(this.anonymousId=L(this.cookieDomain)),m(t)||this.queue.stop(),this.consent.setLevel(t),m(t)?I(s)&&!I(t)&&(this.userId=void 0):(N(x,this.cookieDomain),N(_,this.cookieDomain)),i){this.isFirstPage=!0;let r=this.startSession();this.queue.start(),r&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),N(x,this.cookieDomain),N(_,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=k(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=L(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),e.liveInstances=Math.max(0,e.liveInstances-1));}};var os={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked"};/*! Bundled license information:
3
+ ${o.stack}`),_(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},Se=d(Kt),zt=e=>{S("env",e);};d(C("setEnvironment",zt));var Wt=e=>{S("passportClientId",e);};d(C("setPassportClientId",Wt));var Jt=e=>{S("pak",e);};d(C("setPublishableApiKey",Jt));d(C("getDetail",Y));var Yt={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},U=class extends Error{status;endpoint;body;constructor(e){super(`audience transport failed: ${e.status||"network error"} ${e.endpoint}`,e.cause!==void 0?{cause:e.cause}:void 0),this.name="TransportError",this.status=e.status,this.endpoint=e.endpoint,this.body=e.body;}},N=class extends Error{code;status;endpoint;responseBody;cause;constructor(e){super(e.message),this.name="AudienceError",this.code=e.code,this.status=e.status,this.endpoint=e.endpoint,this.responseBody=e.responseBody,this.cause=e.cause;}};function ke(e,t,s){if(e.status===0)return new N({code:"NETWORK_ERROR",message:t==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:e.endpoint,cause:e.cause});if(e.status>=200&&e.status<300){let i=e.body,r=i?.rejected??0,n=i?.accepted??0;return new N({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return e.status===429?new N({code:"RATE_LIMITED",message:t==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:e.status,endpoint:e.endpoint,responseBody:e.body}):e.status>=400&&e.status<500?new N({code:t==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush rejected with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body}):new N({code:t==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush failed with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body,cause:e.cause})}function Ae(e,t){if(e)try{e(t);}catch{}}var Xt=3e4;function Qt(e){let t=e.get?.("retry-after");if(!t)return null;let s=Number(t.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let i=new Date(t);if(!Number.isNaN(i.getTime())){let r=i.getTime()-Date.now();return r>0?r:null}return null}async function _e(e){let t=e.headers?.get?.("content-type")??"";try{return t.includes("application/json")?await e.json():await e.text()}catch{return}}var se=async(e,t,s,i)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),Xt);try{let o=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive,signal:r.signal});if(o.status===429){_("audience","transport_send_failed",{status:429});let a=Qt(o.headers);return {ok:!1,error:new U({status:429,endpoint:e}),...a!==null?{retryAfterMs:a}:{}}}if(!o.ok){let a=await _e(o);return _("audience","transport_send_failed",{status:o.status}),{ok:!1,error:new U({status:o.status,endpoint:e,body:a})}}let l=await _e(o);if(typeof l=="object"&&l!==null&&"rejected"in l){let a=l.rejected??0;if(a>0)return _("audience","transport_partial_rejected",{status:o.status,rejected:a}),{ok:!1,error:new U({status:o.status,endpoint:e,body:l})}}return {ok:!0}}catch(o){let l=new U({status:0,endpoint:e,cause:o});return Se("audience","transport_send",l),{ok:!1,error:l}}finally{clearTimeout(n);}},ie="__imtbl_audience_";function re(){try{return f()&&typeof localStorage<"u"}catch{return !1}}function Zt(e,t=ie){if(re())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function es(e,t,s=ie){if(re())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function ts(e,t=ie){if(re())try{localStorage.removeItem(`${t}${e}`);}catch{}}var te="queue",xe=100,Pe=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??j}${ue}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let i=Zt(te,this.storagePrefix)??[];this.messages=s?.staleFilter?i.filter(s.staleFilter):i;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;consecutiveFailures=0;nextAttemptAt=0;start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(e){this.messages.push(e),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let e=this.messages.slice(0,xe),t={messages:e},s=await this.send(this.endpointUrl,this.publishableKey,t),i;!s.ok&&s.error&&(i=ke(s.error,"flush",e.length));let r=i?.code==="VALIDATION_REJECTED";s.ok||r?(this.messages=this.messages.slice(e.length),this.persist(),this.resetBackoff()):i&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,e.length),i&&Ae(this.onError,i);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let e=this.messages.slice(0,xe),t={messages:e};this.send(this.endpointUrl,this.publishableKey,t,{keepalive:!0}),this.messages=this.messages.slice(e.length),this.persist();}purge(e){this.messages=this.messages.filter(t=>!e(t)),this.persist();}transform(e){this.messages=this.messages.map(e),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],ts(te,this.storagePrefix);}registerUnload(){!f()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let e=Date.now();e<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=e+this.backoffDelayMs());}setBackoffUntil(e){this.consecutiveFailures++,this.nextAttemptAt=e;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){es(te,this.messages,this.storagePrefix);}},ss="2.20.1-alpha.2";function Te(e="@imtbl/audience",t=ss){let s={library:e,libraryVersion:t};return f()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ne(e){let t=new Date(e).getTime();if(Number.isNaN(t))return !1;let s=Date.now();return t<=s+864e5&&t>=s-2592e6}function Oe(e,t,s,i){return e!==s||t!==i}function $(e,t=256){return e.length>t?e.slice(0,t):e}function O(e){let t=k(y);if(t)return A(y,t,1800,e),{sessionId:t,isNew:!1};let s=v();return A(y,s,1800,e),{sessionId:s,isNew:!0}}var De=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Ce=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],$e="__imtbl_attribution";function is(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...De,...Ce]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function rs(){try{let e=sessionStorage.getItem($e);return e?JSON.parse(e):null}catch{return null}}function ns(e){try{sessionStorage.setItem($e,JSON.stringify(e));}catch{}}function Re(){let e=typeof window<"u"&&window.location?is(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=Ce.some(r=>r in e),i=De.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function Me(){let e=rs();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...Re(),landing_page:t};return ns(s),s}function Ue(){return Re()}function w(e){return e!=="none"}function x(e){return e==="full"}function Le(e,t,s,i,r,n,o,l){let a=n??"none",h={none:0,anonymous:1,full:2};function m(c){let u=`${l??j}${ce}`;t(u,s,{anonymousId:i,status:c,source:r},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&Ae(o,ke(p.error,"consent"));});}return {get level(){return a},setLevel(c){c!==a&&(h[c]<h[a]&&(c==="none"?e.purge(()=>!0):c==="anonymous"&&(e.purge(u=>u.type==="identify"||u.type==="alias"),e.transform(u=>{if("userId"in u){let{userId:p,...F}=u;return F}return u}))),a=c,m(c));}}}var Fe="@imtbl/audience",je="2.20.1-alpha.2",b="[audience]",Be="WebSDK";var L=class{enabled;constructor(t=!1){this.enabled=t;}logEvent(t,s){this.enabled&&console.log(`${b} ${t}`,s);}logFlush(t,s){this.enabled&&console.log(`${b} flush ${t?"ok":"failed"} (${s} messages)`);}logConsent(t,s){this.enabled&&console.log(`${b} consent ${t} \u2192 ${s}`);}logWarning(t){this.enabled&&console.warn(`${b} ${t}`);}};var os=new Set(["sign_up","link_clicked"]),ne=class e{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;static UUID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;static readAndStripAidParam(){if(!f())return null;let t=new URLSearchParams(window.location.search),s=t.get("imtbl_aid");if(s!==null){t.delete("imtbl_aid");let i=t.toString(),r=`${window.location.pathname}${i?`?${i}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",r);}return s&&e.UUID_RE.test(s)?s:null}constructor(t){let{cookieDomain:s,publishableKey:i}=t,r=t.consent??"none",n=Be;this.cookieDomain=s,this.testMode=t.testMode??!1,this.debug=new L(t.debug??!1);let o=e.readAndStripAidParam(),l=!1;w(r)?(o?(K(o,s),this.anonymousId=o):this.anonymousId=D(s),l=this.startSession()):this.anonymousId=k(g)??v(),this.queue=new Pe(se,i,{baseUrl:t.baseUrl,flushIntervalMs:t.flushInterval,flushSize:t.flushSize,onFlush:(a,h)=>this.debug.logFlush(a,h),onError:t.onError,staleFilter:a=>Ne(a.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Le(this.queue,se,i,this.anonymousId,n,r,t.onError,t.baseUrl),this.attribution=Me(),this.isTrackingDisabled()||(this.queue.start(),l&&this.trackSessionStart());}static init(t){if(!t.publishableKey?.trim())throw new Error(`${b} publishableKey is required`);return e.liveInstances>0&&console.warn(`${b} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),e.liveInstances+=1,new e(t)}getAnonymousId(){return this.anonymousId}isTrackingDisabled(){return !w(this.consent.level)}effectiveUserId(){return x(this.consent.level)?this.userId:void 0}startSession(){let t=O(this.cookieDomain);return this.sessionId=t.sessionId,this.sessionStartTime=Date.now(),t.isNew}baseMessage(){return {messageId:v(),eventTimestamp:q(),anonymousId:this.anonymousId,surface:"web",context:Te(Fe,je),...this.testMode&&{test:!0}}}enqueue(t,s){this.queue.enqueue(s),this.debug.logEvent(t,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:B,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:G,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(t){if(this.isTrackingDisabled())return;O(this.cookieDomain);let s={session_id:this.sessionId,...t};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(t,...s){if(this.isTrackingDisabled())return;O(this.cookieDomain);let[i]=s,r={session_id:this.sessionId,...os.has(t)?Ue():{},...i};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:$(t),properties:r,userId:this.effectiveUserId()});}identify(t,s,i){if(!x(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}O(this.cookieDomain);let r=$(t);this.userId=r,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:r,identityType:s,traits:i});}alias(t,s){if(!x(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Oe(t.id,t.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}O(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:$(t.id),fromType:t.identityType,toId:$(s.id),toType:s.identityType});}setConsent(t){let s=this.consent.level;if(t===s)return;this.debug.logConsent(s,t);let i=!w(s)&&w(t);if(i&&(this.anonymousId=D(this.cookieDomain)),w(t)||this.queue.stop(),this.consent.setLevel(t),w(t)?x(s)&&!x(t)&&(this.userId=void 0):(P(g,this.cookieDomain),P(y,this.cookieDomain)),i){this.isFirstPage=!0;let r=this.startSession();this.queue.start(),r&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),P(g,this.cookieDomain),P(y,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=v(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=D(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),e.liveInstances=Math.max(0,e.liveInstances-1));}};var as={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked",BUTTON_CLICKED:"button_clicked"};/*! Bundled license information:
4
4
 
5
5
  tiny-lru/dist/tiny-lru.js:
6
6
  (**
@@ -12,4 +12,4 @@ tiny-lru/dist/tiny-lru.js:
12
12
  *)
13
13
  */
14
14
 
15
- export { ee as Audience, S as AudienceError, os as AudienceEvents, zt as IdentityType, I as canIdentify, m as canTrack };
15
+ export { ne as Audience, N as AudienceError, as as AudienceEvents, Yt as IdentityType, x as canIdentify, w as canTrack };
@@ -92,6 +92,7 @@ declare const AudienceEvents: {
92
92
  readonly EMAIL_ACQUIRED: "email_acquired";
93
93
  readonly GAME_PAGE_VIEWED: "game_page_viewed";
94
94
  readonly LINK_CLICKED: "link_clicked";
95
+ readonly BUTTON_CLICKED: "button_clicked";
95
96
  };
96
97
  interface SignUpProperties {
97
98
  method?: string;
@@ -151,6 +152,11 @@ interface LinkClickedProperties {
151
152
  source?: string;
152
153
  game_id?: string;
153
154
  }
155
+ interface ButtonClickedProperties {
156
+ button_text?: string;
157
+ element_id?: string;
158
+ element_type?: string;
159
+ }
154
160
  interface EventPropsMap {
155
161
  sign_up: SignUpProperties;
156
162
  sign_in: SignInProperties;
@@ -163,6 +169,7 @@ interface EventPropsMap {
163
169
  email_acquired: EmailAcquiredProperties;
164
170
  game_page_viewed: GamePageViewedProperties;
165
171
  link_clicked: LinkClickedProperties;
172
+ button_clicked: ButtonClickedProperties;
166
173
  }
167
174
  type AudienceEventName = keyof EventPropsMap;
168
175
  /**
@@ -227,12 +234,16 @@ declare class Audience {
227
234
  private userId;
228
235
  private isFirstPage;
229
236
  private destroyed;
237
+ private static readonly UUID_RE;
238
+ private static readAndStripAidParam;
230
239
  private constructor();
231
240
  /**
232
241
  * Create and start the SDK. Warns if another instance is already active —
233
242
  * call `shutdown()` on the previous one first.
234
243
  */
235
244
  static init(config: AudienceConfig): Audience;
245
+ /** Returns the anonymous ID for the current browser session. */
246
+ getAnonymousId(): string;
236
247
  /** True when the current consent level does not permit tracking. */
237
248
  private isTrackingDisabled;
238
249
  /** Returns userId if consent is full, undefined otherwise. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@imtbl/audience",
3
3
  "description": "Immutable Audience — consent-aware event tracking and identity management",
4
- "version": "2.20.1-alpha.0",
4
+ "version": "2.20.1-alpha.2",
5
5
  "author": "Immutable",
6
6
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
7
7
  "devDependencies": {