@imtbl/audience 2.19.0 → 2.20.0

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 Sn=(r,i,o,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of vn(i))!En.call(r,h)&&h!==o&&lt(r,h,{get:()=>i[h],enumerable:!(f=wn(i,h))||f.enumerable});return r};var An=(r,i,o)=>(o=r!=null?mn(bn(r)):{},Sn(lt(o,"default",{value:r,enumerable:!0}),r));var B=ft(()=>{});var T=ft(()=>{});var yt=In(ie=>{T();B();Object.defineProperty(ie,"__esModule",{value:!0});ie.clearGlobalNamespace=ie.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(),o=dt(r);return i[o]||(i[o]={}),i[o]},Un=(r,i)=>gt(r)[i]||void 0,On=(r,i,o)=>{let f=gt(r);f[i]=o;},Pn=(r,i,o)=>{kn(r,i);let f=Un(r,i);return f!==void 0?f:(On(r,i,o),o)};ie.getGlobalisedValue=Pn;var Rn=r=>{let i=pt(),o=dt(r);i[o]!==void 0&&delete i[o];};ie.clearGlobalNamespace=Rn;});T();B();T();B();T();B();T();B();T();B();T();B();var Ue=class{constructor(i=0,o=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=o;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(i){if(this.has(i)){let o=this.items[i];delete this.items[i],this.size--,o.prev!==null&&(o.prev.next=o.next),o.next!==null&&(o.next.prev=o.prev),this.first===o&&(this.first=o.next),this.last===o&&(this.last=o.prev);}return this}entries(i=this.keys()){return i.map(o=>[o,this.get(o)])}evict(i=!1){if(i||this.size>0){let o=this.first;delete this.items[o.key],--this.size===0?(this.first=null,this.last=null):(this.first=o.next,this.first.prev=null);}return this}expiresAt(i){let o;return this.has(i)&&(o=this.items[i].expiry),o}get(i){let o;if(this.has(i)){let f=this.items[i];this.ttl>0&&f.expiry<=Date.now()?this.delete(i):(o=f.value,this.set(i,o,!0));}return o}has(i){return i in this.items}keys(){let i=[],o=this.first;for(;o!==null;)i.push(o.key),o=o.next;return i}set(i,o,f=!1,h=this.resetTtl){let p;if(f||this.has(i)){if(p=this.items[i],p.value=o,f===!1&&h&&(p.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==p){let a=this.last,y=p.next,m=p.prev;this.first===p&&(this.first=p.next),p.next=null,p.prev=this.last,a.next=p,m!==null&&(m.next=y),y!==null&&(y.prev=m);}}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:o},++this.size===1?this.first=p:this.last.next=p;return this.last=p,this}values(i=this.keys()){return i.map(o=>this.get(o))}};function ht(r=1e3,i=0,o=!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 o!="boolean")throw new TypeError("Invalid resetTtl value");return new Ue(r,i,o)}var _n={max:1e3},ct=(r,i={})=>{let{cache:o,cacheKeyResolver:f=Oe,onHit:h,lruOptions:p={}}=i,a={..._n,...p},y=o||ht(a.max,a.ttl);function m(...x){let v=f(...x),w=y.get(v);if(y.has(v))return h&&h(v,w,y),w;let d=r.apply(this,x);return y.set(v,d),d}return m._cache=y,m},Oe=(...r)=>r.length===0?"no-args":r.map(i=>i===void 0?"undefined":i===null?"null":Array.isArray(i)?`[${Oe(...i)}]`:typeof i=="object"?`{${Oe(...xn(i))}}`:JSON.stringify(i)).join(","),xn=r=>Object.entries(r).sort((i,o)=>i[0]<o[0]?-1:1);var je=An(yt()),Nn=Object.defineProperty,Cn=(r,i)=>{for(var o in i)Nn(r,o,{get:i[o],enumerable:!0});};function Ge(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}var q=[],se=!1,J,ve=-1;function Ln(){!se||!J||(se=!1,J.length?q=J.concat(q):ve=-1,q.length&&It());}function It(){if(!se){var r=setTimeout(Ln,0);se=!0;for(var i=q.length;i;){for(J=q,q=[];++ve<i;)J&&J[ve].run();ve=-1,i=q.length;}J=null,se=!1,clearTimeout(r);}}function Mn(r){var i=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)i[o-1]=arguments[o];q.push(new St(r,i)),q.length===1&&!se&&setTimeout(It,0);}function St(r,i){this.fun=r,this.array=i;}St.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){Ge("binding");},Wn=function(r){return 0},Yn=function(){return "/"},Jn=function(r){},Xn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function N(){}var Qn=N,Zn=[];function er(r){Ge("_linkedBinding");}var tr={},nr=!1,rr={};function ir(r){Ge("dlopen");}function sr(){return []}function or(){return []}var ar=N,ur=N,qe=function(){return {}},lr=qe,fr=qe,hr=N,cr=N,pr=N,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=N,wr=N;function vr(){return !1}var br=N,Er=N,Ir=N,Sr=N,Ar=N,_r=void 0,xr=void 0,Br=void 0,Tr=N,kr=2,Ur=1,Or="/bin/usr/node",Pr=9229,Rr="node",Nr=[],Cr=N,K={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};K.now===void 0&&(Pe=Date.now(),K.timing&&K.timing.navigationStart&&(Pe=K.timing.navigationStart),K.now=()=>Date.now()-Pe);var Pe;function Lr(){return K.now()/1e3}var Ne=1e9;function Ce(r){var i=Math.floor((Date.now()-K.now())*.001),o=K.now()*.001,f=Math.floor(o)+i,h=Math.floor(o%1*1e9);return r&&(f=f-r[0],h=h-r[1],h<0&&(f--,h+=Ne)),[f,h]}Ce.bigint=function(r){var i=Ce(r);return typeof BigInt>"u"?i[0]*Ne+i[1]:BigInt(i[0]*Ne)+BigInt(i[1])};var Mr=10,$r={},Dr=0;function z(){return Le}var Fr=z,jr=z,Gr=z,qr=z,Vr=z,Kr=N,zr=z,Hr=z;function Wr(r){return []}var Le={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:qe,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:Sr,_stopProfilerIdleNotifier:Ar,stdout:_r,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:Ce,argv0:Rr,_preload_modules:Nr,setSourceMapsEnabled:Cr},ce={},mt=!1;function Yr(){if(mt)return ce;mt=!0,ce.byteLength=y,ce.toByteArray=x,ce.fromByteArray=b;for(var r=[],i=[],o=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,p=f.length;h<p;++h)r[h]=f[h],i[f.charCodeAt(h)]=h;i[45]=62,i[95]=63;function a(d){var g=d.length;if(g%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=d.indexOf("=");E===-1&&(E=g);var _=E===g?0:4-E%4;return [E,_]}function y(d){var g=a(d),E=g[0],_=g[1];return (E+_)*3/4-_}function m(d,g,E){return (g+E)*3/4-E}function x(d){var g,E=a(d),_=E[0],R=E[1],k=new o(m(d,_,R)),L=0,$=R>0?_-4:_,C;for(C=0;C<$;C+=4)g=i[d.charCodeAt(C)]<<18|i[d.charCodeAt(C+1)]<<12|i[d.charCodeAt(C+2)]<<6|i[d.charCodeAt(C+3)],k[L++]=g>>16&255,k[L++]=g>>8&255,k[L++]=g&255;return R===2&&(g=i[d.charCodeAt(C)]<<2|i[d.charCodeAt(C+1)]>>4,k[L++]=g&255),R===1&&(g=i[d.charCodeAt(C)]<<10|i[d.charCodeAt(C+1)]<<4|i[d.charCodeAt(C+2)]>>2,k[L++]=g>>8&255,k[L++]=g&255),k}function v(d){return r[d>>18&63]+r[d>>12&63]+r[d>>6&63]+r[d&63]}function w(d,g,E){for(var _,R=[],k=g;k<E;k+=3)_=(d[k]<<16&16711680)+(d[k+1]<<8&65280)+(d[k+2]&255),R.push(v(_));return R.join("")}function b(d){for(var g,E=d.length,_=E%3,R=[],k=16383,L=0,$=E-_;L<$;L+=k)R.push(w(d,L,L+k>$?$:L+k));return _===1?(g=d[E-1],R.push(r[g>>2]+r[g<<4&63]+"==")):_===2&&(g=(d[E-2]<<8)+d[E-1],R.push(r[g>>10]+r[g>>4&63]+r[g<<2&63]+"=")),R.join("")}return ce}var we={},wt=!1;function Jr(){return wt?we:(wt=!0,we.read=function(r,i,o,f,h){var p,a,y=h*8-f-1,m=(1<<y)-1,x=m>>1,v=-7,w=o?h-1:0,b=o?-1:1,d=r[i+w];for(w+=b,p=d&(1<<-v)-1,d>>=-v,v+=y;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===m)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)},we.write=function(r,i,o,f,h,p){var a,y,m,x=p*8-h-1,v=(1<<x)-1,w=v>>1,b=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=f?0:p-1,g=f?1:-1,E=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=v):(a=Math.floor(Math.log(i)/Math.LN2),i*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+w>=1?i+=b/m:i+=b*Math.pow(2,1-w),i*m>=2&&(a++,m/=2),a+w>=v?(y=0,a=v):a+w>=1?(y=(i*m-1)*Math.pow(2,h),a=a+w):(y=i*Math.pow(2,w-1)*Math.pow(2,h),a=0));h>=8;r[o+d]=y&255,d+=g,y/=256,h-=8);for(a=a<<h|y,x+=h;x>0;r[o+d]=a&255,d+=g,a/=256,x-=8);r[o+d-g]|=E*128;},we)}var Y={},vt=!1;function Xr(){if(vt)return Y;vt=!0;let r=Yr(),i=Jr(),o=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Y.Buffer=a,Y.SlowBuffer=R,Y.INSPECT_MAX_BYTES=50;let f=2147483647;Y.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 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 y(e,t,n)}a.poolSize=8192;function y(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 g(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let s=e.valueOf&&e.valueOf();if(s!=null&&s!==e)return a.from(s,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 y(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 x(e,t,n){return m(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 m(e),p(e<0?0:_(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,s=p(n),u=s.write(e,t);return u!==n&&(s=s.slice(0,u)),s}function b(e){let t=e.length<0?0:_(e.length)|0,n=p(t);for(let s=0;s<t;s+=1)n[s]=e[s]&255;return n}function d(e){if(F(e,Uint8Array)){let t=new Uint8Array(e);return g(t.buffer,t.byteOffset,t.byteLength)}return b(e)}function g(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 s;return t===void 0&&n===void 0?s=new Uint8Array(e):n===void 0?s=new Uint8Array(e,t):s=new Uint8Array(e,t,n),Object.setPrototypeOf(s,a.prototype),s}function E(e){if(a.isBuffer(e)){let t=_(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"||ke(e.length)?p(0):b(e);if(e.type==="Buffer"&&Array.isArray(e.data))return b(e.data)}function _(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function R(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,s=t.length;for(let u=0,l=Math.min(n,s);u<l;++u)if(e[u]!==t[u]){n=e[u],s=t[u];break}return n<s?-1:s<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 s=a.allocUnsafe(t),u=0;for(n=0;n<e.length;++n){let l=e[n];if(F(l,Uint8Array))u+l.length>s.length?(a.isBuffer(l)||(l=a.from(l)),l.copy(s,u)):Uint8Array.prototype.set.call(s,l,u);else if(a.isBuffer(l))l.copy(s,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=l.length;}return s};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,s=arguments.length>2&&arguments[2]===!0;if(!s&&n===0)return 0;let u=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Te(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 s?-1:Te(e).length;t=(""+t).toLowerCase(),u=!0;}}a.byteLength=k;function L(e,t,n){let s=!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(s)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),s=!0;}}a.prototype._isBuffer=!0;function $(e,t,n){let s=e[t];e[t]=e[n],e[n]=s;}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+">"},o&&(a.prototype[o]=a.prototype.inspect),a.prototype.compare=function(e,t,n,s,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),s===void 0&&(s=0),u===void 0&&(u=this.length),t<0||n>e.length||s<0||u>this.length)throw new RangeError("out of range index");if(s>=u&&t>=n)return 0;if(s>=u)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,s>>>=0,u>>>=0,this===e)return 0;let l=u-s,c=n-t,S=Math.min(l,c),P=this.slice(s,u),A=e.slice(t,n);for(let I=0;I<S;++I)if(P[I]!==A[I]){l=P[I],c=A[I];break}return l<c?-1:c<l?1:0};function C(e,t,n,s,u){if(e.length===0)return -1;if(typeof n=="string"?(s=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ke(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,s)),a.isBuffer(t))return t.length===0?-1:Qe(e,t,n,s,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,s,u);throw new TypeError("val must be string, number or Buffer")}function Qe(e,t,n,s,u){let l=1,c=e.length,S=t.length;if(s!==void 0&&(s=String(s).toLowerCase(),s==="ucs2"||s==="ucs-2"||s==="utf16le"||s==="utf-16le")){if(e.length<2||t.length<2)return -1;l=2,c/=2,S/=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<c;A++)if(P(e,A)===P(t,I===-1?0:A-I)){if(I===-1&&(I=A),A-I+1===S)return I*l}else I!==-1&&(A-=A-I),I=-1;}else for(n+S>c&&(n=c-S),A=n;A>=0;A--){let I=!0;for(let U=0;U<S;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,s){n=Number(n)||0;let u=e.length-n;s?(s=Number(s),s>u&&(s=u)):s=u;let l=t.length;s>l/2&&(s=l/2);let c;for(c=0;c<s;++c){let S=parseInt(t.substr(c*2,2),16);if(ke(S))return c;e[n+c]=S;}return c}function Zt(e,t,n,s){return me(Te(t,e.length-n),e,n,s)}function en(e,t,n,s){return me(pn(t),e,n,s)}function tn(e,t,n,s){return me(ut(t),e,n,s)}function nn(e,t,n,s){return me(dn(t,e.length-n),e,n,s)}a.prototype.write=function(e,t,n,s){if(t===void 0)s="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")s=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,s===void 0&&(s="utf8")):(s=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");s||(s="utf8");let l=!1;for(;;)switch(s){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: "+s);s=(""+s).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 s=[],u=t;for(;u<n;){let l=e[u],c=null,S=l>239?4:l>223?3:l>191?2:1;if(u+S<=n){let P,A,I,U;switch(S){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],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)&&(c=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&&(c=U));}}c===null?(c=65533,S=1):c>65535&&(c-=65536,s.push(c>>>10&1023|55296),c=56320|c&1023),s.push(c),u+=S;}return sn(s)}let et=4096;function sn(e){let t=e.length;if(t<=et)return String.fromCharCode.apply(String,e);let n="",s=0;for(;s<t;)n+=String.fromCharCode.apply(String,e.slice(s,s+=et));return n}function on(e,t,n){let s="";n=Math.min(e.length,n);for(let u=t;u<n;++u)s+=String.fromCharCode(e[u]&127);return s}function an(e,t,n){let s="";n=Math.min(e.length,n);for(let u=t;u<n;++u)s+=String.fromCharCode(e[u]);return s}function un(e,t,n){let s=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>s)&&(n=s);let u="";for(let l=t;l<n;++l)u+=gn[e[l]];return u}function ln(e,t,n){let s=e.slice(t,n),u="";for(let l=0;l<s.length-1;l+=2)u+=String.fromCharCode(s[l]+s[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 s=this.subarray(e,t);return Object.setPrototypeOf(s,a.prototype),s};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 s=this[e],u=1,l=0;for(;++l<t&&(u*=256);)s+=this[e+l]*u;return s},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let s=this[e+--t],u=1;for(;t>0&&(u*=256);)s+=this[e+--t]*u;return s},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,re(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&he(e,this.length-8);let s=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(s)+(BigInt(u)<<BigInt(32))}),a.prototype.readBigUInt64BE=V(function(e){e=e>>>0,re(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&he(e,this.length-8);let s=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(s)<<BigInt(32))+BigInt(u)}),a.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let s=this[e],u=1,l=0;for(;++l<t&&(u*=256);)s+=this[e+l]*u;return u*=128,s>=u&&(s-=Math.pow(2,8*t)),s},a.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let s=t,u=1,l=this[e+--s];for(;s>0&&(u*=256);)l+=this[e+--s]*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,re(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&he(e,this.length-8);let s=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(s)<<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,re(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&he(e,this.length-8);let s=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(s)<<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,s,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+s>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,s){if(e=+e,t=t>>>0,n=n>>>0,!s){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,s){if(e=+e,t=t>>>0,n=n>>>0,!s){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 tt(e,t,n,s,u){at(t,s,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 nt(e,t,n,s,u){at(t,s,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=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,s){if(e=+e,t=t>>>0,!s){let S=Math.pow(2,8*n-1);M(this,e,t,n,S-1,-S);}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,s){if(e=+e,t=t>>>0,!s){let S=Math.pow(2,8*n-1);M(this,e,t,n,S-1,-S);}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=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,s,u,l){if(n+s>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function it(e,t,n,s,u){return t=+t,n=n>>>0,u||rt(e,t,n,4),i.write(e,t,n,s,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,s,u){return t=+t,n=n>>>0,u||rt(e,t,n,8),i.write(e,t,n,s,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,s){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!s&&s!==0&&(s=this.length),t>=e.length&&(t=e.length),t||(t=0),s>0&&s<n&&(s=n),s===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(s<0)throw new RangeError("sourceEnd out of bounds");s>this.length&&(s=this.length),e.length-t<s-n&&(s=e.length-t+n);let u=s-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,s):Uint8Array.prototype.set.call(e,this.subarray(n,s),t),u},a.prototype.fill=function(e,t,n,s){if(typeof e=="string"){if(typeof t=="string"?(s=t,t=0,n=this.length):typeof n=="string"&&(s=n,n=this.length),s!==void 0&&typeof s!="string")throw new TypeError("encoding must be a string");if(typeof s=="string"&&!a.isEncoding(s))throw new TypeError("Unknown encoding: "+s);if(e.length===1){let l=e.charCodeAt(0);(s==="utf8"&&l<128||s==="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,s),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 ne={};function Be(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(s){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:s,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}Be("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Be("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),Be("ERR_OUT_OF_RANGE",function(e,t,n){let s=`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"),s+=` It must be ${t}. Received ${u}`,s},RangeError);function ot(e){let t="",n=e.length,s=e[0]==="-"?1:0;for(;n>=s+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return `${e.slice(0,n)}${t}`}function fn(e,t,n){re(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&he(t,e.length-(n+1));}function at(e,t,n,s,u,l){if(e>n||e<t){let c=typeof t=="bigint"?"n":"",S;throw t===0||t===BigInt(0)?S=`>= 0${c} and < 2${c} ** ${(l+1)*8}${c}`:S=`>= -(2${c} ** ${(l+1)*8-1}${c}) and < 2 ** ${(l+1)*8-1}${c}`,new ne.ERR_OUT_OF_RANGE("value",S,e)}fn(s,u,l);}function re(e,t){if(typeof e!="number")throw new ne.ERR_INVALID_ARG_TYPE(t,"number",e)}function he(e,t,n){throw Math.floor(e)!==e?(re(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 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 Te(e,t){t=t||1/0;let n,s=e.length,u=null,l=[];for(let c=0;c<s;++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===s){(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,s,u,l=[];for(let c=0;c<e.length&&!((t-=2)<0);++c)n=e.charCodeAt(c),s=n>>8,u=n%256,l.push(u),l.push(s);return l}function ut(e){return r.toByteArray(cn(e))}function me(e,t,n,s){let u;for(u=0;u<s&&!(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 ke(e){return e!==e}let gn=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let s=n*16;for(let u=0;u<16;++u)t[s+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:()=>Me,setItem:()=>Ee});var be=()=>typeof window>"u",At=()=>!be(),Zr="__IMX-",Ve=()=>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),Ke=r=>`${Zr}${r}`;function Me(r){if(Ve())return ei(window.localStorage.getItem(Ke(r)))}var Ee=(r,i)=>Ve()?(window.localStorage.setItem(Ke(r),ti(i)),!0):!1,ni=r=>Ve()?(window.localStorage.removeItem(Ke(r)),!0):!1,$e=0,ri=r=>{let i=parseInt(r,10)*1e3,o=new Date(i),f=new Date;return $e=o.getTime()-f.getTime(),$e},ii=()=>{let r=new Date().getTime()+$e;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 _t(r,i){let o=JSON.stringify(i),f={payload:ai(o)},h=await fetch(`${oi}${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok){let p=await h.text().catch(()=>"");throw new Error(`Request failed (${h.status}): ${p||h.statusText}`)}return h.json()}var X,Q,ui=()=>{X=Me("metrics-events")||[],Q=Me("metrics-runtime")||{};};ui();var Z=(r,i)=>{Q={...Q,[r]:i},Ee("metrics-runtime",Q);},De=r=>{if(Q[r]!==void 0)return Q[r]},li=()=>Q,fi=()=>X,hi=r=>{X.push(r),Ee("metrics-events",X);},ci=r=>{X=X.slice(r),Ee("metrics-events",X);},xt=r=>{let i=[];return Object.entries(r).forEach(([o,f])=>{(typeof o=="string"||typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&i.push([o,f.toString()]);}),i},Re="2.19.0",pi=()=>be()?"":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(be())return "";let r;try{window.self!==window.top&&(r=pi());}catch{}return r||(r=window.location.hostname),r},gi=()=>{if(Z("sdkVersion",Re),be())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}`}},Fe=!1,yi=()=>Fe,mi=async()=>{Fe=!0;try{let r=xt(gi()),i=De("rid"),o=De("uid"),f=await _t("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:o}}),{runtimeId:h,sTime:p}=f;Z("rid",h),ri(p);}catch{Fe=!1;}};function D(r,i){return (...o)=>{try{let f=r(...o);return f instanceof Promise?f.catch(()=>i):f}catch{return i}}}function wi(){return At()||typeof Le>"u"?!1:Le.env.JEST_WORKER_ID!==void 0}var vi=D(wi,!1),Bt="imtbl__metrics",bi=5e3,Ei=1e3,pe=(r,i)=>(0, je.getGlobalisedValue)(Bt,r,i),Ii=(r,i)=>{let o=ct(i,{lruOptions:{ttl:bi,max:Ei}});return (0, je.getGlobalisedValue)(Bt,r,o)},Si=5e3,Ai=(r,i,o)=>{let f={event:`${r}.${i}`,time:ii(),...o&&{properties:xt(o)}};hi(f);},oe=D(Ii("track",Ai)),_i=async()=>{if(yi()===!1){await mi();return}let r=fi();if(r.length===0)return;let i=r.length,o=li();await _t("/v1/sdk/metrics",{version:1,data:{events:r,details:o}})instanceof Error||ci(i);},xi=D(_i),Tt=async()=>{await xi(),setTimeout(Tt,Si);},Et=!1,Bi=()=>{Et||(Et=!0,Tt());};vi()||D(pe("startFlushing",Bi))();var Ni=(r,i,o,f)=>{let{message:h}=o,p=o.stack||"",{cause:a}=o;a instanceof Error&&(p=`${p}
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.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}
2
2
  Cause: ${a.message}
3
- ${a.stack}`),oe(r,`trackError_${i}`,{...f||{},errorMessage:h,errorStack:p,isTrackError:!0});},kt=D(Ni),Mi=r=>{Z("env",r);};D(pe("setEnvironment",Mi));var $i=r=>{Z("passportClientId",r);};D(pe("setPassportClientId",$i));var Di=r=>{Z("pak",r);};D(pe("setPublishableApiKey",Di));D(pe("getDetail",De));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",ue="imtbl_anon_id",ae="_imtbl_sid",Rt="session_start",Nt="session_end",de=()=>typeof window<"u"&&typeof document<"u",le=()=>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 Ae(r){if(!de())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function Se(r,i,o,f){if(!de())return;let h=window.location.protocol==="https:"?"; Secure":"",p=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${o}; SameSite=Lax${p}${h}`;}function ge(r,i){Se(r,"",0,i);}function _e(r){let i=Ae(ue);if(i)return i;let o=le();return Se(ue,o,63072e3,r),o}var ze=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;}},Ie=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,o){if(r.status===0)return new Ie({code:"NETWORK_ERROR",message:i==="flush"?`Network error sending ${o??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,p=f?.accepted??0;return new Ie({code:"VALIDATION_REJECTED",message:`Backend rejected ${h} of ${h+p} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return new Ie({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{}}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,o,f)=>{try{let h=await fetch(r,{method:f?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(o),keepalive:f?.keepalive});if(!h.ok){let a=await Ut(h);return oe("audience","transport_send_failed",{status:h.status}),{ok:!1,error:new ze({status:h.status,endpoint:r,body:a})}}let p=await Ut(h);if(typeof p=="object"&&p!==null&&"rejected"in p){let a=p.rejected??0;if(a>0)return oe("audience","transport_partial_rejected",{status:h.status,rejected:a}),{ok:!1,error:new ze({status:h.status,endpoint:r,body:p})}}return {ok:!0}}catch(h){let p=new ze({status:0,endpoint:r,cause:h});return kt("audience","transport_send",p),{ok:!1,error:p}}},Ye="__imtbl_audience_";function Je(){try{return de()&&typeof localStorage<"u"}catch{return !1}}function qi(r,i=Ye){if(Je())try{let o=localStorage.getItem(`${i}${r}`);return o?JSON.parse(o):void 0}catch{return}}function Vi(r,i,o=Ye){if(Je())try{localStorage.setItem(`${o}${r}`,JSON.stringify(i));}catch{}}function Ki(r,i=Ye){if(Je())try{localStorage.removeItem(`${i}${r}`);}catch{}}var He="queue",Ot=100,$t=class{constructor(r,i,o){this.send=r,this.publishableKey=i,this.endpointUrl=`${o?.baseUrl??Pt}${ji}`,this.flushIntervalMs=o?.flushIntervalMs??5e3,this.flushSize=o?.flushSize??20,this.onFlush=o?.onFlush,this.onError=o?.onError,this.storagePrefix=o?.storagePrefix;let f=qi(He,this.storagePrefix)??[];this.messages=o?.staleFilter?f.filter(o.staleFilter):f;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;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)){this.flushing=!0;try{let r=this.messages.slice(0,Ot),i={messages:r},o=await this.send(this.endpointUrl,this.publishableKey,i),f;!o.ok&&o.error&&(f=Lt(o.error,"flush",r.length));let h=f?.code==="VALIDATION_REJECTED";(o.ok||h)&&(this.messages=this.messages.slice(r.length),this.persist()),this.onFlush?.(o.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=[],Ki(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);}persist(){Vi(He,this.messages,this.storagePrefix);}},zi="2.19.0";function Dt(r="@imtbl/audience",i=zi){let o={library:r,libraryVersion:i};return de()&&(o.userAgent=navigator.userAgent,o.locale=navigator.language,o.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,o.screen=`${window.screen.width}x${window.screen.height}`,o.pageUrl=window.location.href,o.pagePath=window.location.pathname,o.pageReferrer=document.referrer,o.pageTitle=document.title),o}function Ft(r){let i=new Date(r).getTime();if(Number.isNaN(i))return !1;let o=Date.now();return i<=o+864e5&&i>=o-2592e6}function jt(r,i,o,f){return r!==o||i!==f}function ye(r,i=256){return r.length>i?r.slice(0,i):r}function fe(r){let i=Ae(ae);if(i)return Se(ae,i,1800,r),{sessionId:i,isNew:!1};let o=le();return Se(ae,o,1800,r),{sessionId:o,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 Hi(r){let i;try{i=new URL(r).searchParams;}catch{return {}}let o={};for(let h of [...Gt,...qt]){let p=i.get(h);p&&(o[h]=p);}let f=i.get("referral_code");return f&&(o.referral_code=f),o}function Wi(){try{let r=sessionStorage.getItem(Vt);return r?JSON.parse(r):null}catch{return null}}function Yi(r){try{sessionStorage.setItem(Vt,JSON.stringify(r));}catch{}}function Kt(){let r=typeof window<"u"&&window.location?Hi(window.location.href):{},i=typeof document<"u"&&document.referrer||void 0,o=qt.some(h=>h in r),f=Gt.some(h=>h in r);return {...r,referrer:i,touchpoint_type:o||f?"click":void 0}}function zt(){let r=Wi();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,o={...Kt(),landing_page:i};return Yi(o),o}function Ht(){return Kt()}function H(r){return r!=="none"}function te(r){return r==="full"}function Wt(r,i,o,f,h,p,a,y){let m=p??"none",x={none:0,anonymous:1,full:2};function v(w){let b=`${y??Pt}${Gi}`;i(b,o,{anonymousId:f,status:w,source:h},{method:"PUT",keepalive:!0}).then(d=>{!d.ok&&d.error&&Mt(a,Lt(d.error,"consent"));});}return {get level(){return m},setLevel(w){w!==m&&(x[w]<x[m]&&(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,...g}=b;return g}return b}))),m=w,v(w));}}}T();B();T();B();var Yt="@imtbl/audience",Jt="2.19.0",W="[audience]",Xt="WebSDK";var xe=class{enabled;constructor(i=!1){this.enabled=i;}logEvent(i,o){this.enabled&&console.log(`${W} ${i}`,o);}logFlush(i,o){this.enabled&&console.log(`${W} flush ${i?"ok":"failed"} (${o} messages)`);}logConsent(i,o){this.enabled&&console.log(`${W} consent ${i} \u2192 ${o}`);}logWarning(i){this.enabled&&console.warn(`${W} ${i}`);}};var Ji=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:o,publishableKey:f}=i,h=i.consent??"none",p=Xt;this.cookieDomain=o,this.testMode=i.testMode??!1,this.debug=new xe(i.debug??!1);let a=!1;H(h)?(this.anonymousId=_e(o),a=this.startSession()):this.anonymousId=Ae(ue)??le(),this.queue=new $t(We,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(y,m)=>this.debug.logFlush(y,m),onError:i.onError,staleFilter:y=>Ft(y.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Wt(this.queue,We,f,this.anonymousId,p,h,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 te(this.consent.level)?this.userId:void 0}startSession(){let i=fe(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:le(),eventTimestamp:Ct(),anonymousId:this.anonymousId,surface:"web",context:Dt(Yt,Jt),...this.testMode&&{test:!0}}}enqueue(i,o){this.queue.enqueue(o),this.debug.logEvent(i,o);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:Rt,properties:{sessionId:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Nt,properties:{sessionId:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;fe(this.cookieDomain);let o={sessionId:this.sessionId,...i};this.isFirstPage&&(Object.assign(o,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:o,userId:this.effectiveUserId()});}track(i,...o){if(this.isTrackingDisabled())return;fe(this.cookieDomain);let[f]=o,h={sessionId:this.sessionId,...Ji.has(i)?Ht():{},...f};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:ye(i),properties:h,userId:this.effectiveUserId()});}identify(i,o,f){if(!te(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}fe(this.cookieDomain);let h=ye(i);this.userId=h,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:h,identityType:o,traits:f});}alias(i,o){if(!te(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!jt(i.id,i.identityType,o.id,o.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}fe(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:ye(i.id),fromType:i.identityType,toId:ye(o.id),toType:o.identityType});}setConsent(i){let o=this.consent.level;if(i===o)return;this.debug.logConsent(o,i);let f=!H(o)&&H(i);if(f&&(this.anonymousId=_e(this.cookieDomain)),H(i)||this.queue.stop(),this.consent.setLevel(i),H(i)?te(o)&&!te(i)&&(this.userId=void 0):(ge(ue,this.cookieDomain),ge(ae,this.cookieDomain)),f){this.isFirstPage=!0;let h=this.startSession();this.queue.start(),h&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),ge(ue,this.cookieDomain),ge(ae,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=le(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=_e(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 Xi={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}`),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.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.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> */
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, Ie as AudienceError, Xi as AudienceEvents, Fi as IdentityType, te as canIdentify, H as canTrack };
16
+ export { Xe as Audience, ae as AudienceError, Zi as AudienceEvents, Fi as IdentityType, ne as canIdentify, H as canTrack };
@@ -1,9 +1,9 @@
1
1
  (function () {
2
2
  'use strict';
3
3
 
4
- var wn=Object.create;var Ue=Object.defineProperty;var bn=Object.getOwnPropertyDescriptor;var vn=Object.getOwnPropertyNames;var In=Object.getPrototypeOf,En=Object.prototype.hasOwnProperty;var Sn=(r,i,s)=>i in r?Ue(r,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[i]=s;var An=(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 h of vn(i))!En.call(r,h)&&h!==s&&Ue(r,h,{get:()=>i[h],enumerable:!(f=bn(i,h))||f.enumerable});return r};var Bn=(r,i,s)=>(s=r!=null?wn(In(r)):{},_n(Ue(s,"default",{value:r,enumerable:!0}),r));var w=(r,i,s)=>Sn(r,typeof i!="symbol"?i+"":i,s);var gt=An(ne=>{Object.defineProperty(ne,"__esModule",{value:!0});ne.clearGlobalNamespace=ne.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"},pt=r=>`${kn}${r}`,dt=r=>{let i=ct(),s=pt(r);return i[s]||(i[s]={}),i[s]},Rn=(r,i)=>dt(r)[i]||void 0,Nn=(r,i,s)=>{let f=dt(r);f[i]=s;},Pn=(r,i,s)=>{On(r,i);let f=Rn(r,i);return f!==void 0?f:(Nn(r,i,s),s)};ne.getGlobalisedValue=Pn;var Ln=r=>{let i=ct(),s=pt(r);i[s]!==void 0&&delete i[s];};ne.clearGlobalNamespace=Ln;});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,h=this.resetTtl){let p;if(f||this.has(i)){if(p=this.items[i],p.value=s,f===!1&&h&&(p.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==p){let a=this.last,g=p.next,m=p.prev;this.first===p&&(this.first=p.next),p.next=null,p.prev=this.last,a.next=p,m!==null&&(m.next=g),g!==null&&(g.prev=m);}}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 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 Oe(r,i,s)}var xn={max:1e3},ht=(r,i={})=>{let{cache:s,cacheKeyResolver:f=Re,onHit:h,lruOptions:p={}}=i,a={...xn,...p},g=s||ft(a.max,a.ttl);function m(..._){let v=f(..._),b=g.get(v);if(g.has(v))return h&&h(v,b,g),b;let d=r.apply(this,_);return g.set(v,d),d}return m._cache=g,m},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 Ge=Bn(gt()),Cn=Object.defineProperty,Mn=(r,i)=>{for(var s in i)Cn(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 F=[],ie=!1,W,be=-1;function $n(){!ie||!W||(ie=!1,W.length?F=W.concat(F):be=-1,F.length&&It());}function It(){if(!ie){var r=setTimeout($n,0);ie=!0;for(var i=F.length;i;){for(W=F,F=[];++be<i;)W&&W[be].run();be=-1,i=F.length;}W=null,ie=!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 Et(r,i)),F.length===1&&!ie&&setTimeout(It,0);}function Et(r,i){this.fun=r,this.array=i;}Et.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",Hn={},Yn=function(r,i){console.warn((i?i+": ":"")+r);},Wn=function(r){qe("binding");},Jn=function(r){return 0},Xn=function(){return "/"},Qn=function(r){},Zn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function N(){}var ei=N,ti=[];function ni(r){qe("_linkedBinding");}var ii={},ri=!1,si={};function oi(r){qe("dlopen");}function ai(){return []}function ui(){return []}var li=N,fi=N,Ve=function(){return {}},hi=Ve,ci=Ve,pi=N,di=N,gi=N,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=N,vi=N;function Ii(){return !1}var Ei=N,Si=N,Ai=N,_i=N,Bi=N,xi=void 0,Ti=void 0,ki=void 0,Ui=N,Oi=2,Ri=1,Ni="/bin/usr/node",Pi=9229,Li="node",Ci=[],Mi=N,q={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};q.now===void 0&&(Ne=Date.now(),q.timing&&q.timing.navigationStart&&(Ne=q.timing.navigationStart),q.now=()=>Date.now()-Ne);var Ne;function $i(){return q.now()/1e3}var Le=1e9;function Ce(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+=Le)),[f,h]}Ce.bigint=function(r){var i=Ce(r);return typeof BigInt>"u"?i[0]*Le+i[1]:BigInt(i[0]*Le)+BigInt(i[1])};var Di=10,Fi={},ji=0;function V(){return Me}var Gi=V,qi=V,Vi=V,Ki=V,zi=V,Hi=N,Yi=V,Wi=V;function Ji(r){return []}var Me={version:zn,versions:Hn,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:Hi,prependListener:Yi,prependOnceListener:Wi,listeners:Ji,domain:ii,_exiting:ri,config:si,dlopen:oi,uptime:$i,_getActiveRequests:ai,_getActiveHandles:ui,reallyExit:li,_kill:fi,cpuUsage:Ve,resourceUsage:hi,memoryUsage:ci,kill:pi,exit:di,openStdin:gi,allowedNodeEnvironmentFlags:yi,assert:mi,features:wi,_fatalExceptions:bi,setUncaughtExceptionCaptureCallback:vi,hasUncaughtExceptionCaptureCallback:Ii,emitWarning:Yn,nextTick:Dn,_tickCallback:Ei,_debugProcess:Si,_debugEnd:Ai,_startProfilerIdleNotifier:_i,_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:Ri,execPath:Ni,debugPort:Pi,hrtime:Ce,argv0:Li,_preload_modules:Ci,setSourceMapsEnabled:Mi},fe={},yt=!1;function Xi(){if(yt)return fe;yt=!0,fe.byteLength=g,fe.toByteArray=_,fe.fromByteArray=I;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,p=f.length;h<p;++h)r[h]=f[h],i[f.charCodeAt(h)]=h;i[45]=62,i[95]=63;function a(d){var y=d.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=d.indexOf("=");E===-1&&(E=y);var x=E===y?0:4-E%4;return [E,x]}function g(d){var y=a(d),E=y[0],x=y[1];return (E+x)*3/4-x}function m(d,y,E){return (y+E)*3/4-E}function _(d){var y,E=a(d),x=E[0],R=E[1],T=new s(m(d,x,R)),L=0,M=R>0?x-4:x,P;for(P=0;P<M;P+=4)y=i[d.charCodeAt(P)]<<18|i[d.charCodeAt(P+1)]<<12|i[d.charCodeAt(P+2)]<<6|i[d.charCodeAt(P+3)],T[L++]=y>>16&255,T[L++]=y>>8&255,T[L++]=y&255;return R===2&&(y=i[d.charCodeAt(P)]<<2|i[d.charCodeAt(P+1)]>>4,T[L++]=y&255),R===1&&(y=i[d.charCodeAt(P)]<<10|i[d.charCodeAt(P+1)]<<4|i[d.charCodeAt(P+2)]>>2,T[L++]=y>>8&255,T[L++]=y&255),T}function v(d){return r[d>>18&63]+r[d>>12&63]+r[d>>6&63]+r[d&63]}function b(d,y,E){for(var x,R=[],T=y;T<E;T+=3)x=(d[T]<<16&16711680)+(d[T+1]<<8&65280)+(d[T+2]&255),R.push(v(x));return R.join("")}function I(d){for(var y,E=d.length,x=E%3,R=[],T=16383,L=0,M=E-x;L<M;L+=T)R.push(b(d,L,L+T>M?M:L+T));return x===1?(y=d[E-1],R.push(r[y>>2]+r[y<<4&63]+"==")):x===2&&(y=(d[E-2]<<8)+d[E-1],R.push(r[y>>10]+r[y>>4&63]+r[y<<2&63]+"=")),R.join("")}return fe}var we={},mt=!1;function Qi(){return mt?we:(mt=!0,we.read=function(r,i,s,f,h){var p,a,g=h*8-f-1,m=(1<<g)-1,_=m>>1,v=-7,b=s?h-1:0,I=s?-1:1,d=r[i+b];for(b+=I,p=d&(1<<-v)-1,d>>=-v,v+=g;v>0;p=p*256+r[i+b],b+=I,v-=8);for(a=p&(1<<-v)-1,p>>=-v,v+=f;v>0;a=a*256+r[i+b],b+=I,v-=8);if(p===0)p=1-_;else {if(p===m)return a?NaN:(d?-1:1)*(1/0);a=a+Math.pow(2,f),p=p-_;}return (d?-1:1)*a*Math.pow(2,p-f)},we.write=function(r,i,s,f,h,p){var a,g,m,_=p*8-h-1,v=(1<<_)-1,b=v>>1,I=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=f?0:p-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=v):(a=Math.floor(Math.log(i)/Math.LN2),i*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+b>=1?i+=I/m:i+=I*Math.pow(2,1-b),i*m>=2&&(a++,m/=2),a+b>=v?(g=0,a=v):a+b>=1?(g=(i*m-1)*Math.pow(2,h),a=a+b):(g=i*Math.pow(2,b-1)*Math.pow(2,h),a=0));h>=8;r[s+d]=g&255,d+=y,g/=256,h-=8);for(a=a<<h|g,_+=h;_>0;r[s+d]=a&255,d+=y,a/=256,_-=8);r[s+d-y]|=E*128;},we)}var Y={},wt=!1;function Zi(){if(wt)return Y;wt=!0;let r=Xi(),i=Qi(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Y.Buffer=a,Y.SlowBuffer=R,Y.INSPECT_MAX_BYTES=50;let f=2147483647;Y.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 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 b(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(D(e,ArrayBuffer)||e&&D(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(D(e,SharedArrayBuffer)||e&&D(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 _(e,t,n){return m(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 _(e,t,n)};function v(e){return m(e),p(e<0?0:x(e)|0)}a.allocUnsafe=function(e){return v(e)},a.allocUnsafeSlow=function(e){return v(e)};function b(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=p(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=p(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function d(e){if(D(e,Uint8Array)){let t=new Uint8Array(e);return y(t.buffer,t.byteOffset,t.byteLength)}return I(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=x(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"||ke(e.length)?p(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 R(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 Te(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:Te(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=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(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,c=n-t,A=Math.min(l,c),O=this.slice(o,u),B=e.slice(t,n);for(let S=0;S<A;++S)if(O[S]!==B[S]){l=O[S],c=B[S];break}return l<c?-1:c<l?1:0};function P(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,ke(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,c=e.length,A=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,A/=2,n/=2;}function O(S,k){return l===1?S[k]:S.readUInt16BE(k*l)}let B;if(u){let S=-1;for(B=n;B<c;B++)if(O(e,B)===O(t,S===-1?0:B-S)){if(S===-1&&(S=B),B-S+1===A)return S*l}else S!==-1&&(B-=B-S),S=-1;}else for(n+A>c&&(n=c-A),B=n;B>=0;B--){let S=!0;for(let k=0;k<A;k++)if(O(e,B+k)!==O(t,k)){S=!1;break}if(S)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 P(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return P(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 c;for(c=0;c<o;++c){let A=parseInt(t.substr(c*2,2),16);if(ke(A))return c;e[n+c]=A;}return c}function en(e,t,n,o){return me(Te(t,e.length-n),e,n,o)}function tn(e,t,n,o){return me(dn(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],c=null,A=l>239?4:l>223?3:l>191?2:1;if(u+A<=n){let O,B,S,k;switch(A){case 1:l<128&&(c=l);break;case 2:O=e[u+1],(O&192)===128&&(k=(l&31)<<6|O&63,k>127&&(c=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)&&(c=k));break;case 4:O=e[u+1],B=e[u+2],S=e[u+3],(O&192)===128&&(B&192)===128&&(S&192)===128&&(k=(l&15)<<18|(O&63)<<12|(B&63)<<6|S&63,k>65535&&k<1114112&&(c=k));}}c===null?(c=65533,A=1):c>65535&&(c-=65536,o.push(c>>>10&1023|55296),c=56320|c&1023),o.push(c),u+=A;}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,te(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&le(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,te(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&le(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,te(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&le(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,te(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&le(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 C(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;C(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;C(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||C(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||C(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||C(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||C(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||C(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 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 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 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=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 A=Math.pow(2,8*n-1);C(this,e,t,n,A-1,-A);}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 A=Math.pow(2,8*n-1);C(this,e,t,n,A-1,-A);}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||C(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||C(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||C(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||C(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||C(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),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 ee={};function xe(e,t,n){ee[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}`}};}xe("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),xe("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),xe("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){te(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&le(t,e.length-(n+1));}function ut(e,t,n,o,u,l){if(e>n||e<t){let c=typeof t=="bigint"?"n":"",A;throw t===0||t===BigInt(0)?A=`>= 0${c} and < 2${c} ** ${(l+1)*8}${c}`:A=`>= -(2${c} ** ${(l+1)*8-1}${c}) and < 2 ** ${(l+1)*8-1}${c}`,new ee.ERR_OUT_OF_RANGE("value",A,e)}hn(o,u,l);}function te(e,t){if(typeof e!="number")throw new ee.ERR_INVALID_ARG_TYPE(t,"number",e)}function le(e,t,n){throw Math.floor(e)!==e?(te(e,n),new ee.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new ee.ERR_BUFFER_OUT_OF_BOUNDS:new ee.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}let cn=/[^+/0-9A-Za-z-_]/g;function pn(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 Te(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 dn(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 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 lt(e){return r.toByteArray(pn(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 ke(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 Y}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:()=>$e,setItem:()=>Ie});var ve=()=>typeof window>"u",St=()=>!ve(),tr="__IMX-",Ke=()=>St()&&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),ze=r=>`${tr}${r}`;function $e(r){if(Ke())return nr(window.localStorage.getItem(ze(r)))}var Ie=(r,i)=>Ke()?(window.localStorage.setItem(ze(r),ir(i)),!0):!1,rr=r=>Ke()?(window.localStorage.removeItem(ze(r)),!0):!1,De=0,sr=r=>{let i=parseInt(r,10)*1e3,s=new Date(i),f=new Date;return De=s.getTime()-f.getTime(),De},or=()=>{let r=new Date().getTime()+De;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 At(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 p=await h.text().catch(()=>"");throw new Error(`Request failed (${h.status}): ${p||h.statusText}`)}return h.json()}var J,X,fr=()=>{J=$e("metrics-events")||[],X=$e("metrics-runtime")||{};};fr();var Q=(r,i)=>{X={...X,[r]:i},Ie("metrics-runtime",X);},Fe=r=>{if(X[r]!==void 0)return X[r]},hr=()=>X,cr=()=>J,pr=r=>{J.push(r),Ie("metrics-events",J);},dr=r=>{J=J.slice(r),Ie("metrics-events",J);},_t=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},Pe="2.19.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",Pe),ve())return {browser:"nodejs",sdkVersion:Pe};let r=yr();return r&&Q("domain",r),{sdkVersion:Pe,browser:window.navigator.userAgent,domain:r,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},je=!1,wr=()=>je,br=async()=>{je=!0;try{let r=_t(mr()),i=Fe("rid"),s=Fe("uid"),f=await At("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:s}}),{runtimeId:h,sTime:p}=f;Q("rid",h),sr(p);}catch(r){je=!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 St()||typeof Me>"u"?!1:Me.env.JEST_WORKER_ID!==void 0}var Ir=$(vr,!1),Bt="imtbl__metrics",Er=5e3,Sr=1e3,he=(r,i)=>(0, Ge.getGlobalisedValue)(Bt,r,i),Ar=(r,i)=>{let s=ht(i,{lruOptions:{ttl:Er,max:Sr}});return (0, Ge.getGlobalisedValue)(Bt,r,s)},_r=5e3,Br=(r,i,s)=>{let f={event:`${r}.${i}`,time:or(),...s&&{properties:_t(s)}};pr(f);},re=$(Ar("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 At("/v1/sdk/metrics",{version:1,data:{events:r,details:s}})instanceof Error||dr(i);},Tr=$(xr),xt=async()=>{await Tr(),setTimeout(xt,_r);},vt=!1,kr=()=>{vt||(vt=!0,xt());};Ir()||$(he("startFlushing",kr))();var Cr=(r,i,s,f)=>{let{message:h}=s,p=s.stack||"",{cause:a}=s;a instanceof Error&&(p=`${p}
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.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}
5
5
  Cause: ${a.message}
6
- ${a.stack}`),re(r,`trackError_${i}`,{...f||{},errorMessage:h,errorStack:p,isTrackError:!0});},Tt=$(Cr),Dr=r=>{Q("env",r);};$(he("setEnvironment",Dr));var Fr=r=>{Q("passportClientId",r);};$(he("setPassportClientId",Fr));var jr=r=>{Q("pak",r);};$(he("setPublishableApiKey",jr));$(he("getDetail",Fe));var Ot={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},Rt="https://api.immutable.com",Gr="/v1/audience/messages",qr="/v1/audience/tracking-consent",oe="imtbl_anon_id",se="_imtbl_sid",Nt="session_start",Pt="session_end",pe=()=>typeof window<"u"&&typeof document<"u",ae=()=>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 Se(r){if(!pe())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function Ee(r,i,s,f){if(!pe())return;let h=window.location.protocol==="https:"?"; Secure":"",p=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${s}; SameSite=Lax${p}${h}`;}function de(r,i){Ee(r,"",0,i);}function Ae(r){let i=Se(oe);if(i)return i;let s=ae();return Ee(oe,s,63072e3,r),s}var He=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;}},ce=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 Ct(r,i,s){var f,h;if(r.status===0)return new ce({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 p=r.body,a=(f=p==null?void 0:p.rejected)!=null?f:0,g=(h=p==null?void 0:p.accepted)!=null?h:0;return new ce({code:"VALIDATION_REJECTED",message:`Backend rejected ${a} of ${a+g} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return new ce({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){}}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(p){return}}var We=async(r,i,s,f)=>{var h,p;try{let a=await fetch(r,{method:(h=f==null?void 0:f.method)!=null?h:"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(s),keepalive:f==null?void 0:f.keepalive});if(!a.ok){let m=await kt(a);return re("audience","transport_send_failed",{status:a.status}),{ok:!1,error:new He({status:a.status,endpoint:r,body:m})}}let g=await kt(a);if(typeof g=="object"&&g!==null&&"rejected"in g){let m=(p=g.rejected)!=null?p:0;if(m>0)return re("audience","transport_partial_rejected",{status:a.status,rejected:m}),{ok:!1,error:new He({status:a.status,endpoint:r,body:g})}}return {ok:!0}}catch(a){let g=new He({status:0,endpoint:r,cause:a});return Tt("audience","transport_send",g),{ok:!1,error:g}}},Je="__imtbl_audience_";function Xe(){try{return pe()&&typeof localStorage<"u"}catch(r){return !1}}function Vr(r,i=Je){if(Xe())try{let s=localStorage.getItem(`${i}${r}`);return s?JSON.parse(s):void 0}catch(s){return}}function Kr(r,i,s=Je){if(Xe())try{localStorage.setItem(`${s}${r}`,JSON.stringify(i));}catch(f){}}function zr(r,i=Je){if(Xe())try{localStorage.removeItem(`${i}${r}`);}catch(s){}}var Ye="queue",Ut=100,$t=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");var h,p,a,g;this.send=r,this.publishableKey=i,this.endpointUrl=`${(h=s==null?void 0:s.baseUrl)!=null?h:Rt}${Gr}`,this.flushIntervalMs=(p=s==null?void 0:s.flushIntervalMs)!=null?p: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=(g=Vr(Ye,this.storagePrefix))!=null?g:[];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)){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=Ct(f.error,"flush",i.length));let p=(h==null?void 0:h.code)==="VALIDATION_REJECTED";(f.ok||p)&&(this.messages=this.messages.slice(i.length),this.persist()),(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=[],zr(Ye,this.storagePrefix);}registerUnload(){!pe()||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);}persist(){Kr(Ye,this.messages,this.storagePrefix);}},Hr="2.19.0";function Dt(r="@imtbl/audience",i=Hr){let s={library:r,libraryVersion:i};return pe()&&(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 ue(r){let i=Se(se);if(i)return Ee(se,i,1800,r),{sessionId:i,isNew:!1};let s=ae();return Ee(se,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 Yr(r){let i;try{i=new URL(r).searchParams;}catch(h){return {}}let s={};for(let h of [...Gt,...qt]){let p=i.get(h);p&&(s[h]=p);}let f=i.get("referral_code");return f&&(s.referral_code=f),s}function Wr(){try{let r=sessionStorage.getItem(Vt);return r?JSON.parse(r):null}catch(r){return null}}function Jr(r){try{sessionStorage.setItem(Vt,JSON.stringify(r));}catch(i){}}function Kt(){let r=typeof window<"u"&&window.location?Yr(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=Wr();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,s={...Kt(),landing_page:i};return Jr(s),s}function Ht(){return Kt()}function j(r){return r!=="none"}function K(r){return r==="full"}function Yt(r,i,s,f,h,p,a,g){let m=p!=null?p:"none",_={none:0,anonymous:1,full:2};function v(b){let I=`${g!=null?g:Rt}${qr}`;i(I,s,{anonymousId:f,status:b,source:h},{method:"PUT",keepalive:!0}).then(d=>{!d.ok&&d.error&&Mt(a,Ct(d.error,"consent"));});}return {get level(){return m},setLevel(b){b!==m&&(_[b]<_[m]&&(b==="none"?r.purge(()=>!0):b==="anonymous"&&(r.purge(I=>I.type==="identify"||I.type==="alias"),r.transform(I=>{if("userId"in I){let{userId:d,...y}=I;return y}return I}))),m=b,v(b));}}}var Wt="@imtbl/audience",_e="2.19.0",z="[audience]",Jt="WebSDK";var Be=class{constructor(i=!1){w(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 Xr=new Set(["sign_up","link_clicked"]),H=class H{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,m,_,v;let{cookieDomain:s,publishableKey:f}=i,h=(g=i.consent)!=null?g:"none",p=Jt;this.cookieDomain=s,this.testMode=(m=i.testMode)!=null?m:!1,this.debug=new Be((_=i.debug)!=null?_:!1);let a=!1;j(h)?(this.anonymousId=Ae(s),a=this.startSession()):this.anonymousId=(v=Se(oe))!=null?v:ae(),this.queue=new $t(We,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(b,I)=>this.debug.logFlush(b,I),onError:i.onError,staleFilter:b=>Ft(b.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Yt(this.queue,We,f,this.anonymousId,p,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 H.liveInstances>0&&console.warn(`${z} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),H.liveInstances+=1,new H(i)}isTrackingDisabled(){return !j(this.consent.level)}effectiveUserId(){return K(this.consent.level)?this.userId:void 0}startSession(){let i=ue(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:ae(),eventTimestamp:Lt(),anonymousId:this.anonymousId,surface:"web",context:Dt(Wt,_e),...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:{sessionId:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Pt,properties:{sessionId:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;ue(this.cookieDomain);let s={sessionId: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;ue(this.cookieDomain);let[f]=s,h={sessionId:this.sessionId,...Xr.has(i)?Ht():{},...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}ue(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}ue(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=Ae(this.cookieDomain)),j(i)||this.queue.stop(),this.consent.setLevel(i),j(i)?K(s)&&!K(i)&&(this.userId=void 0):(de(oe,this.cookieDomain),de(se,this.cookieDomain)),f){this.isFirstPage=!0;let h=this.startSession();this.queue.start(),h&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),de(oe,this.cookieDomain),de(se,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=ae(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=Ae(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(),H.liveInstances=Math.max(0,H.liveInstances-1));}};w(H,"liveInstances",0);var ye=H;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:ce,AudienceEvents:Xt,IdentityType:Ot,canIdentify:K,canTrack:j,version:_e};
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.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.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};
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 qe=Object.getOwnPropertyNames;var Ke=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var Be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ze=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of qe(t))!Ve.call(e,r)&&r!==s&&ie(e,r,{get:()=>t[r],enumerable:!(i=Ge(t,r))||i.enumerable});return e};var He=(e,t,s)=>(s=e!=null?je(Ke(e)):{},ze(ie(s,"default",{value:e,enumerable:!0}),e));var ue=Be(b=>{Object.defineProperty(b,"__esModule",{value:!0});b.clearGlobalNamespace=b.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)};b.getGlobalisedValue=tt;var st=e=>{let t=oe(),s=ae(e);t[s]!==void 0&&delete t[s];};b.clearGlobalNamespace=st;});var F=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 F(e,t,s)}var We={max:1e3},ne=(e,t={})=>{let{cache:s,cacheKeyResolver:i=j,onHit:r,lruOptions:n={}}=t,o={...We,...n},a=s||re(o.max,o.ttl);function l(...h){let f=i(...h),d=a.get(f);if(a.has(f))return r&&r(f,d,a),d;let p=e.apply(this,h);return a.set(f,p),p}return l._cache=a,l},j=(...e)=>e.length===0?"no-args":e.map(t=>t===void 0?"undefined":t===null?"null":Array.isArray(t)?`[${j(...t)}]`:typeof t=="object"?`{${j(...Je(t))}}`:JSON.stringify(t)).join(","),Je=e=>Object.entries(e).sort((t,s)=>t[0]<s[0]?-1:1);var z=He(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 O=()=>typeof window>"u",ce=()=>!O(),ot="__IMX-",H=()=>ce()&&window.localStorage,at=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},lt=e=>typeof e=="string"?e:JSON.stringify(e),W=e=>`${ot}${e}`;function q(e){if(H())return at(window.localStorage.getItem(W(e)))}var C=(e,t)=>H()?(window.localStorage.setItem(W(e),lt(t)),!0):!1,ut=e=>H()?(window.localStorage.removeItem(W(e)),!0):!1,K=0,dt=e=>{let t=parseInt(e,10)*1e3,s=new Date(t),i=new Date;return K=s.getTime()-i.getTime(),K},ct=()=>{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 I=(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);},It=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},G="2.19.0",wt=()=>O()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",bt=()=>{if(O())return "";let e;try{window.self!==window.top&&(e=wt());}catch{}return e||(e=window.location.hostname),e},St=()=>{if(I("sdkVersion",G),O())return {browser:"nodejs",sdkVersion:G};let e=bt();return e&&I("domain",e),{sdkVersion:G,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},B=!1,Et=()=>B,xt=async()=>{B=!0;try{let e=pe(St()),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;I("rid",r),dt(n);}catch{B=!1;}};function c(e,t){return (...s)=>{try{let i=e(...s);return i instanceof Promise?i.catch(()=>t):i}catch{return t}}}function _t(){return ce()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var kt=c(_t,!1),fe="imtbl__metrics",Pt=5e3,Tt=1e3,P=(e,t)=>(0, z.getGlobalisedValue)(fe,e,t),At=(e,t)=>{let s=ne(t,{lruOptions:{ttl:Pt,max:Tt}});return (0, z.getGlobalisedValue)(fe,e,s)},Nt=5e3,Ot=(e,t,s)=>{let i={event:`${e}.${t}`,time:ct(),...s&&{properties:pe(s)}};vt(i);},S=c(At("track",Ot)),Ct=async()=>{if(Et()===!1){await xt();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||It(t);},Dt=c(Ct),me=async()=>{await Dt(),setTimeout(me,Nt);},de=!1,$t=()=>{de||(de=!0,me());};kt()||c(P("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 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.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}
4
4
  Cause: ${o.message}
5
- ${o.stack}`),S(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},ge=c(Gt),Vt=e=>{I("env",e);};c(P("setEnvironment",Vt));var Bt=e=>{I("passportClientId",e);};c(P("setPassportClientId",Bt));var zt=e=>{I("pak",e);};c(P("setPublishableApiKey",zt));c(P("getDetail",V));var Ht={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},Ie="https://api.immutable.com",Wt="/v1/audience/messages",Jt="/v1/audience/tracking-consent",x="imtbl_anon_id",E="_imtbl_sid",we="session_start",be="session_end",T=()=>typeof window<"u"&&typeof document<"u",_=()=>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)}),Se=()=>new Date().toISOString();function R(e){if(!T())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function $(e,t,s,i){if(!T())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 A(e,t){$(e,"",0,t);}function L(e){let t=R(x);if(t)return t;let s=_();return $(x,s,63072e3,e),s}var J=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;}},D=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 Ee(e,t,s){if(e.status===0)return new D({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 D({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return new D({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 xe(e,t){if(e)try{e(t);}catch{}}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)=>{try{let r=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive});if(!r.ok){let o=await ye(r);return S("audience","transport_send_failed",{status:r.status}),{ok:!1,error:new J({status:r.status,endpoint:e,body:o})}}let n=await ye(r);if(typeof n=="object"&&n!==null&&"rejected"in n){let o=n.rejected??0;if(o>0)return S("audience","transport_partial_rejected",{status:r.status,rejected:o}),{ok:!1,error:new J({status:r.status,endpoint:e,body:n})}}return {ok:!0}}catch(r){let n=new J({status:0,endpoint:e,cause:r});return ge("audience","transport_send",n),{ok:!1,error:n}}},Q="__imtbl_audience_";function Z(){try{return T()&&typeof localStorage<"u"}catch{return !1}}function Yt(e,t=Q){if(Z())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function Xt(e,t,s=Q){if(Z())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function Qt(e,t=Q){if(Z())try{localStorage.removeItem(`${t}${e}`);}catch{}}var Y="queue",ve=100,_e=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??Ie}${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=Yt(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;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)){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=Ee(s.error,"flush",e.length));let r=i?.code==="VALIDATION_REJECTED";(s.ok||r)&&(this.messages=this.messages.slice(e.length),this.persist()),this.onFlush?.(s.ok,e.length),i&&xe(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=[],Qt(Y,this.storagePrefix);}registerUnload(){!T()||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);}persist(){Xt(Y,this.messages,this.storagePrefix);}},Zt="2.19.0";function ke(e="@imtbl/audience",t=Zt){let s={library:e,libraryVersion:t};return T()&&(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 Pe(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 N(e,t=256){return e.length>t?e.slice(0,t):e}function k(e){let t=R(E);if(t)return $(E,t,1800,e),{sessionId:t,isNew:!1};let s=_();return $(E,s,1800,e),{sessionId:s,isNew:!0}}var Ae=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Ne=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Oe="__imtbl_attribution";function es(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...Ae,...Ne]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function ts(){try{let e=sessionStorage.getItem(Oe);return e?JSON.parse(e):null}catch{return null}}function ss(e){try{sessionStorage.setItem(Oe,JSON.stringify(e));}catch{}}function Ce(){let e=typeof window<"u"&&window.location?es(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=Ne.some(r=>r in e),i=Ae.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function De(){let e=ts();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...Ce(),landing_page:t};return ss(s),s}function $e(){return Ce()}function m(e){return e!=="none"}function w(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(d){let u=`${a??Ie}${Jt}`;t(u,s,{anonymousId:i,status:d,source:r},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&xe(o,Ee(p.error,"consent"));});}return {get level(){return l},setLevel(d){d!==l&&(h[d]<h[l]&&(d==="none"?e.purge(()=>!0):d==="anonymous"&&(e.purge(u=>u.type==="identify"||u.type==="alias"),e.transform(u=>{if("userId"in u){let{userId:p,...U}=u;return U}return u}))),l=d,f(d));}}}var Le="@imtbl/audience",Me="2.19.0",g="[audience]",Ue="WebSDK";var M=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 is=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 M(t.debug??!1);let o=!1;m(r)?(this.anonymousId=L(s),o=this.startSession()):this.anonymousId=R(x)??_(),this.queue=new _e(X,i,{baseUrl:t.baseUrl,flushIntervalMs:t.flushInterval,flushSize:t.flushSize,onFlush:(a,l)=>this.debug.logFlush(a,l),onError:t.onError,staleFilter:a=>Pe(a.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Re(this.queue,X,i,this.anonymousId,n,r,t.onError,t.baseUrl),this.attribution=De(),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 w(this.consent.level)?this.userId:void 0}startSession(){let t=k(this.cookieDomain);return this.sessionId=t.sessionId,this.sessionStartTime=Date.now(),t.isNew}baseMessage(){return {messageId:_(),eventTimestamp:Se(),anonymousId:this.anonymousId,surface:"web",context:ke(Le,Me),...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:we,properties:{sessionId:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:be,properties:{sessionId:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(t){if(this.isTrackingDisabled())return;k(this.cookieDomain);let s={sessionId: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;k(this.cookieDomain);let[i]=s,r={sessionId:this.sessionId,...is.has(t)?$e():{},...i};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:N(t),properties:r,userId:this.effectiveUserId()});}identify(t,s,i){if(!w(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}k(this.cookieDomain);let r=N(t);this.userId=r,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:r,identityType:s,traits:i});}alias(t,s){if(!w(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}k(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:N(t.id),fromType:t.identityType,toId:N(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)?w(s)&&!w(t)&&(this.userId=void 0):(A(x,this.cookieDomain),A(E,this.cookieDomain)),i){this.isFirstPage=!0;let r=this.startSession();this.queue.start(),r&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),A(x,this.cookieDomain),A(E,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=_(),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 rs={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}`),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.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.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:
6
6
 
7
7
  tiny-lru/dist/tiny-lru.js:
8
8
  (**
@@ -15,8 +15,8 @@ tiny-lru/dist/tiny-lru.js:
15
15
  */
16
16
 
17
17
  exports.Audience = ee;
18
- exports.AudienceError = D;
19
- exports.AudienceEvents = rs;
20
- exports.IdentityType = Ht;
21
- exports.canIdentify = w;
18
+ exports.AudienceError = S;
19
+ exports.AudienceEvents = os;
20
+ exports.IdentityType = zt;
21
+ exports.canIdentify = I;
22
22
  exports.canTrack = m;
@@ -1,6 +1,6 @@
1
- var je=Object.create;var ie=Object.defineProperty;var Ge=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var Ke=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var Be=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ze=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of qe(t))!Ve.call(e,r)&&r!==s&&ie(e,r,{get:()=>t[r],enumerable:!(i=Ge(t,r))||i.enumerable});return e};var He=(e,t,s)=>(s=e!=null?je(Ke(e)):{},ze(ie(s,"default",{value:e,enumerable:!0}),e));var ue=Be(b=>{Object.defineProperty(b,"__esModule",{value:!0});b.clearGlobalNamespace=b.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)};b.getGlobalisedValue=tt;var st=e=>{let t=oe(),s=ae(e);t[s]!==void 0&&delete t[s];};b.clearGlobalNamespace=st;});var F=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 F(e,t,s)}var We={max:1e3},ne=(e,t={})=>{let{cache:s,cacheKeyResolver:i=j,onHit:r,lruOptions:n={}}=t,o={...We,...n},a=s||re(o.max,o.ttl);function l(...h){let f=i(...h),d=a.get(f);if(a.has(f))return r&&r(f,d,a),d;let p=e.apply(this,h);return a.set(f,p),p}return l._cache=a,l},j=(...e)=>e.length===0?"no-args":e.map(t=>t===void 0?"undefined":t===null?"null":Array.isArray(t)?`[${j(...t)}]`:typeof t=="object"?`{${j(...Je(t))}}`:JSON.stringify(t)).join(","),Je=e=>Object.entries(e).sort((t,s)=>t[0]<s[0]?-1:1);var z=He(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 O=()=>typeof window>"u",ce=()=>!O(),ot="__IMX-",H=()=>ce()&&window.localStorage,at=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},lt=e=>typeof e=="string"?e:JSON.stringify(e),W=e=>`${ot}${e}`;function q(e){if(H())return at(window.localStorage.getItem(W(e)))}var C=(e,t)=>H()?(window.localStorage.setItem(W(e),lt(t)),!0):!1,ut=e=>H()?(window.localStorage.removeItem(W(e)),!0):!1,K=0,dt=e=>{let t=parseInt(e,10)*1e3,s=new Date(t),i=new Date;return K=s.getTime()-i.getTime(),K},ct=()=>{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 I=(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);},It=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},G="2.19.0",wt=()=>O()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",bt=()=>{if(O())return "";let e;try{window.self!==window.top&&(e=wt());}catch{}return e||(e=window.location.hostname),e},St=()=>{if(I("sdkVersion",G),O())return {browser:"nodejs",sdkVersion:G};let e=bt();return e&&I("domain",e),{sdkVersion:G,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},B=!1,Et=()=>B,xt=async()=>{B=!0;try{let e=pe(St()),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;I("rid",r),dt(n);}catch{B=!1;}};function c(e,t){return (...s)=>{try{let i=e(...s);return i instanceof Promise?i.catch(()=>t):i}catch{return t}}}function _t(){return ce()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var kt=c(_t,!1),fe="imtbl__metrics",Pt=5e3,Tt=1e3,P=(e,t)=>(0, z.getGlobalisedValue)(fe,e,t),At=(e,t)=>{let s=ne(t,{lruOptions:{ttl:Pt,max:Tt}});return (0, z.getGlobalisedValue)(fe,e,s)},Nt=5e3,Ot=(e,t,s)=>{let i={event:`${e}.${t}`,time:ct(),...s&&{properties:pe(s)}};vt(i);},S=c(At("track",Ot)),Ct=async()=>{if(Et()===!1){await xt();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||It(t);},Dt=c(Ct),me=async()=>{await Dt(),setTimeout(me,Nt);},de=!1,$t=()=>{de||(de=!0,me());};kt()||c(P("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 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.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}
2
2
  Cause: ${o.message}
