@imtbl/audience 2.20.1-alpha.1 → 2.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var mn=Object.create;var lt=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var vn=Object.getOwnPropertyNames;var bn=Object.getPrototypeOf,En=Object.prototype.hasOwnProperty;var ft=(r,i)=>()=>(r&&(i=r(r=0)),i);var In=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var _n=(r,i,s,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of vn(i))!En.call(r,c)&&c!==s&<(r,c,{get:()=>i[c],enumerable:!(f=wn(i,c))||f.enumerable});return r};var An=(r,i,s)=>(s=r!=null?mn(bn(r)):{},_n(lt(s,"default",{value:r,enumerable:!0}),r));var B=ft(()=>{});var T=ft(()=>{});var yt=In(se=>{T();B();Object.defineProperty(se,"__esModule",{value:!0});se.clearGlobalNamespace=se.getGlobalisedValue=void 0;var Bn="globalise__singleton__",Tn={},pt=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:Tn,kn=(r,i)=>{if(typeof r!="string")throw "Invalid namespace key";if(typeof i!="string")throw "Invalid item key"},dt=r=>`${Bn}${r}`,gt=r=>{let i=pt(),s=dt(r);return i[s]||(i[s]={}),i[s]},Un=(r,i)=>gt(r)[i]||void 0,On=(r,i,s)=>{let f=gt(r);f[i]=s;},Pn=(r,i,s)=>{kn(r,i);let f=Un(r,i);return f!==void 0?f:(On(r,i,s),s)};se.getGlobalisedValue=Pn;var Nn=r=>{let i=pt(),s=dt(r);i[s]!==void 0&&delete i[s];};se.clearGlobalNamespace=Nn;});T();B();T();B();T();B();T();B();T();B();T();B();var Oe=class{constructor(i=0,s=0,f=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=i,this.resetTtl=f,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(i){if(this.has(i)){let s=this.items[i];delete this.items[i],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(i=this.keys()){return i.map(s=>[s,this.get(s)])}evict(i=!1){if(i||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(i){let s;return this.has(i)&&(s=this.items[i].expiry),s}get(i){let s;if(this.has(i)){let f=this.items[i];this.ttl>0&&f.expiry<=Date.now()?this.delete(i):(s=f.value,this.set(i,s,!0));}return s}has(i){return i in this.items}keys(){let i=[],s=this.first;for(;s!==null;)i.push(s.key),s=s.next;return i}set(i,s,f=!1,c=this.resetTtl){let p;if(f||this.has(i)){if(p=this.items[i],p.value=s,f===!1&&c&&(p.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==p){let a=this.last,g=p.next,y=p.prev;this.first===p&&(this.first=p.next),p.next=null,p.prev=this.last,a.next=p,y!==null&&(y.next=g),g!==null&&(g.prev=y);}}else this.max>0&&this.size===this.max&&this.evict(!0),p=this.items[i]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:i,prev:this.last,next:null,value:s},++this.size===1?this.first=p:this.last.next=p;return this.last=p,this}values(i=this.keys()){return i.map(s=>this.get(s))}};function ht(r=1e3,i=0,s=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(i)||i<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new Oe(r,i,s)}var Sn={max:1e3},ct=(r,i={})=>{let{cache:s,cacheKeyResolver:f=Pe,onHit:c,lruOptions:p={}}=i,a={...Sn,...p},g=s||ht(a.max,a.ttl);function y(...x){let v=f(...x),w=g.get(v);if(g.has(v))return c&&c(v,w,g),w;let d=r.apply(this,x);return g.set(v,d),d}return y._cache=g,y},Pe=(...r)=>r.length===0?"no-args":r.map(i=>i===void 0?"undefined":i===null?"null":Array.isArray(i)?`[${Pe(...i)}]`:typeof i=="object"?`{${Pe(...xn(i))}}`:JSON.stringify(i)).join(","),xn=r=>Object.entries(r).sort((i,s)=>i[0]<s[0]?-1:1);var Ge=An(yt()),Rn=Object.defineProperty,Cn=(r,i)=>{for(var s in i)Rn(r,s,{get:i[s],enumerable:!0});};function qe(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}var q=[],oe=!1,J,be=-1;function Ln(){!oe||!J||(oe=!1,J.length?q=J.concat(q):be=-1,q.length&&It());}function It(){if(!oe){var r=setTimeout(Ln,0);oe=!0;for(var i=q.length;i;){for(J=q,q=[];++be<i;)J&&J[be].run();be=-1,i=q.length;}J=null,oe=!1,clearTimeout(r);}}function Mn(r){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];q.push(new _t(r,i)),q.length===1&&!oe&&setTimeout(It,0);}function _t(r,i){this.fun=r,this.array=i;}_t.prototype.run=function(){this.fun.apply(null,this.array);};var $n="browser",Dn="x64",Fn="browser",jn={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Gn=["/usr/bin/node"],qn=[],Vn="v16.8.0",Kn={},zn=function(r,i){console.warn((i?i+": ":"")+r);},Hn=function(r){qe("binding");},Wn=function(r){return 0},Yn=function(){return "/"},Jn=function(r){},Xn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function R(){}var Qn=R,Zn=[];function er(r){qe("_linkedBinding");}var tr={},nr=!1,rr={};function ir(r){qe("dlopen");}function sr(){return []}function or(){return []}var ar=R,ur=R,Ve=function(){return {}},lr=Ve,fr=Ve,hr=R,cr=R,pr=R,dr={};function gr(r,i){if(!r)throw new Error(i||"assertion error")}var yr={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},mr=R,wr=R;function vr(){return !1}var br=R,Er=R,Ir=R,_r=R,Ar=R,Sr=void 0,xr=void 0,Br=void 0,Tr=R,kr=2,Ur=1,Or="/bin/usr/node",Pr=9229,Nr="node",Rr=[],Cr=R,K={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};K.now===void 0&&(Ne=Date.now(),K.timing&&K.timing.navigationStart&&(Ne=K.timing.navigationStart),K.now=()=>Date.now()-Ne);var Ne;function Lr(){return K.now()/1e3}var Ce=1e9;function Le(r){var i=Math.floor((Date.now()-K.now())*.001),s=K.now()*.001,f=Math.floor(s)+i,c=Math.floor(s%1*1e9);return r&&(f=f-r[0],c=c-r[1],c<0&&(f--,c+=Ce)),[f,c]}Le.bigint=function(r){var i=Le(r);return typeof BigInt>"u"?i[0]*Ce+i[1]:BigInt(i[0]*Ce)+BigInt(i[1])};var Mr=10,$r={},Dr=0;function z(){return Me}var Fr=z,jr=z,Gr=z,qr=z,Vr=z,Kr=R,zr=z,Hr=z;function Wr(r){return []}var Me={version:Vn,versions:Kn,arch:Dn,platform:Fn,release:Xn,_rawDebug:Qn,moduleLoadList:Zn,binding:Hn,_linkedBinding:er,_events:$r,_eventsCount:Dr,_maxListeners:Mr,on:z,addListener:Fr,once:jr,off:Gr,removeListener:qr,removeAllListeners:Vr,emit:Kr,prependListener:zr,prependOnceListener:Hr,listeners:Wr,domain:tr,_exiting:nr,config:rr,dlopen:ir,uptime:Lr,_getActiveRequests:sr,_getActiveHandles:or,reallyExit:ar,_kill:ur,cpuUsage:Ve,resourceUsage:lr,memoryUsage:fr,kill:hr,exit:cr,openStdin:pr,allowedNodeEnvironmentFlags:dr,assert:gr,features:yr,_fatalExceptions:mr,setUncaughtExceptionCaptureCallback:wr,hasUncaughtExceptionCaptureCallback:vr,emitWarning:zn,nextTick:Mn,_tickCallback:br,_debugProcess:Er,_debugEnd:Ir,_startProfilerIdleNotifier:_r,_stopProfilerIdleNotifier:Ar,stdout:Sr,stdin:Br,stderr:xr,abort:Tr,umask:Wn,chdir:Jn,cwd:Yn,env:jn,title:$n,argv:Gn,execArgv:qn,pid:kr,ppid:Ur,execPath:Or,debugPort:Pr,hrtime:Le,argv0:Nr,_preload_modules:Rr,setSourceMapsEnabled:Cr},pe={},mt=!1;function Yr(){if(mt)return pe;mt=!0,pe.byteLength=g,pe.toByteArray=x,pe.fromByteArray=b;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,p=f.length;c<p;++c)r[c]=f[c],i[f.charCodeAt(c)]=c;i[45]=62,i[95]=63;function a(d){var m=d.length;if(m%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=d.indexOf("=");E===-1&&(E=m);var S=E===m?0:4-E%4;return [E,S]}function g(d){var m=a(d),E=m[0],S=m[1];return (E+S)*3/4-S}function y(d,m,E){return (m+E)*3/4-E}function x(d){var m,E=a(d),S=E[0],N=E[1],k=new s(y(d,S,N)),L=0,$=N>0?S-4:S,C;for(C=0;C<$;C+=4)m=i[d.charCodeAt(C)]<<18|i[d.charCodeAt(C+1)]<<12|i[d.charCodeAt(C+2)]<<6|i[d.charCodeAt(C+3)],k[L++]=m>>16&255,k[L++]=m>>8&255,k[L++]=m&255;return N===2&&(m=i[d.charCodeAt(C)]<<2|i[d.charCodeAt(C+1)]>>4,k[L++]=m&255),N===1&&(m=i[d.charCodeAt(C)]<<10|i[d.charCodeAt(C+1)]<<4|i[d.charCodeAt(C+2)]>>2,k[L++]=m>>8&255,k[L++]=m&255),k}function v(d){return r[d>>18&63]+r[d>>12&63]+r[d>>6&63]+r[d&63]}function w(d,m,E){for(var S,N=[],k=m;k<E;k+=3)S=(d[k]<<16&16711680)+(d[k+1]<<8&65280)+(d[k+2]&255),N.push(v(S));return N.join("")}function b(d){for(var m,E=d.length,S=E%3,N=[],k=16383,L=0,$=E-S;L<$;L+=k)N.push(w(d,L,L+k>$?$:L+k));return S===1?(m=d[E-1],N.push(r[m>>2]+r[m<<4&63]+"==")):S===2&&(m=(d[E-2]<<8)+d[E-1],N.push(r[m>>10]+r[m>>4&63]+r[m<<2&63]+"=")),N.join("")}return pe}var ve={},wt=!1;function Jr(){return wt?ve:(wt=!0,ve.read=function(r,i,s,f,c){var p,a,g=c*8-f-1,y=(1<<g)-1,x=y>>1,v=-7,w=s?c-1:0,b=s?-1:1,d=r[i+w];for(w+=b,p=d&(1<<-v)-1,d>>=-v,v+=g;v>0;p=p*256+r[i+w],w+=b,v-=8);for(a=p&(1<<-v)-1,p>>=-v,v+=f;v>0;a=a*256+r[i+w],w+=b,v-=8);if(p===0)p=1-x;else {if(p===y)return a?NaN:(d?-1:1)*(1/0);a=a+Math.pow(2,f),p=p-x;}return (d?-1:1)*a*Math.pow(2,p-f)},ve.write=function(r,i,s,f,c,p){var a,g,y,x=p*8-c-1,v=(1<<x)-1,w=v>>1,b=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=f?0:p-1,m=f?1:-1,E=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(g=isNaN(i)?1:0,a=v):(a=Math.floor(Math.log(i)/Math.LN2),i*(y=Math.pow(2,-a))<1&&(a--,y*=2),a+w>=1?i+=b/y:i+=b*Math.pow(2,1-w),i*y>=2&&(a++,y/=2),a+w>=v?(g=0,a=v):a+w>=1?(g=(i*y-1)*Math.pow(2,c),a=a+w):(g=i*Math.pow(2,w-1)*Math.pow(2,c),a=0));c>=8;r[s+d]=g&255,d+=m,g/=256,c-=8);for(a=a<<c|g,x+=c;x>0;r[s+d]=a&255,d+=m,a/=256,x-=8);r[s+d-m]|=E*128;},ve)}var Y={},vt=!1;function Xr(){if(vt)return Y;vt=!0;let r=Yr(),i=Jr(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Y.Buffer=a,Y.SlowBuffer=N,Y.INSPECT_MAX_BYTES=50;let f=2147483647;Y.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=c(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return !1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function p(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(e)}return g(e,t,n)}a.poolSize=8192;function g(e,t,n){if(typeof e=="string")return w(e,t);if(ArrayBuffer.isView(e))return d(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return m(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let u=E(e);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,t,n){return g(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function y(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function x(e,t,n){return y(e),e<=0?p(e):t!==void 0?typeof n=="string"?p(e).fill(t,n):p(e).fill(t):p(e)}a.alloc=function(e,t,n){return x(e,t,n)};function v(e){return y(e),p(e<0?0:S(e)|0)}a.allocUnsafe=function(e){return v(e)},a.allocUnsafeSlow=function(e){return v(e)};function w(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=k(e,t)|0,o=p(n),u=o.write(e,t);return u!==n&&(o=o.slice(0,u)),o}function b(e){let t=e.length<0?0:S(e.length)|0,n=p(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function d(e){if(F(e,Uint8Array)){let t=new Uint8Array(e);return m(t.buffer,t.byteOffset,t.byteLength)}return b(e)}function m(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return t===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,n),Object.setPrototypeOf(o,a.prototype),o}function E(e){if(a.isBuffer(e)){let t=S(e.length)|0,n=p(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!="number"||Ue(e.length)?p(0):b(e);if(e.type==="Buffer"&&Array.isArray(e.data))return b(e.data)}function S(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function N(e){return +e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype},a.compare=function(e,t){if(F(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,o=t.length;for(let u=0,l=Math.min(n,o);u<l;++u)if(e[u]!==t[u]){n=e[u],o=t[u];break}return n<o?-1:o<n?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=a.allocUnsafe(t),u=0;for(n=0;n<e.length;++n){let l=e[n];if(F(l,Uint8Array))u+l.length>o.length?(a.isBuffer(l)||(l=a.from(l)),l.copy(o,u)):Uint8Array.prototype.set.call(o,l,u);else if(a.isBuffer(l))l.copy(o,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=l.length;}return o};function k(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let u=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ke(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return ut(e).length;default:if(u)return o?-1:ke(e).length;t=(""+t).toLowerCase(),u=!0;}}a.byteLength=k;function L(e,t,n){let o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return "";for(e||(e="utf8");;)switch(e){case"hex":return un(this,t,n);case"utf8":case"utf-8":return Ze(this,t,n);case"ascii":return on(this,t,n);case"latin1":case"binary":return an(this,t,n);case"base64":return rn(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ln(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0;}}a.prototype._isBuffer=!0;function $(e,t,n){let o=e[t];e[t]=e[n],e[n]=o;}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)$(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)$(this,t,t+3),$(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)$(this,t,t+7),$(this,t+1,t+6),$(this,t+2,t+5),$(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ze(this,0,e):L.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=Y.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,o,u){if(F(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),u===void 0&&(u=this.length),t<0||n>e.length||o<0||u>this.length)throw new RangeError("out of range index");if(o>=u&&t>=n)return 0;if(o>=u)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,u>>>=0,this===e)return 0;let l=u-o,h=n-t,_=Math.min(l,h),P=this.slice(o,u),A=e.slice(t,n);for(let I=0;I<_;++I)if(P[I]!==A[I]){l=P[I],h=A[I];break}return l<h?-1:h<l?1:0};function C(e,t,n,o,u){if(e.length===0)return -1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ue(n)&&(n=u?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(u)return -1;n=e.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:Qe(e,t,n,o,u);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?u?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Qe(e,[t],n,o,u);throw new TypeError("val must be string, number or Buffer")}function Qe(e,t,n,o,u){let l=1,h=e.length,_=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return -1;l=2,h/=2,_/=2,n/=2;}function P(I,U){return l===1?I[U]:I.readUInt16BE(U*l)}let A;if(u){let I=-1;for(A=n;A<h;A++)if(P(e,A)===P(t,I===-1?0:A-I)){if(I===-1&&(I=A),A-I+1===_)return I*l}else I!==-1&&(A-=A-I),I=-1;}else for(n+_>h&&(n=h-_),A=n;A>=0;A--){let I=!0;for(let U=0;U<_;U++)if(P(e,A+U)!==P(t,U)){I=!1;break}if(I)return A}return -1}a.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},a.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)};function Qt(e,t,n,o){n=Number(n)||0;let u=e.length-n;o?(o=Number(o),o>u&&(o=u)):o=u;let l=t.length;o>l/2&&(o=l/2);let h;for(h=0;h<o;++h){let _=parseInt(t.substr(h*2,2),16);if(Ue(_))return h;e[n+h]=_;}return h}function Zt(e,t,n,o){return we(ke(t,e.length-n),e,n,o)}function en(e,t,n,o){return we(pn(t),e,n,o)}function tn(e,t,n,o){return we(ut(t),e,n,o)}function nn(e,t,n,o){return we(dn(t,e.length-n),e,n,o)}a.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((n===void 0||n>u)&&(n=u),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let l=!1;for(;;)switch(o){case"hex":return Qt(this,e,t,n);case"utf8":case"utf-8":return Zt(this,e,t,n);case"ascii":case"latin1":case"binary":return en(this,e,t,n);case"base64":return tn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nn(this,e,t,n);default:if(l)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),l=!0;}},a.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function rn(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function Ze(e,t,n){n=Math.min(e.length,n);let o=[],u=t;for(;u<n;){let l=e[u],h=null,_=l>239?4:l>223?3:l>191?2:1;if(u+_<=n){let P,A,I,U;switch(_){case 1:l<128&&(h=l);break;case 2:P=e[u+1],(P&192)===128&&(U=(l&31)<<6|P&63,U>127&&(h=U));break;case 3:P=e[u+1],A=e[u+2],(P&192)===128&&(A&192)===128&&(U=(l&15)<<12|(P&63)<<6|A&63,U>2047&&(U<55296||U>57343)&&(h=U));break;case 4:P=e[u+1],A=e[u+2],I=e[u+3],(P&192)===128&&(A&192)===128&&(I&192)===128&&(U=(l&15)<<18|(P&63)<<12|(A&63)<<6|I&63,U>65535&&U<1114112&&(h=U));}}h===null?(h=65533,_=1):h>65535&&(h-=65536,o.push(h>>>10&1023|55296),h=56320|h&1023),o.push(h),u+=_;}return sn(o)}let et=4096;function sn(e){let t=e.length;if(t<=et)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=et));return n}function on(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]&127);return o}function an(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]);return o}function un(e,t,n){let o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);let u="";for(let l=t;l<n;++l)u+=gn[e[l]];return u}function ln(e,t,n){let o=e.slice(t,n),u="";for(let l=0;l<o.length-1;l+=2)u+=String.fromCharCode(o[l]+o[l+1]*256);return u}a.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let o=this.subarray(e,t);return Object.setPrototypeOf(o,a.prototype),o};function O(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e+--t],u=1;for(;t>0&&(u*=256);)o+=this[e+--t]*u;return o},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||O(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||O(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||O(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=V(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let o=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(u)<<BigInt(32))}),a.prototype.readBigUInt64BE=V(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let o=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(u)}),a.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*t)),o},a.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=t,u=1,l=this[e+--o];for(;o>0&&(u*=256);)l+=this[e+--o]*u;return u*=128,l>=u&&(l-=Math.pow(2,8*t)),l},a.prototype.readInt8=function(e,t){return e=e>>>0,t||O(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||O(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||O(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=V(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=V(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&ce(e,this.length-8);let o=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||O(e,8,this.length),i.read(this,e,!1,52,8)};function M(e,t,n,o,u,l){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>u||t<l)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let h=Math.pow(2,8*n)-1;M(this,e,t,n,h,0);}let u=1,l=0;for(this[t]=e&255;++l<n&&(u*=256);)this[t+l]=e/u&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let h=Math.pow(2,8*n)-1;M(this,e,t,n,h,0);}let u=n-1,l=1;for(this[t+u]=e&255;--u>=0&&(l*=256);)this[t+u]=e/l&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function tt(e,t,n,o,u){at(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l;let h=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=h,h=h>>8,e[n++]=h,h=h>>8,e[n++]=h,h=h>>8,e[n++]=h,n}function nt(e,t,n,o,u){at(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n+7]=l,l=l>>8,e[n+6]=l,l=l>>8,e[n+5]=l,l=l>>8,e[n+4]=l;let h=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=h,h=h>>8,e[n+2]=h,h=h>>8,e[n+1]=h,h=h>>8,e[n]=h,n+8}a.prototype.writeBigUInt64LE=V(function(e,t=0){return tt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=V(function(e,t=0){return nt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let _=Math.pow(2,8*n-1);M(this,e,t,n,_-1,-_);}let u=0,l=1,h=0;for(this[t]=e&255;++u<n&&(l*=256);)e<0&&h===0&&this[t+u-1]!==0&&(h=1),this[t+u]=(e/l>>0)-h&255;return t+n},a.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let _=Math.pow(2,8*n-1);M(this,e,t,n,_-1,-_);}let u=n-1,l=1,h=0;for(this[t+u]=e&255;--u>=0&&(l*=256);)e<0&&h===0&&this[t+u+1]!==0&&(h=1),this[t+u]=(e/l>>0)-h&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=V(function(e,t=0){return tt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=V(function(e,t=0){return nt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rt(e,t,n,o,u,l){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function it(e,t,n,o,u){return t=+t,n=n>>>0,u||rt(e,t,n,4),i.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(e,t,n){return it(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return it(this,e,t,!1,n)};function st(e,t,n,o,u){return t=+t,n=n>>>0,u||rt(e,t,n,8),i.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(e,t,n){return st(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return st(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,o){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let u=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),u},a.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let l=e.charCodeAt(0);(o==="utf8"&&l<128||o==="latin1")&&(e=l);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<n;++u)this[u]=e;else {let l=a.isBuffer(e)?e:a.from(e,o),h=l.length;if(h===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<n-t;++u)this[u+t]=l[u%h];}return this};let re={};function Te(e,t,n){re[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name;}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Te("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),Te("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,u=n;return Number.isInteger(n)&&Math.abs(n)>2**32?u=ot(String(n)):typeof n=="bigint"&&(u=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(u=ot(u)),u+="n"),o+=` It must be ${t}. Received ${u}`,o},RangeError);function ot(e){let t="",n=e.length,o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return `${e.slice(0,n)}${t}`}function fn(e,t,n){ie(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&ce(t,e.length-(n+1));}function at(e,t,n,o,u,l){if(e>n||e<t){let h=typeof t=="bigint"?"n":"",_;throw t===0||t===BigInt(0)?_=`>= 0${h} and < 2${h} ** ${(l+1)*8}${h}`:_=`>= -(2${h} ** ${(l+1)*8-1}${h}) and < 2 ** ${(l+1)*8-1}${h}`,new re.ERR_OUT_OF_RANGE("value",_,e)}fn(o,u,l);}function ie(e,t){if(typeof e!="number")throw new re.ERR_INVALID_ARG_TYPE(t,"number",e)}function ce(e,t,n){throw Math.floor(e)!==e?(ie(e,n),new re.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new re.ERR_BUFFER_OUT_OF_BOUNDS:new re.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}let hn=/[^+/0-9A-Za-z-_]/g;function cn(e){if(e=e.split("=")[0],e=e.trim().replace(hn,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function ke(e,t){t=t||1/0;let n,o=e.length,u=null,l=[];for(let h=0;h<o;++h){if(n=e.charCodeAt(h),n>55295&&n<57344){if(!u){if(n>56319){(t-=3)>-1&&l.push(239,191,189);continue}else if(h+1===o){(t-=3)>-1&&l.push(239,191,189);continue}u=n;continue}if(n<56320){(t-=3)>-1&&l.push(239,191,189),u=n;continue}n=(u-55296<<10|n-56320)+65536;}else u&&(t-=3)>-1&&l.push(239,191,189);if(u=null,n<128){if((t-=1)<0)break;l.push(n);}else if(n<2048){if((t-=2)<0)break;l.push(n>>6|192,n&63|128);}else if(n<65536){if((t-=3)<0)break;l.push(n>>12|224,n>>6&63|128,n&63|128);}else if(n<1114112){if((t-=4)<0)break;l.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128);}else throw new Error("Invalid code point")}return l}function pn(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function dn(e,t){let n,o,u,l=[];for(let h=0;h<e.length&&!((t-=2)<0);++h)n=e.charCodeAt(h),o=n>>8,u=n%256,l.push(u),l.push(o);return l}function ut(e){return r.toByteArray(cn(e))}function we(e,t,n,o){let u;for(u=0;u<o&&!(u+n>=t.length||u>=e.length);++u)t[u+n]=e[u];return u}function F(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ue(e){return e!==e}let gn=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let o=n*16;for(let u=0;u<16;++u)t[o+u]=e[n]+e[u];}return t}();function V(e){return typeof BigInt>"u"?yn:e}function yn(){throw new Error("BigInt not supported")}return Y}var ee=Xr();ee.Buffer;ee.SlowBuffer;ee.INSPECT_MAX_BYTES;ee.kMaxLength;var bt=ee.Buffer;ee.INSPECT_MAX_BYTES;ee.kMaxLength;var Qr={};Cn(Qr,{deleteItem:()=>ni,getItem:()=>$e,setItem:()=>Ie});var Ee=()=>typeof window>"u",At=()=>!Ee(),Zr="__IMX-",Ke=()=>At()&&window.localStorage,ei=r=>{if(r!==null)try{return JSON.parse(r)}catch{return r}},ti=r=>typeof r=="string"?r:JSON.stringify(r),ze=r=>`${Zr}${r}`;function $e(r){if(Ke())return ei(window.localStorage.getItem(ze(r)))}var Ie=(r,i)=>Ke()?(window.localStorage.setItem(ze(r),ti(i)),!0):!1,ni=r=>Ke()?(window.localStorage.removeItem(ze(r)),!0):!1,De=0,ri=r=>{let i=parseInt(r,10)*1e3,s=new Date(i),f=new Date;return De=s.getTime()-f.getTime(),De},ii=()=>{let r=new Date().getTime()+De;return new Date(r).toISOString()},si=(r=>(r.RUNTIME_ID="rid",r.PASSPORT_CLIENT_ID="passportClientId",r.ENVIRONMENT="env",r.PUBLISHABLE_API_KEY="pak",r.IDENTITY="uid",r.DOMAIN="domain",r.SDK_VERSION="sdkVersion",r))(si||{}),oi="https://api.immutable.com",ai=r=>{if(typeof bt<"u")return bt.from(r,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(r)));throw new Error("Base64 encoding not supported in this environment")};async function St(r,i){let s=JSON.stringify(i),f={payload:ai(s)},c=await fetch(`${oi}${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!c.ok){let p=await c.text().catch(()=>"");throw new Error(`Request failed (${c.status}): ${p||c.statusText}`)}return c.json()}var X,Q,ui=()=>{X=$e("metrics-events")||[],Q=$e("metrics-runtime")||{};};ui();var Z=(r,i)=>{Q={...Q,[r]:i},Ie("metrics-runtime",Q);},Fe=r=>{if(Q[r]!==void 0)return Q[r]},li=()=>Q,fi=()=>X,hi=r=>{X.push(r),Ie("metrics-events",X);},ci=r=>{X=X.slice(r),Ie("metrics-events",X);},xt=r=>{let i=[];return Object.entries(r).forEach(([s,f])=>{(typeof s=="string"||typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&i.push([s,f.toString()]);}),i},Re="2.20.1-alpha.1",pi=()=>Ee()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",di=()=>{if(Ee())return "";let r;try{window.self!==window.top&&(r=pi());}catch{}return r||(r=window.location.hostname),r},gi=()=>{if(Z("sdkVersion",Re),Ee())return {browser:"nodejs",sdkVersion:Re};let r=di();return r&&Z("domain",r),{sdkVersion:Re,browser:window.navigator.userAgent,domain:r,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},je=!1,yi=()=>je,mi=async()=>{je=!0;try{let r=xt(gi()),i=Fe("rid"),s=Fe("uid"),f=await St("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:s}}),{runtimeId:c,sTime:p}=f;Z("rid",c),ri(p);}catch{je=!1;}};function D(r,i){return (...s)=>{try{let f=r(...s);return f instanceof Promise?f.catch(()=>i):f}catch{return i}}}function wi(){return At()||typeof Me>"u"?!1:Me.env.JEST_WORKER_ID!==void 0}var vi=D(wi,!1),Bt="imtbl__metrics",bi=5e3,Ei=1e3,de=(r,i)=>(0, Ge.getGlobalisedValue)(Bt,r,i),Ii=(r,i)=>{let s=ct(i,{lruOptions:{ttl:bi,max:Ei}});return (0, Ge.getGlobalisedValue)(Bt,r,s)},_i=5e3,Ai=(r,i,s)=>{let f={event:`${r}.${i}`,time:ii(),...s&&{properties:xt(s)}};hi(f);},te=D(Ii("track",Ai)),Si=async()=>{if(yi()===!1){await mi();return}let r=fi();if(r.length===0)return;let i=r.length,s=li();await St("/v1/sdk/metrics",{version:1,data:{events:r,details:s}})instanceof Error||ci(i);},xi=D(Si),Tt=async()=>{await xi(),setTimeout(Tt,_i);},Et=!1,Bi=()=>{Et||(Et=!0,Tt());};vi()||D(de("startFlushing",Bi))();var Ri=(r,i,s,f)=>{let{message:c}=s,p=s.stack||"",{cause:a}=s;a instanceof Error&&(p=`${p}
|
|
1
|
+
var En=Object.create;var gt=Object.defineProperty;var In=Object.getOwnPropertyDescriptor;var _n=Object.getOwnPropertyNames;var An=Object.getPrototypeOf,Sn=Object.prototype.hasOwnProperty;var mt=(r,i)=>()=>(r&&(i=r(r=0)),i);var xn=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var Bn=(r,i,s,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of _n(i))!Sn.call(r,h)&&h!==s&>(r,h,{get:()=>i[h],enumerable:!(f=In(i,h))||f.enumerable});return r};var Tn=(r,i,s)=>(s=r!=null?En(An(r)):{},Bn(gt(s,"default",{value:r,enumerable:!0}),r));var S=mt(()=>{});var x=mt(()=>{});var At=xn(ce=>{x();S();Object.defineProperty(ce,"__esModule",{value:!0});ce.clearGlobalNamespace=ce.getGlobalisedValue=void 0;var On="globalise__singleton__",Pn={},Et=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:Pn,Nn=(r,i)=>{if(typeof r!="string")throw "Invalid namespace key";if(typeof i!="string")throw "Invalid item key"},It=r=>`${On}${r}`,_t=r=>{let i=Et(),s=It(r);return i[s]||(i[s]={}),i[s]},Rn=(r,i)=>_t(r)[i]||void 0,Cn=(r,i,s)=>{let f=_t(r);f[i]=s;},Ln=(r,i,s)=>{Nn(r,i);let f=Rn(r,i);return f!==void 0?f:(Cn(r,i,s),s)};ce.getGlobalisedValue=Ln;var Mn=r=>{let i=Et(),s=It(r);i[s]!==void 0&&delete i[s];};ce.clearGlobalNamespace=Mn;});x();S();x();S();x();S();x();S();var Oe="https://api.immutable.com",yt="/v1/audience/messages",wt="/v1/audience/tracking-consent",z="imtbl_anon_id",H="_imtbl_sid",Pe="session_start",Ne="session_end",q=()=>typeof window<"u"&&typeof document<"u",Y=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let i=Math.trunc(Math.random()*16);return (r==="x"?i:i%4+8).toString(16)}),Re=()=>new Date().toISOString();function le(r){if(!q())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function fe(r,i,s,f){if(!q())return;let h=window.location.protocol==="https:"?"; Secure":"",p=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${s}; SameSite=Lax${p}${h}`;}function he(r,i){fe(r,"",0,i);}function ye(r){let i=le(z);if(i)return i;let s=Y();return fe(z,s,63072e3,r),s}function Ce(r,i){fe(z,r,63072e3,i);}x();S();x();S();x();S();var Le=class{constructor(i=0,s=0,f=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=i,this.resetTtl=f,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(i){if(this.has(i)){let s=this.items[i];delete this.items[i],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(i=this.keys()){return i.map(s=>[s,this.get(s)])}evict(i=!1){if(i||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(i){let s;return this.has(i)&&(s=this.items[i].expiry),s}get(i){let s;if(this.has(i)){let f=this.items[i];this.ttl>0&&f.expiry<=Date.now()?this.delete(i):(s=f.value,this.set(i,s,!0));}return s}has(i){return i in this.items}keys(){let i=[],s=this.first;for(;s!==null;)i.push(s.key),s=s.next;return i}set(i,s,f=!1,h=this.resetTtl){let 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 vt(r=1e3,i=0,s=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(i)||i<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new Le(r,i,s)}var kn={max:1e3},bt=(r,i={})=>{let{cache:s,cacheKeyResolver:f=Me,onHit:h,lruOptions:p={}}=i,a={...kn,...p},g=s||vt(a.max,a.ttl);function m(...v){let b=f(...v),w=g.get(b);if(g.has(b))return h&&h(b,w,g),w;let d=r.apply(this,v);return g.set(b,d),d}return m._cache=g,m},Me=(...r)=>r.length===0?"no-args":r.map(i=>i===void 0?"undefined":i===null?"null":Array.isArray(i)?`[${Me(...i)}]`:typeof i=="object"?`{${Me(...Un(i))}}`:JSON.stringify(i)).join(","),Un=r=>Object.entries(r).sort((i,s)=>i[0]<s[0]?-1:1);var He=Tn(At()),$n=Object.defineProperty,Dn=(r,i)=>{for(var s in i)$n(r,s,{get:i[s],enumerable:!0});};function Ye(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}var V=[],pe=!1,ee,_e=-1;function Fn(){!pe||!ee||(pe=!1,ee.length?V=ee.concat(V):_e=-1,V.length&&Ut());}function Ut(){if(!pe){var r=setTimeout(Fn,0);pe=!0;for(var i=V.length;i;){for(ee=V,V=[];++_e<i;)ee&&ee[_e].run();_e=-1,i=V.length;}ee=null,pe=!1,clearTimeout(r);}}function jn(r){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];V.push(new Ot(r,i)),V.length===1&&!pe&&setTimeout(Ut,0);}function Ot(r,i){this.fun=r,this.array=i;}Ot.prototype.run=function(){this.fun.apply(null,this.array);};var Gn="browser",qn="x64",Vn="browser",Kn={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},zn=["/usr/bin/node"],Hn=[],Yn="v16.8.0",Wn={},Jn=function(r,i){console.warn((i?i+": ":"")+r);},Xn=function(r){Ye("binding");},Qn=function(r){return 0},Zn=function(){return "/"},er=function(r){},tr={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function R(){}var nr=R,rr=[];function ir(r){Ye("_linkedBinding");}var sr={},or=!1,ar={};function ur(r){Ye("dlopen");}function lr(){return []}function fr(){return []}var hr=R,cr=R,We=function(){return {}},pr=We,dr=We,gr=R,mr=R,yr=R,wr={};function vr(r,i){if(!r)throw new Error(i||"assertion error")}var br={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Er=R,Ir=R;function _r(){return !1}var Ar=R,Sr=R,xr=R,Br=R,Tr=R,kr=void 0,Ur=void 0,Or=void 0,Pr=R,Nr=2,Rr=1,Cr="/bin/usr/node",Lr=9229,Mr="node",$r=[],Dr=R,W={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};W.now===void 0&&($e=Date.now(),W.timing&&W.timing.navigationStart&&($e=W.timing.navigationStart),W.now=()=>Date.now()-$e);var $e;function Fr(){return W.now()/1e3}var Fe=1e9;function je(r){var i=Math.floor((Date.now()-W.now())*.001),s=W.now()*.001,f=Math.floor(s)+i,h=Math.floor(s%1*1e9);return r&&(f=f-r[0],h=h-r[1],h<0&&(f--,h+=Fe)),[f,h]}je.bigint=function(r){var i=je(r);return typeof BigInt>"u"?i[0]*Fe+i[1]:BigInt(i[0]*Fe)+BigInt(i[1])};var jr=10,Gr={},qr=0;function J(){return Ge}var Vr=J,Kr=J,zr=J,Hr=J,Yr=J,Wr=R,Jr=J,Xr=J;function Qr(r){return []}var Ge={version:Yn,versions:Wn,arch:qn,platform:Vn,release:tr,_rawDebug:nr,moduleLoadList:rr,binding:Xn,_linkedBinding:ir,_events:Gr,_eventsCount:qr,_maxListeners:jr,on:J,addListener:Vr,once:Kr,off:zr,removeListener:Hr,removeAllListeners:Yr,emit:Wr,prependListener:Jr,prependOnceListener:Xr,listeners:Qr,domain:sr,_exiting:or,config:ar,dlopen:ur,uptime:Fr,_getActiveRequests:lr,_getActiveHandles:fr,reallyExit:hr,_kill:cr,cpuUsage:We,resourceUsage:pr,memoryUsage:dr,kill:gr,exit:mr,openStdin:yr,allowedNodeEnvironmentFlags:wr,assert:vr,features:br,_fatalExceptions:Er,setUncaughtExceptionCaptureCallback:Ir,hasUncaughtExceptionCaptureCallback:_r,emitWarning:Jn,nextTick:jn,_tickCallback:Ar,_debugProcess:Sr,_debugEnd:xr,_startProfilerIdleNotifier:Br,_stopProfilerIdleNotifier:Tr,stdout:kr,stdin:Or,stderr:Ur,abort:Pr,umask:Qn,chdir:er,cwd:Zn,env:Kn,title:Gn,argv:zn,execArgv:Hn,pid:Nr,ppid:Rr,execPath:Cr,debugPort:Lr,hrtime:je,argv0:Mr,_preload_modules:$r,setSourceMapsEnabled:Dr},we={},St=!1;function Zr(){if(St)return we;St=!0,we.byteLength=g,we.toByteArray=v,we.fromByteArray=E;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 I=d.indexOf("=");I===-1&&(I=y);var T=I===y?0:4-I%4;return [I,T]}function g(d){var y=a(d),I=y[0],T=y[1];return (I+T)*3/4-T}function m(d,y,I){return (y+I)*3/4-I}function v(d){var y,I=a(d),T=I[0],N=I[1],k=new s(m(d,T,N)),L=0,$=N>0?T-4:T,C;for(C=0;C<$;C+=4)y=i[d.charCodeAt(C)]<<18|i[d.charCodeAt(C+1)]<<12|i[d.charCodeAt(C+2)]<<6|i[d.charCodeAt(C+3)],k[L++]=y>>16&255,k[L++]=y>>8&255,k[L++]=y&255;return N===2&&(y=i[d.charCodeAt(C)]<<2|i[d.charCodeAt(C+1)]>>4,k[L++]=y&255),N===1&&(y=i[d.charCodeAt(C)]<<10|i[d.charCodeAt(C+1)]<<4|i[d.charCodeAt(C+2)]>>2,k[L++]=y>>8&255,k[L++]=y&255),k}function b(d){return r[d>>18&63]+r[d>>12&63]+r[d>>6&63]+r[d&63]}function w(d,y,I){for(var T,N=[],k=y;k<I;k+=3)T=(d[k]<<16&16711680)+(d[k+1]<<8&65280)+(d[k+2]&255),N.push(b(T));return N.join("")}function E(d){for(var y,I=d.length,T=I%3,N=[],k=16383,L=0,$=I-T;L<$;L+=k)N.push(w(d,L,L+k>$?$:L+k));return T===1?(y=d[I-1],N.push(r[y>>2]+r[y<<4&63]+"==")):T===2&&(y=(d[I-2]<<8)+d[I-1],N.push(r[y>>10]+r[y>>4&63]+r[y<<2&63]+"=")),N.join("")}return we}var Ie={},xt=!1;function ei(){return xt?Ie:(xt=!0,Ie.read=function(r,i,s,f,h){var p,a,g=h*8-f-1,m=(1<<g)-1,v=m>>1,b=-7,w=s?h-1:0,E=s?-1:1,d=r[i+w];for(w+=E,p=d&(1<<-b)-1,d>>=-b,b+=g;b>0;p=p*256+r[i+w],w+=E,b-=8);for(a=p&(1<<-b)-1,p>>=-b,b+=f;b>0;a=a*256+r[i+w],w+=E,b-=8);if(p===0)p=1-v;else {if(p===m)return a?NaN:(d?-1:1)*(1/0);a=a+Math.pow(2,f),p=p-v;}return (d?-1:1)*a*Math.pow(2,p-f)},Ie.write=function(r,i,s,f,h,p){var a,g,m,v=p*8-h-1,b=(1<<v)-1,w=b>>1,E=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=f?0:p-1,y=f?1:-1,I=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(g=isNaN(i)?1:0,a=b):(a=Math.floor(Math.log(i)/Math.LN2),i*(m=Math.pow(2,-a))<1&&(a--,m*=2),a+w>=1?i+=E/m:i+=E*Math.pow(2,1-w),i*m>=2&&(a++,m/=2),a+w>=b?(g=0,a=b):a+w>=1?(g=(i*m-1)*Math.pow(2,h),a=a+w):(g=i*Math.pow(2,w-1)*Math.pow(2,h),a=0));h>=8;r[s+d]=g&255,d+=y,g/=256,h-=8);for(a=a<<h|g,v+=h;v>0;r[s+d]=a&255,d+=y,a/=256,v-=8);r[s+d-y]|=I*128;},Ie)}var Z={},Bt=!1;function ti(){if(Bt)return Z;Bt=!0;let r=Zr(),i=ei(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Z.Buffer=a,Z.SlowBuffer=N,Z.INSPECT_MAX_BYTES=50;let f=2147483647;Z.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=h(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function h(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return !1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function 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 b(e)}return g(e,t,n)}a.poolSize=8192;function g(e,t,n){if(typeof e=="string")return w(e,t);if(ArrayBuffer.isView(e))return 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(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(G(e,SharedArrayBuffer)||e&&G(e.buffer,SharedArrayBuffer)))return y(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let u=I(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 v(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 v(e,t,n)};function b(e){return m(e),p(e<0?0:T(e)|0)}a.allocUnsafe=function(e){return b(e)},a.allocUnsafeSlow=function(e){return b(e)};function w(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=k(e,t)|0,o=p(n),u=o.write(e,t);return u!==n&&(o=o.slice(0,u)),o}function E(e){let t=e.length<0?0:T(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(G(e,Uint8Array)){let t=new Uint8Array(e);return y(t.buffer,t.byteOffset,t.byteLength)}return E(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 I(e){if(a.isBuffer(e)){let t=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"||Ue(e.length)?p(0):E(e);if(e.type==="Buffer"&&Array.isArray(e.data))return E(e.data)}function T(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function N(e){return +e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype},a.compare=function(e,t){if(G(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),G(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,o=t.length;for(let u=0,l=Math.min(n,o);u<l;++u)if(e[u]!==t[u]){n=e[u],o=t[u];break}return n<o?-1:o<n?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=a.allocUnsafe(t),u=0;for(n=0;n<e.length;++n){let l=e[n];if(G(l,Uint8Array))u+l.length>o.length?(a.isBuffer(l)||(l=a.from(l)),l.copy(o,u)):Uint8Array.prototype.set.call(o,l,u);else if(a.isBuffer(l))l.copy(o,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=l.length;}return o};function k(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let u=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ke(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return dt(e).length;default:if(u)return o?-1:ke(e).length;t=(""+t).toLowerCase(),u=!0;}}a.byteLength=k;function L(e,t,n){let o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return "";for(e||(e="utf8");;)switch(e){case"hex":return cn(this,t,n);case"utf8":case"utf-8":return st(this,t,n);case"ascii":return fn(this,t,n);case"latin1":case"binary":return hn(this,t,n);case"base64":return un(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pn(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?st(this,0,e):L.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=Z.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,o,u){if(G(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),u===void 0&&(u=this.length),t<0||n>e.length||o<0||u>this.length)throw new RangeError("out of range index");if(o>=u&&t>=n)return 0;if(o>=u)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,u>>>=0,this===e)return 0;let l=u-o,c=n-t,A=Math.min(l,c),P=this.slice(o,u),B=e.slice(t,n);for(let _=0;_<A;++_)if(P[_]!==B[_]){l=P[_],c=B[_];break}return l<c?-1:c<l?1:0};function C(e,t,n,o,u){if(e.length===0)return -1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ue(n)&&(n=u?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(u)return -1;n=e.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:it(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):it(e,[t],n,o,u);throw new TypeError("val must be string, number or Buffer")}function it(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 P(_,U){return l===1?_[U]:_.readUInt16BE(U*l)}let B;if(u){let _=-1;for(B=n;B<c;B++)if(P(e,B)===P(t,_===-1?0:B-_)){if(_===-1&&(_=B),B-_+1===A)return _*l}else _!==-1&&(B-=B-_),_=-1;}else for(n+A>c&&(n=c-A),B=n;B>=0;B--){let _=!0;for(let U=0;U<A;U++)if(P(e,B+U)!==P(t,U)){_=!1;break}if(_)return B}return -1}a.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},a.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)};function nn(e,t,n,o){n=Number(n)||0;let u=e.length-n;o?(o=Number(o),o>u&&(o=u)):o=u;let l=t.length;o>l/2&&(o=l/2);let c;for(c=0;c<o;++c){let A=parseInt(t.substr(c*2,2),16);if(Ue(A))return c;e[n+c]=A;}return c}function rn(e,t,n,o){return Ee(ke(t,e.length-n),e,n,o)}function sn(e,t,n,o){return Ee(yn(t),e,n,o)}function on(e,t,n,o){return Ee(dt(t),e,n,o)}function an(e,t,n,o){return Ee(wn(t,e.length-n),e,n,o)}a.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((n===void 0||n>u)&&(n=u),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let l=!1;for(;;)switch(o){case"hex":return nn(this,e,t,n);case"utf8":case"utf-8":return rn(this,e,t,n);case"ascii":case"latin1":case"binary":return sn(this,e,t,n);case"base64":return on(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return an(this,e,t,n);default:if(l)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),l=!0;}},a.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function un(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function st(e,t,n){n=Math.min(e.length,n);let o=[],u=t;for(;u<n;){let l=e[u],c=null,A=l>239?4:l>223?3:l>191?2:1;if(u+A<=n){let P,B,_,U;switch(A){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],B=e[u+2],(P&192)===128&&(B&192)===128&&(U=(l&15)<<12|(P&63)<<6|B&63,U>2047&&(U<55296||U>57343)&&(c=U));break;case 4:P=e[u+1],B=e[u+2],_=e[u+3],(P&192)===128&&(B&192)===128&&(_&192)===128&&(U=(l&15)<<18|(P&63)<<12|(B&63)<<6|_&63,U>65535&&U<1114112&&(c=U));}}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 ln(o)}let ot=4096;function ln(e){let t=e.length;if(t<=ot)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=ot));return n}function fn(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]&127);return o}function hn(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]);return o}function cn(e,t,n){let o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);let u="";for(let l=t;l<n;++l)u+=vn[e[l]];return u}function pn(e,t,n){let o=e.slice(t,n),u="";for(let l=0;l<o.length-1;l+=2)u+=String.fromCharCode(o[l]+o[l+1]*256);return u}a.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let o=this.subarray(e,t);return Object.setPrototypeOf(o,a.prototype),o};function O(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e+--t],u=1;for(;t>0&&(u*=256);)o+=this[e+--t]*u;return o},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||O(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||O(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||O(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||O(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=K(function(e){e=e>>>0,ue(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&me(e,this.length-8);let o=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(u)<<BigInt(32))}),a.prototype.readBigUInt64BE=K(function(e){e=e>>>0,ue(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&me(e,this.length-8);let o=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(u)}),a.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*t)),o},a.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||O(e,t,this.length);let o=t,u=1,l=this[e+--o];for(;o>0&&(u*=256);)l+=this[e+--o]*u;return u*=128,l>=u&&(l-=Math.pow(2,8*t)),l},a.prototype.readInt8=function(e,t){return e=e>>>0,t||O(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||O(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||O(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||O(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=K(function(e){e=e>>>0,ue(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&me(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=K(function(e){e=e>>>0,ue(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&me(e,this.length-8);let o=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||O(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||O(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||O(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||O(e,8,this.length),i.read(this,e,!1,52,8)};function M(e,t,n,o,u,l){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>u||t<l)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let c=Math.pow(2,8*n)-1;M(this,e,t,n,c,0);}let u=1,l=0;for(this[t]=e&255;++l<n&&(u*=256);)this[t+l]=e/u&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let c=Math.pow(2,8*n)-1;M(this,e,t,n,c,0);}let u=n-1,l=1;for(this[t+u]=e&255;--u>=0&&(l*=256);)this[t+u]=e/l&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function at(e,t,n,o,u){pt(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 ut(e,t,n,o,u){pt(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n+7]=l,l=l>>8,e[n+6]=l,l=l>>8,e[n+5]=l,l=l>>8,e[n+4]=l;let c=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=c,c=c>>8,e[n+2]=c,c=c>>8,e[n+1]=c,c=c>>8,e[n]=c,n+8}a.prototype.writeBigUInt64LE=K(function(e,t=0){return at(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=K(function(e,t=0){return ut(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let A=Math.pow(2,8*n-1);M(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);M(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||M(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=K(function(e,t=0){return at(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=K(function(e,t=0){return ut(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lt(e,t,n,o,u,l){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ft(e,t,n,o,u){return t=+t,n=n>>>0,u||lt(e,t,n,4),i.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(e,t,n){return ft(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return ft(this,e,t,!1,n)};function ht(e,t,n,o,u){return t=+t,n=n>>>0,u||lt(e,t,n,8),i.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(e,t,n){return ht(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return ht(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,o){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let u=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),u},a.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let l=e.charCodeAt(0);(o==="utf8"&&l<128||o==="latin1")&&(e=l);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<n;++u)this[u]=e;else {let l=a.isBuffer(e)?e:a.from(e,o),c=l.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<n-t;++u)this[u+t]=l[u%c];}return this};let ae={};function Te(e,t,n){ae[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name;}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Te("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),Te("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,u=n;return Number.isInteger(n)&&Math.abs(n)>2**32?u=ct(String(n)):typeof n=="bigint"&&(u=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(u=ct(u)),u+="n"),o+=` It must be ${t}. Received ${u}`,o},RangeError);function ct(e){let t="",n=e.length,o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return `${e.slice(0,n)}${t}`}function dn(e,t,n){ue(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&me(t,e.length-(n+1));}function pt(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 ae.ERR_OUT_OF_RANGE("value",A,e)}dn(o,u,l);}function ue(e,t){if(typeof e!="number")throw new ae.ERR_INVALID_ARG_TYPE(t,"number",e)}function me(e,t,n){throw Math.floor(e)!==e?(ue(e,n),new ae.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new ae.ERR_BUFFER_OUT_OF_BOUNDS:new ae.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}let gn=/[^+/0-9A-Za-z-_]/g;function mn(e){if(e=e.split("=")[0],e=e.trim().replace(gn,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function ke(e,t){t=t||1/0;let n,o=e.length,u=null,l=[];for(let 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 yn(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function wn(e,t){let n,o,u,l=[];for(let c=0;c<e.length&&!((t-=2)<0);++c)n=e.charCodeAt(c),o=n>>8,u=n%256,l.push(u),l.push(o);return l}function dt(e){return r.toByteArray(mn(e))}function Ee(e,t,n,o){let u;for(u=0;u<o&&!(u+n>=t.length||u>=e.length);++u)t[u+n]=e[u];return u}function G(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ue(e){return e!==e}let vn=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let o=n*16;for(let u=0;u<16;++u)t[o+u]=e[n]+e[u];}return t}();function K(e){return typeof BigInt>"u"?bn:e}function bn(){throw new Error("BigInt not supported")}return Z}var ie=ti();ie.Buffer;ie.SlowBuffer;ie.INSPECT_MAX_BYTES;ie.kMaxLength;var Tt=ie.Buffer;ie.INSPECT_MAX_BYTES;ie.kMaxLength;var ni={};Dn(ni,{deleteItem:()=>oi,getItem:()=>qe,setItem:()=>Se});var Ae=()=>typeof window>"u",Pt=()=>!Ae(),ri="__IMX-",Je=()=>Pt()&&window.localStorage,ii=r=>{if(r!==null)try{return JSON.parse(r)}catch{return r}},si=r=>typeof r=="string"?r:JSON.stringify(r),Xe=r=>`${ri}${r}`;function qe(r){if(Je())return ii(window.localStorage.getItem(Xe(r)))}var Se=(r,i)=>Je()?(window.localStorage.setItem(Xe(r),si(i)),!0):!1,oi=r=>Je()?(window.localStorage.removeItem(Xe(r)),!0):!1,Ve=0,ai=r=>{let i=parseInt(r,10)*1e3,s=new Date(i),f=new Date;return Ve=s.getTime()-f.getTime(),Ve},ui=()=>{let r=new Date().getTime()+Ve;return new Date(r).toISOString()},li=(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))(li||{}),fi="https://api.immutable.com",hi=r=>{if(typeof Tt<"u")return Tt.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 Nt(r,i){let s=JSON.stringify(i),f={payload:hi(s)},h=await fetch(`${fi}${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 te,ne,ci=()=>{te=qe("metrics-events")||[],ne=qe("metrics-runtime")||{};};ci();var re=(r,i)=>{ne={...ne,[r]:i},Se("metrics-runtime",ne);},Ke=r=>{if(ne[r]!==void 0)return ne[r]},pi=()=>ne,di=()=>te,gi=r=>{te.push(r),Se("metrics-events",te);},mi=r=>{te=te.slice(r),Se("metrics-events",te);},Rt=r=>{let i=[];return Object.entries(r).forEach(([s,f])=>{(typeof s=="string"||typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&i.push([s,f.toString()]);}),i},De="2.20.1",yi=()=>Ae()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",wi=()=>{if(Ae())return "";let r;try{window.self!==window.top&&(r=yi());}catch{}return r||(r=window.location.hostname),r},vi=()=>{if(re("sdkVersion",De),Ae())return {browser:"nodejs",sdkVersion:De};let r=wi();return r&&re("domain",r),{sdkVersion:De,browser:window.navigator.userAgent,domain:r,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},ze=!1,bi=()=>ze,Ei=async()=>{ze=!0;try{let r=Rt(vi()),i=Ke("rid"),s=Ke("uid"),f=await Nt("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:s}}),{runtimeId:h,sTime:p}=f;re("rid",h),ai(p);}catch{ze=!1;}};function D(r,i){return (...s)=>{try{let f=r(...s);return f instanceof Promise?f.catch(()=>i):f}catch{return i}}}function Ii(){return Pt()||typeof Ge>"u"?!1:Ge.env.JEST_WORKER_ID!==void 0}var _i=D(Ii,!1),Ct="imtbl__metrics",Ai=5e3,Si=1e3,ve=(r,i)=>(0, He.getGlobalisedValue)(Ct,r,i),xi=(r,i)=>{let s=bt(i,{lruOptions:{ttl:Ai,max:Si}});return (0, He.getGlobalisedValue)(Ct,r,s)},Bi=5e3,Ti=(r,i,s)=>{let f={event:`${r}.${i}`,time:ui(),...s&&{properties:Rt(s)}};gi(f);},se=D(xi("track",Ti)),ki=async()=>{if(bi()===!1){await Ei();return}let r=di();if(r.length===0)return;let i=r.length,s=pi();await Nt("/v1/sdk/metrics",{version:1,data:{events:r,details:s}})instanceof Error||mi(i);},Ui=D(ki),Lt=async()=>{await Ui(),setTimeout(Lt,Bi);},kt=!1,Oi=()=>{kt||(kt=!0,Lt());};_i()||D(ve("startFlushing",Oi))();var $i=(r,i,s,f)=>{let{message:h}=s,p=s.stack||"",{cause:a}=s;a instanceof Error&&(p=`${p}
|
|
2
2
|
Cause: ${a.message}
|
|
3
|
-
${a.stack}`),te(r,`trackError_${i}`,{...f||{},errorMessage:c,errorStack:p,isTrackError:!0});},kt=D(Ri),Mi=r=>{Z("env",r);};D(de("setEnvironment",Mi));var $i=r=>{Z("passportClientId",r);};D(de("setPassportClientId",$i));var Di=r=>{Z("pak",r);};D(de("setPublishableApiKey",Di));D(de("getDetail",Fe));var Fi={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},Pt="https://api.immutable.com",ji="/v1/audience/messages",Gi="/v1/audience/tracking-consent",le="imtbl_anon_id",ue="_imtbl_sid",Nt="session_start",Rt="session_end",ge=()=>typeof window<"u"&&typeof document<"u",fe=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let i=Math.trunc(Math.random()*16);return (r==="x"?i:i%4+8).toString(16)}),Ct=()=>new Date().toISOString();function Se(r){if(!ge())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function Ae(r,i,s,f){if(!ge())return;let c=window.location.protocol==="https:"?"; Secure":"",p=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${s}; SameSite=Lax${p}${c}`;}function ye(r,i){Ae(r,"",0,i);}function xe(r){let i=Se(le);if(i)return i;let s=fe();return Ae(le,s,63072e3,r),s}var _e=class extends Error{status;endpoint;body;constructor(r){super(`audience transport failed: ${r.status||"network error"} ${r.endpoint}`,r.cause!==void 0?{cause:r.cause}:void 0),this.name="TransportError",this.status=r.status,this.endpoint=r.endpoint,this.body=r.body;}},ae=class extends Error{code;status;endpoint;responseBody;cause;constructor(r){super(r.message),this.name="AudienceError",this.code=r.code,this.status=r.status,this.endpoint=r.endpoint,this.responseBody=r.responseBody,this.cause=r.cause;}};function Lt(r,i,s){if(r.status===0)return new ae({code:"NETWORK_ERROR",message:i==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:r.endpoint,cause:r.cause});if(r.status>=200&&r.status<300){let f=r.body,c=f?.rejected??0,p=f?.accepted??0;return new ae({code:"VALIDATION_REJECTED",message:`Backend rejected ${c} of ${c+p} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return r.status===429?new ae({code:"RATE_LIMITED",message:i==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:r.status,endpoint:r.endpoint,responseBody:r.body}):r.status>=400&&r.status<500?new ae({code:i==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush rejected with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body}):new ae({code:i==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush failed with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body,cause:r.cause})}function Mt(r,i){if(r)try{r(i);}catch{}}var qi=3e4;function Vi(r){let i=r.get?.("retry-after");if(!i)return null;let s=Number(i.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let f=new Date(i);if(!Number.isNaN(f.getTime())){let c=f.getTime()-Date.now();return c>0?c:null}return null}async function Ut(r){let i=r.headers?.get?.("content-type")??"";try{return i.includes("application/json")?await r.json():await r.text()}catch{return}}var We=async(r,i,s,f)=>{let c=new AbortController,p=setTimeout(()=>c.abort(),qi);try{let a=await fetch(r,{method:f?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(s),keepalive:f?.keepalive,signal:c.signal});if(a.status===429){te("audience","transport_send_failed",{status:429});let y=Vi(a.headers);return {ok:!1,error:new _e({status:429,endpoint:r}),...y!==null?{retryAfterMs:y}:{}}}if(!a.ok){let y=await Ut(a);return te("audience","transport_send_failed",{status:a.status}),{ok:!1,error:new _e({status:a.status,endpoint:r,body:y})}}let g=await Ut(a);if(typeof g=="object"&&g!==null&&"rejected"in g){let y=g.rejected??0;if(y>0)return te("audience","transport_partial_rejected",{status:a.status,rejected:y}),{ok:!1,error:new _e({status:a.status,endpoint:r,body:g})}}return {ok:!0}}catch(a){let g=new _e({status:0,endpoint:r,cause:a});return kt("audience","transport_send",g),{ok:!1,error:g}}finally{clearTimeout(p);}},Ye="__imtbl_audience_";function Je(){try{return ge()&&typeof localStorage<"u"}catch{return !1}}function Ki(r,i=Ye){if(Je())try{let s=localStorage.getItem(`${i}${r}`);return s?JSON.parse(s):void 0}catch{return}}function zi(r,i,s=Ye){if(Je())try{localStorage.setItem(`${s}${r}`,JSON.stringify(i));}catch{}}function Hi(r,i=Ye){if(Je())try{localStorage.removeItem(`${i}${r}`);}catch{}}var He="queue",Ot=100,$t=class{constructor(r,i,s){this.send=r,this.publishableKey=i,this.endpointUrl=`${s?.baseUrl??Pt}${ji}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let f=Ki(He,this.storagePrefix)??[];this.messages=s?.staleFilter?f.filter(s.staleFilter):f;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;consecutiveFailures=0;nextAttemptAt=0;start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(r){this.messages.push(r),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let r=this.messages.slice(0,Ot),i={messages:r},s=await this.send(this.endpointUrl,this.publishableKey,i),f;!s.ok&&s.error&&(f=Lt(s.error,"flush",r.length));let c=f?.code==="VALIDATION_REJECTED";s.ok||c?(this.messages=this.messages.slice(r.length),this.persist(),this.resetBackoff()):f&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,r.length),f&&Mt(this.onError,f);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let r=this.messages.slice(0,Ot),i={messages:r};this.send(this.endpointUrl,this.publishableKey,i,{keepalive:!0}),this.messages=this.messages.slice(r.length),this.persist();}purge(r){this.messages=this.messages.filter(i=>!r(i)),this.persist();}transform(r){this.messages=this.messages.map(r),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],Hi(He,this.storagePrefix);}registerUnload(){!ge()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let r=Date.now();r<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=r+this.backoffDelayMs());}setBackoffUntil(r){this.consecutiveFailures++,this.nextAttemptAt=r;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){zi(He,this.messages,this.storagePrefix);}},Wi="2.20.1-alpha.1";function Dt(r="@imtbl/audience",i=Wi){let s={library:r,libraryVersion:i};return ge()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ft(r){let i=new Date(r).getTime();if(Number.isNaN(i))return !1;let s=Date.now();return i<=s+864e5&&i>=s-2592e6}function jt(r,i,s,f){return r!==s||i!==f}function me(r,i=256){return r.length>i?r.slice(0,i):r}function he(r){let i=Se(ue);if(i)return Ae(ue,i,1800,r),{sessionId:i,isNew:!1};let s=fe();return Ae(ue,s,1800,r),{sessionId:s,isNew:!0}}var Gt=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],qt=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Vt="__imtbl_attribution";function Yi(r){let i;try{i=new URL(r).searchParams;}catch{return {}}let s={};for(let c of [...Gt,...qt]){let p=i.get(c);p&&(s[c]=p);}let f=i.get("referral_code");return f&&(s.referral_code=f),s}function Ji(){try{let r=sessionStorage.getItem(Vt);return r?JSON.parse(r):null}catch{return null}}function Xi(r){try{sessionStorage.setItem(Vt,JSON.stringify(r));}catch{}}function Kt(){let r=typeof window<"u"&&window.location?Yi(window.location.href):{},i=typeof document<"u"&&document.referrer||void 0,s=qt.some(c=>c in r),f=Gt.some(c=>c in r);return {...r,referrer:i,touchpoint_type:s||f?"click":void 0}}function zt(){let r=Ji();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,s={...Kt(),landing_page:i};return Xi(s),s}function Ht(){return Kt()}function H(r){return r!=="none"}function ne(r){return r==="full"}function Wt(r,i,s,f,c,p,a,g){let y=p??"none",x={none:0,anonymous:1,full:2};function v(w){let b=`${g??Pt}${Gi}`;i(b,s,{anonymousId:f,status:w,source:c},{method:"PUT",keepalive:!0}).then(d=>{!d.ok&&d.error&&Mt(a,Lt(d.error,"consent"));});}return {get level(){return y},setLevel(w){w!==y&&(x[w]<x[y]&&(w==="none"?r.purge(()=>!0):w==="anonymous"&&(r.purge(b=>b.type==="identify"||b.type==="alias"),r.transform(b=>{if("userId"in b){let{userId:d,...m}=b;return m}return b}))),y=w,v(w));}}}T();B();T();B();var Yt="@imtbl/audience",Jt="2.20.1-alpha.1",W="[audience]",Xt="WebSDK";var Be=class{enabled;constructor(i=!1){this.enabled=i;}logEvent(i,s){this.enabled&&console.log(`${W} ${i}`,s);}logFlush(i,s){this.enabled&&console.log(`${W} flush ${i?"ok":"failed"} (${s} messages)`);}logConsent(i,s){this.enabled&&console.log(`${W} consent ${i} \u2192 ${s}`);}logWarning(i){this.enabled&&console.warn(`${W} ${i}`);}};var Qi=new Set(["sign_up","link_clicked"]),Xe=class r{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;constructor(i){let{cookieDomain:s,publishableKey:f}=i,c=i.consent??"none",p=Xt;this.cookieDomain=s,this.testMode=i.testMode??!1,this.debug=new Be(i.debug??!1);let a=!1;H(c)?(this.anonymousId=xe(s),a=this.startSession()):this.anonymousId=Se(le)??fe(),this.queue=new $t(We,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(g,y)=>this.debug.logFlush(g,y),onError:i.onError,staleFilter:g=>Ft(g.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Wt(this.queue,We,f,this.anonymousId,p,c,i.onError,i.baseUrl),this.attribution=zt(),this.isTrackingDisabled()||(this.queue.start(),a&&this.trackSessionStart());}static init(i){if(!i.publishableKey?.trim())throw new Error(`${W} publishableKey is required`);return r.liveInstances>0&&console.warn(`${W} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),r.liveInstances+=1,new r(i)}isTrackingDisabled(){return !H(this.consent.level)}effectiveUserId(){return ne(this.consent.level)?this.userId:void 0}startSession(){let i=he(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:fe(),eventTimestamp:Ct(),anonymousId:this.anonymousId,surface:"web",context:Dt(Yt,Jt),...this.testMode&&{test:!0}}}enqueue(i,s){this.queue.enqueue(s),this.debug.logEvent(i,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:Nt,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Rt,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;he(this.cookieDomain);let s={session_id:this.sessionId,...i};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(i,...s){if(this.isTrackingDisabled())return;he(this.cookieDomain);let[f]=s,c={session_id:this.sessionId,...Qi.has(i)?Ht():{},...f};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:me(i),properties:c,userId:this.effectiveUserId()});}identify(i,s,f){if(!ne(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}he(this.cookieDomain);let c=me(i);this.userId=c,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:c,identityType:s,traits:f});}alias(i,s){if(!ne(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!jt(i.id,i.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}he(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:me(i.id),fromType:i.identityType,toId:me(s.id),toType:s.identityType});}setConsent(i){let s=this.consent.level;if(i===s)return;this.debug.logConsent(s,i);let f=!H(s)&&H(i);if(f&&(this.anonymousId=xe(this.cookieDomain)),H(i)||this.queue.stop(),this.consent.setLevel(i),H(i)?ne(s)&&!ne(i)&&(this.userId=void 0):(ye(le,this.cookieDomain),ye(ue,this.cookieDomain)),f){this.isFirstPage=!0;let c=this.startSession();this.queue.start(),c&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),ye(le,this.cookieDomain),ye(ue,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=fe(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=xe(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),r.liveInstances=Math.max(0,r.liveInstances-1));}};T();B();var Zi={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked"};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3
|
+
${a.stack}`),se(r,`trackError_${i}`,{...f||{},errorMessage:h,errorStack:p,isTrackError:!0});},Mt=D($i),ji=r=>{re("env",r);};D(ve("setEnvironment",ji));var Gi=r=>{re("passportClientId",r);};D(ve("setPassportClientId",Gi));var qi=r=>{re("pak",r);};D(ve("setPublishableApiKey",qi));D(ve("getDetail",Ke));var Vi={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},xe=class extends Error{status;endpoint;body;constructor(r){super(`audience transport failed: ${r.status||"network error"} ${r.endpoint}`,r.cause!==void 0?{cause:r.cause}:void 0),this.name="TransportError",this.status=r.status,this.endpoint=r.endpoint,this.body=r.body;}},de=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 Ft(r,i,s){if(r.status===0)return new de({code:"NETWORK_ERROR",message:i==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:r.endpoint,cause:r.cause});if(r.status>=200&&r.status<300){let f=r.body,h=f?.rejected??0,p=f?.accepted??0;return new de({code:"VALIDATION_REJECTED",message:`Backend rejected ${h} of ${h+p} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return r.status===429?new de({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 de({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 de({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 jt(r,i){if(r)try{r(i);}catch{}}var Ki=3e4;function zi(r){let i=r.get?.("retry-after");if(!i)return null;let s=Number(i.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let f=new Date(i);if(!Number.isNaN(f.getTime())){let h=f.getTime()-Date.now();return h>0?h:null}return null}function Qe(){try{return q()?navigator.onLine:void 0}catch{return}}async function $t(r){let i=r.headers?.get?.("content-type")??"";try{return i.includes("application/json")?await r.json():await r.text()}catch{return}}var et=async(r,i,s,f)=>{let h=new AbortController,p=setTimeout(()=>h.abort(),Ki),a=Date.now();try{let g=await fetch(r,{method:f?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(s),keepalive:f?.keepalive,signal:h.signal});if(g.status===429){se("audience","transport_send_failed",{status:429,online:Qe(),timeToFailureMs:Date.now()-a});let v=zi(g.headers);return {ok:!1,error:new xe({status:429,endpoint:r}),...v!==null?{retryAfterMs:v}:{}}}if(!g.ok){let v=await $t(g);return se("audience","transport_send_failed",{status:g.status,online:Qe(),timeToFailureMs:Date.now()-a}),{ok:!1,error:new xe({status:g.status,endpoint:r,body:v})}}let m=await $t(g);if(typeof m=="object"&&m!==null&&"rejected"in m){let v=m.rejected??0;if(v>0)return se("audience","transport_partial_rejected",{status:g.status,rejected:v}),{ok:!1,error:new xe({status:g.status,endpoint:r,body:m})}}return {ok:!0}}catch(g){let m=new xe({status:0,endpoint:r,cause:g});return Mt("audience","transport_send",m,{errorName:g instanceof Error?g.name:void 0,online:Qe(),timeToFailureMs:Date.now()-a}),{ok:!1,error:m}}finally{clearTimeout(p);}},tt="__imtbl_audience_";function nt(){try{return q()&&typeof localStorage<"u"}catch{return !1}}function Hi(r,i=tt){if(nt())try{let s=localStorage.getItem(`${i}${r}`);return s?JSON.parse(s):void 0}catch{return}}function Yi(r,i,s=tt){if(nt())try{localStorage.setItem(`${s}${r}`,JSON.stringify(i));}catch{}}function Wi(r,i=tt){if(nt())try{localStorage.removeItem(`${i}${r}`);}catch{}}var Ze="queue",Dt=100,Gt=class{constructor(r,i,s){this.send=r,this.publishableKey=i,this.endpointUrl=`${s?.baseUrl??Oe}${yt}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let f=Hi(Ze,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,Dt),i={messages:r},s=await this.send(this.endpointUrl,this.publishableKey,i),f;!s.ok&&s.error&&(f=Ft(s.error,"flush",r.length));let h=f?.code==="VALIDATION_REJECTED";s.ok||h?(this.messages=this.messages.slice(r.length),this.persist(),this.resetBackoff()):f&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,r.length),f&&jt(this.onError,f);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let r=this.messages.slice(0,Dt),i={messages:r};this.send(this.endpointUrl,this.publishableKey,i,{keepalive:!0}),this.messages=this.messages.slice(r.length),this.persist();}purge(r){this.messages=this.messages.filter(i=>!r(i)),this.persist();}transform(r){this.messages=this.messages.map(r),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],Wi(Ze,this.storagePrefix);}registerUnload(){!q()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let r=Date.now();r<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=r+this.backoffDelayMs());}setBackoffUntil(r){this.consecutiveFailures++,this.nextAttemptAt=r;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Yi(Ze,this.messages,this.storagePrefix);}},Ji="2.20.1";function qt(r="@imtbl/audience",i=Ji){let s={library:r,libraryVersion:i};return q()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Vt(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 Kt(r,i,s,f){return r!==s||i!==f}function be(r,i=256){return r.length>i?r.slice(0,i):r}function ge(r){let i=le(H);if(i)return fe(H,i,1800,r),{sessionId:i,isNew:!1};let s=Y();return fe(H,s,1800,r),{sessionId:s,isNew:!0}}var zt=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Ht=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Yt="__imtbl_attribution";function Xi(r){let i;try{i=new URL(r).searchParams;}catch{return {}}let s={};for(let h of [...zt,...Ht]){let p=i.get(h);p&&(s[h]=p);}let f=i.get("referral_code");return f&&(s.referral_code=f),s}function Qi(){try{let r=sessionStorage.getItem(Yt);return r?JSON.parse(r):null}catch{return null}}function Zi(r){try{sessionStorage.setItem(Yt,JSON.stringify(r));}catch{}}function Wt(){let r=typeof window<"u"&&window.location?Xi(window.location.href):{},i=typeof document<"u"&&document.referrer||void 0,s=Ht.some(h=>h in r),f=zt.some(h=>h in r);return {...r,referrer:i,touchpoint_type:s||f?"click":void 0}}function Jt(){let r=Qi();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,s={...Wt(),landing_page:i};return Zi(s),s}function Xt(){return Wt()}function X(r){return r!=="none"}function oe(r){return r==="full"}function Qt(r,i,s,f,h,p,a,g){let m=p??"none",v={none:0,anonymous:1,full:2};function b(w){let E=`${g??Oe}${wt}`;i(E,s,{anonymousId:f,status:w,source:h},{method:"PUT",keepalive:!0}).then(d=>{!d.ok&&d.error&&jt(a,Ft(d.error,"consent"));});}return {get level(){return m},setLevel(w){w!==m&&(v[w]<v[m]&&(w==="none"?r.purge(()=>!0):w==="anonymous"&&(r.purge(E=>E.type==="identify"||E.type==="alias"),r.transform(E=>{if("userId"in E){let{userId:d,...y}=E;return y}return E}))),m=w,b(w));}}}x();S();x();S();x();S();var Zt="@imtbl/audience",en="2.20.1",Q="[audience]",tn="WebSDK";var Be=class{enabled;constructor(i=!1){this.enabled=i;}logEvent(i,s){this.enabled&&console.log(`${Q} ${i}`,s);}logFlush(i,s){this.enabled&&console.log(`${Q} flush ${i?"ok":"failed"} (${s} messages)`);}logConsent(i,s){this.enabled&&console.log(`${Q} consent ${i} \u2192 ${s}`);}logWarning(i){this.enabled&&console.warn(`${Q} ${i}`);}};var es=new Set(["sign_up","link_clicked"]),rt=class r{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;static UUID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;static readAndStripAidParam(){if(!q())return null;let i=new URLSearchParams(window.location.search),s=i.get("imtbl_aid");if(s!==null){i.delete("imtbl_aid");let f=i.toString(),h=`${window.location.pathname}${f?`?${f}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",h);}return s&&r.UUID_RE.test(s)?s:null}constructor(i){let{cookieDomain:s,publishableKey:f}=i,h=i.consent??"none",p=tn;this.cookieDomain=s,this.testMode=i.testMode??!1,this.debug=new Be(i.debug??!1);let a=r.readAndStripAidParam(),g=!1;X(h)?(a?(Ce(a,s),this.anonymousId=a):this.anonymousId=ye(s),g=this.startSession()):this.anonymousId=le(z)??Y(),this.queue=new Gt(et,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(m,v)=>this.debug.logFlush(m,v),onError:i.onError,staleFilter:m=>Vt(m.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Qt(this.queue,et,f,this.anonymousId,p,h,i.onError,i.baseUrl),this.attribution=Jt(),this.isTrackingDisabled()||(this.queue.start(),g&&this.trackSessionStart());}static init(i){if(!i.publishableKey?.trim())throw new Error(`${Q} publishableKey is required`);return r.liveInstances>0&&console.warn(`${Q} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),r.liveInstances+=1,new r(i)}getAnonymousId(){return this.anonymousId}isTrackingDisabled(){return !X(this.consent.level)}effectiveUserId(){return oe(this.consent.level)?this.userId:void 0}startSession(){let i=ge(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:Y(),eventTimestamp:Re(),anonymousId:this.anonymousId,surface:"web",context:qt(Zt,en),...this.testMode&&{test:!0}}}enqueue(i,s){this.queue.enqueue(s),this.debug.logEvent(i,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:Pe,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Ne,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;ge(this.cookieDomain);let s={session_id:this.sessionId,...i};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(i,...s){if(this.isTrackingDisabled())return;ge(this.cookieDomain);let[f]=s,h={session_id:this.sessionId,...es.has(i)?Xt():{},...f};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:be(i),properties:h,userId:this.effectiveUserId()});}identify(i,s,f){if(!oe(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}ge(this.cookieDomain);let h=be(i);this.userId=h,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:h,identityType:s,traits:f});}alias(i,s){if(!oe(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Kt(i.id,i.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}ge(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:be(i.id),fromType:i.identityType,toId:be(s.id),toType:s.identityType});}setConsent(i){let s=this.consent.level;if(i===s)return;this.debug.logConsent(s,i);let f=!X(s)&&X(i);if(f&&(this.anonymousId=ye(this.cookieDomain)),X(i)||this.queue.stop(),this.consent.setLevel(i),X(i)?oe(s)&&!oe(i)&&(this.userId=void 0):(he(z,this.cookieDomain),he(H,this.cookieDomain)),f){this.isFirstPage=!0;let h=this.startSession();this.queue.start(),h&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),he(z,this.cookieDomain),he(H,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=Y(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=ye(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),r.liveInstances=Math.max(0,r.liveInstances-1));}};x();S();var ts={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked",BUTTON_CLICKED:"button_clicked"};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
4
4
|
/*! Bundled license information:
|
|
5
5
|
|
|
6
6
|
tiny-lru/dist/tiny-lru.js:
|
|
@@ -13,4 +13,4 @@ tiny-lru/dist/tiny-lru.js:
|
|
|
13
13
|
*)
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
export {
|
|
16
|
+
export { rt as Audience, de as AudienceError, ts as AudienceEvents, Vi as IdentityType, oe as canIdentify, X as canTrack };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
(function () {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var wn=Object.create;var Oe=Object.defineProperty;var bn=Object.getOwnPropertyDescriptor;var vn=Object.getOwnPropertyNames;var En=Object.getPrototypeOf,In=Object.prototype.hasOwnProperty;var An=(r,i,s)=>i in r?Oe(r,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[i]=s;var _n=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var Sn=(r,i,s,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let h of vn(i))!In.call(r,h)&&h!==s&&Oe(r,h,{get:()=>i[h],enumerable:!(f=bn(i,h))||f.enumerable});return r};var Bn=(r,i,s)=>(s=r!=null?wn(En(r)):{},Sn(Oe(s,"default",{value:r,enumerable:!0}),r));var b=(r,i,s)=>An(r,typeof i!="symbol"?i+"":i,s);var gt=_n(re=>{Object.defineProperty(re,"__esModule",{value:!0});re.clearGlobalNamespace=re.getGlobalisedValue=void 0;var kn="globalise__singleton__",Un={},ct=()=>typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:Un,On=(r,i)=>{if(typeof r!="string")throw "Invalid namespace key";if(typeof i!="string")throw "Invalid item key"},dt=r=>`${kn}${r}`,pt=r=>{let i=ct(),s=dt(r);return i[s]||(i[s]={}),i[s]},Nn=(r,i)=>pt(r)[i]||void 0,Rn=(r,i,s)=>{let f=pt(r);f[i]=s;},Cn=(r,i,s)=>{On(r,i);let f=Nn(r,i);return f!==void 0?f:(Rn(r,i,s),s)};re.getGlobalisedValue=Cn;var Ln=r=>{let i=ct(),s=dt(r);i[s]!==void 0&&delete i[s];};re.clearGlobalNamespace=Ln;});var Ne=class{constructor(i=0,s=0,f=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=i,this.resetTtl=f,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(i){if(this.has(i)){let s=this.items[i];delete this.items[i],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(i=this.keys()){return i.map(s=>[s,this.get(s)])}evict(i=!1){if(i||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(i){let s;return this.has(i)&&(s=this.items[i].expiry),s}get(i){let s;if(this.has(i)){let f=this.items[i];this.ttl>0&&f.expiry<=Date.now()?this.delete(i):(s=f.value,this.set(i,s,!0));}return s}has(i){return i in this.items}keys(){let i=[],s=this.first;for(;s!==null;)i.push(s.key),s=s.next;return i}set(i,s,f=!1,h=this.resetTtl){let c;if(f||this.has(i)){if(c=this.items[i],c.value=s,f===!1&&h&&(c.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==c){let a=this.last,y=c.next,g=c.prev;this.first===c&&(this.first=c.next),c.next=null,c.prev=this.last,a.next=c,g!==null&&(g.next=y),y!==null&&(y.prev=g);}}else this.max>0&&this.size===this.max&&this.evict(!0),c=this.items[i]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:i,prev:this.last,next:null,value:s},++this.size===1?this.first=c:this.last.next=c;return this.last=c,this}values(i=this.keys()){return i.map(s=>this.get(s))}};function ft(r=1e3,i=0,s=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(i)||i<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new Ne(r,i,s)}var xn={max:1e3},ht=(r,i={})=>{let{cache:s,cacheKeyResolver:f=Re,onHit:h,lruOptions:c={}}=i,a={...xn,...c},y=s||ft(a.max,a.ttl);function g(...E){let m=f(...E),v=y.get(m);if(y.has(m))return h&&h(m,v,y),v;let p=r.apply(this,E);return y.set(m,p),p}return g._cache=y,g},Re=(...r)=>r.length===0?"no-args":r.map(i=>i===void 0?"undefined":i===null?"null":Array.isArray(i)?`[${Re(...i)}]`:typeof i=="object"?`{${Re(...Tn(i))}}`:JSON.stringify(i)).join(","),Tn=r=>Object.entries(r).sort((i,s)=>i[0]<s[0]?-1:1);var qe=Bn(gt()),Pn=Object.defineProperty,Mn=(r,i)=>{for(var s in i)Pn(r,s,{get:i[s],enumerable:!0});};function Ve(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}var F=[],se=!1,W,be=-1;function $n(){!se||!W||(se=!1,W.length?F=W.concat(F):be=-1,F.length&&Et());}function Et(){if(!se){var r=setTimeout($n,0);se=!0;for(var i=F.length;i;){for(W=F,F=[];++be<i;)W&&W[be].run();be=-1,i=F.length;}W=null,se=!1,clearTimeout(r);}}function Dn(r){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];F.push(new It(r,i)),F.length===1&&!se&&setTimeout(Et,0);}function It(r,i){this.fun=r,this.array=i;}It.prototype.run=function(){this.fun.apply(null,this.array);};var Fn="browser",jn="x64",Gn="browser",qn={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Vn=["/usr/bin/node"],Kn=[],zn="v16.8.0",Yn={},Hn=function(r,i){console.warn((i?i+": ":"")+r);},Wn=function(r){Ve("binding");},Jn=function(r){return 0},Xn=function(){return "/"},Qn=function(r){},Zn={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function R(){}var ei=R,ti=[];function ni(r){Ve("_linkedBinding");}var ii={},ri=!1,si={};function oi(r){Ve("dlopen");}function ai(){return []}function ui(){return []}var li=R,fi=R,Ke=function(){return {}},hi=Ke,ci=Ke,di=R,pi=R,gi=R,yi={};function mi(r,i){if(!r)throw new Error(i||"assertion error")}var wi={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},bi=R,vi=R;function Ei(){return !1}var Ii=R,Ai=R,_i=R,Si=R,Bi=R,xi=void 0,Ti=void 0,ki=void 0,Ui=R,Oi=2,Ni=1,Ri="/bin/usr/node",Ci=9229,Li="node",Pi=[],Mi=R,q={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};q.now===void 0&&(Ce=Date.now(),q.timing&&q.timing.navigationStart&&(Ce=q.timing.navigationStart),q.now=()=>Date.now()-Ce);var Ce;function $i(){return q.now()/1e3}var Pe=1e9;function Me(r){var i=Math.floor((Date.now()-q.now())*.001),s=q.now()*.001,f=Math.floor(s)+i,h=Math.floor(s%1*1e9);return r&&(f=f-r[0],h=h-r[1],h<0&&(f--,h+=Pe)),[f,h]}Me.bigint=function(r){var i=Me(r);return typeof BigInt>"u"?i[0]*Pe+i[1]:BigInt(i[0]*Pe)+BigInt(i[1])};var Di=10,Fi={},ji=0;function V(){return $e}var Gi=V,qi=V,Vi=V,Ki=V,zi=V,Yi=R,Hi=V,Wi=V;function Ji(r){return []}var $e={version:zn,versions:Yn,arch:jn,platform:Gn,release:Zn,_rawDebug:ei,moduleLoadList:ti,binding:Wn,_linkedBinding:ni,_events:Fi,_eventsCount:ji,_maxListeners:Di,on:V,addListener:Gi,once:qi,off:Vi,removeListener:Ki,removeAllListeners:zi,emit:Yi,prependListener:Hi,prependOnceListener:Wi,listeners:Ji,domain:ii,_exiting:ri,config:si,dlopen:oi,uptime:$i,_getActiveRequests:ai,_getActiveHandles:ui,reallyExit:li,_kill:fi,cpuUsage:Ke,resourceUsage:hi,memoryUsage:ci,kill:di,exit:pi,openStdin:gi,allowedNodeEnvironmentFlags:yi,assert:mi,features:wi,_fatalExceptions:bi,setUncaughtExceptionCaptureCallback:vi,hasUncaughtExceptionCaptureCallback:Ei,emitWarning:Hn,nextTick:Dn,_tickCallback:Ii,_debugProcess:Ai,_debugEnd:_i,_startProfilerIdleNotifier:Si,_stopProfilerIdleNotifier:Bi,stdout:xi,stdin:ki,stderr:Ti,abort:Ui,umask:Jn,chdir:Qn,cwd:Xn,env:qn,title:Fn,argv:Vn,execArgv:Kn,pid:Oi,ppid:Ni,execPath:Ri,debugPort:Ci,hrtime:Me,argv0:Li,_preload_modules:Pi,setSourceMapsEnabled:Mi},he={},yt=!1;function Xi(){if(yt)return he;yt=!0,he.byteLength=y,he.toByteArray=E,he.fromByteArray=I;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h=0,c=f.length;h<c;++h)r[h]=f[h],i[f.charCodeAt(h)]=h;i[45]=62,i[95]=63;function a(p){var w=p.length;if(w%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var A=p.indexOf("=");A===-1&&(A=w);var x=A===w?0:4-A%4;return [A,x]}function y(p){var w=a(p),A=w[0],x=w[1];return (A+x)*3/4-x}function g(p,w,A){return (w+A)*3/4-A}function E(p){var w,A=a(p),x=A[0],N=A[1],T=new s(g(p,x,N)),L=0,M=N>0?x-4:x,C;for(C=0;C<M;C+=4)w=i[p.charCodeAt(C)]<<18|i[p.charCodeAt(C+1)]<<12|i[p.charCodeAt(C+2)]<<6|i[p.charCodeAt(C+3)],T[L++]=w>>16&255,T[L++]=w>>8&255,T[L++]=w&255;return N===2&&(w=i[p.charCodeAt(C)]<<2|i[p.charCodeAt(C+1)]>>4,T[L++]=w&255),N===1&&(w=i[p.charCodeAt(C)]<<10|i[p.charCodeAt(C+1)]<<4|i[p.charCodeAt(C+2)]>>2,T[L++]=w>>8&255,T[L++]=w&255),T}function m(p){return r[p>>18&63]+r[p>>12&63]+r[p>>6&63]+r[p&63]}function v(p,w,A){for(var x,N=[],T=w;T<A;T+=3)x=(p[T]<<16&16711680)+(p[T+1]<<8&65280)+(p[T+2]&255),N.push(m(x));return N.join("")}function I(p){for(var w,A=p.length,x=A%3,N=[],T=16383,L=0,M=A-x;L<M;L+=T)N.push(v(p,L,L+T>M?M:L+T));return x===1?(w=p[A-1],N.push(r[w>>2]+r[w<<4&63]+"==")):x===2&&(w=(p[A-2]<<8)+p[A-1],N.push(r[w>>10]+r[w>>4&63]+r[w<<2&63]+"=")),N.join("")}return he}var we={},mt=!1;function Qi(){return mt?we:(mt=!0,we.read=function(r,i,s,f,h){var c,a,y=h*8-f-1,g=(1<<y)-1,E=g>>1,m=-7,v=s?h-1:0,I=s?-1:1,p=r[i+v];for(v+=I,c=p&(1<<-m)-1,p>>=-m,m+=y;m>0;c=c*256+r[i+v],v+=I,m-=8);for(a=c&(1<<-m)-1,c>>=-m,m+=f;m>0;a=a*256+r[i+v],v+=I,m-=8);if(c===0)c=1-E;else {if(c===g)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,f),c=c-E;}return (p?-1:1)*a*Math.pow(2,c-f)},we.write=function(r,i,s,f,h,c){var a,y,g,E=c*8-h-1,m=(1<<E)-1,v=m>>1,I=h===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=f?0:c-1,w=f?1:-1,A=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(y=isNaN(i)?1:0,a=m):(a=Math.floor(Math.log(i)/Math.LN2),i*(g=Math.pow(2,-a))<1&&(a--,g*=2),a+v>=1?i+=I/g:i+=I*Math.pow(2,1-v),i*g>=2&&(a++,g/=2),a+v>=m?(y=0,a=m):a+v>=1?(y=(i*g-1)*Math.pow(2,h),a=a+v):(y=i*Math.pow(2,v-1)*Math.pow(2,h),a=0));h>=8;r[s+p]=y&255,p+=w,y/=256,h-=8);for(a=a<<h|y,E+=h;E>0;r[s+p]=a&255,p+=w,a/=256,E-=8);r[s+p-w]|=A*128;},we)}var H={},wt=!1;function Zi(){if(wt)return H;wt=!0;let r=Xi(),i=Qi(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;H.Buffer=a,H.SlowBuffer=N,H.INSPECT_MAX_BYTES=50;let f=2147483647;H.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=h(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function h(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch(e){return !1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function c(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(e)}return y(e,t,n)}a.poolSize=8192;function y(e,t,n){if(typeof e=="string")return v(e,t);if(ArrayBuffer.isView(e))return p(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(D(e,ArrayBuffer)||e&&D(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(D(e,SharedArrayBuffer)||e&&D(e.buffer,SharedArrayBuffer)))return w(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let u=A(e);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,t,n){return y(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function g(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function E(e,t,n){return g(e),e<=0?c(e):t!==void 0?typeof n=="string"?c(e).fill(t,n):c(e).fill(t):c(e)}a.alloc=function(e,t,n){return E(e,t,n)};function m(e){return g(e),c(e<0?0:x(e)|0)}a.allocUnsafe=function(e){return m(e)},a.allocUnsafeSlow=function(e){return m(e)};function v(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=T(e,t)|0,o=c(n),u=o.write(e,t);return u!==n&&(o=o.slice(0,u)),o}function I(e){let t=e.length<0?0:x(e.length)|0,n=c(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function p(e){if(D(e,Uint8Array)){let t=new Uint8Array(e);return w(t.buffer,t.byteOffset,t.byteLength)}return I(e)}function w(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return t===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,n),Object.setPrototypeOf(o,a.prototype),o}function A(e){if(a.isBuffer(e)){let t=x(e.length)|0,n=c(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!="number"||Ue(e.length)?c(0):I(e);if(e.type==="Buffer"&&Array.isArray(e.data))return I(e.data)}function x(e){if(e>=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return e|0}function N(e){return +e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==a.prototype},a.compare=function(e,t){if(D(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),D(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,o=t.length;for(let u=0,l=Math.min(n,o);u<l;++u)if(e[u]!==t[u]){n=e[u],o=t[u];break}return n<o?-1:o<n?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=a.allocUnsafe(t),u=0;for(n=0;n<e.length;++n){let l=e[n];if(D(l,Uint8Array))u+l.length>o.length?(a.isBuffer(l)||(l=a.from(l)),l.copy(o,u)):Uint8Array.prototype.set.call(o,l,u);else if(a.isBuffer(l))l.copy(o,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=l.length;}return o};function T(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||D(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let u=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ke(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return lt(e).length;default:if(u)return o?-1:ke(e).length;t=(""+t).toLowerCase(),u=!0;}}a.byteLength=T;function L(e,t,n){let o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return "";for(e||(e="utf8");;)switch(e){case"hex":return ln(this,t,n);case"utf8":case"utf-8":return et(this,t,n);case"ascii":return an(this,t,n);case"latin1":case"binary":return un(this,t,n);case"base64":return sn(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fn(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0;}}a.prototype._isBuffer=!0;function M(e,t,n){let o=e[t];e[t]=e[n],e[n]=o;}a.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)M(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)M(this,t,t+3),M(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)M(this,t,t+7),M(this,t+1,t+6),M(this,t+2,t+5),M(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?et(this,0,e):L.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=H.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,o,u){if(D(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),u===void 0&&(u=this.length),t<0||n>e.length||o<0||u>this.length)throw new RangeError("out of range index");if(o>=u&&t>=n)return 0;if(o>=u)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,u>>>=0,this===e)return 0;let l=u-o,d=n-t,S=Math.min(l,d),O=this.slice(o,u),B=e.slice(t,n);for(let _=0;_<S;++_)if(O[_]!==B[_]){l=O[_],d=B[_];break}return l<d?-1:d<l?1:0};function C(e,t,n,o,u){if(e.length===0)return -1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ue(n)&&(n=u?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(u)return -1;n=e.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:Ze(e,t,n,o,u);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?u?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Ze(e,[t],n,o,u);throw new TypeError("val must be string, number or Buffer")}function Ze(e,t,n,o,u){let l=1,d=e.length,S=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return -1;l=2,d/=2,S/=2,n/=2;}function O(_,k){return l===1?_[k]:_.readUInt16BE(k*l)}let B;if(u){let _=-1;for(B=n;B<d;B++)if(O(e,B)===O(t,_===-1?0:B-_)){if(_===-1&&(_=B),B-_+1===S)return _*l}else _!==-1&&(B-=B-_),_=-1;}else for(n+S>d&&(n=d-S),B=n;B>=0;B--){let _=!0;for(let k=0;k<S;k++)if(O(e,B+k)!==O(t,k)){_=!1;break}if(_)return B}return -1}a.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},a.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)};function Zt(e,t,n,o){n=Number(n)||0;let u=e.length-n;o?(o=Number(o),o>u&&(o=u)):o=u;let l=t.length;o>l/2&&(o=l/2);let d;for(d=0;d<o;++d){let S=parseInt(t.substr(d*2,2),16);if(Ue(S))return d;e[n+d]=S;}return d}function en(e,t,n,o){return me(ke(t,e.length-n),e,n,o)}function tn(e,t,n,o){return me(pn(t),e,n,o)}function nn(e,t,n,o){return me(lt(t),e,n,o)}function rn(e,t,n,o){return me(gn(t,e.length-n),e,n,o)}a.prototype.write=function(e,t,n,o){if(t===void 0)o="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")o=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let u=this.length-t;if((n===void 0||n>u)&&(n=u),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");let l=!1;for(;;)switch(o){case"hex":return Zt(this,e,t,n);case"utf8":case"utf-8":return en(this,e,t,n);case"ascii":case"latin1":case"binary":return tn(this,e,t,n);case"base64":return nn(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rn(this,e,t,n);default:if(l)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),l=!0;}},a.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function sn(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function et(e,t,n){n=Math.min(e.length,n);let o=[],u=t;for(;u<n;){let l=e[u],d=null,S=l>239?4:l>223?3:l>191?2:1;if(u+S<=n){let O,B,_,k;switch(S){case 1:l<128&&(d=l);break;case 2:O=e[u+1],(O&192)===128&&(k=(l&31)<<6|O&63,k>127&&(d=k));break;case 3:O=e[u+1],B=e[u+2],(O&192)===128&&(B&192)===128&&(k=(l&15)<<12|(O&63)<<6|B&63,k>2047&&(k<55296||k>57343)&&(d=k));break;case 4:O=e[u+1],B=e[u+2],_=e[u+3],(O&192)===128&&(B&192)===128&&(_&192)===128&&(k=(l&15)<<18|(O&63)<<12|(B&63)<<6|_&63,k>65535&&k<1114112&&(d=k));}}d===null?(d=65533,S=1):d>65535&&(d-=65536,o.push(d>>>10&1023|55296),d=56320|d&1023),o.push(d),u+=S;}return on(o)}let tt=4096;function on(e){let t=e.length;if(t<=tt)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=tt));return n}function an(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]&127);return o}function un(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]);return o}function ln(e,t,n){let o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);let u="";for(let l=t;l<n;++l)u+=yn[e[l]];return u}function fn(e,t,n){let o=e.slice(t,n),u="";for(let l=0;l<o.length-1;l+=2)u+=String.fromCharCode(o[l]+o[l+1]*256);return u}a.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let o=this.subarray(e,t);return Object.setPrototypeOf(o,a.prototype),o};function U(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e+--t],u=1;for(;t>0&&(u*=256);)o+=this[e+--t]*u;return o},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||U(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||U(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||U(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=G(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let o=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(u)<<BigInt(32))}),a.prototype.readBigUInt64BE=G(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let o=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(u)}),a.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*t)),o},a.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=t,u=1,l=this[e+--o];for(;o>0&&(u*=256);)l+=this[e+--o]*u;return u*=128,l>=u&&(l-=Math.pow(2,8*t)),l},a.prototype.readInt8=function(e,t){return e=e>>>0,t||U(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||U(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||U(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=G(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=G(function(e){e=e>>>0,ie(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&fe(e,this.length-8);let o=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||U(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||U(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||U(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||U(e,8,this.length),i.read(this,e,!1,52,8)};function P(e,t,n,o,u,l){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>u||t<l)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let d=Math.pow(2,8*n)-1;P(this,e,t,n,d,0);}let u=1,l=0;for(this[t]=e&255;++l<n&&(u*=256);)this[t+l]=e/u&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let d=Math.pow(2,8*n)-1;P(this,e,t,n,d,0);}let u=n-1,l=1;for(this[t+u]=e&255;--u>=0&&(l*=256);)this[t+u]=e/l&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function nt(e,t,n,o,u){ut(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l,l=l>>8,e[n++]=l;let d=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=d,d=d>>8,e[n++]=d,d=d>>8,e[n++]=d,d=d>>8,e[n++]=d,n}function it(e,t,n,o,u){ut(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n+7]=l,l=l>>8,e[n+6]=l,l=l>>8,e[n+5]=l,l=l>>8,e[n+4]=l;let d=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=d,d=d>>8,e[n+2]=d,d=d>>8,e[n+1]=d,d=d>>8,e[n]=d,n+8}a.prototype.writeBigUInt64LE=G(function(e,t=0){return nt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=G(function(e,t=0){return it(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let S=Math.pow(2,8*n-1);P(this,e,t,n,S-1,-S);}let u=0,l=1,d=0;for(this[t]=e&255;++u<n&&(l*=256);)e<0&&d===0&&this[t+u-1]!==0&&(d=1),this[t+u]=(e/l>>0)-d&255;return t+n},a.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let S=Math.pow(2,8*n-1);P(this,e,t,n,S-1,-S);}let u=n-1,l=1,d=0;for(this[t+u]=e&255;--u>=0&&(l*=256);)e<0&&d===0&&this[t+u+1]!==0&&(d=1),this[t+u]=(e/l>>0)-d&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=G(function(e,t=0){return nt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=G(function(e,t=0){return it(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function rt(e,t,n,o,u,l){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function st(e,t,n,o,u){return t=+t,n=n>>>0,u||rt(e,t,n,4),i.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(e,t,n){return st(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return st(this,e,t,!1,n)};function ot(e,t,n,o,u){return t=+t,n=n>>>0,u||rt(e,t,n,8),i.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(e,t,n){return ot(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return ot(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,o){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let u=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),u},a.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let l=e.charCodeAt(0);(o==="utf8"&&l<128||o==="latin1")&&(e=l);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<n;++u)this[u]=e;else {let l=a.isBuffer(e)?e:a.from(e,o),d=l.length;if(d===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<n-t;++u)this[u+t]=l[u%d];}return this};let ne={};function Te(e,t,n){ne[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name;}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Te("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),Te("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,u=n;return Number.isInteger(n)&&Math.abs(n)>2**32?u=at(String(n)):typeof n=="bigint"&&(u=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(u=at(u)),u+="n"),o+=` It must be ${t}. Received ${u}`,o},RangeError);function at(e){let t="",n=e.length,o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return `${e.slice(0,n)}${t}`}function hn(e,t,n){ie(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&fe(t,e.length-(n+1));}function ut(e,t,n,o,u,l){if(e>n||e<t){let d=typeof t=="bigint"?"n":"",S;throw t===0||t===BigInt(0)?S=`>= 0${d} and < 2${d} ** ${(l+1)*8}${d}`:S=`>= -(2${d} ** ${(l+1)*8-1}${d}) and < 2 ** ${(l+1)*8-1}${d}`,new ne.ERR_OUT_OF_RANGE("value",S,e)}hn(o,u,l);}function ie(e,t){if(typeof e!="number")throw new ne.ERR_INVALID_ARG_TYPE(t,"number",e)}function fe(e,t,n){throw Math.floor(e)!==e?(ie(e,n),new ne.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new ne.ERR_BUFFER_OUT_OF_BOUNDS:new ne.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}let cn=/[^+/0-9A-Za-z-_]/g;function dn(e){if(e=e.split("=")[0],e=e.trim().replace(cn,""),e.length<2)return "";for(;e.length%4!==0;)e=e+"=";return e}function ke(e,t){t=t||1/0;let n,o=e.length,u=null,l=[];for(let d=0;d<o;++d){if(n=e.charCodeAt(d),n>55295&&n<57344){if(!u){if(n>56319){(t-=3)>-1&&l.push(239,191,189);continue}else if(d+1===o){(t-=3)>-1&&l.push(239,191,189);continue}u=n;continue}if(n<56320){(t-=3)>-1&&l.push(239,191,189),u=n;continue}n=(u-55296<<10|n-56320)+65536;}else u&&(t-=3)>-1&&l.push(239,191,189);if(u=null,n<128){if((t-=1)<0)break;l.push(n);}else if(n<2048){if((t-=2)<0)break;l.push(n>>6|192,n&63|128);}else if(n<65536){if((t-=3)<0)break;l.push(n>>12|224,n>>6&63|128,n&63|128);}else if(n<1114112){if((t-=4)<0)break;l.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128);}else throw new Error("Invalid code point")}return l}function pn(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function gn(e,t){let n,o,u,l=[];for(let d=0;d<e.length&&!((t-=2)<0);++d)n=e.charCodeAt(d),o=n>>8,u=n%256,l.push(u),l.push(o);return l}function lt(e){return r.toByteArray(dn(e))}function me(e,t,n,o){let u;for(u=0;u<o&&!(u+n>=t.length||u>=e.length);++u)t[u+n]=e[u];return u}function D(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ue(e){return e!==e}let yn=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let o=n*16;for(let u=0;u<16;++u)t[o+u]=e[n]+e[u];}return t}();function G(e){return typeof BigInt>"u"?mn:e}function mn(){throw new Error("BigInt not supported")}return H}var Z=Zi();Z.Buffer;Z.SlowBuffer;Z.INSPECT_MAX_BYTES;Z.kMaxLength;var bt=Z.Buffer;Z.INSPECT_MAX_BYTES;Z.kMaxLength;var er={};Mn(er,{deleteItem:()=>rr,getItem:()=>De,setItem:()=>Ee});var ve=()=>typeof window>"u",At=()=>!ve(),tr="__IMX-",ze=()=>At()&&window.localStorage,nr=r=>{if(r!==null)try{return JSON.parse(r)}catch(i){return r}},ir=r=>typeof r=="string"?r:JSON.stringify(r),Ye=r=>`${tr}${r}`;function De(r){if(ze())return nr(window.localStorage.getItem(Ye(r)))}var Ee=(r,i)=>ze()?(window.localStorage.setItem(Ye(r),ir(i)),!0):!1,rr=r=>ze()?(window.localStorage.removeItem(Ye(r)),!0):!1,Fe=0,sr=r=>{let i=parseInt(r,10)*1e3,s=new Date(i),f=new Date;return Fe=s.getTime()-f.getTime(),Fe},or=()=>{let r=new Date().getTime()+Fe;return new Date(r).toISOString()},ar=(r=>(r.RUNTIME_ID="rid",r.PASSPORT_CLIENT_ID="passportClientId",r.ENVIRONMENT="env",r.PUBLISHABLE_API_KEY="pak",r.IDENTITY="uid",r.DOMAIN="domain",r.SDK_VERSION="sdkVersion",r))(ar||{}),ur="https://api.immutable.com",lr=r=>{if(typeof bt<"u")return bt.from(r,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(unescape(encodeURIComponent(r)));throw new Error("Base64 encoding not supported in this environment")};async function _t(r,i){let s=JSON.stringify(i),f={payload:lr(s)},h=await fetch(`${ur}${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!h.ok){let c=await h.text().catch(()=>"");throw new Error(`Request failed (${h.status}): ${c||h.statusText}`)}return h.json()}var J,X,fr=()=>{J=De("metrics-events")||[],X=De("metrics-runtime")||{};};fr();var Q=(r,i)=>{X={...X,[r]:i},Ee("metrics-runtime",X);},je=r=>{if(X[r]!==void 0)return X[r]},hr=()=>X,cr=()=>J,dr=r=>{J.push(r),Ee("metrics-events",J);},pr=r=>{J=J.slice(r),Ee("metrics-events",J);},St=r=>{let i=[];return Object.entries(r).forEach(([s,f])=>{(typeof s=="string"||typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&i.push([s,f.toString()]);}),i},Le="2.20.1-alpha.1",gr=()=>ve()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",yr=()=>{if(ve())return "";let r;try{window.self!==window.top&&(r=gr());}catch(i){}return r||(r=window.location.hostname),r},mr=()=>{if(Q("sdkVersion",Le),ve())return {browser:"nodejs",sdkVersion:Le};let r=yr();return r&&Q("domain",r),{sdkVersion:Le,browser:window.navigator.userAgent,domain:r,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},Ge=!1,wr=()=>Ge,br=async()=>{Ge=!0;try{let r=St(mr()),i=je("rid"),s=je("uid"),f=await _t("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:s}}),{runtimeId:h,sTime:c}=f;Q("rid",h),sr(c);}catch(r){Ge=!1;}};function $(r,i){return (...s)=>{try{let f=r(...s);return f instanceof Promise?f.catch(()=>i):f}catch(f){return i}}}function vr(){return At()||typeof $e>"u"?!1:$e.env.JEST_WORKER_ID!==void 0}var Er=$(vr,!1),Bt="imtbl__metrics",Ir=5e3,Ar=1e3,ce=(r,i)=>(0, qe.getGlobalisedValue)(Bt,r,i),_r=(r,i)=>{let s=ht(i,{lruOptions:{ttl:Ir,max:Ar}});return (0, qe.getGlobalisedValue)(Bt,r,s)},Sr=5e3,Br=(r,i,s)=>{let f={event:`${r}.${i}`,time:or(),...s&&{properties:St(s)}};dr(f);},ee=$(_r("track",Br)),xr=async()=>{if(wr()===!1){await br();return}let r=cr();if(r.length===0)return;let i=r.length,s=hr();await _t("/v1/sdk/metrics",{version:1,data:{events:r,details:s}})instanceof Error||pr(i);},Tr=$(xr),xt=async()=>{await Tr(),setTimeout(xt,Sr);},vt=!1,kr=()=>{vt||(vt=!0,xt());};Er()||$(ce("startFlushing",kr))();var Pr=(r,i,s,f)=>{let{message:h}=s,c=s.stack||"",{cause:a}=s;a instanceof Error&&(c=`${c}
|
|
4
|
+
var In=Object.create;var Oe=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var _n=Object.getOwnPropertyNames;var Sn=Object.getPrototypeOf,Bn=Object.prototype.hasOwnProperty;var xn=(r,i,s)=>i in r?Oe(r,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[i]=s;var Tn=(r,i)=>()=>(i||r((i={exports:{}}).exports,i),i.exports);var kn=(r,i,s,f)=>{if(i&&typeof i=="object"||typeof i=="function")for(let c of _n(i))!Bn.call(r,c)&&c!==s&&Oe(r,c,{get:()=>i[c],enumerable:!(f=An(i,c))||f.enumerable});return r};var Un=(r,i,s)=>(s=r!=null?In(Sn(r)):{},kn(Oe(s,"default",{value:r,enumerable:!0}),r));var w=(r,i,s)=>xn(r,typeof i!="symbol"?i+"":i,s);var At=Tn(ce=>{Object.defineProperty(ce,"__esModule",{value:!0});ce.clearGlobalNamespace=ce.getGlobalisedValue=void 0;var Rn="globalise__singleton__",Cn={},vt=()=>typeof window!="undefined"?window:typeof globalThis!="undefined"?globalThis:Cn,Ln=(r,i)=>{if(typeof r!="string")throw "Invalid namespace key";if(typeof i!="string")throw "Invalid item key"},Et=r=>`${Rn}${r}`,It=r=>{let i=vt(),s=Et(r);return i[s]||(i[s]={}),i[s]},Pn=(r,i)=>It(r)[i]||void 0,Mn=(r,i,s)=>{let f=It(r);f[i]=s;},$n=(r,i,s)=>{Ln(r,i);let f=Pn(r,i);return f!==void 0?f:(Mn(r,i,s),s)};ce.getGlobalisedValue=$n;var Dn=r=>{let i=vt(),s=Et(r);i[s]!==void 0&&delete i[s];};ce.clearGlobalNamespace=Dn;});var Ne="https://api.immutable.com",mt="/v1/audience/messages",yt="/v1/audience/tracking-consent",K="imtbl_anon_id",z="_imtbl_sid",Re="session_start",Ce="session_end",j=()=>typeof window<"u"&&typeof document<"u",Y=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let i=Math.trunc(Math.random()*16);return (r==="x"?i:i%4+8).toString(16)}),Le=()=>new Date().toISOString();function ue(r){if(!j())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function le(r,i,s,f){if(!j())return;let c=window.location.protocol==="https:"?"; Secure":"",h=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${s}; SameSite=Lax${h}${c}`;}function fe(r,i){le(r,"",0,i);}function ge(r){let i=ue(K);if(i)return i;let s=Y();return le(K,s,63072e3,r),s}function Pe(r,i){le(K,r,63072e3,i);}var Me=class{constructor(i=0,s=0,f=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=i,this.resetTtl=f,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(i){if(this.has(i)){let s=this.items[i];delete this.items[i],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(i=this.keys()){return i.map(s=>[s,this.get(s)])}evict(i=!1){if(i||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(i){let s;return this.has(i)&&(s=this.items[i].expiry),s}get(i){let s;if(this.has(i)){let f=this.items[i];this.ttl>0&&f.expiry<=Date.now()?this.delete(i):(s=f.value,this.set(i,s,!0));}return s}has(i){return i in this.items}keys(){let i=[],s=this.first;for(;s!==null;)i.push(s.key),s=s.next;return i}set(i,s,f=!1,c=this.resetTtl){let h;if(f||this.has(i)){if(h=this.items[i],h.value=s,f===!1&&c&&(h.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==h){let a=this.last,g=h.next,E=h.prev;this.first===h&&(this.first=h.next),h.next=null,h.prev=this.last,a.next=h,E!==null&&(E.next=g),g!==null&&(g.prev=E);}}else this.max>0&&this.size===this.max&&this.evict(!0),h=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=h:this.last.next=h;return this.last=h,this}values(i=this.keys()){return i.map(s=>this.get(s))}};function wt(r=1e3,i=0,s=!1){if(isNaN(r)||r<0)throw new TypeError("Invalid max value");if(isNaN(i)||i<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new Me(r,i,s)}var On={max:1e3},bt=(r,i={})=>{let{cache:s,cacheKeyResolver:f=$e,onHit:c,lruOptions:h={}}=i,a={...On,...h},g=s||wt(a.max,a.ttl);function E(...v){let y=f(...v),m=g.get(y);if(g.has(y))return c&&c(y,m,g),m;let p=r.apply(this,v);return g.set(y,p),p}return E._cache=g,E},$e=(...r)=>r.length===0?"no-args":r.map(i=>i===void 0?"undefined":i===null?"null":Array.isArray(i)?`[${$e(...i)}]`:typeof i=="object"?`{${$e(...Nn(i))}}`:JSON.stringify(i)).join(","),Nn=r=>Object.entries(r).sort((i,s)=>i[0]<s[0]?-1:1);var He=Un(At()),Fn=Object.defineProperty,jn=(r,i)=>{for(var s in i)Fn(r,s,{get:i[s],enumerable:!0});};function We(r){throw new Error("Node.js process "+r+" is not supported by JSPM core outside of Node.js")}var G=[],he=!1,Z,Ie=-1;function Gn(){!he||!Z||(he=!1,Z.length?G=Z.concat(G):Ie=-1,G.length&&kt());}function kt(){if(!he){var r=setTimeout(Gn,0);he=!0;for(var i=G.length;i;){for(Z=G,G=[];++Ie<i;)Z&&Z[Ie].run();Ie=-1,i=G.length;}Z=null,he=!1,clearTimeout(r);}}function qn(r){var i=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)i[s-1]=arguments[s];G.push(new Ut(r,i)),G.length===1&&!he&&setTimeout(kt,0);}function Ut(r,i){this.fun=r,this.array=i;}Ut.prototype.run=function(){this.fun.apply(null,this.array);};var Vn="browser",Kn="x64",zn="browser",Yn={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},Hn=["/usr/bin/node"],Wn=[],Jn="v16.8.0",Xn={},Qn=function(r,i){console.warn((i?i+": ":"")+r);},Zn=function(r){We("binding");},ei=function(r){return 0},ti=function(){return "/"},ni=function(r){},ii={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function R(){}var ri=R,si=[];function oi(r){We("_linkedBinding");}var ai={},ui=!1,li={};function fi(r){We("dlopen");}function ci(){return []}function hi(){return []}var di=R,pi=R,Je=function(){return {}},gi=Je,mi=Je,yi=R,wi=R,bi=R,vi={};function Ei(r,i){if(!r)throw new Error(i||"assertion error")}var Ii={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Ai=R,_i=R;function Si(){return !1}var Bi=R,xi=R,Ti=R,ki=R,Ui=R,Oi=void 0,Ni=void 0,Ri=void 0,Ci=R,Li=2,Pi=1,Mi="/bin/usr/node",$i=9229,Di="node",Fi=[],ji=R,H={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};H.now===void 0&&(De=Date.now(),H.timing&&H.timing.navigationStart&&(De=H.timing.navigationStart),H.now=()=>Date.now()-De);var De;function Gi(){return H.now()/1e3}var je=1e9;function Ge(r){var i=Math.floor((Date.now()-H.now())*.001),s=H.now()*.001,f=Math.floor(s)+i,c=Math.floor(s%1*1e9);return r&&(f=f-r[0],c=c-r[1],c<0&&(f--,c+=je)),[f,c]}Ge.bigint=function(r){var i=Ge(r);return typeof BigInt>"u"?i[0]*je+i[1]:BigInt(i[0]*je)+BigInt(i[1])};var qi=10,Vi={},Ki=0;function W(){return qe}var zi=W,Yi=W,Hi=W,Wi=W,Ji=W,Xi=R,Qi=W,Zi=W;function er(r){return []}var qe={version:Jn,versions:Xn,arch:Kn,platform:zn,release:ii,_rawDebug:ri,moduleLoadList:si,binding:Zn,_linkedBinding:oi,_events:Vi,_eventsCount:Ki,_maxListeners:qi,on:W,addListener:zi,once:Yi,off:Hi,removeListener:Wi,removeAllListeners:Ji,emit:Xi,prependListener:Qi,prependOnceListener:Zi,listeners:er,domain:ai,_exiting:ui,config:li,dlopen:fi,uptime:Gi,_getActiveRequests:ci,_getActiveHandles:hi,reallyExit:di,_kill:pi,cpuUsage:Je,resourceUsage:gi,memoryUsage:mi,kill:yi,exit:wi,openStdin:bi,allowedNodeEnvironmentFlags:vi,assert:Ei,features:Ii,_fatalExceptions:Ai,setUncaughtExceptionCaptureCallback:_i,hasUncaughtExceptionCaptureCallback:Si,emitWarning:Qn,nextTick:qn,_tickCallback:Bi,_debugProcess:xi,_debugEnd:Ti,_startProfilerIdleNotifier:ki,_stopProfilerIdleNotifier:Ui,stdout:Oi,stdin:Ri,stderr:Ni,abort:Ci,umask:ei,chdir:ni,cwd:ti,env:Yn,title:Vn,argv:Hn,execArgv:Wn,pid:Li,ppid:Pi,execPath:Mi,debugPort:$i,hrtime:Ge,argv0:Di,_preload_modules:Fi,setSourceMapsEnabled:ji},me={},_t=!1;function tr(){if(_t)return me;_t=!0,me.byteLength=g,me.toByteArray=v,me.fromByteArray=I;for(var r=[],i=[],s=typeof Uint8Array<"u"?Uint8Array:Array,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,h=f.length;c<h;++c)r[c]=f[c],i[f.charCodeAt(c)]=c;i[45]=62,i[95]=63;function a(p){var b=p.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var A=p.indexOf("=");A===-1&&(A=b);var x=A===b?0:4-A%4;return [A,x]}function g(p){var b=a(p),A=b[0],x=b[1];return (A+x)*3/4-x}function E(p,b,A){return (b+A)*3/4-A}function v(p){var b,A=a(p),x=A[0],N=A[1],T=new s(E(p,x,N)),L=0,M=N>0?x-4:x,C;for(C=0;C<M;C+=4)b=i[p.charCodeAt(C)]<<18|i[p.charCodeAt(C+1)]<<12|i[p.charCodeAt(C+2)]<<6|i[p.charCodeAt(C+3)],T[L++]=b>>16&255,T[L++]=b>>8&255,T[L++]=b&255;return N===2&&(b=i[p.charCodeAt(C)]<<2|i[p.charCodeAt(C+1)]>>4,T[L++]=b&255),N===1&&(b=i[p.charCodeAt(C)]<<10|i[p.charCodeAt(C+1)]<<4|i[p.charCodeAt(C+2)]>>2,T[L++]=b>>8&255,T[L++]=b&255),T}function y(p){return r[p>>18&63]+r[p>>12&63]+r[p>>6&63]+r[p&63]}function m(p,b,A){for(var x,N=[],T=b;T<A;T+=3)x=(p[T]<<16&16711680)+(p[T+1]<<8&65280)+(p[T+2]&255),N.push(y(x));return N.join("")}function I(p){for(var b,A=p.length,x=A%3,N=[],T=16383,L=0,M=A-x;L<M;L+=T)N.push(m(p,L,L+T>M?M:L+T));return x===1?(b=p[A-1],N.push(r[b>>2]+r[b<<4&63]+"==")):x===2&&(b=(p[A-2]<<8)+p[A-1],N.push(r[b>>10]+r[b>>4&63]+r[b<<2&63]+"=")),N.join("")}return me}var Ee={},St=!1;function nr(){return St?Ee:(St=!0,Ee.read=function(r,i,s,f,c){var h,a,g=c*8-f-1,E=(1<<g)-1,v=E>>1,y=-7,m=s?c-1:0,I=s?-1:1,p=r[i+m];for(m+=I,h=p&(1<<-y)-1,p>>=-y,y+=g;y>0;h=h*256+r[i+m],m+=I,y-=8);for(a=h&(1<<-y)-1,h>>=-y,y+=f;y>0;a=a*256+r[i+m],m+=I,y-=8);if(h===0)h=1-v;else {if(h===E)return a?NaN:(p?-1:1)*(1/0);a=a+Math.pow(2,f),h=h-v;}return (p?-1:1)*a*Math.pow(2,h-f)},Ee.write=function(r,i,s,f,c,h){var a,g,E,v=h*8-c-1,y=(1<<v)-1,m=y>>1,I=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,p=f?0:h-1,b=f?1:-1,A=i<0||i===0&&1/i<0?1:0;for(i=Math.abs(i),isNaN(i)||i===1/0?(g=isNaN(i)?1:0,a=y):(a=Math.floor(Math.log(i)/Math.LN2),i*(E=Math.pow(2,-a))<1&&(a--,E*=2),a+m>=1?i+=I/E:i+=I*Math.pow(2,1-m),i*E>=2&&(a++,E/=2),a+m>=y?(g=0,a=y):a+m>=1?(g=(i*E-1)*Math.pow(2,c),a=a+m):(g=i*Math.pow(2,m-1)*Math.pow(2,c),a=0));c>=8;r[s+p]=g&255,p+=b,g/=256,c-=8);for(a=a<<c|g,v+=c;v>0;r[s+p]=a&255,p+=b,a/=256,v-=8);r[s+p-b]|=A*128;},Ee)}var Q={},Bt=!1;function ir(){if(Bt)return Q;Bt=!0;let r=tr(),i=nr(),s=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Q.Buffer=a,Q.SlowBuffer=N,Q.INSPECT_MAX_BYTES=50;let f=2147483647;Q.kMaxLength=f,a.TYPED_ARRAY_SUPPORT=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(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 h(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(e)}return g(e,t,n)}a.poolSize=8192;function g(e,t,n){if(typeof e=="string")return m(e,t);if(ArrayBuffer.isView(e))return p(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return b(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let u=A(e);if(u)return u;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,t,n){return g(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function E(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 v(e,t,n){return E(e),e<=0?h(e):t!==void 0?typeof n=="string"?h(e).fill(t,n):h(e).fill(t):h(e)}a.alloc=function(e,t,n){return v(e,t,n)};function y(e){return E(e),h(e<0?0:x(e)|0)}a.allocUnsafe=function(e){return y(e)},a.allocUnsafeSlow=function(e){return y(e)};function m(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=h(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=h(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function p(e){if(F(e,Uint8Array)){let t=new Uint8Array(e);return b(t.buffer,t.byteOffset,t.byteLength)}return I(e)}function b(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return t===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,n),Object.setPrototypeOf(o,a.prototype),o}function A(e){if(a.isBuffer(e)){let t=x(e.length)|0,n=h(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)?h(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(F(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),F(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,o=t.length;for(let u=0,l=Math.min(n,o);u<l;++u)if(e[u]!==t[u]){n=e[u],o=t[u];break}return n<o?-1:o<n?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return a.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let o=a.allocUnsafe(t),u=0;for(n=0;n<e.length;++n){let l=e[n];if(F(l,Uint8Array))u+l.length>o.length?(a.isBuffer(l)||(l=a.from(l)),l.copy(o,u)):Uint8Array.prototype.set.call(o,l,u);else if(a.isBuffer(l))l.copy(o,u);else throw new TypeError('"list" argument must be an Array of Buffers');u+=l.length;}return o};function T(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let u=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ke(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return gt(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 dn(this,t,n);case"utf8":case"utf-8":return ot(this,t,n);case"ascii":return cn(this,t,n);case"latin1":case"binary":return hn(this,t,n);case"base64":return ln(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pn(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?ot(this,0,e):L.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:a.compare(this,e)===0},a.prototype.inspect=function(){let e="",t=Q.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,o,u){if(F(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),u===void 0&&(u=this.length),t<0||n>e.length||o<0||u>this.length)throw new RangeError("out of range index");if(o>=u&&t>=n)return 0;if(o>=u)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,u>>>=0,this===e)return 0;let l=u-o,d=n-t,S=Math.min(l,d),O=this.slice(o,u),B=e.slice(t,n);for(let _=0;_<S;++_)if(O[_]!==B[_]){l=O[_],d=B[_];break}return l<d?-1:d<l?1:0};function C(e,t,n,o,u){if(e.length===0)return -1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ue(n)&&(n=u?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(u)return -1;n=e.length-1;}else if(n<0)if(u)n=0;else return -1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:st(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):st(e,[t],n,o,u);throw new TypeError("val must be string, number or Buffer")}function st(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 rn(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 sn(e,t,n,o){return ve(ke(t,e.length-n),e,n,o)}function on(e,t,n,o){return ve(wn(t),e,n,o)}function an(e,t,n,o){return ve(gt(t),e,n,o)}function un(e,t,n,o){return ve(bn(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 rn(this,e,t,n);case"utf8":case"utf-8":return sn(this,e,t,n);case"ascii":case"latin1":case"binary":return on(this,e,t,n);case"base64":return an(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return un(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 ln(e,t,n){return t===0&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function ot(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 fn(o)}let at=4096;function fn(e){let t=e.length;if(t<=at)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=at));return n}function cn(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]&127);return o}function hn(e,t,n){let o="";n=Math.min(e.length,n);for(let u=t;u<n;++u)o+=String.fromCharCode(e[u]);return o}function dn(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+=vn[e[l]];return u}function pn(e,t,n){let o=e.slice(t,n),u="";for(let l=0;l<o.length-1;l+=2)u+=String.fromCharCode(o[l]+o[l+1]*256);return u}a.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let o=this.subarray(e,t);return Object.setPrototypeOf(o,a.prototype),o};function U(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return o},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e+--t],u=1;for(;t>0&&(u*=256);)o+=this[e+--t]*u;return o},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e=e>>>0,t||U(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||U(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||U(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||U(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=V(function(e){e=e>>>0,ae(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&pe(e,this.length-8);let o=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,u=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(o)+(BigInt(u)<<BigInt(32))}),a.prototype.readBigUInt64BE=V(function(e){e=e>>>0,ae(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&pe(e,this.length-8);let o=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],u=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return (BigInt(o)<<BigInt(32))+BigInt(u)}),a.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=this[e],u=1,l=0;for(;++l<t&&(u*=256);)o+=this[e+l]*u;return u*=128,o>=u&&(o-=Math.pow(2,8*t)),o},a.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||U(e,t,this.length);let o=t,u=1,l=this[e+--o];for(;o>0&&(u*=256);)l+=this[e+--o]*u;return u*=128,l>=u&&(l-=Math.pow(2,8*t)),l},a.prototype.readInt8=function(e,t){return e=e>>>0,t||U(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},a.prototype.readInt16LE=function(e,t){e=e>>>0,t||U(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},a.prototype.readInt16BE=function(e,t){e=e>>>0,t||U(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},a.prototype.readInt32LE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e=e>>>0,t||U(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=V(function(e){e=e>>>0,ae(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&pe(e,this.length-8);let o=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return (BigInt(o)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),a.prototype.readBigInt64BE=V(function(e){e=e>>>0,ae(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&pe(e,this.length-8);let o=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(o)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),a.prototype.readFloatLE=function(e,t){return e=e>>>0,t||U(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e=e>>>0,t||U(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||U(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||U(e,8,this.length),i.read(this,e,!1,52,8)};function P(e,t,n,o,u,l){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>u||t<l)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let d=Math.pow(2,8*n)-1;P(this,e,t,n,d,0);}let u=1,l=0;for(this[t]=e&255;++l<n&&(u*=256);)this[t+l]=e/u&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,n=n>>>0,!o){let d=Math.pow(2,8*n)-1;P(this,e,t,n,d,0);}let u=n-1,l=1;for(this[t+u]=e&255;--u>=0&&(l*=256);)this[t+u]=e/l&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,1,255,0),this[t]=e&255,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function ut(e,t,n,o,u){pt(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 lt(e,t,n,o,u){pt(t,o,u,e,n,7);let l=Number(t&BigInt(4294967295));e[n+7]=l,l=l>>8,e[n+6]=l,l=l>>8,e[n+5]=l,l=l>>8,e[n+4]=l;let d=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=d,d=d>>8,e[n+2]=d,d=d>>8,e[n+1]=d,d=d>>8,e[n]=d,n+8}a.prototype.writeBigUInt64LE=V(function(e,t=0){return ut(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=V(function(e,t=0){return lt(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let S=Math.pow(2,8*n-1);P(this,e,t,n,S-1,-S);}let u=0,l=1,d=0;for(this[t]=e&255;++u<n&&(l*=256);)e<0&&d===0&&this[t+u-1]!==0&&(d=1),this[t+u]=(e/l>>0)-d&255;return t+n},a.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t=t>>>0,!o){let S=Math.pow(2,8*n-1);P(this,e,t,n,S-1,-S);}let u=n-1,l=1,d=0;for(this[t+u]=e&255;--u>=0&&(l*=256);)e<0&&d===0&&this[t+u+1]!==0&&(d=1),this[t+u]=(e/l>>0)-d&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},a.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},a.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},a.prototype.writeBigInt64LE=V(function(e,t=0){return ut(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=V(function(e,t=0){return lt(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ft(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 ct(e,t,n,o,u){return t=+t,n=n>>>0,u||ft(e,t,n,4),i.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(e,t,n){return ct(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return ct(this,e,t,!1,n)};function ht(e,t,n,o,u){return t=+t,n=n>>>0,u||ft(e,t,n,8),i.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(e,t,n){return ht(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return ht(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,o){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);let u=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),t),u},a.prototype.fill=function(e,t,n,o){if(typeof e=="string"){if(typeof t=="string"?(o=t,t=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){let l=e.charCodeAt(0);(o==="utf8"&&l<128||o==="latin1")&&(e=l);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let u;if(typeof e=="number")for(u=t;u<n;++u)this[u]=e;else {let l=a.isBuffer(e)?e:a.from(e,o),d=l.length;if(d===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(u=0;u<n-t;++u)this[u+t]=l[u%d];}return this};let oe={};function Te(e,t,n){oe[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name;}get code(){return e}set code(o){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:o,writable:!0});}toString(){return `${this.name} [${e}]: ${this.message}`}};}Te("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Te("ERR_INVALID_ARG_TYPE",function(e,t){return `The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),Te("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,u=n;return Number.isInteger(n)&&Math.abs(n)>2**32?u=dt(String(n)):typeof n=="bigint"&&(u=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(u=dt(u)),u+="n"),o+=` It must be ${t}. Received ${u}`,o},RangeError);function dt(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 gn(e,t,n){ae(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&pe(t,e.length-(n+1));}function pt(e,t,n,o,u,l){if(e>n||e<t){let d=typeof t=="bigint"?"n":"",S;throw t===0||t===BigInt(0)?S=`>= 0${d} and < 2${d} ** ${(l+1)*8}${d}`:S=`>= -(2${d} ** ${(l+1)*8-1}${d}) and < 2 ** ${(l+1)*8-1}${d}`,new oe.ERR_OUT_OF_RANGE("value",S,e)}gn(o,u,l);}function ae(e,t){if(typeof e!="number")throw new oe.ERR_INVALID_ARG_TYPE(t,"number",e)}function pe(e,t,n){throw Math.floor(e)!==e?(ae(e,n),new oe.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new oe.ERR_BUFFER_OUT_OF_BOUNDS:new oe.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}let mn=/[^+/0-9A-Za-z-_]/g;function yn(e){if(e=e.split("=")[0],e=e.trim().replace(mn,""),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 wn(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function bn(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 gt(e){return r.toByteArray(yn(e))}function ve(e,t,n,o){let u;for(u=0;u<o&&!(u+n>=t.length||u>=e.length);++u)t[u+n]=e[u];return u}function F(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Ue(e){return e!==e}let vn=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"?En:e}function En(){throw new Error("BigInt not supported")}return Q}var ie=ir();ie.Buffer;ie.SlowBuffer;ie.INSPECT_MAX_BYTES;ie.kMaxLength;var xt=ie.Buffer;ie.INSPECT_MAX_BYTES;ie.kMaxLength;var rr={};jn(rr,{deleteItem:()=>ur,getItem:()=>Ve,setItem:()=>_e});var Ae=()=>typeof window>"u",Ot=()=>!Ae(),sr="__IMX-",Xe=()=>Ot()&&window.localStorage,or=r=>{if(r!==null)try{return JSON.parse(r)}catch(i){return r}},ar=r=>typeof r=="string"?r:JSON.stringify(r),Qe=r=>`${sr}${r}`;function Ve(r){if(Xe())return or(window.localStorage.getItem(Qe(r)))}var _e=(r,i)=>Xe()?(window.localStorage.setItem(Qe(r),ar(i)),!0):!1,ur=r=>Xe()?(window.localStorage.removeItem(Qe(r)),!0):!1,Ke=0,lr=r=>{let i=parseInt(r,10)*1e3,s=new Date(i),f=new Date;return Ke=s.getTime()-f.getTime(),Ke},fr=()=>{let r=new Date().getTime()+Ke;return new Date(r).toISOString()},cr=(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))(cr||{}),hr="https://api.immutable.com",dr=r=>{if(typeof xt<"u")return xt.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 Nt(r,i){let s=JSON.stringify(i),f={payload:dr(s)},c=await fetch(`${hr}${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(!c.ok){let h=await c.text().catch(()=>"");throw new Error(`Request failed (${c.status}): ${h||c.statusText}`)}return c.json()}var ee,te,pr=()=>{ee=Ve("metrics-events")||[],te=Ve("metrics-runtime")||{};};pr();var ne=(r,i)=>{te={...te,[r]:i},_e("metrics-runtime",te);},ze=r=>{if(te[r]!==void 0)return te[r]},gr=()=>te,mr=()=>ee,yr=r=>{ee.push(r),_e("metrics-events",ee);},wr=r=>{ee=ee.slice(r),_e("metrics-events",ee);},Rt=r=>{let i=[];return Object.entries(r).forEach(([s,f])=>{(typeof s=="string"||typeof f=="string"||typeof f=="number"||typeof f=="boolean")&&i.push([s,f.toString()]);}),i},Fe="2.20.1",br=()=>Ae()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",vr=()=>{if(Ae())return "";let r;try{window.self!==window.top&&(r=br());}catch(i){}return r||(r=window.location.hostname),r},Er=()=>{if(ne("sdkVersion",Fe),Ae())return {browser:"nodejs",sdkVersion:Fe};let r=vr();return r&&ne("domain",r),{sdkVersion:Fe,browser:window.navigator.userAgent,domain:r,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},Ye=!1,Ir=()=>Ye,Ar=async()=>{Ye=!0;try{let r=Rt(Er()),i=ze("rid"),s=ze("uid"),f=await Nt("/v1/sdk/initialise",{version:1,data:{runtimeDetails:r,runtimeId:i,uId:s}}),{runtimeId:c,sTime:h}=f;ne("rid",c),lr(h);}catch(r){Ye=!1;}};function $(r,i){return (...s)=>{try{let f=r(...s);return f instanceof Promise?f.catch(()=>i):f}catch(f){return i}}}function _r(){return Ot()||typeof qe>"u"?!1:qe.env.JEST_WORKER_ID!==void 0}var Sr=$(_r,!1),Ct="imtbl__metrics",Br=5e3,xr=1e3,ye=(r,i)=>(0, He.getGlobalisedValue)(Ct,r,i),Tr=(r,i)=>{let s=bt(i,{lruOptions:{ttl:Br,max:xr}});return (0, He.getGlobalisedValue)(Ct,r,s)},kr=5e3,Ur=(r,i,s)=>{let f={event:`${r}.${i}`,time:fr(),...s&&{properties:Rt(s)}};yr(f);},re=$(Tr("track",Ur)),Or=async()=>{if(Ir()===!1){await Ar();return}let r=mr();if(r.length===0)return;let i=r.length,s=gr();await Nt("/v1/sdk/metrics",{version:1,data:{events:r,details:s}})instanceof Error||wr(i);},Nr=$(Or),Lt=async()=>{await Nr(),setTimeout(Lt,kr);},Tt=!1,Rr=()=>{Tt||(Tt=!0,Lt());};Sr()||$(ye("startFlushing",Rr))();var Fr=(r,i,s,f)=>{let{message:c}=s,h=s.stack||"",{cause:a}=s;a instanceof Error&&(h=`${h}
|
|
5
5
|
Cause: ${a.message}
|
|
6
|
-
${a.stack}`),ee(r,`trackError_${i}`,{...f||{},errorMessage:h,errorStack:c,isTrackError:!0});},Tt=$(Pr),Dr=r=>{Q("env",r);};$(ce("setEnvironment",Dr));var Fr=r=>{Q("passportClientId",r);};$(ce("setPassportClientId",Fr));var jr=r=>{Q("pak",r);};$(ce("setPublishableApiKey",jr));$(ce("getDetail",je));var Ot={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},Nt="https://api.immutable.com",Gr="/v1/audience/messages",qr="/v1/audience/tracking-consent",ae="imtbl_anon_id",oe="_imtbl_sid",Rt="session_start",Ct="session_end",de=()=>typeof window<"u"&&typeof document<"u",ue=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{let i=Math.trunc(Math.random()*16);return (r==="x"?i:i%4+8).toString(16)}),Lt=()=>new Date().toISOString();function _e(r){if(!de())return;let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}function Ae(r,i,s,f){if(!de())return;let h=window.location.protocol==="https:"?"; Secure":"",c=f?`; domain=${f}`:"";document.cookie=`${r}=${encodeURIComponent(i)}; path=/; max-age=${s}; SameSite=Lax${c}${h}`;}function pe(r,i){Ae(r,"",0,i);}function Se(r){let i=_e(ae);if(i)return i;let s=ue();return Ae(ae,s,63072e3,r),s}var Ie=class extends Error{constructor(i){super(`audience transport failed: ${i.status||"network error"} ${i.endpoint}`,i.cause!==void 0?{cause:i.cause}:void 0);b(this,"status");b(this,"endpoint");b(this,"body");this.name="TransportError",this.status=i.status,this.endpoint=i.endpoint,this.body=i.body;}},te=class extends Error{constructor(i){super(i.message);b(this,"code");b(this,"status");b(this,"endpoint");b(this,"responseBody");b(this,"cause");this.name="AudienceError",this.code=i.code,this.status=i.status,this.endpoint=i.endpoint,this.responseBody=i.responseBody,this.cause=i.cause;}};function Pt(r,i,s){var f,h;if(r.status===0)return new te({code:"NETWORK_ERROR",message:i==="flush"?`Network error sending ${s!=null?s:0} messages`:"Network error syncing consent",status:0,endpoint:r.endpoint,cause:r.cause});if(r.status>=200&&r.status<300){let c=r.body,a=(f=c==null?void 0:c.rejected)!=null?f:0,y=(h=c==null?void 0:c.accepted)!=null?h:0;return new te({code:"VALIDATION_REJECTED",message:`Backend rejected ${a} of ${a+y} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return r.status===429?new te({code:"RATE_LIMITED",message:i==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:r.status,endpoint:r.endpoint,responseBody:r.body}):r.status>=400&&r.status<500?new te({code:i==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush rejected with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body}):new te({code:i==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush failed with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body,cause:r.cause})}function Mt(r,i){if(r)try{r(i);}catch(s){}}var Vr=3e4;function Kr(r){var h;let i=(h=r.get)==null?void 0:h.call(r,"retry-after");if(!i)return null;let s=Number(i.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let f=new Date(i);if(!Number.isNaN(f.getTime())){let c=f.getTime()-Date.now();return c>0?c:null}return null}async function kt(r){var s,f,h;let i=(h=(f=(s=r.headers)==null?void 0:s.get)==null?void 0:f.call(s,"content-type"))!=null?h:"";try{return i.includes("application/json")?await r.json():await r.text()}catch(c){return}}var We=async(r,i,s,f)=>{var a,y;let h=new AbortController,c=setTimeout(()=>h.abort(),Vr);try{let g=await fetch(r,{method:(a=f==null?void 0:f.method)!=null?a:"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(s),keepalive:f==null?void 0:f.keepalive,signal:h.signal});if(g.status===429){ee("audience","transport_send_failed",{status:429});let m=Kr(g.headers);return {ok:!1,error:new Ie({status:429,endpoint:r}),...m!==null?{retryAfterMs:m}:{}}}if(!g.ok){let m=await kt(g);return ee("audience","transport_send_failed",{status:g.status}),{ok:!1,error:new Ie({status:g.status,endpoint:r,body:m})}}let E=await kt(g);if(typeof E=="object"&&E!==null&&"rejected"in E){let m=(y=E.rejected)!=null?y:0;if(m>0)return ee("audience","transport_partial_rejected",{status:g.status,rejected:m}),{ok:!1,error:new Ie({status:g.status,endpoint:r,body:E})}}return {ok:!0}}catch(g){let E=new Ie({status:0,endpoint:r,cause:g});return Tt("audience","transport_send",E),{ok:!1,error:E}}finally{clearTimeout(c);}},Je="__imtbl_audience_";function Xe(){try{return de()&&typeof localStorage<"u"}catch(r){return !1}}function zr(r,i=Je){if(Xe())try{let s=localStorage.getItem(`${i}${r}`);return s?JSON.parse(s):void 0}catch(s){return}}function Yr(r,i,s=Je){if(Xe())try{localStorage.setItem(`${s}${r}`,JSON.stringify(i));}catch(f){}}function Hr(r,i=Je){if(Xe())try{localStorage.removeItem(`${i}${r}`);}catch(s){}}var He="queue",Ut=100,$t=class{constructor(r,i,s){b(this,"messages");b(this,"timer",null);b(this,"flushing",!1);b(this,"unloadBound",!1);b(this,"visibilityHandler");b(this,"pagehideHandler");b(this,"onFlush");b(this,"onError");b(this,"storagePrefix");b(this,"endpointUrl");b(this,"flushIntervalMs");b(this,"flushSize");b(this,"consecutiveFailures",0);b(this,"nextAttemptAt",0);var h,c,a,y;this.send=r,this.publishableKey=i,this.endpointUrl=`${(h=s==null?void 0:s.baseUrl)!=null?h:Nt}${Gr}`,this.flushIntervalMs=(c=s==null?void 0:s.flushIntervalMs)!=null?c:5e3,this.flushSize=(a=s==null?void 0:s.flushSize)!=null?a:20,this.onFlush=s==null?void 0:s.onFlush,this.onError=s==null?void 0:s.onError,this.storagePrefix=s==null?void 0:s.storagePrefix;let f=(y=zr(He,this.storagePrefix))!=null?y:[];this.messages=s!=null&&s.staleFilter?f.filter(s.staleFilter):f;}start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(r){this.messages.push(r),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){var r;if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let i=this.messages.slice(0,Ut),s={messages:i},f=await this.send(this.endpointUrl,this.publishableKey,s),h;!f.ok&&f.error&&(h=Pt(f.error,"flush",i.length));let c=(h==null?void 0:h.code)==="VALIDATION_REJECTED";f.ok||c?(this.messages=this.messages.slice(i.length),this.persist(),this.resetBackoff()):h&&(f.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+f.retryAfterMs):this.recordFailure()),(r=this.onFlush)==null||r.call(this,f.ok,i.length),h&&Mt(this.onError,h);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let r=this.messages.slice(0,Ut),i={messages:r};this.send(this.endpointUrl,this.publishableKey,i,{keepalive:!0}),this.messages=this.messages.slice(r.length),this.persist();}purge(r){this.messages=this.messages.filter(i=>!r(i)),this.persist();}transform(r){this.messages=this.messages.map(r),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],Hr(He,this.storagePrefix);}registerUnload(){!de()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let r=Date.now();r<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=r+this.backoffDelayMs());}setBackoffUntil(r){this.consecutiveFailures++,this.nextAttemptAt=r;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Yr(He,this.messages,this.storagePrefix);}},Wr="2.20.1-alpha.1";function Dt(r="@imtbl/audience",i=Wr){let s={library:r,libraryVersion:i};return de()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ft(r){let i=new Date(r).getTime();if(Number.isNaN(i))return !1;let s=Date.now();return i<=s+864e5&&i>=s-2592e6}function jt(r,i,s,f){return r!==s||i!==f}function ge(r,i=256){return r.length>i?r.slice(0,i):r}function le(r){let i=_e(oe);if(i)return Ae(oe,i,1800,r),{sessionId:i,isNew:!1};let s=ue();return Ae(oe,s,1800,r),{sessionId:s,isNew:!0}}var Gt=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],qt=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Vt="__imtbl_attribution";function Jr(r){let i;try{i=new URL(r).searchParams;}catch(h){return {}}let s={};for(let h of [...Gt,...qt]){let c=i.get(h);c&&(s[h]=c);}let f=i.get("referral_code");return f&&(s.referral_code=f),s}function Xr(){try{let r=sessionStorage.getItem(Vt);return r?JSON.parse(r):null}catch(r){return null}}function Qr(r){try{sessionStorage.setItem(Vt,JSON.stringify(r));}catch(i){}}function Kt(){let r=typeof window<"u"&&window.location?Jr(window.location.href):{},i=typeof document<"u"&&document.referrer||void 0,s=qt.some(h=>h in r),f=Gt.some(h=>h in r);return {...r,referrer:i,touchpoint_type:s||f?"click":void 0}}function zt(){let r=Xr();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,s={...Kt(),landing_page:i};return Qr(s),s}function Yt(){return Kt()}function j(r){return r!=="none"}function K(r){return r==="full"}function Ht(r,i,s,f,h,c,a,y){let g=c!=null?c:"none",E={none:0,anonymous:1,full:2};function m(v){let I=`${y!=null?y:Nt}${qr}`;i(I,s,{anonymousId:f,status:v,source:h},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&Mt(a,Pt(p.error,"consent"));});}return {get level(){return g},setLevel(v){v!==g&&(E[v]<E[g]&&(v==="none"?r.purge(()=>!0):v==="anonymous"&&(r.purge(I=>I.type==="identify"||I.type==="alias"),r.transform(I=>{if("userId"in I){let{userId:p,...w}=I;return w}return I}))),g=v,m(v));}}}var Wt="@imtbl/audience",Be="2.20.1-alpha.1",z="[audience]",Jt="WebSDK";var xe=class{constructor(i=!1){b(this,"enabled");this.enabled=i;}logEvent(i,s){this.enabled&&console.log(`${z} ${i}`,s);}logFlush(i,s){this.enabled&&console.log(`${z} flush ${i?"ok":"failed"} (${s} messages)`);}logConsent(i,s){this.enabled&&console.log(`${z} consent ${i} \u2192 ${s}`);}logWarning(i){this.enabled&&console.warn(`${z} ${i}`);}};var Zr=new Set(["sign_up","link_clicked"]),Y=class Y{constructor(i){b(this,"queue");b(this,"consent");b(this,"attribution");b(this,"debug");b(this,"cookieDomain");b(this,"testMode");b(this,"anonymousId");b(this,"sessionId");b(this,"sessionStartTime");b(this,"userId");b(this,"isFirstPage",!0);b(this,"destroyed",!1);var y,g,E,m;let{cookieDomain:s,publishableKey:f}=i,h=(y=i.consent)!=null?y:"none",c=Jt;this.cookieDomain=s,this.testMode=(g=i.testMode)!=null?g:!1,this.debug=new xe((E=i.debug)!=null?E:!1);let a=!1;j(h)?(this.anonymousId=Se(s),a=this.startSession()):this.anonymousId=(m=_e(ae))!=null?m:ue(),this.queue=new $t(We,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(v,I)=>this.debug.logFlush(v,I),onError:i.onError,staleFilter:v=>Ft(v.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Ht(this.queue,We,f,this.anonymousId,c,h,i.onError,i.baseUrl),this.attribution=zt(),this.isTrackingDisabled()||(this.queue.start(),a&&this.trackSessionStart());}static init(i){var s;if(!((s=i.publishableKey)!=null&&s.trim()))throw new Error(`${z} publishableKey is required`);return Y.liveInstances>0&&console.warn(`${z} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),Y.liveInstances+=1,new Y(i)}isTrackingDisabled(){return !j(this.consent.level)}effectiveUserId(){return K(this.consent.level)?this.userId:void 0}startSession(){let i=le(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:ue(),eventTimestamp:Lt(),anonymousId:this.anonymousId,surface:"web",context:Dt(Wt,Be),...this.testMode&&{test:!0}}}enqueue(i,s){this.queue.enqueue(s),this.debug.logEvent(i,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:Rt,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Ct,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;le(this.cookieDomain);let s={session_id:this.sessionId,...i};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(i,...s){if(this.isTrackingDisabled())return;le(this.cookieDomain);let[f]=s,h={session_id:this.sessionId,...Zr.has(i)?Yt():{},...f};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:ge(i),properties:h,userId:this.effectiveUserId()});}identify(i,s,f){if(!K(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}le(this.cookieDomain);let h=ge(i);this.userId=h,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:h,identityType:s,traits:f});}alias(i,s){if(!K(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!jt(i.id,i.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}le(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:ge(i.id),fromType:i.identityType,toId:ge(s.id),toType:s.identityType});}setConsent(i){let s=this.consent.level;if(i===s)return;this.debug.logConsent(s,i);let f=!j(s)&&j(i);if(f&&(this.anonymousId=Se(this.cookieDomain)),j(i)||this.queue.stop(),this.consent.setLevel(i),j(i)?K(s)&&!K(i)&&(this.userId=void 0):(pe(ae,this.cookieDomain),pe(oe,this.cookieDomain)),f){this.isFirstPage=!0;let h=this.startSession();this.queue.start(),h&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),pe(ae,this.cookieDomain),pe(oe,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=ue(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=Se(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),Y.liveInstances=Math.max(0,Y.liveInstances-1));}};b(Y,"liveInstances",0);var ye=Y;var Xt={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked"};var Qe=typeof globalThis!="undefined"?globalThis:window,Qt;if(Qe.ImmutableAudience){let r=(Qt=Qe.ImmutableAudience.version)!=null?Qt:"unknown";console.warn(`[@imtbl/audience] CDN bundle loaded twice; keeping v${r}. Remove the old <script> tag to load a different version.`);}else Qe.ImmutableAudience={init:ye.init.bind(ye),AudienceError:te,AudienceEvents:Xt,IdentityType:Ot,canIdentify:K,canTrack:j,version:Be};
|
|
6
|
+
${a.stack}`),re(r,`trackError_${i}`,{...f||{},errorMessage:c,errorStack:h,isTrackError:!0});},Pt=$(Fr),qr=r=>{ne("env",r);};$(ye("setEnvironment",qr));var Vr=r=>{ne("passportClientId",r);};$(ye("setPassportClientId",Vr));var Kr=r=>{ne("pak",r);};$(ye("setPublishableApiKey",Kr));$(ye("getDetail",ze));var Dt={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},Se=class extends Error{constructor(i){super(`audience transport failed: ${i.status||"network error"} ${i.endpoint}`,i.cause!==void 0?{cause:i.cause}:void 0);w(this,"status");w(this,"endpoint");w(this,"body");this.name="TransportError",this.status=i.status,this.endpoint=i.endpoint,this.body=i.body;}},se=class extends Error{constructor(i){super(i.message);w(this,"code");w(this,"status");w(this,"endpoint");w(this,"responseBody");w(this,"cause");this.name="AudienceError",this.code=i.code,this.status=i.status,this.endpoint=i.endpoint,this.responseBody=i.responseBody,this.cause=i.cause;}};function Ft(r,i,s){var f,c;if(r.status===0)return new se({code:"NETWORK_ERROR",message:i==="flush"?`Network error sending ${s!=null?s:0} messages`:"Network error syncing consent",status:0,endpoint:r.endpoint,cause:r.cause});if(r.status>=200&&r.status<300){let h=r.body,a=(f=h==null?void 0:h.rejected)!=null?f:0,g=(c=h==null?void 0:h.accepted)!=null?c:0;return new se({code:"VALIDATION_REJECTED",message:`Backend rejected ${a} of ${a+g} messages`,status:r.status,endpoint:r.endpoint,responseBody:r.body})}return r.status===429?new se({code:"RATE_LIMITED",message:i==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:r.status,endpoint:r.endpoint,responseBody:r.body}):r.status>=400&&r.status<500?new se({code:i==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush rejected with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body}):new se({code:i==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:i==="flush"?`Flush failed with status ${r.status}`:`Consent sync failed with status ${r.status}`,status:r.status,endpoint:r.endpoint,responseBody:r.body,cause:r.cause})}function jt(r,i){if(r)try{r(i);}catch(s){}}var zr=3e4;function Yr(r){var c;let i=(c=r.get)==null?void 0:c.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 h=f.getTime()-Date.now();return h>0?h:null}return null}function Ze(){try{return j()?navigator.onLine:void 0}catch(r){return}}async function Mt(r){var s,f,c;let i=(c=(f=(s=r.headers)==null?void 0:s.get)==null?void 0:f.call(s,"content-type"))!=null?c:"";try{return i.includes("application/json")?await r.json():await r.text()}catch(h){return}}var tt=async(r,i,s,f)=>{var g,E;let c=new AbortController,h=setTimeout(()=>c.abort(),zr),a=Date.now();try{let v=await fetch(r,{method:(g=f==null?void 0:f.method)!=null?g:"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":i},body:JSON.stringify(s),keepalive:f==null?void 0:f.keepalive,signal:c.signal});if(v.status===429){re("audience","transport_send_failed",{status:429,online:Ze(),timeToFailureMs:Date.now()-a});let m=Yr(v.headers);return {ok:!1,error:new Se({status:429,endpoint:r}),...m!==null?{retryAfterMs:m}:{}}}if(!v.ok){let m=await Mt(v);return re("audience","transport_send_failed",{status:v.status,online:Ze(),timeToFailureMs:Date.now()-a}),{ok:!1,error:new Se({status:v.status,endpoint:r,body:m})}}let y=await Mt(v);if(typeof y=="object"&&y!==null&&"rejected"in y){let m=(E=y.rejected)!=null?E:0;if(m>0)return re("audience","transport_partial_rejected",{status:v.status,rejected:m}),{ok:!1,error:new Se({status:v.status,endpoint:r,body:y})}}return {ok:!0}}catch(v){let y=new Se({status:0,endpoint:r,cause:v});return Pt("audience","transport_send",y,{errorName:v instanceof Error?v.name:void 0,online:Ze(),timeToFailureMs:Date.now()-a}),{ok:!1,error:y}}finally{clearTimeout(h);}},nt="__imtbl_audience_";function it(){try{return j()&&typeof localStorage<"u"}catch(r){return !1}}function Hr(r,i=nt){if(it())try{let s=localStorage.getItem(`${i}${r}`);return s?JSON.parse(s):void 0}catch(s){return}}function Wr(r,i,s=nt){if(it())try{localStorage.setItem(`${s}${r}`,JSON.stringify(i));}catch(f){}}function Jr(r,i=nt){if(it())try{localStorage.removeItem(`${i}${r}`);}catch(s){}}var et="queue",$t=100,Gt=class{constructor(r,i,s){w(this,"messages");w(this,"timer",null);w(this,"flushing",!1);w(this,"unloadBound",!1);w(this,"visibilityHandler");w(this,"pagehideHandler");w(this,"onFlush");w(this,"onError");w(this,"storagePrefix");w(this,"endpointUrl");w(this,"flushIntervalMs");w(this,"flushSize");w(this,"consecutiveFailures",0);w(this,"nextAttemptAt",0);var c,h,a,g;this.send=r,this.publishableKey=i,this.endpointUrl=`${(c=s==null?void 0:s.baseUrl)!=null?c:Ne}${mt}`,this.flushIntervalMs=(h=s==null?void 0:s.flushIntervalMs)!=null?h: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=Hr(et,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)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let i=this.messages.slice(0,$t),s={messages:i},f=await this.send(this.endpointUrl,this.publishableKey,s),c;!f.ok&&f.error&&(c=Ft(f.error,"flush",i.length));let h=(c==null?void 0:c.code)==="VALIDATION_REJECTED";f.ok||h?(this.messages=this.messages.slice(i.length),this.persist(),this.resetBackoff()):c&&(f.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+f.retryAfterMs):this.recordFailure()),(r=this.onFlush)==null||r.call(this,f.ok,i.length),c&&jt(this.onError,c);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let r=this.messages.slice(0,$t),i={messages:r};this.send(this.endpointUrl,this.publishableKey,i,{keepalive:!0}),this.messages=this.messages.slice(r.length),this.persist();}purge(r){this.messages=this.messages.filter(i=>!r(i)),this.persist();}transform(r){this.messages=this.messages.map(r),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],Jr(et,this.storagePrefix);}registerUnload(){!j()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let r=Date.now();r<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=r+this.backoffDelayMs());}setBackoffUntil(r){this.consecutiveFailures++,this.nextAttemptAt=r;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Wr(et,this.messages,this.storagePrefix);}},Xr="2.20.1";function qt(r="@imtbl/audience",i=Xr){let s={library:r,libraryVersion:i};return j()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Vt(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 Kt(r,i,s,f){return r!==s||i!==f}function we(r,i=256){return r.length>i?r.slice(0,i):r}function de(r){let i=ue(z);if(i)return le(z,i,1800,r),{sessionId:i,isNew:!1};let s=Y();return le(z,s,1800,r),{sessionId:s,isNew:!0}}var zt=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Yt=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Ht="__imtbl_attribution";function Qr(r){let i;try{i=new URL(r).searchParams;}catch(c){return {}}let s={};for(let c of [...zt,...Yt]){let h=i.get(c);h&&(s[c]=h);}let f=i.get("referral_code");return f&&(s.referral_code=f),s}function Zr(){try{let r=sessionStorage.getItem(Ht);return r?JSON.parse(r):null}catch(r){return null}}function es(r){try{sessionStorage.setItem(Ht,JSON.stringify(r));}catch(i){}}function Wt(){let r=typeof window<"u"&&window.location?Qr(window.location.href):{},i=typeof document<"u"&&document.referrer||void 0,s=Yt.some(c=>c in r),f=zt.some(c=>c in r);return {...r,referrer:i,touchpoint_type:s||f?"click":void 0}}function Jt(){let r=Zr();if(r)return r;let i=typeof window<"u"&&window.location?window.location.href:void 0,s={...Wt(),landing_page:i};return es(s),s}function Xt(){return Wt()}function q(r){return r!=="none"}function J(r){return r==="full"}function Qt(r,i,s,f,c,h,a,g){let E=h!=null?h:"none",v={none:0,anonymous:1,full:2};function y(m){let I=`${g!=null?g:Ne}${yt}`;i(I,s,{anonymousId:f,status:m,source:c},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&jt(a,Ft(p.error,"consent"));});}return {get level(){return E},setLevel(m){m!==E&&(v[m]<v[E]&&(m==="none"?r.purge(()=>!0):m==="anonymous"&&(r.purge(I=>I.type==="identify"||I.type==="alias"),r.transform(I=>{if("userId"in I){let{userId:p,...b}=I;return b}return I}))),E=m,y(m));}}}var Zt="@imtbl/audience",Be="2.20.1",X="[audience]",en="WebSDK";var xe=class{constructor(i=!1){w(this,"enabled");this.enabled=i;}logEvent(i,s){this.enabled&&console.log(`${X} ${i}`,s);}logFlush(i,s){this.enabled&&console.log(`${X} flush ${i?"ok":"failed"} (${s} messages)`);}logConsent(i,s){this.enabled&&console.log(`${X} consent ${i} \u2192 ${s}`);}logWarning(i){this.enabled&&console.warn(`${X} ${i}`);}};var ts=new Set(["sign_up","link_clicked"]),D=class D{constructor(i){w(this,"queue");w(this,"consent");w(this,"attribution");w(this,"debug");w(this,"cookieDomain");w(this,"testMode");w(this,"anonymousId");w(this,"sessionId");w(this,"sessionStartTime");w(this,"userId");w(this,"isFirstPage",!0);w(this,"destroyed",!1);var E,v,y,m;let{cookieDomain:s,publishableKey:f}=i,c=(E=i.consent)!=null?E:"none",h=en;this.cookieDomain=s,this.testMode=(v=i.testMode)!=null?v:!1,this.debug=new xe((y=i.debug)!=null?y:!1);let a=D.readAndStripAidParam(),g=!1;q(c)?(a?(Pe(a,s),this.anonymousId=a):this.anonymousId=ge(s),g=this.startSession()):this.anonymousId=(m=ue(K))!=null?m:Y(),this.queue=new Gt(tt,f,{baseUrl:i.baseUrl,flushIntervalMs:i.flushInterval,flushSize:i.flushSize,onFlush:(I,p)=>this.debug.logFlush(I,p),onError:i.onError,staleFilter:I=>Vt(I.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Qt(this.queue,tt,f,this.anonymousId,h,c,i.onError,i.baseUrl),this.attribution=Jt(),this.isTrackingDisabled()||(this.queue.start(),g&&this.trackSessionStart());}static readAndStripAidParam(){if(!j())return null;let i=new URLSearchParams(window.location.search),s=i.get("imtbl_aid");if(s!==null){i.delete("imtbl_aid");let f=i.toString(),c=`${window.location.pathname}${f?`?${f}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",c);}return s&&D.UUID_RE.test(s)?s:null}static init(i){var s;if(!((s=i.publishableKey)!=null&&s.trim()))throw new Error(`${X} publishableKey is required`);return D.liveInstances>0&&console.warn(`${X} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),D.liveInstances+=1,new D(i)}getAnonymousId(){return this.anonymousId}isTrackingDisabled(){return !q(this.consent.level)}effectiveUserId(){return J(this.consent.level)?this.userId:void 0}startSession(){let i=de(this.cookieDomain);return this.sessionId=i.sessionId,this.sessionStartTime=Date.now(),i.isNew}baseMessage(){return {messageId:Y(),eventTimestamp:Le(),anonymousId:this.anonymousId,surface:"web",context:qt(Zt,Be),...this.testMode&&{test:!0}}}enqueue(i,s){this.queue.enqueue(s),this.debug.logEvent(i,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:Re,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Ce,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(i){if(this.isTrackingDisabled())return;de(this.cookieDomain);let s={session_id:this.sessionId,...i};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(i,...s){if(this.isTrackingDisabled())return;de(this.cookieDomain);let[f]=s,c={session_id:this.sessionId,...ts.has(i)?Xt():{},...f};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:we(i),properties:c,userId:this.effectiveUserId()});}identify(i,s,f){if(!J(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}de(this.cookieDomain);let c=we(i);this.userId=c,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:c,identityType:s,traits:f});}alias(i,s){if(!J(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Kt(i.id,i.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}de(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:we(i.id),fromType:i.identityType,toId:we(s.id),toType:s.identityType});}setConsent(i){let s=this.consent.level;if(i===s)return;this.debug.logConsent(s,i);let f=!q(s)&&q(i);if(f&&(this.anonymousId=ge(this.cookieDomain)),q(i)||this.queue.stop(),this.consent.setLevel(i),q(i)?J(s)&&!J(i)&&(this.userId=void 0):(fe(K,this.cookieDomain),fe(z,this.cookieDomain)),f){this.isFirstPage=!0;let c=this.startSession();this.queue.start(),c&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),fe(K,this.cookieDomain),fe(z,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=Y(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=ge(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),D.liveInstances=Math.max(0,D.liveInstances-1));}};w(D,"liveInstances",0),w(D,"UUID_RE",/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i);var be=D;var tn={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked",BUTTON_CLICKED:"button_clicked"};var rt=typeof globalThis!="undefined"?globalThis:window,nn;if(rt.ImmutableAudience){let r=(nn=rt.ImmutableAudience.version)!=null?nn:"unknown";console.warn(`[@imtbl/audience] CDN bundle loaded twice; keeping v${r}. Remove the old <script> tag to load a different version.`);}else rt.ImmutableAudience={init:be.init.bind(be),AudienceError:se,AudienceEvents:tn,IdentityType:Dt,canIdentify:J,canTrack:q,version:Be};
|
|
7
7
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
8
8
|
/*! Bundled license information:
|
|
9
9
|
|
package/dist/node/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
Cause: ${
|
|
5
|
-
${o.stack}`),b(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},ge=d(Gt),Kt=e=>{w("env",e);};d(T("setEnvironment",Kt));var Vt=e=>{w("passportClientId",e);};d(T("setPassportClientId",Vt));var Ht=e=>{w("pak",e);};d(T("setPublishableApiKey",Ht));d(T("getDetail",V));var zt={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},we="https://api.immutable.com",Wt="/v1/audience/messages",Jt="/v1/audience/tracking-consent",x="imtbl_anon_id",_="_imtbl_sid",be="session_start",Ie="session_end",P=()=>typeof window<"u"&&typeof document<"u",k=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return (e==="x"?t:t%4+8).toString(16)}),Ee=()=>new Date().toISOString();function M(e){if(!P())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function R(e,t,s,i){if(!P())return;let r=window.location.protocol==="https:"?"; Secure":"",n=i?`; domain=${i}`:"";document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${s}; SameSite=Lax${n}${r}`;}function N(e,t){R(e,"",0,t);}function L(e){let t=M(x);if(t)return t;let s=k();return R(x,s,63072e3,e),s}var $=class extends Error{status;endpoint;body;constructor(e){super(`audience transport failed: ${e.status||"network error"} ${e.endpoint}`,e.cause!==void 0?{cause:e.cause}:void 0),this.name="TransportError",this.status=e.status,this.endpoint=e.endpoint,this.body=e.body;}},S=class extends Error{code;status;endpoint;responseBody;cause;constructor(e){super(e.message),this.name="AudienceError",this.code=e.code,this.status=e.status,this.endpoint=e.endpoint,this.responseBody=e.responseBody,this.cause=e.cause;}};function Se(e,t,s){if(e.status===0)return new S({code:"NETWORK_ERROR",message:t==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:e.endpoint,cause:e.cause});if(e.status>=200&&e.status<300){let i=e.body,r=i?.rejected??0,n=i?.accepted??0;return new S({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return e.status===429?new S({code:"RATE_LIMITED",message:t==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:e.status,endpoint:e.endpoint,responseBody:e.body}):e.status>=400&&e.status<500?new S({code:t==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush rejected with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body}):new S({code:t==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush failed with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body,cause:e.cause})}function _e(e,t){if(e)try{e(t);}catch{}}var Yt=3e4;function Xt(e){let t=e.get?.("retry-after");if(!t)return null;let s=Number(t.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let i=new Date(t);if(!Number.isNaN(i.getTime())){let r=i.getTime()-Date.now();return r>0?r:null}return null}async function ye(e){let t=e.headers?.get?.("content-type")??"";try{return t.includes("application/json")?await e.json():await e.text()}catch{return}}var X=async(e,t,s,i)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),Yt);try{let o=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive,signal:r.signal});if(o.status===429){b("audience","transport_send_failed",{status:429});let l=Xt(o.headers);return {ok:!1,error:new $({status:429,endpoint:e}),...l!==null?{retryAfterMs:l}:{}}}if(!o.ok){let l=await ye(o);return b("audience","transport_send_failed",{status:o.status}),{ok:!1,error:new $({status:o.status,endpoint:e,body:l})}}let a=await ye(o);if(typeof a=="object"&&a!==null&&"rejected"in a){let l=a.rejected??0;if(l>0)return b("audience","transport_partial_rejected",{status:o.status,rejected:l}),{ok:!1,error:new $({status:o.status,endpoint:e,body:a})}}return {ok:!0}}catch(o){let a=new $({status:0,endpoint:e,cause:o});return ge("audience","transport_send",a),{ok:!1,error:a}}finally{clearTimeout(n);}},Q="__imtbl_audience_";function Z(){try{return P()&&typeof localStorage<"u"}catch{return !1}}function Qt(e,t=Q){if(Z())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function Zt(e,t,s=Q){if(Z())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function es(e,t=Q){if(Z())try{localStorage.removeItem(`${t}${e}`);}catch{}}var Y="queue",ve=100,xe=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??we}${Wt}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let i=Qt(Y,this.storagePrefix)??[];this.messages=s?.staleFilter?i.filter(s.staleFilter):i;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;consecutiveFailures=0;nextAttemptAt=0;start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(e){this.messages.push(e),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let e=this.messages.slice(0,ve),t={messages:e},s=await this.send(this.endpointUrl,this.publishableKey,t),i;!s.ok&&s.error&&(i=Se(s.error,"flush",e.length));let r=i?.code==="VALIDATION_REJECTED";s.ok||r?(this.messages=this.messages.slice(e.length),this.persist(),this.resetBackoff()):i&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,e.length),i&&_e(this.onError,i);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let e=this.messages.slice(0,ve),t={messages:e};this.send(this.endpointUrl,this.publishableKey,t,{keepalive:!0}),this.messages=this.messages.slice(e.length),this.persist();}purge(e){this.messages=this.messages.filter(t=>!e(t)),this.persist();}transform(e){this.messages=this.messages.map(e),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],es(Y,this.storagePrefix);}registerUnload(){!P()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let e=Date.now();e<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=e+this.backoffDelayMs());}setBackoffUntil(e){this.consecutiveFailures++,this.nextAttemptAt=e;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Zt(Y,this.messages,this.storagePrefix);}},ts="2.20.1-alpha.1";function ke(e="@imtbl/audience",t=ts){let s={library:e,libraryVersion:t};return P()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ae(e){let t=new Date(e).getTime();if(Number.isNaN(t))return !1;let s=Date.now();return t<=s+864e5&&t>=s-2592e6}function Te(e,t,s,i){return e!==s||t!==i}function O(e,t=256){return e.length>t?e.slice(0,t):e}function A(e){let t=M(_);if(t)return R(_,t,1800,e),{sessionId:t,isNew:!1};let s=k();return R(_,s,1800,e),{sessionId:s,isNew:!0}}var Pe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Ne=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Oe="__imtbl_attribution";function ss(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...Pe,...Ne]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function is(){try{let e=sessionStorage.getItem(Oe);return e?JSON.parse(e):null}catch{return null}}function rs(e){try{sessionStorage.setItem(Oe,JSON.stringify(e));}catch{}}function De(){let e=typeof window<"u"&&window.location?ss(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=Ne.some(r=>r in e),i=Pe.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function Ce(){let e=is();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...De(),landing_page:t};return rs(s),s}function $e(){return De()}function m(e){return e!=="none"}function I(e){return e==="full"}function Re(e,t,s,i,r,n,o,a){let l=n??"none",h={none:0,anonymous:1,full:2};function f(c){let u=`${a??we}${Jt}`;t(u,s,{anonymousId:i,status:c,source:r},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&_e(o,Se(p.error,"consent"));});}return {get level(){return l},setLevel(c){c!==l&&(h[c]<h[l]&&(c==="none"?e.purge(()=>!0):c==="anonymous"&&(e.purge(u=>u.type==="identify"||u.type==="alias"),e.transform(u=>{if("userId"in u){let{userId:p,...F}=u;return F}return u}))),l=c,f(c));}}}var Me="@imtbl/audience",Le="2.20.1-alpha.1",g="[audience]",Ue="WebSDK";var U=class{enabled;constructor(t=!1){this.enabled=t;}logEvent(t,s){this.enabled&&console.log(`${g} ${t}`,s);}logFlush(t,s){this.enabled&&console.log(`${g} flush ${t?"ok":"failed"} (${s} messages)`);}logConsent(t,s){this.enabled&&console.log(`${g} consent ${t} \u2192 ${s}`);}logWarning(t){this.enabled&&console.warn(`${g} ${t}`);}};var ns=new Set(["sign_up","link_clicked"]),ee=class e{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;constructor(t){let{cookieDomain:s,publishableKey:i}=t,r=t.consent??"none",n=Ue;this.cookieDomain=s,this.testMode=t.testMode??!1,this.debug=new U(t.debug??!1);let o=!1;m(r)?(this.anonymousId=L(s),o=this.startSession()):this.anonymousId=M(x)??k(),this.queue=new xe(X,i,{baseUrl:t.baseUrl,flushIntervalMs:t.flushInterval,flushSize:t.flushSize,onFlush:(a,l)=>this.debug.logFlush(a,l),onError:t.onError,staleFilter:a=>Ae(a.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Re(this.queue,X,i,this.anonymousId,n,r,t.onError,t.baseUrl),this.attribution=Ce(),this.isTrackingDisabled()||(this.queue.start(),o&&this.trackSessionStart());}static init(t){if(!t.publishableKey?.trim())throw new Error(`${g} publishableKey is required`);return e.liveInstances>0&&console.warn(`${g} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),e.liveInstances+=1,new e(t)}isTrackingDisabled(){return !m(this.consent.level)}effectiveUserId(){return I(this.consent.level)?this.userId:void 0}startSession(){let t=A(this.cookieDomain);return this.sessionId=t.sessionId,this.sessionStartTime=Date.now(),t.isNew}baseMessage(){return {messageId:k(),eventTimestamp:Ee(),anonymousId:this.anonymousId,surface:"web",context:ke(Me,Le),...this.testMode&&{test:!0}}}enqueue(t,s){this.queue.enqueue(s),this.debug.logEvent(t,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:be,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:Ie,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(t){if(this.isTrackingDisabled())return;A(this.cookieDomain);let s={session_id:this.sessionId,...t};this.isFirstPage&&(Object.assign(s,this.attribution),this.isFirstPage=!1),this.enqueue("page",{...this.baseMessage(),type:"page",properties:s,userId:this.effectiveUserId()});}track(t,...s){if(this.isTrackingDisabled())return;A(this.cookieDomain);let[i]=s,r={session_id:this.sessionId,...ns.has(t)?$e():{},...i};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:O(t),properties:r,userId:this.effectiveUserId()});}identify(t,s,i){if(!I(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}A(this.cookieDomain);let r=O(t);this.userId=r,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:r,identityType:s,traits:i});}alias(t,s){if(!I(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Te(t.id,t.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}A(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:O(t.id),fromType:t.identityType,toId:O(s.id),toType:s.identityType});}setConsent(t){let s=this.consent.level;if(t===s)return;this.debug.logConsent(s,t);let i=!m(s)&&m(t);if(i&&(this.anonymousId=L(this.cookieDomain)),m(t)||this.queue.stop(),this.consent.setLevel(t),m(t)?I(s)&&!I(t)&&(this.userId=void 0):(N(x,this.cookieDomain),N(_,this.cookieDomain)),i){this.isFirstPage=!0;let r=this.startSession();this.queue.start(),r&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),N(x,this.cookieDomain),N(_,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=k(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=L(this.cookieDomain),this.startSession()&&this.trackSessionStart()),this.isFirstPage=!0;}async flush(){await this.queue.flush();}shutdown(){this.destroyed||(this.destroyed=!0,this.isTrackingDisabled()||this.trackSessionEnd(),this.queue.destroy(),e.liveInstances=Math.max(0,e.liveInstances-1));}};var os={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked"};/*! Bundled license information:
|
|
3
|
+
var Ke=Object.create;var ue=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var ze=Object.getPrototypeOf,We=Object.prototype.hasOwnProperty;var Je=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ye=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of He(t))!We.call(e,r)&&r!==s&&ue(e,r,{get:()=>t[r],enumerable:!(i=Ve(t,r))||i.enumerable});return e};var Xe=(e,t,s)=>(s=e!=null?Ke(ze(e)):{},Ye(ue(s,"default",{value:e,enumerable:!0}),e));var ye=Je(P=>{Object.defineProperty(P,"__esModule",{value:!0});P.clearGlobalNamespace=P.getGlobalisedValue=void 0;var et="globalise__singleton__",tt={},fe=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:tt,st=(e,t)=>{if(typeof e!="string")throw "Invalid namespace key";if(typeof t!="string")throw "Invalid item key"},me=e=>`${et}${e}`,ge=e=>{let t=fe(),s=me(e);return t[s]||(t[s]={}),t[s]},it=(e,t)=>ge(e)[t]||void 0,rt=(e,t,s)=>{let i=ge(e);i[t]=s;},nt=(e,t,s)=>{st(e,t);let i=it(e,t);return i!==void 0?i:(rt(e,t,s),s)};P.getGlobalisedValue=nt;var ot=e=>{let t=fe(),s=me(e);t[s]!==void 0&&delete t[s];};P.clearGlobalNamespace=ot;});var j="https://api.immutable.com",ce="/v1/audience/messages",de="/v1/audience/tracking-consent",g="imtbl_anon_id",y="_imtbl_sid",B="session_start",G="session_end",p=()=>typeof window<"u"&&typeof document<"u",v=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return (e==="x"?t:t%4+8).toString(16)}),q=()=>new Date().toISOString();function k(e){if(!p())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function A(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 T(e,t){A(e,"",0,t);}function O(e){let t=k(g);if(t)return t;let s=v();return A(g,s,63072e3,e),s}function K(e,t){A(g,e,63072e3,t);}var V=class{constructor(t=0,s=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){let s=this.items[t];delete this.items[t],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(t=this.keys()){return t.map(s=>[s,this.get(s)])}evict(t=!1){if(t||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(t){let s;return this.has(t)&&(s=this.items[t].expiry),s}get(t){let s;if(this.has(t)){let i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(s=i.value,this.set(t,s,!0));}return s}has(t){return t in this.items}keys(){let t=[],s=this.first;for(;s!==null;)t.push(s.key),s=s.next;return t}set(t,s,i=!1,r=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=s,i===!1&&r&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){let l=this.last,o=n.next,a=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,l.next=n,a!==null&&(a.next=o),o!==null&&(o.prev=a);}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:s},++this.size===1?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map(s=>this.get(s))}};function he(e=1e3,t=0,s=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new V(e,t,s)}var Qe={max:1e3},pe=(e,t={})=>{let{cache:s,cacheKeyResolver:i=H,onHit:r,lruOptions:n={}}=t,l={...Qe,...n},o=s||he(l.max,l.ttl);function a(...u){let m=i(...u),d=o.get(m);if(o.has(m))return r&&r(m,d,o),d;let f=e.apply(this,u);return o.set(m,f),f}return a._cache=o,a},H=(...e)=>e.length===0?"no-args":e.map(t=>t===void 0?"undefined":t===null?"null":Array.isArray(t)?`[${H(...t)}]`:typeof t=="object"?`{${H(...Ze(t))}}`:JSON.stringify(t)).join(","),Ze=e=>Object.entries(e).sort((t,s)=>t[0]<s[0]?-1:1);var Q=Xe(ye()),at=Object.defineProperty,lt=(e,t)=>{for(var s in t)at(e,s,{get:t[s],enumerable:!0});},ut={};lt(ut,{deleteItem:()=>pt,getItem:()=>W,setItem:()=>M});var R=()=>typeof window>"u",we=()=>!R(),ct="__IMX-",Z=()=>we()&&window.localStorage,dt=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},ht=e=>typeof e=="string"?e:JSON.stringify(e),ee=e=>`${ct}${e}`;function W(e){if(Z())return dt(window.localStorage.getItem(ee(e)))}var M=(e,t)=>Z()?(window.localStorage.setItem(ee(e),ht(t)),!0):!1,pt=e=>Z()?(window.localStorage.removeItem(ee(e)),!0):!1,J=0,ft=e=>{let t=parseInt(e,10)*1e3,s=new Date(t),i=new Date;return J=s.getTime()-i.getTime(),J},mt=()=>{let e=new Date().getTime()+J;return new Date(e).toISOString()},gt=(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))(gt||{}),yt="https://api.immutable.com",vt=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 be(e,t){let s=JSON.stringify(t),i={payload:vt(s)},r=await fetch(`${yt}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok){let n=await r.text().catch(()=>"");throw new Error(`Request failed (${r.status}): ${n||r.statusText}`)}return r.json()}var I,E,wt=()=>{I=W("metrics-events")||[],E=W("metrics-runtime")||{};};wt();var S=(e,t)=>{E={...E,[e]:t},M("metrics-runtime",E);},Y=e=>{if(E[e]!==void 0)return E[e]},bt=()=>E,It=()=>I,Et=e=>{I.push(e),M("metrics-events",I);},St=e=>{I=I.slice(e),M("metrics-events",I);},Ie=e=>{let t=[];return Object.entries(e).forEach(([s,i])=>{(typeof s=="string"||typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&t.push([s,i.toString()]);}),t},z="2.20.1",_t=()=>R()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",xt=()=>{if(R())return "";let e;try{window.self!==window.top&&(e=_t());}catch{}return e||(e=window.location.hostname),e},kt=()=>{if(S("sdkVersion",z),R())return {browser:"nodejs",sdkVersion:z};let e=xt();return e&&S("domain",e),{sdkVersion:z,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},X=!1,At=()=>X,Tt=async()=>{X=!0;try{let e=Ie(kt()),t=Y("rid"),s=Y("uid"),i=await be("/v1/sdk/initialise",{version:1,data:{runtimeDetails:e,runtimeId:t,uId:s}}),{runtimeId:r,sTime:n}=i;S("rid",r),ft(n);}catch{X=!1;}};function h(e,t){return (...s)=>{try{let i=e(...s);return i instanceof Promise?i.catch(()=>t):i}catch{return t}}}function Pt(){return we()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var Nt=h(Pt,!1),Ee="imtbl__metrics",Dt=5e3,Ot=1e3,C=(e,t)=>(0, Q.getGlobalisedValue)(Ee,e,t),Ct=(e,t)=>{let s=pe(t,{lruOptions:{ttl:Dt,max:Ot}});return (0, Q.getGlobalisedValue)(Ee,e,s)},$t=5e3,Rt=(e,t,s)=>{let i={event:`${e}.${t}`,time:mt(),...s&&{properties:Ie(s)}};Et(i);},_=h(Ct("track",Rt)),Mt=async()=>{if(At()===!1){await Tt();return}let e=It();if(e.length===0)return;let t=e.length,s=bt();await be("/v1/sdk/metrics",{version:1,data:{events:e,details:s}})instanceof Error||St(t);},Lt=h(Mt),Se=async()=>{await Lt(),setTimeout(Se,$t);},ve=!1,Ut=()=>{ve||(ve=!0,Se());};Nt()||h(C("startFlushing",Ut))();var Vt=(e,t,s,i)=>{let{message:r}=s,n=s.stack||"",{cause:l}=s;l instanceof Error&&(n=`${n}
|
|
4
|
+
Cause: ${l.message}
|
|
5
|
+
${l.stack}`),_(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},_e=h(Vt),Wt=e=>{S("env",e);};h(C("setEnvironment",Wt));var Jt=e=>{S("passportClientId",e);};h(C("setPassportClientId",Jt));var Yt=e=>{S("pak",e);};h(C("setPublishableApiKey",Yt));h(C("getDetail",Y));var Xt={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},L=class extends Error{status;endpoint;body;constructor(e){super(`audience transport failed: ${e.status||"network error"} ${e.endpoint}`,e.cause!==void 0?{cause:e.cause}:void 0),this.name="TransportError",this.status=e.status,this.endpoint=e.endpoint,this.body=e.body;}},N=class extends Error{code;status;endpoint;responseBody;cause;constructor(e){super(e.message),this.name="AudienceError",this.code=e.code,this.status=e.status,this.endpoint=e.endpoint,this.responseBody=e.responseBody,this.cause=e.cause;}};function Ae(e,t,s){if(e.status===0)return new N({code:"NETWORK_ERROR",message:t==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:e.endpoint,cause:e.cause});if(e.status>=200&&e.status<300){let i=e.body,r=i?.rejected??0,n=i?.accepted??0;return new N({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return e.status===429?new N({code:"RATE_LIMITED",message:t==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:e.status,endpoint:e.endpoint,responseBody:e.body}):e.status>=400&&e.status<500?new N({code:t==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush rejected with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body}):new N({code:t==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush failed with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body,cause:e.cause})}function Te(e,t){if(e)try{e(t);}catch{}}var Qt=3e4;function Zt(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}function te(){try{return p()?navigator.onLine:void 0}catch{return}}async function xe(e){let t=e.headers?.get?.("content-type")??"";try{return t.includes("application/json")?await e.json():await e.text()}catch{return}}var ie=async(e,t,s,i)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),Qt),l=Date.now();try{let o=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive,signal:r.signal});if(o.status===429){_("audience","transport_send_failed",{status:429,online:te(),timeToFailureMs:Date.now()-l});let u=Zt(o.headers);return {ok:!1,error:new L({status:429,endpoint:e}),...u!==null?{retryAfterMs:u}:{}}}if(!o.ok){let u=await xe(o);return _("audience","transport_send_failed",{status:o.status,online:te(),timeToFailureMs:Date.now()-l}),{ok:!1,error:new L({status:o.status,endpoint:e,body:u})}}let a=await xe(o);if(typeof a=="object"&&a!==null&&"rejected"in a){let u=a.rejected??0;if(u>0)return _("audience","transport_partial_rejected",{status:o.status,rejected:u}),{ok:!1,error:new L({status:o.status,endpoint:e,body:a})}}return {ok:!0}}catch(o){let a=new L({status:0,endpoint:e,cause:o});return _e("audience","transport_send",a,{errorName:o instanceof Error?o.name:void 0,online:te(),timeToFailureMs:Date.now()-l}),{ok:!1,error:a}}finally{clearTimeout(n);}},re="__imtbl_audience_";function ne(){try{return p()&&typeof localStorage<"u"}catch{return !1}}function es(e,t=re){if(ne())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function ts(e,t,s=re){if(ne())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function ss(e,t=re){if(ne())try{localStorage.removeItem(`${t}${e}`);}catch{}}var se="queue",ke=100,Pe=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??j}${ce}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let i=es(se,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,ke),t={messages:e},s=await this.send(this.endpointUrl,this.publishableKey,t),i;!s.ok&&s.error&&(i=Ae(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&&Te(this.onError,i);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let e=this.messages.slice(0,ke),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=[],ss(se,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(){ts(se,this.messages,this.storagePrefix);}},is="2.20.1";function Ne(e="@imtbl/audience",t=is){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 De(e){let t=new Date(e).getTime();if(Number.isNaN(t))return !1;let s=Date.now();return t<=s+864e5&&t>=s-2592e6}function Oe(e,t,s,i){return e!==s||t!==i}function $(e,t=256){return e.length>t?e.slice(0,t):e}function D(e){let t=k(y);if(t)return A(y,t,1800,e),{sessionId:t,isNew:!1};let s=v();return A(y,s,1800,e),{sessionId:s,isNew:!0}}var Ce=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],$e=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Re="__imtbl_attribution";function rs(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...Ce,...$e]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function ns(){try{let e=sessionStorage.getItem(Re);return e?JSON.parse(e):null}catch{return null}}function os(e){try{sessionStorage.setItem(Re,JSON.stringify(e));}catch{}}function Me(){let e=typeof window<"u"&&window.location?rs(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=$e.some(r=>r in e),i=Ce.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function Le(){let e=ns();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...Me(),landing_page:t};return os(s),s}function Ue(){return Me()}function w(e){return e!=="none"}function x(e){return e==="full"}function Fe(e,t,s,i,r,n,l,o){let a=n??"none",u={none:0,anonymous:1,full:2};function m(d){let c=`${o??j}${de}`;t(c,s,{anonymousId:i,status:d,source:r},{method:"PUT",keepalive:!0}).then(f=>{!f.ok&&f.error&&Te(l,Ae(f.error,"consent"));});}return {get level(){return a},setLevel(d){d!==a&&(u[d]<u[a]&&(d==="none"?e.purge(()=>!0):d==="anonymous"&&(e.purge(c=>c.type==="identify"||c.type==="alias"),e.transform(c=>{if("userId"in c){let{userId:f,...F}=c;return F}return c}))),a=d,m(d));}}}var je="@imtbl/audience",Be="2.20.1",b="[audience]",Ge="WebSDK";var U=class{enabled;constructor(t=!1){this.enabled=t;}logEvent(t,s){this.enabled&&console.log(`${b} ${t}`,s);}logFlush(t,s){this.enabled&&console.log(`${b} flush ${t?"ok":"failed"} (${s} messages)`);}logConsent(t,s){this.enabled&&console.log(`${b} consent ${t} \u2192 ${s}`);}logWarning(t){this.enabled&&console.warn(`${b} ${t}`);}};var as=new Set(["sign_up","link_clicked"]),oe=class e{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;static UUID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;static readAndStripAidParam(){if(!p())return null;let t=new URLSearchParams(window.location.search),s=t.get("imtbl_aid");if(s!==null){t.delete("imtbl_aid");let i=t.toString(),r=`${window.location.pathname}${i?`?${i}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",r);}return s&&e.UUID_RE.test(s)?s:null}constructor(t){let{cookieDomain:s,publishableKey:i}=t,r=t.consent??"none",n=Ge;this.cookieDomain=s,this.testMode=t.testMode??!1,this.debug=new U(t.debug??!1);let l=e.readAndStripAidParam(),o=!1;w(r)?(l?(K(l,s),this.anonymousId=l):this.anonymousId=O(s),o=this.startSession()):this.anonymousId=k(g)??v(),this.queue=new Pe(ie,i,{baseUrl:t.baseUrl,flushIntervalMs:t.flushInterval,flushSize:t.flushSize,onFlush:(a,u)=>this.debug.logFlush(a,u),onError:t.onError,staleFilter:a=>De(a.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Fe(this.queue,ie,i,this.anonymousId,n,r,t.onError,t.baseUrl),this.attribution=Le(),this.isTrackingDisabled()||(this.queue.start(),o&&this.trackSessionStart());}static init(t){if(!t.publishableKey?.trim())throw new Error(`${b} publishableKey is required`);return e.liveInstances>0&&console.warn(`${b} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),e.liveInstances+=1,new e(t)}getAnonymousId(){return this.anonymousId}isTrackingDisabled(){return !w(this.consent.level)}effectiveUserId(){return x(this.consent.level)?this.userId:void 0}startSession(){let t=D(this.cookieDomain);return this.sessionId=t.sessionId,this.sessionStartTime=Date.now(),t.isNew}baseMessage(){return {messageId:v(),eventTimestamp:q(),anonymousId:this.anonymousId,surface:"web",context:Ne(je,Be),...this.testMode&&{test:!0}}}enqueue(t,s){this.queue.enqueue(s),this.debug.logEvent(t,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:B,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:G,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(t){if(this.isTrackingDisabled())return;D(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;D(this.cookieDomain);let[i]=s,r={session_id:this.sessionId,...as.has(t)?Ue():{},...i};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:$(t),properties:r,userId:this.effectiveUserId()});}identify(t,s,i){if(!x(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}D(this.cookieDomain);let r=$(t);this.userId=r,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:r,identityType:s,traits:i});}alias(t,s){if(!x(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Oe(t.id,t.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}D(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:$(t.id),fromType:t.identityType,toId:$(s.id),toType:s.identityType});}setConsent(t){let s=this.consent.level;if(t===s)return;this.debug.logConsent(s,t);let i=!w(s)&&w(t);if(i&&(this.anonymousId=O(this.cookieDomain)),w(t)||this.queue.stop(),this.consent.setLevel(t),w(t)?x(s)&&!x(t)&&(this.userId=void 0):(T(g,this.cookieDomain),T(y,this.cookieDomain)),i){this.isFirstPage=!0;let r=this.startSession();this.queue.start(),r&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),T(g,this.cookieDomain),T(y,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=v(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=O(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 ls={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked",BUTTON_CLICKED:"button_clicked"};/*! Bundled license information:
|
|
6
6
|
|
|
7
7
|
tiny-lru/dist/tiny-lru.js:
|
|
8
8
|
(**
|
|
@@ -14,9 +14,9 @@ tiny-lru/dist/tiny-lru.js:
|
|
|
14
14
|
*)
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
exports.Audience =
|
|
18
|
-
exports.AudienceError =
|
|
19
|
-
exports.AudienceEvents =
|
|
20
|
-
exports.IdentityType =
|
|
21
|
-
exports.canIdentify =
|
|
22
|
-
exports.canTrack =
|
|
17
|
+
exports.Audience = oe;
|
|
18
|
+
exports.AudienceError = N;
|
|
19
|
+
exports.AudienceEvents = ls;
|
|
20
|
+
exports.IdentityType = Xt;
|
|
21
|
+
exports.canIdentify = x;
|
|
22
|
+
exports.canTrack = w;
|
package/dist/node/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
Cause: ${
|
|
3
|
-
${o.stack}`),b(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},ge=d(Gt),Kt=e=>{w("env",e);};d(T("setEnvironment",Kt));var Vt=e=>{w("passportClientId",e);};d(T("setPassportClientId",Vt));var Ht=e=>{w("pak",e);};d(T("setPublishableApiKey",Ht));d(T("getDetail",V));var zt={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},we="https://api.immutable.com",Wt="/v1/audience/messages",Jt="/v1/audience/tracking-consent",x="imtbl_anon_id",_="_imtbl_sid",be="session_start",Ie="session_end",P=()=>typeof window<"u"&&typeof document<"u",k=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return (e==="x"?t:t%4+8).toString(16)}),Ee=()=>new Date().toISOString();function M(e){if(!P())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function R(e,t,s,i){if(!P())return;let r=window.location.protocol==="https:"?"; Secure":"",n=i?`; domain=${i}`:"";document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${s}; SameSite=Lax${n}${r}`;}function N(e,t){R(e,"",0,t);}function L(e){let t=M(x);if(t)return t;let s=k();return R(x,s,63072e3,e),s}var $=class extends Error{status;endpoint;body;constructor(e){super(`audience transport failed: ${e.status||"network error"} ${e.endpoint}`,e.cause!==void 0?{cause:e.cause}:void 0),this.name="TransportError",this.status=e.status,this.endpoint=e.endpoint,this.body=e.body;}},S=class extends Error{code;status;endpoint;responseBody;cause;constructor(e){super(e.message),this.name="AudienceError",this.code=e.code,this.status=e.status,this.endpoint=e.endpoint,this.responseBody=e.responseBody,this.cause=e.cause;}};function Se(e,t,s){if(e.status===0)return new S({code:"NETWORK_ERROR",message:t==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:e.endpoint,cause:e.cause});if(e.status>=200&&e.status<300){let i=e.body,r=i?.rejected??0,n=i?.accepted??0;return new S({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return e.status===429?new S({code:"RATE_LIMITED",message:t==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:e.status,endpoint:e.endpoint,responseBody:e.body}):e.status>=400&&e.status<500?new S({code:t==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush rejected with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body}):new S({code:t==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush failed with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body,cause:e.cause})}function _e(e,t){if(e)try{e(t);}catch{}}var Yt=3e4;function Xt(e){let t=e.get?.("retry-after");if(!t)return null;let s=Number(t.trim());if(!Number.isNaN(s)&&s>=0)return Math.round(s*1e3);let i=new Date(t);if(!Number.isNaN(i.getTime())){let r=i.getTime()-Date.now();return r>0?r:null}return null}async function ye(e){let t=e.headers?.get?.("content-type")??"";try{return t.includes("application/json")?await e.json():await e.text()}catch{return}}var X=async(e,t,s,i)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),Yt);try{let o=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive,signal:r.signal});if(o.status===429){b("audience","transport_send_failed",{status:429});let l=Xt(o.headers);return {ok:!1,error:new $({status:429,endpoint:e}),...l!==null?{retryAfterMs:l}:{}}}if(!o.ok){let l=await ye(o);return b("audience","transport_send_failed",{status:o.status}),{ok:!1,error:new $({status:o.status,endpoint:e,body:l})}}let a=await ye(o);if(typeof a=="object"&&a!==null&&"rejected"in a){let l=a.rejected??0;if(l>0)return b("audience","transport_partial_rejected",{status:o.status,rejected:l}),{ok:!1,error:new $({status:o.status,endpoint:e,body:a})}}return {ok:!0}}catch(o){let a=new $({status:0,endpoint:e,cause:o});return ge("audience","transport_send",a),{ok:!1,error:a}}finally{clearTimeout(n);}},Q="__imtbl_audience_";function Z(){try{return P()&&typeof localStorage<"u"}catch{return !1}}function Qt(e,t=Q){if(Z())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function Zt(e,t,s=Q){if(Z())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function es(e,t=Q){if(Z())try{localStorage.removeItem(`${t}${e}`);}catch{}}var Y="queue",ve=100,xe=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??we}${Wt}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let i=Qt(Y,this.storagePrefix)??[];this.messages=s?.staleFilter?i.filter(s.staleFilter):i;}messages;timer=null;flushing=!1;unloadBound=!1;visibilityHandler;pagehideHandler;onFlush;onError;storagePrefix;endpointUrl;flushIntervalMs;flushSize;consecutiveFailures=0;nextAttemptAt=0;start(){this.timer||(this.timer=setInterval(()=>this.flush(),this.flushIntervalMs),this.registerUnload());}stop(){this.timer&&(clearInterval(this.timer),this.timer=null),this.removeUnload();}destroy(){this.stop(),this.flushUnload();}enqueue(e){this.messages.push(e),this.persist(),this.messages.length>=this.flushSize&&this.flush();}async flush(){if(!(this.flushing||this.messages.length===0)&&!(Date.now()<this.nextAttemptAt)){this.flushing=!0;try{let e=this.messages.slice(0,ve),t={messages:e},s=await this.send(this.endpointUrl,this.publishableKey,t),i;!s.ok&&s.error&&(i=Se(s.error,"flush",e.length));let r=i?.code==="VALIDATION_REJECTED";s.ok||r?(this.messages=this.messages.slice(e.length),this.persist(),this.resetBackoff()):i&&(s.retryAfterMs!==void 0?this.setBackoffUntil(Date.now()+s.retryAfterMs):this.recordFailure()),this.onFlush?.(s.ok,e.length),i&&_e(this.onError,i);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let e=this.messages.slice(0,ve),t={messages:e};this.send(this.endpointUrl,this.publishableKey,t,{keepalive:!0}),this.messages=this.messages.slice(e.length),this.persist();}purge(e){this.messages=this.messages.filter(t=>!e(t)),this.persist();}transform(e){this.messages=this.messages.map(e),this.persist();}get length(){return this.messages.length}clear(){this.messages=[],es(Y,this.storagePrefix);}registerUnload(){!P()||this.unloadBound||(this.unloadBound=!0,this.pagehideHandler=()=>this.flushUnload(),this.visibilityHandler=()=>{document.visibilityState==="hidden"&&this.flushUnload();},document.addEventListener("visibilitychange",this.visibilityHandler),window.addEventListener("pagehide",this.pagehideHandler));}removeUnload(){this.unloadBound&&(this.visibilityHandler&&document.removeEventListener("visibilitychange",this.visibilityHandler),this.pagehideHandler&&window.removeEventListener("pagehide",this.pagehideHandler),this.unloadBound=!1);}backoffDelayMs(){switch(this.consecutiveFailures){case 0:return 0;case 1:return 5e3;case 2:return 1e4;case 3:return 2e4;case 4:return 4e4;default:return 6e4}}recordFailure(){let e=Date.now();e<this.nextAttemptAt||(this.consecutiveFailures++,this.nextAttemptAt=e+this.backoffDelayMs());}setBackoffUntil(e){this.consecutiveFailures++,this.nextAttemptAt=e;}resetBackoff(){this.consecutiveFailures=0,this.nextAttemptAt=0;}persist(){Zt(Y,this.messages,this.storagePrefix);}},ts="2.20.1-alpha.1";function ke(e="@imtbl/audience",t=ts){let s={library:e,libraryVersion:t};return P()&&(s.userAgent=navigator.userAgent,s.locale=navigator.language,s.timezone=Intl.DateTimeFormat().resolvedOptions().timeZone,s.screen=`${window.screen.width}x${window.screen.height}`,s.pageUrl=window.location.href,s.pagePath=window.location.pathname,s.pageReferrer=document.referrer,s.pageTitle=document.title),s}function Ae(e){let t=new Date(e).getTime();if(Number.isNaN(t))return !1;let s=Date.now();return t<=s+864e5&&t>=s-2592e6}function Te(e,t,s,i){return e!==s||t!==i}function O(e,t=256){return e.length>t?e.slice(0,t):e}function A(e){let t=M(_);if(t)return R(_,t,1800,e),{sessionId:t,isNew:!1};let s=k();return R(_,s,1800,e),{sessionId:s,isNew:!0}}var Pe=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],Ne=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Oe="__imtbl_attribution";function ss(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...Pe,...Ne]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function is(){try{let e=sessionStorage.getItem(Oe);return e?JSON.parse(e):null}catch{return null}}function rs(e){try{sessionStorage.setItem(Oe,JSON.stringify(e));}catch{}}function De(){let e=typeof window<"u"&&window.location?ss(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=Ne.some(r=>r in e),i=Pe.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function Ce(){let e=is();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...De(),landing_page:t};return rs(s),s}function $e(){return De()}function m(e){return e!=="none"}function I(e){return e==="full"}function Re(e,t,s,i,r,n,o,a){let l=n??"none",h={none:0,anonymous:1,full:2};function f(c){let u=`${a??we}${Jt}`;t(u,s,{anonymousId:i,status:c,source:r},{method:"PUT",keepalive:!0}).then(p=>{!p.ok&&p.error&&_e(o,Se(p.error,"consent"));});}return {get level(){return l},setLevel(c){c!==l&&(h[c]<h[l]&&(c==="none"?e.purge(()=>!0):c==="anonymous"&&(e.purge(u=>u.type==="identify"||u.type==="alias"),e.transform(u=>{if("userId"in u){let{userId:p,...F}=u;return F}return u}))),l=c,f(c));}}}var Me="@imtbl/audience",Le="2.20.1-alpha.1",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:
|
|
1
|
+
var Ke=Object.create;var ue=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var ze=Object.getPrototypeOf,We=Object.prototype.hasOwnProperty;var Je=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ye=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of He(t))!We.call(e,r)&&r!==s&&ue(e,r,{get:()=>t[r],enumerable:!(i=Ve(t,r))||i.enumerable});return e};var Xe=(e,t,s)=>(s=e!=null?Ke(ze(e)):{},Ye(ue(s,"default",{value:e,enumerable:!0}),e));var ye=Je(P=>{Object.defineProperty(P,"__esModule",{value:!0});P.clearGlobalNamespace=P.getGlobalisedValue=void 0;var et="globalise__singleton__",tt={},fe=()=>typeof window<"u"?window:typeof globalThis<"u"?globalThis:tt,st=(e,t)=>{if(typeof e!="string")throw "Invalid namespace key";if(typeof t!="string")throw "Invalid item key"},me=e=>`${et}${e}`,ge=e=>{let t=fe(),s=me(e);return t[s]||(t[s]={}),t[s]},it=(e,t)=>ge(e)[t]||void 0,rt=(e,t,s)=>{let i=ge(e);i[t]=s;},nt=(e,t,s)=>{st(e,t);let i=it(e,t);return i!==void 0?i:(rt(e,t,s),s)};P.getGlobalisedValue=nt;var ot=e=>{let t=fe(),s=me(e);t[s]!==void 0&&delete t[s];};P.clearGlobalNamespace=ot;});var j="https://api.immutable.com",ce="/v1/audience/messages",de="/v1/audience/tracking-consent",g="imtbl_anon_id",y="_imtbl_sid",B="session_start",G="session_end",p=()=>typeof window<"u"&&typeof document<"u",v=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return (e==="x"?t:t%4+8).toString(16)}),q=()=>new Date().toISOString();function k(e){if(!p())return;let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):void 0}function A(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 T(e,t){A(e,"",0,t);}function O(e){let t=k(g);if(t)return t;let s=v();return A(g,s,63072e3,e),s}function K(e,t){A(g,e,63072e3,t);}var V=class{constructor(t=0,s=0,i=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=i,this.size=0,this.ttl=s;}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){let s=this.items[t];delete this.items[t],this.size--,s.prev!==null&&(s.prev.next=s.next),s.next!==null&&(s.next.prev=s.prev),this.first===s&&(this.first=s.next),this.last===s&&(this.last=s.prev);}return this}entries(t=this.keys()){return t.map(s=>[s,this.get(s)])}evict(t=!1){if(t||this.size>0){let s=this.first;delete this.items[s.key],--this.size===0?(this.first=null,this.last=null):(this.first=s.next,this.first.prev=null);}return this}expiresAt(t){let s;return this.has(t)&&(s=this.items[t].expiry),s}get(t){let s;if(this.has(t)){let i=this.items[t];this.ttl>0&&i.expiry<=Date.now()?this.delete(t):(s=i.value,this.set(t,s,!0));}return s}has(t){return t in this.items}keys(){let t=[],s=this.first;for(;s!==null;)t.push(s.key),s=s.next;return t}set(t,s,i=!1,r=this.resetTtl){let n;if(i||this.has(t)){if(n=this.items[t],n.value=s,i===!1&&r&&(n.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==n){let l=this.last,o=n.next,a=n.prev;this.first===n&&(this.first=n.next),n.next=null,n.prev=this.last,l.next=n,a!==null&&(a.next=o),o!==null&&(o.prev=a);}}else this.max>0&&this.size===this.max&&this.evict(!0),n=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:s},++this.size===1?this.first=n:this.last.next=n;return this.last=n,this}values(t=this.keys()){return t.map(s=>this.get(s))}};function he(e=1e3,t=0,s=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if(typeof s!="boolean")throw new TypeError("Invalid resetTtl value");return new V(e,t,s)}var Qe={max:1e3},pe=(e,t={})=>{let{cache:s,cacheKeyResolver:i=H,onHit:r,lruOptions:n={}}=t,l={...Qe,...n},o=s||he(l.max,l.ttl);function a(...u){let m=i(...u),d=o.get(m);if(o.has(m))return r&&r(m,d,o),d;let f=e.apply(this,u);return o.set(m,f),f}return a._cache=o,a},H=(...e)=>e.length===0?"no-args":e.map(t=>t===void 0?"undefined":t===null?"null":Array.isArray(t)?`[${H(...t)}]`:typeof t=="object"?`{${H(...Ze(t))}}`:JSON.stringify(t)).join(","),Ze=e=>Object.entries(e).sort((t,s)=>t[0]<s[0]?-1:1);var Q=Xe(ye()),at=Object.defineProperty,lt=(e,t)=>{for(var s in t)at(e,s,{get:t[s],enumerable:!0});},ut={};lt(ut,{deleteItem:()=>pt,getItem:()=>W,setItem:()=>M});var R=()=>typeof window>"u",we=()=>!R(),ct="__IMX-",Z=()=>we()&&window.localStorage,dt=e=>{if(e!==null)try{return JSON.parse(e)}catch{return e}},ht=e=>typeof e=="string"?e:JSON.stringify(e),ee=e=>`${ct}${e}`;function W(e){if(Z())return dt(window.localStorage.getItem(ee(e)))}var M=(e,t)=>Z()?(window.localStorage.setItem(ee(e),ht(t)),!0):!1,pt=e=>Z()?(window.localStorage.removeItem(ee(e)),!0):!1,J=0,ft=e=>{let t=parseInt(e,10)*1e3,s=new Date(t),i=new Date;return J=s.getTime()-i.getTime(),J},mt=()=>{let e=new Date().getTime()+J;return new Date(e).toISOString()},gt=(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))(gt||{}),yt="https://api.immutable.com",vt=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 be(e,t){let s=JSON.stringify(t),i={payload:vt(s)},r=await fetch(`${yt}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!r.ok){let n=await r.text().catch(()=>"");throw new Error(`Request failed (${r.status}): ${n||r.statusText}`)}return r.json()}var I,E,wt=()=>{I=W("metrics-events")||[],E=W("metrics-runtime")||{};};wt();var S=(e,t)=>{E={...E,[e]:t},M("metrics-runtime",E);},Y=e=>{if(E[e]!==void 0)return E[e]},bt=()=>E,It=()=>I,Et=e=>{I.push(e),M("metrics-events",I);},St=e=>{I=I.slice(e),M("metrics-events",I);},Ie=e=>{let t=[];return Object.entries(e).forEach(([s,i])=>{(typeof s=="string"||typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&t.push([s,i.toString()]);}),t},z="2.20.1",_t=()=>R()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",xt=()=>{if(R())return "";let e;try{window.self!==window.top&&(e=_t());}catch{}return e||(e=window.location.hostname),e},kt=()=>{if(S("sdkVersion",z),R())return {browser:"nodejs",sdkVersion:z};let e=xt();return e&&S("domain",e),{sdkVersion:z,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},X=!1,At=()=>X,Tt=async()=>{X=!0;try{let e=Ie(kt()),t=Y("rid"),s=Y("uid"),i=await be("/v1/sdk/initialise",{version:1,data:{runtimeDetails:e,runtimeId:t,uId:s}}),{runtimeId:r,sTime:n}=i;S("rid",r),ft(n);}catch{X=!1;}};function h(e,t){return (...s)=>{try{let i=e(...s);return i instanceof Promise?i.catch(()=>t):i}catch{return t}}}function Pt(){return we()||typeof process>"u"?!1:process.env.JEST_WORKER_ID!==void 0}var Nt=h(Pt,!1),Ee="imtbl__metrics",Dt=5e3,Ot=1e3,C=(e,t)=>(0, Q.getGlobalisedValue)(Ee,e,t),Ct=(e,t)=>{let s=pe(t,{lruOptions:{ttl:Dt,max:Ot}});return (0, Q.getGlobalisedValue)(Ee,e,s)},$t=5e3,Rt=(e,t,s)=>{let i={event:`${e}.${t}`,time:mt(),...s&&{properties:Ie(s)}};Et(i);},_=h(Ct("track",Rt)),Mt=async()=>{if(At()===!1){await Tt();return}let e=It();if(e.length===0)return;let t=e.length,s=bt();await be("/v1/sdk/metrics",{version:1,data:{events:e,details:s}})instanceof Error||St(t);},Lt=h(Mt),Se=async()=>{await Lt(),setTimeout(Se,$t);},ve=!1,Ut=()=>{ve||(ve=!0,Se());};Nt()||h(C("startFlushing",Ut))();var Vt=(e,t,s,i)=>{let{message:r}=s,n=s.stack||"",{cause:l}=s;l instanceof Error&&(n=`${n}
|
|
2
|
+
Cause: ${l.message}
|
|
3
|
+
${l.stack}`),_(e,`trackError_${t}`,{...i||{},errorMessage:r,errorStack:n,isTrackError:!0});},_e=h(Vt),Wt=e=>{S("env",e);};h(C("setEnvironment",Wt));var Jt=e=>{S("passportClientId",e);};h(C("setPassportClientId",Jt));var Yt=e=>{S("pak",e);};h(C("setPublishableApiKey",Yt));h(C("getDetail",Y));var Xt={Passport:"passport",Steam:"steam",Epic:"epic",Google:"google",Apple:"apple",Discord:"discord",Email:"email",Custom:"custom"},L=class extends Error{status;endpoint;body;constructor(e){super(`audience transport failed: ${e.status||"network error"} ${e.endpoint}`,e.cause!==void 0?{cause:e.cause}:void 0),this.name="TransportError",this.status=e.status,this.endpoint=e.endpoint,this.body=e.body;}},N=class extends Error{code;status;endpoint;responseBody;cause;constructor(e){super(e.message),this.name="AudienceError",this.code=e.code,this.status=e.status,this.endpoint=e.endpoint,this.responseBody=e.responseBody,this.cause=e.cause;}};function Ae(e,t,s){if(e.status===0)return new N({code:"NETWORK_ERROR",message:t==="flush"?`Network error sending ${s??0} messages`:"Network error syncing consent",status:0,endpoint:e.endpoint,cause:e.cause});if(e.status>=200&&e.status<300){let i=e.body,r=i?.rejected??0,n=i?.accepted??0;return new N({code:"VALIDATION_REJECTED",message:`Backend rejected ${r} of ${r+n} messages`,status:e.status,endpoint:e.endpoint,responseBody:e.body})}return e.status===429?new N({code:"RATE_LIMITED",message:t==="flush"?"Flush rate limited (429)":"Consent sync rate limited (429)",status:e.status,endpoint:e.endpoint,responseBody:e.body}):e.status>=400&&e.status<500?new N({code:t==="flush"?"VALIDATION_REJECTED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush rejected with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body}):new N({code:t==="flush"?"FLUSH_FAILED":"CONSENT_SYNC_FAILED",message:t==="flush"?`Flush failed with status ${e.status}`:`Consent sync failed with status ${e.status}`,status:e.status,endpoint:e.endpoint,responseBody:e.body,cause:e.cause})}function Te(e,t){if(e)try{e(t);}catch{}}var Qt=3e4;function Zt(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}function te(){try{return p()?navigator.onLine:void 0}catch{return}}async function xe(e){let t=e.headers?.get?.("content-type")??"";try{return t.includes("application/json")?await e.json():await e.text()}catch{return}}var ie=async(e,t,s,i)=>{let r=new AbortController,n=setTimeout(()=>r.abort(),Qt),l=Date.now();try{let o=await fetch(e,{method:i?.method??"POST",headers:{"Content-Type":"application/json","x-immutable-publishable-key":t},body:JSON.stringify(s),keepalive:i?.keepalive,signal:r.signal});if(o.status===429){_("audience","transport_send_failed",{status:429,online:te(),timeToFailureMs:Date.now()-l});let u=Zt(o.headers);return {ok:!1,error:new L({status:429,endpoint:e}),...u!==null?{retryAfterMs:u}:{}}}if(!o.ok){let u=await xe(o);return _("audience","transport_send_failed",{status:o.status,online:te(),timeToFailureMs:Date.now()-l}),{ok:!1,error:new L({status:o.status,endpoint:e,body:u})}}let a=await xe(o);if(typeof a=="object"&&a!==null&&"rejected"in a){let u=a.rejected??0;if(u>0)return _("audience","transport_partial_rejected",{status:o.status,rejected:u}),{ok:!1,error:new L({status:o.status,endpoint:e,body:a})}}return {ok:!0}}catch(o){let a=new L({status:0,endpoint:e,cause:o});return _e("audience","transport_send",a,{errorName:o instanceof Error?o.name:void 0,online:te(),timeToFailureMs:Date.now()-l}),{ok:!1,error:a}}finally{clearTimeout(n);}},re="__imtbl_audience_";function ne(){try{return p()&&typeof localStorage<"u"}catch{return !1}}function es(e,t=re){if(ne())try{let s=localStorage.getItem(`${t}${e}`);return s?JSON.parse(s):void 0}catch{return}}function ts(e,t,s=re){if(ne())try{localStorage.setItem(`${s}${e}`,JSON.stringify(t));}catch{}}function ss(e,t=re){if(ne())try{localStorage.removeItem(`${t}${e}`);}catch{}}var se="queue",ke=100,Pe=class{constructor(e,t,s){this.send=e,this.publishableKey=t,this.endpointUrl=`${s?.baseUrl??j}${ce}`,this.flushIntervalMs=s?.flushIntervalMs??5e3,this.flushSize=s?.flushSize??20,this.onFlush=s?.onFlush,this.onError=s?.onError,this.storagePrefix=s?.storagePrefix;let i=es(se,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,ke),t={messages:e},s=await this.send(this.endpointUrl,this.publishableKey,t),i;!s.ok&&s.error&&(i=Ae(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&&Te(this.onError,i);}finally{this.flushing=!1;}}}flushUnload(){if(this.flushing||this.messages.length===0)return;let e=this.messages.slice(0,ke),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=[],ss(se,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(){ts(se,this.messages,this.storagePrefix);}},is="2.20.1";function Ne(e="@imtbl/audience",t=is){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 De(e){let t=new Date(e).getTime();if(Number.isNaN(t))return !1;let s=Date.now();return t<=s+864e5&&t>=s-2592e6}function Oe(e,t,s,i){return e!==s||t!==i}function $(e,t=256){return e.length>t?e.slice(0,t):e}function D(e){let t=k(y);if(t)return A(y,t,1800,e),{sessionId:t,isNew:!1};let s=v();return A(y,s,1800,e),{sessionId:s,isNew:!0}}var Ce=["utm_source","utm_medium","utm_campaign","utm_content","utm_term"],$e=["gclid","dclid","fbclid","ttclid","msclkid","li_fat_id"],Re="__imtbl_attribution";function rs(e){let t;try{t=new URL(e).searchParams;}catch{return {}}let s={};for(let r of [...Ce,...$e]){let n=t.get(r);n&&(s[r]=n);}let i=t.get("referral_code");return i&&(s.referral_code=i),s}function ns(){try{let e=sessionStorage.getItem(Re);return e?JSON.parse(e):null}catch{return null}}function os(e){try{sessionStorage.setItem(Re,JSON.stringify(e));}catch{}}function Me(){let e=typeof window<"u"&&window.location?rs(window.location.href):{},t=typeof document<"u"&&document.referrer||void 0,s=$e.some(r=>r in e),i=Ce.some(r=>r in e);return {...e,referrer:t,touchpoint_type:s||i?"click":void 0}}function Le(){let e=ns();if(e)return e;let t=typeof window<"u"&&window.location?window.location.href:void 0,s={...Me(),landing_page:t};return os(s),s}function Ue(){return Me()}function w(e){return e!=="none"}function x(e){return e==="full"}function Fe(e,t,s,i,r,n,l,o){let a=n??"none",u={none:0,anonymous:1,full:2};function m(d){let c=`${o??j}${de}`;t(c,s,{anonymousId:i,status:d,source:r},{method:"PUT",keepalive:!0}).then(f=>{!f.ok&&f.error&&Te(l,Ae(f.error,"consent"));});}return {get level(){return a},setLevel(d){d!==a&&(u[d]<u[a]&&(d==="none"?e.purge(()=>!0):d==="anonymous"&&(e.purge(c=>c.type==="identify"||c.type==="alias"),e.transform(c=>{if("userId"in c){let{userId:f,...F}=c;return F}return c}))),a=d,m(d));}}}var je="@imtbl/audience",Be="2.20.1",b="[audience]",Ge="WebSDK";var U=class{enabled;constructor(t=!1){this.enabled=t;}logEvent(t,s){this.enabled&&console.log(`${b} ${t}`,s);}logFlush(t,s){this.enabled&&console.log(`${b} flush ${t?"ok":"failed"} (${s} messages)`);}logConsent(t,s){this.enabled&&console.log(`${b} consent ${t} \u2192 ${s}`);}logWarning(t){this.enabled&&console.warn(`${b} ${t}`);}};var as=new Set(["sign_up","link_clicked"]),oe=class e{static liveInstances=0;queue;consent;attribution;debug;cookieDomain;testMode;anonymousId;sessionId;sessionStartTime;userId;isFirstPage=!0;destroyed=!1;static UUID_RE=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;static readAndStripAidParam(){if(!p())return null;let t=new URLSearchParams(window.location.search),s=t.get("imtbl_aid");if(s!==null){t.delete("imtbl_aid");let i=t.toString(),r=`${window.location.pathname}${i?`?${i}`:""}${window.location.hash}`;window.history.replaceState(window.history.state,"",r);}return s&&e.UUID_RE.test(s)?s:null}constructor(t){let{cookieDomain:s,publishableKey:i}=t,r=t.consent??"none",n=Ge;this.cookieDomain=s,this.testMode=t.testMode??!1,this.debug=new U(t.debug??!1);let l=e.readAndStripAidParam(),o=!1;w(r)?(l?(K(l,s),this.anonymousId=l):this.anonymousId=O(s),o=this.startSession()):this.anonymousId=k(g)??v(),this.queue=new Pe(ie,i,{baseUrl:t.baseUrl,flushIntervalMs:t.flushInterval,flushSize:t.flushSize,onFlush:(a,u)=>this.debug.logFlush(a,u),onError:t.onError,staleFilter:a=>De(a.eventTimestamp),storagePrefix:"__imtbl_web_"}),this.consent=Fe(this.queue,ie,i,this.anonymousId,n,r,t.onError,t.baseUrl),this.attribution=Le(),this.isTrackingDisabled()||(this.queue.start(),o&&this.trackSessionStart());}static init(t){if(!t.publishableKey?.trim())throw new Error(`${b} publishableKey is required`);return e.liveInstances>0&&console.warn(`${b} Multiple SDK instances detected. Ensure previous instances are shut down to avoid duplicate events.`),e.liveInstances+=1,new e(t)}getAnonymousId(){return this.anonymousId}isTrackingDisabled(){return !w(this.consent.level)}effectiveUserId(){return x(this.consent.level)?this.userId:void 0}startSession(){let t=D(this.cookieDomain);return this.sessionId=t.sessionId,this.sessionStartTime=Date.now(),t.isNew}baseMessage(){return {messageId:v(),eventTimestamp:q(),anonymousId:this.anonymousId,surface:"web",context:Ne(je,Be),...this.testMode&&{test:!0}}}enqueue(t,s){this.queue.enqueue(s),this.debug.logEvent(t,s);}trackSessionStart(){this.sessionId&&this.enqueue("track(session_start)",{...this.baseMessage(),type:"track",eventName:B,properties:{session_id:this.sessionId,...this.attribution}});}trackSessionEnd(){this.sessionId&&this.enqueue("track(session_end)",{...this.baseMessage(),type:"track",eventName:G,properties:{session_id:this.sessionId,...this.sessionStartTime&&{duration:Math.round((Date.now()-this.sessionStartTime)/1e3)}}});}page(t){if(this.isTrackingDisabled())return;D(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;D(this.cookieDomain);let[i]=s,r={session_id:this.sessionId,...as.has(t)?Ue():{},...i};this.enqueue("track",{...this.baseMessage(),type:"track",eventName:$(t),properties:r,userId:this.effectiveUserId()});}identify(t,s,i){if(!x(this.consent.level)){this.debug.logWarning("identify() requires full consent \u2014 call ignored.");return}D(this.cookieDomain);let r=$(t);this.userId=r,this.enqueue("identify",{...this.baseMessage(),type:"identify",userId:r,identityType:s,traits:i});}alias(t,s){if(!x(this.consent.level)){this.debug.logWarning("alias() requires full consent \u2014 call ignored.");return}if(!Oe(t.id,t.identityType,s.id,s.identityType)){this.debug.logWarning("alias() from and to are identical \u2014 call ignored.");return}D(this.cookieDomain),this.enqueue("alias",{...this.baseMessage(),type:"alias",fromId:$(t.id),fromType:t.identityType,toId:$(s.id),toType:s.identityType});}setConsent(t){let s=this.consent.level;if(t===s)return;this.debug.logConsent(s,t);let i=!w(s)&&w(t);if(i&&(this.anonymousId=O(this.cookieDomain)),w(t)||this.queue.stop(),this.consent.setLevel(t),w(t)?x(s)&&!x(t)&&(this.userId=void 0):(T(g,this.cookieDomain),T(y,this.cookieDomain)),i){this.isFirstPage=!0;let r=this.startSession();this.queue.start(),r&&this.trackSessionStart();}}reset(){this.userId=void 0,this.queue.clear(),T(g,this.cookieDomain),T(y,this.cookieDomain),this.isTrackingDisabled()?(this.anonymousId=v(),this.sessionId=void 0,this.sessionStartTime=void 0):(this.anonymousId=O(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 ls={SIGN_UP:"sign_up",SIGN_IN:"sign_in",WISHLIST_ADD:"wishlist_add",WISHLIST_REMOVE:"wishlist_remove",PURCHASE:"purchase",GAME_LAUNCH:"game_launch",PROGRESSION:"progression",RESOURCE:"resource",EMAIL_ACQUIRED:"email_acquired",GAME_PAGE_VIEWED:"game_page_viewed",LINK_CLICKED:"link_clicked",BUTTON_CLICKED:"button_clicked"};/*! Bundled license information:
|
|
4
4
|
|
|
5
5
|
tiny-lru/dist/tiny-lru.js:
|
|
6
6
|
(**
|
|
@@ -12,4 +12,4 @@ tiny-lru/dist/tiny-lru.js:
|
|
|
12
12
|
*)
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
export {
|
|
15
|
+
export { oe as Audience, N as AudienceError, ls as AudienceEvents, Xt as IdentityType, x as canIdentify, w as canTrack };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ declare const AudienceEvents: {
|
|
|
92
92
|
readonly EMAIL_ACQUIRED: "email_acquired";
|
|
93
93
|
readonly GAME_PAGE_VIEWED: "game_page_viewed";
|
|
94
94
|
readonly LINK_CLICKED: "link_clicked";
|
|
95
|
+
readonly BUTTON_CLICKED: "button_clicked";
|
|
95
96
|
};
|
|
96
97
|
interface SignUpProperties {
|
|
97
98
|
method?: string;
|
|
@@ -151,6 +152,11 @@ interface LinkClickedProperties {
|
|
|
151
152
|
source?: string;
|
|
152
153
|
game_id?: string;
|
|
153
154
|
}
|
|
155
|
+
interface ButtonClickedProperties {
|
|
156
|
+
button_text?: string;
|
|
157
|
+
element_id?: string;
|
|
158
|
+
element_type?: string;
|
|
159
|
+
}
|
|
154
160
|
interface EventPropsMap {
|
|
155
161
|
sign_up: SignUpProperties;
|
|
156
162
|
sign_in: SignInProperties;
|
|
@@ -163,6 +169,7 @@ interface EventPropsMap {
|
|
|
163
169
|
email_acquired: EmailAcquiredProperties;
|
|
164
170
|
game_page_viewed: GamePageViewedProperties;
|
|
165
171
|
link_clicked: LinkClickedProperties;
|
|
172
|
+
button_clicked: ButtonClickedProperties;
|
|
166
173
|
}
|
|
167
174
|
type AudienceEventName = keyof EventPropsMap;
|
|
168
175
|
/**
|
|
@@ -227,12 +234,16 @@ declare class Audience {
|
|
|
227
234
|
private userId;
|
|
228
235
|
private isFirstPage;
|
|
229
236
|
private destroyed;
|
|
237
|
+
private static readonly UUID_RE;
|
|
238
|
+
private static readAndStripAidParam;
|
|
230
239
|
private constructor();
|
|
231
240
|
/**
|
|
232
241
|
* Create and start the SDK. Warns if another instance is already active —
|
|
233
242
|
* call `shutdown()` on the previous one first.
|
|
234
243
|
*/
|
|
235
244
|
static init(config: AudienceConfig): Audience;
|
|
245
|
+
/** Returns the anonymous ID for the current browser session. */
|
|
246
|
+
getAnonymousId(): string;
|
|
236
247
|
/** True when the current consent level does not permit tracking. */
|
|
237
248
|
private isTrackingDisabled;
|
|
238
249
|
/** Returns userId if consent is full, undefined otherwise. */
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/audience",
|
|
3
3
|
"description": "Immutable Audience — consent-aware event tracking and identity management",
|
|
4
|
-
"version": "2.20.1
|
|
4
|
+
"version": "2.20.1",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
7
7
|
"devDependencies": {
|