3
- ${o.stack}`),S(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},ge=c(Gt),Vt=e=>{I("env",e);};c(P("setEnvironment",Vt));var Bt=e=>{I("passportClientId",e);};c(P("setPassportClientId",Bt));var zt=e=>{I("pak",e);};c(P("setPublishableApiKey",zt));c(P("getDetail",V));var Ht={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},Ie="https://api.immutable.com",Wt="/v1/audience/messages",Jt="/v1/audience/tracking-consent",x="imtbl_anon_id",E="_imtbl_sid",we="session_start",be="session_end",T=()=>typeof window<"u"&&typeof document<"u",_=()=>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)}),Se=()=>new Date().toISOString();function R(e){if(!T())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function $(e,t,s,i){if(!T())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 A(e,t){$(e,"",0,t);}function L(e){let t=R(x);if(t)return t;let s=_();return $(x,s,63072e3,e),s}var J=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;}},D=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 Ee(e,t,s){if(e.status===0)return new D({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 D({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return new D({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 xe(e,t){if(e)try{e(t);}catch{}}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)=>{try{let r=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive});if(!r.ok){let o=await ye(r);return S("audience","transport_send_failed",{status:r.status}),{ok:!1,error:new J({status:r.status,endpoint:e,body:o})}}let n=await ye(r);if(typeof n=="object"&&n!==null&&"rejected"in n){let o=n.rejected??0;if(o>0)return S("audience","transport_partial_rejected",{status:r.status,rejected:o}),{ok:!1,error:new J({status:r.status,endpoint:e,body:n})}}return {ok:!0}}catch(r){let n=new J({status:0,endpoint:e,cause:r});return ge("audience","transport_send",n),{ok:!1,error:n}}},Q="__imtbl_audience_";function Z(){try{return T()&&typeof localStorage<"u"}catch{return !1}}function Yt(e,t=Q){if(Z())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function Xt(e,t,s=Q){if(Z())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function Qt(e,t=Q){if(Z())try{localStorage.removeItem(`${t}${e}`);}catch{}}var Y="queue",ve=100,_e=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??Ie}${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=Yt(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;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)){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=Ee(s.error,"flush",e.length));let r=i?.code==="VALIDATION_REJECTED";(s.ok||r)&&(this.messages=this.messages.slice(e.length),this.persist()),this.onFlush?.(s.ok,e.length),i&&xe(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=[],Qt(Y,this.storagePrefix);}registerUnload(){!T()||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);}persist(){Xt(Y,this.messages,this.storagePrefix);}},Zt="2.19.0";function ke(e="@imtbl/audience",t=Zt){let s={library:e,libraryVersion:t};return T()&&(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 Pe(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 N(e,t=256){return e.length>t?e.slice(0,t):e}function k(e){let t=R(E);if(t)return $(E,t,1800,e),{sessionId:t,isNew:!1};let s=_();return $(E,s,1800,e),{sessionId:s,isNew:!0}}var Ae=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Ne=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Oe="__imtbl_attribution";function es(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...Ae,...Ne]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function ts(){try{let e=sessionStorage.getItem(Oe);return e?JSON.parse(e):null}catch{return null}}function ss(e){try{sessionStorage.setItem(Oe,JSON.stringify(e));}catch{}}function Ce(){let e=typeof window<"u"&&window.location?es(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=Ne.some(r=>r in e),i=Ae.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function De(){let e=ts();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...Ce(),landing_page:t};return ss(s),s}function $e(){return Ce()}function m(e){return e!=="none"}function w(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(d){let u=`${a??Ie}${Jt}`;t(u,s,{anonymousId:i,status:d,source:r},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&xe(o,Ee(p.error,"consent"));});}return {get level(){return l},setLevel(d){d!==l&&(h[d]<h[l]&&(d==="none"?e.purge(()=>!0):d==="anonymous"&&(e.purge(u=>u.type==="identify"||u.type==="alias"),e.transform(u=>{if("userId"in u){let{userId:p,...U}=u;return U}return u}))),l=d,f(d));}}}var Le="@imtbl/audience",Me="2.19.0",g="[audience]",Ue="WebSDK";var M=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 is=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 M(t.debug??!1);let o=!1;m(r)?(this.anonymousId=L(s),o=this.startSession()):this.anonymousId=R(x)??_(),this.queue=new _e(X,i,{baseUrl:t.baseUrl,flushIntervalMs:t.flushInterval,flushSize:t.flushSize,onFlush:(a,l)=>this.debug.logFlush(a,l),onError:t.onError,staleFilter:a=>Pe(a.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Re(this.queue,X,i,this.anonymousId,n,r,t.onError,t.baseUrl),this.attribution=De(),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 w(this.consent.level)?this.userId:void 0}startSession(){let t=k(this.cookieDomain);return this.sessionId=t.sessionId,this.sessionStartTime=Date.now(),t.isNew}baseMessage(){return {messageId:_(),eventTimestamp:Se(),anonymousId:this.anonymousId,surface:"web",context:ke(Le,Me),...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:we,properties:{sessionId:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:be,properties:{sessionId:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(t){if(this.isTrackingDisabled())return;k(this.cookieDomain);let s={sessionId: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;k(this.cookieDomain);let[i]=s,r={sessionId:this.sessionId,...is.has(t)?$e():{},...i};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:N(t),properties:r,userId:this.effectiveUserId()});}identify(t,s,i){if(!w(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}k(this.cookieDomain);let r=N(t);this.userId=r,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:r,identityType:s,traits:i});}alias(t,s){if(!w(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}k(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:N(t.id),fromType:t.identityType,toId:N(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)?w(s)&&!w(t)&&(this.userId=void 0):(A(x,this.cookieDomain),A(E,this.cookieDomain)),i){this.isFirstPage=!0;let r=this.startSession();this.queue.start(),r&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),A(x,this.cookieDomain),A(E,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=_(),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 rs={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}`),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.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.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:
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, D as AudienceError, rs as AudienceEvents, Ht as IdentityType, w as canIdentify, m as canTrack };
15
+ export { ee as Audience, S as AudienceError, os as AudienceEvents, zt as IdentityType, I as canIdentify, m as canTrack };
@@ -35,24 +35,27 @@ type IdentityType = typeof IdentityType[keyof typeof IdentityType];
35
35
  * Stable, machine-readable code identifying the kind of audience SDK
36
36
  * failure. Studios can branch on this in their `onError` handler.
37
37
  *
38
- * - `'FLUSH_FAILED'` — POST to `/v1/audience/messages` returned non-2xx.
39
- * - `'CONSENT_SYNC_FAILED'` — PUT to `/v1/audience/tracking-consent` returned non-2xx.
40
- * - `'NETWORK_ERROR'` — fetch rejected before a response was received
38
+ * - `'FLUSH_FAILED'`:POST to `/v1/audience/messages` returned non-2xx.
39
+ * - `'CONSENT_SYNC_FAILED'`:PUT to `/v1/audience/tracking-consent` returned non-2xx.
40
+ * - `'NETWORK_ERROR'`:fetch rejected before a response was received
41
41
  * (network failure, CORS, DNS, etc.).
42
- * - `'VALIDATION_REJECTED'` — backend returned 2xx but the body reported
43
- * `rejected > 0`. Terminal: retrying won't help, the
44
- * messages were dropped from the queue. Inspect
45
- * `responseBody` for the per-message detail when the
46
- * backend provides it.
42
+ * - `'VALIDATION_REJECTED'`:backend returned 2xx but the body reported
43
+ * `rejected > 0`, or the server returned a 4xx (non-429)
44
+ * indicating the payload was malformed or unauthorised.
45
+ * Terminal: retrying won't help, the messages were dropped
46
+ * from the queue.
47
+ * - `'RATE_LIMITED'`:server returned 429. The batch is retained and will
48
+ * be retried after the backoff window (honoring
49
+ * `Retry-After` when present).
47
50
  */
48
- type AudienceErrorCode = 'FLUSH_FAILED' | 'CONSENT_SYNC_FAILED' | 'NETWORK_ERROR' | 'VALIDATION_REJECTED';
51
+ type AudienceErrorCode = 'FLUSH_FAILED' | 'CONSENT_SYNC_FAILED' | 'NETWORK_ERROR' | 'VALIDATION_REJECTED' | 'RATE_LIMITED';
49
52
  /**
50
53
  * Public error type passed to the SDK's `onError` callback. Wraps the
51
54
  * low-level {@link TransportError} and adds a closed `code` union plus a
52
55
  * human-readable `message`.
53
56
  *
54
57
  * Lives in `@imtbl/audience-core` so every surface (web, pixel, unity,
55
- * unreal) reports failures through the same shape no per-package
58
+ * unreal) reports failures through the same shape, with no per-package
56
59
  * error class, no duplicated mapping logic.
57
60
  *
58
61
  * Is an instance of `Error` so it can be thrown, logged, or passed to
@@ -97,25 +100,25 @@ interface SignInProperties {
97
100
  method?: string;
98
101
  }
99
102
  interface WishlistAddProperties {
100
- gameId: string;
103
+ game_id: string;
101
104
  source?: string;
102
105
  platform?: string;
103
106
  }
104
107
  interface WishlistRemoveProperties {
105
- gameId: string;
108
+ game_id: string;
106
109
  }
107
110
  interface PurchaseProperties {
108
111
  currency: string;
109
112
  value: number;
110
- itemId?: string;
111
- itemName?: string;
113
+ item_id?: string;
114
+ item_name?: string;
112
115
  quantity?: number;
113
- transactionId?: string;
116
+ transaction_id?: string;
114
117
  }
115
118
  interface GameLaunchProperties {
116
119
  platform?: string;
117
120
  version?: string;
118
- buildId?: string;
121
+ build_id?: string;
119
122
  }
120
123
  type ProgressionStatus = 'start' | 'complete' | 'fail';
121
124
  interface ProgressionProperties {
@@ -124,29 +127,29 @@ interface ProgressionProperties {
124
127
  level?: string;
125
128
  stage?: string;
126
129
  score?: number;
127
- durationSec?: number;
130
+ duration_sec?: number;
128
131
  }
129
132
  type ResourceFlow = 'sink' | 'source';
130
133
  interface ResourceProperties {
131
134
  flow: ResourceFlow;
132
135
  currency: string;
133
136
  amount: number;
134
- itemType?: string;
135
- itemId?: string;
137
+ item_type?: string;
138
+ item_id?: string;
136
139
  }
137
140
  interface EmailAcquiredProperties {
138
141
  source?: string;
139
142
  }
140
143
  interface GamePageViewedProperties {
141
- gameId: string;
142
- gameName?: string;
144
+ game_id: string;
145
+ game_name?: string;
143
146
  slug?: string;
144
147
  }
145
148
  interface LinkClickedProperties {
146
149
  url: string;
147
150
  label?: string;
148
151
  source?: string;
149
- gameId?: string;
152
+ game_id?: string;
150
153
  }
151
154
  interface EventPropsMap {
152
155
  sign_up: SignUpProperties;
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.19.0",
4
+ "version": "2.20.0",
5
5
  "author": "Immutable",
6
6
  "bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
7
7
  "devDependencies": {