@formo/analytics 1.35.2 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/src/FormoAnalytics.d.ts +79 -363
- package/dist/cjs/src/FormoAnalytics.js +368 -2234
- package/dist/cjs/src/event/EventManager.d.ts +3 -1
- package/dist/cjs/src/event/EventManager.js +5 -1
- package/dist/cjs/src/event/type.d.ts +1 -0
- package/dist/cjs/src/evm/EvmEventTracker.d.ts +175 -0
- package/dist/cjs/src/evm/EvmEventTracker.js +1030 -0
- package/dist/cjs/src/evm/EvmProviderRegistry.d.ts +132 -0
- package/dist/cjs/src/evm/EvmProviderRegistry.js +348 -0
- package/dist/cjs/src/evm/EvmRequestTracker.d.ts +120 -0
- package/dist/cjs/src/evm/EvmRequestTracker.js +756 -0
- package/dist/cjs/src/queue/EventQueue.d.ts +28 -0
- package/dist/cjs/src/queue/EventQueue.js +97 -19
- package/dist/cjs/src/queue/type.d.ts +1 -0
- package/dist/cjs/src/tracking/TrackingPolicy.d.ts +146 -0
- package/dist/cjs/src/tracking/TrackingPolicy.js +200 -0
- package/dist/cjs/src/validators/address.d.ts +1 -1
- package/dist/cjs/src/version.d.ts +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/cjs/src/wallet/WalletStateStore.d.ts +223 -0
- package/dist/cjs/src/wallet/WalletStateStore.js +515 -0
- package/dist/esm/src/FormoAnalytics.d.ts +79 -363
- package/dist/esm/src/FormoAnalytics.js +369 -2235
- package/dist/esm/src/event/EventManager.d.ts +3 -1
- package/dist/esm/src/event/EventManager.js +5 -1
- package/dist/esm/src/event/type.d.ts +1 -0
- package/dist/esm/src/evm/EvmEventTracker.d.ts +175 -0
- package/dist/esm/src/evm/EvmEventTracker.js +1027 -0
- package/dist/esm/src/evm/EvmProviderRegistry.d.ts +132 -0
- package/dist/esm/src/evm/EvmProviderRegistry.js +345 -0
- package/dist/esm/src/evm/EvmRequestTracker.d.ts +120 -0
- package/dist/esm/src/evm/EvmRequestTracker.js +753 -0
- package/dist/esm/src/queue/EventQueue.d.ts +28 -0
- package/dist/esm/src/queue/EventQueue.js +97 -19
- package/dist/esm/src/queue/type.d.ts +1 -0
- package/dist/esm/src/tracking/TrackingPolicy.d.ts +146 -0
- package/dist/esm/src/tracking/TrackingPolicy.js +197 -0
- package/dist/esm/src/version.d.ts +1 -1
- package/dist/esm/src/version.js +1 -1
- package/dist/esm/src/wallet/WalletStateStore.d.ts +223 -0
- package/dist/esm/src/wallet/WalletStateStore.js +512 -0
- package/dist/index.umd.min.js +1 -1
- package/package.json +5 -4
package/dist/index.umd.min.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.umd.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("FormoAnalytics",[],t):"object"==typeof exports?exports.FormoAnalytics=t():e.FormoAnalytics=t()}(self,()=>(()=>{"use strict";var e={6839(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.notImplemented=t.bitMask=void 0,t.isBytes=i,t.abytes=a,t.abool=function(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)},t.numberToHexUnpadded=o,t.hexToNumber=s,t.bytesToHex=d,t.hexToBytes=h,t.bytesToNumberBE=function(e){return s(d(e))},t.bytesToNumberLE=function(e){return a(e),s(d(Uint8Array.from(e).reverse()))},t.numberToBytesBE=f,t.numberToBytesLE=function(e,t){return f(e,t).reverse()},t.numberToVarBytesBE=function(e){return h(o(e))},t.ensureBytes=function(e,t,r){let n;if("string"==typeof t)try{n=h(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!i(t))throw new Error(e+" must be hex string or Uint8Array");n=Uint8Array.from(t)}const a=n.length;if("number"==typeof r&&a!==r)throw new Error(e+" of length "+r+" expected, got "+a);return n},t.concatBytes=p,t.equalBytes=function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r},t.utf8ToBytes=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))},t.inRange=g,t.aInRange=function(e,t,r,n){if(!g(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)},t.bitLen=function(e){let t;for(t=0;e>r;e>>=n,t+=1);return t},t.bitGet=function(e,t){return e>>BigInt(t)&n},t.bitSet=function(e,t,i){return e|(i?n:r)<<BigInt(t)},t.createHmacDrbg=function(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=y(e),i=y(e),a=0;const o=()=>{n.fill(1),i.fill(0),a=0},s=(...e)=>r(i,n,...e),c=(e=y(0))=>{i=s(m([0]),e),n=s(),0!==e.length&&(i=s(m([1]),e),n=s())},u=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=s();const t=n.slice();r.push(t),e+=n.length}return p(...r)};return(e,t)=>{let r;for(o(),c(e);!(r=t(u()));)c();return o(),r}},t.validateObject=function(e,t,r={}){const n=(t,r,n)=>{const i=A[r];if("function"!=typeof i)throw new Error("invalid validator function");const a=e[t];if(!(n&&void 0===a||i(a,e)))throw new Error("param "+String(t)+" is invalid. Expected "+r+", got "+a)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e},t.memoized=function(e){const t=new WeakMap;return(r,...n)=>{const i=t.get(r);if(void 0!==i)return i;const a=e(r,...n);return t.set(r,a),a}};const r=BigInt(0),n=BigInt(1);function i(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function a(e){if(!i(e))throw new Error("Uint8Array expected")}function o(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function s(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?r:BigInt("0x"+e)}const c="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,u=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function d(e){if(a(e),c)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=u[e[r]];return t}function l(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function h(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(c)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=l(e.charCodeAt(i)),a=l(e.charCodeAt(i+1));if(void 0===r||void 0===a){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+a}return n}function f(e,t){return h(e.toString(16).padStart(2*t,"0"))}function p(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];a(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}const v=e=>"bigint"==typeof e&&r<=e;function g(e,t,r){return v(e)&&v(t)&&v(r)&&t<=e&&e<r}t.bitMask=e=>(n<<BigInt(e))-n;const y=e=>new Uint8Array(e),m=e=>Uint8Array.from(e),A={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||i(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};t.notImplemented=()=>{throw new Error("not implemented")}},681(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.aoutput=t.anumber=t.aexists=t.abytes=void 0;const n=r(11);t.abytes=n.abytes,t.aexists=n.aexists,t.anumber=n.anumber,t.aoutput=n.aoutput},7734(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.SHA512_IV=t.SHA384_IV=t.SHA224_IV=t.SHA256_IV=t.HashMD=void 0,t.setBigUint64=i,t.Chi=function(e,t,r){return e&t^~e&r},t.Maj=function(e,t,r){return e&t^e&r^t&r};const n=r(11);function i(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),a=BigInt(4294967295),o=Number(r>>i&a),s=Number(r&a),c=n?4:0,u=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+u,s,n)}class a extends n.Hash{constructor(e,t,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=(0,n.createView)(this.buffer)}update(e){(0,n.aexists)(this),e=(0,n.toBytes)(e),(0,n.abytes)(e);const{view:t,buffer:r,blockLen:i}=this,a=e.length;for(let o=0;o<a;){const s=Math.min(i-this.pos,a-o);if(s===i){const t=(0,n.createView)(e);for(;i<=a-o;o+=i)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.aexists)(this),(0,n.aoutput)(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:a,isLE:o}=this;let{pos:s}=this;t[s++]=128,(0,n.clean)(this.buffer.subarray(s)),this.padOffset>a-s&&(this.process(r,0),s=0);for(let e=s;e<a;e++)t[e]=0;i(r,a-8,BigInt(8*this.length),o),this.process(r,0);const c=(0,n.createView)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=u/4,l=this.get();if(d>l.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<d;e++)c.setUint32(4*e,l[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}t.HashMD=a,t.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),t.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),t.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])},3842(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.toBig=t.shrSL=t.shrSH=t.rotrSL=t.rotrSH=t.rotrBL=t.rotrBH=t.rotr32L=t.rotr32H=t.rotlSL=t.rotlSH=t.rotlBL=t.rotlBH=t.add5L=t.add5H=t.add4L=t.add4H=t.add3L=t.add3H=void 0,t.add=A,t.fromBig=i,t.split=a;const r=BigInt(2**32-1),n=BigInt(32);function i(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function a(e,t=!1){const r=e.length;let n=new Uint32Array(r),a=new Uint32Array(r);for(let o=0;o<r;o++){const{h:r,l:s}=i(e[o],t);[n[o],a[o]]=[r,s]}return[n,a]}const o=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);t.toBig=o;const s=(e,t,r)=>e>>>r;t.shrSH=s;const c=(e,t,r)=>e<<32-r|t>>>r;t.shrSL=c;const u=(e,t,r)=>e>>>r|t<<32-r;t.rotrSH=u;const d=(e,t,r)=>e<<32-r|t>>>r;t.rotrSL=d;const l=(e,t,r)=>e<<64-r|t>>>r-32;t.rotrBH=l;const h=(e,t,r)=>e>>>r-32|t<<64-r;t.rotrBL=h;const f=(e,t)=>t;t.rotr32H=f;const p=(e,t)=>e;t.rotr32L=p;const v=(e,t,r)=>e<<r|t>>>32-r;t.rotlSH=v;const g=(e,t,r)=>t<<r|e>>>32-r;t.rotlSL=g;const y=(e,t,r)=>t<<r-32|e>>>64-r;t.rotlBH=y;const m=(e,t,r)=>e<<r-32|t>>>64-r;function A(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}t.rotlBL=m;const b=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);t.add3L=b;const S=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;t.add3H=S;const _=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);t.add4L=_;const E=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;t.add4H=E;const C=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);t.add5L=C;const w=(e,t,r,n,i,a)=>t+r+n+i+a+(e/2**32|0)|0;t.add5H=w;const I={fromBig:i,split:a,toBig:o,shrSH:s,shrSL:c,rotrSH:u,rotrSL:d,rotrBH:l,rotrBL:h,rotr32H:f,rotr32L:p,rotlSH:v,rotlSL:g,rotlBH:y,rotlBL:m,add:A,add3L:b,add3H:S,add4L:_,add4H:E,add5H:w,add5L:C};t.default=I},9517(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},4072(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.sha512_224=t.sha512_256=t.sha384=t.sha512=t.sha224=t.sha256=t.SHA512_256=t.SHA512_224=t.SHA384=t.SHA512=t.SHA224=t.SHA256=void 0;const n=r(7734),i=r(3842),a=r(11),o=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=new Uint32Array(64);class c extends n.HashMD{constructor(e=32){super(64,e,8,!1),this.A=0|n.SHA256_IV[0],this.B=0|n.SHA256_IV[1],this.C=0|n.SHA256_IV[2],this.D=0|n.SHA256_IV[3],this.E=0|n.SHA256_IV[4],this.F=0|n.SHA256_IV[5],this.G=0|n.SHA256_IV[6],this.H=0|n.SHA256_IV[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:a,G:o,H:s}=this;return[e,t,r,n,i,a,o,s]}set(e,t,r,n,i,a,o,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|a,this.G=0|o,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)s[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=s[e-15],r=s[e-2],n=(0,a.rotr)(t,7)^(0,a.rotr)(t,18)^t>>>3,i=(0,a.rotr)(r,17)^(0,a.rotr)(r,19)^r>>>10;s[e]=i+s[e-7]+n+s[e-16]|0}let{A:r,B:i,C:c,D:u,E:d,F:l,G:h,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,a.rotr)(d,6)^(0,a.rotr)(d,11)^(0,a.rotr)(d,25))+(0,n.Chi)(d,l,h)+o[e]+s[e]|0,p=((0,a.rotr)(r,2)^(0,a.rotr)(r,13)^(0,a.rotr)(r,22))+(0,n.Maj)(r,i,c)|0;f=h,h=l,l=d,d=u+t|0,u=c,c=i,i=r,r=t+p|0}r=r+this.A|0,i=i+this.B|0,c=c+this.C|0,u=u+this.D|0,d=d+this.E|0,l=l+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(r,i,c,u,d,l,h,f)}roundClean(){(0,a.clean)(s)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,a.clean)(this.buffer)}}t.SHA256=c;class u extends c{constructor(){super(28),this.A=0|n.SHA224_IV[0],this.B=0|n.SHA224_IV[1],this.C=0|n.SHA224_IV[2],this.D=0|n.SHA224_IV[3],this.E=0|n.SHA224_IV[4],this.F=0|n.SHA224_IV[5],this.G=0|n.SHA224_IV[6],this.H=0|n.SHA224_IV[7]}}t.SHA224=u;const d=(()=>i.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),l=(()=>d[0])(),h=(()=>d[1])(),f=new Uint32Array(80),p=new Uint32Array(80);class v extends n.HashMD{constructor(e=64){super(128,e,16,!1),this.Ah=0|n.SHA512_IV[0],this.Al=0|n.SHA512_IV[1],this.Bh=0|n.SHA512_IV[2],this.Bl=0|n.SHA512_IV[3],this.Ch=0|n.SHA512_IV[4],this.Cl=0|n.SHA512_IV[5],this.Dh=0|n.SHA512_IV[6],this.Dl=0|n.SHA512_IV[7],this.Eh=0|n.SHA512_IV[8],this.El=0|n.SHA512_IV[9],this.Fh=0|n.SHA512_IV[10],this.Fl=0|n.SHA512_IV[11],this.Gh=0|n.SHA512_IV[12],this.Gl=0|n.SHA512_IV[13],this.Hh=0|n.SHA512_IV[14],this.Hl=0|n.SHA512_IV[15]}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:u,Fh:d,Fl:l,Gh:h,Gl:f,Hh:p,Hl:v}=this;return[e,t,r,n,i,a,o,s,c,u,d,l,h,f,p,v]}set(e,t,r,n,i,a,o,s,c,u,d,l,h,f,p,v){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|a,this.Dh=0|o,this.Dl=0|s,this.Eh=0|c,this.El=0|u,this.Fh=0|d,this.Fl=0|l,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|v}process(e,t){for(let r=0;r<16;r++,t+=4)f[r]=e.getUint32(t),p[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|f[e-15],r=0|p[e-15],n=i.rotrSH(t,r,1)^i.rotrSH(t,r,8)^i.shrSH(t,r,7),a=i.rotrSL(t,r,1)^i.rotrSL(t,r,8)^i.shrSL(t,r,7),o=0|f[e-2],s=0|p[e-2],c=i.rotrSH(o,s,19)^i.rotrBH(o,s,61)^i.shrSH(o,s,6),u=i.rotrSL(o,s,19)^i.rotrBL(o,s,61)^i.shrSL(o,s,6),d=i.add4L(a,u,p[e-7],p[e-16]),l=i.add4H(d,n,c,f[e-7],f[e-16]);f[e]=0|l,p[e]=0|d}let{Ah:r,Al:n,Bh:a,Bl:o,Ch:s,Cl:c,Dh:u,Dl:d,Eh:v,El:g,Fh:y,Fl:m,Gh:A,Gl:b,Hh:S,Hl:_}=this;for(let e=0;e<80;e++){const t=i.rotrSH(v,g,14)^i.rotrSH(v,g,18)^i.rotrBH(v,g,41),E=i.rotrSL(v,g,14)^i.rotrSL(v,g,18)^i.rotrBL(v,g,41),C=v&y^~v&A,w=g&m^~g&b,I=i.add5L(_,E,w,h[e],p[e]),k=i.add5H(I,S,t,C,l[e],f[e]),P=0|I,O=i.rotrSH(r,n,28)^i.rotrBH(r,n,34)^i.rotrBH(r,n,39),T=i.rotrSL(r,n,28)^i.rotrBL(r,n,34)^i.rotrBL(r,n,39),x=r&a^r&s^a&s,H=n&o^n&c^o&c;S=0|A,_=0|b,A=0|y,b=0|m,y=0|v,m=0|g,({h:v,l:g}=i.add(0|u,0|d,0|k,0|P)),u=0|s,d=0|c,s=0|a,c=0|o,a=0|r,o=0|n;const L=i.add3L(P,T,H);r=i.add3H(L,k,O,x),n=0|L}({h:r,l:n}=i.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:a,l:o}=i.add(0|this.Bh,0|this.Bl,0|a,0|o)),({h:s,l:c}=i.add(0|this.Ch,0|this.Cl,0|s,0|c)),({h:u,l:d}=i.add(0|this.Dh,0|this.Dl,0|u,0|d)),({h:v,l:g}=i.add(0|this.Eh,0|this.El,0|v,0|g)),({h:y,l:m}=i.add(0|this.Fh,0|this.Fl,0|y,0|m)),({h:A,l:b}=i.add(0|this.Gh,0|this.Gl,0|A,0|b)),({h:S,l:_}=i.add(0|this.Hh,0|this.Hl,0|S,0|_)),this.set(r,n,a,o,s,c,u,d,v,g,y,m,A,b,S,_)}roundClean(){(0,a.clean)(f,p)}destroy(){(0,a.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.SHA512=v;class g extends v{constructor(){super(48),this.Ah=0|n.SHA384_IV[0],this.Al=0|n.SHA384_IV[1],this.Bh=0|n.SHA384_IV[2],this.Bl=0|n.SHA384_IV[3],this.Ch=0|n.SHA384_IV[4],this.Cl=0|n.SHA384_IV[5],this.Dh=0|n.SHA384_IV[6],this.Dl=0|n.SHA384_IV[7],this.Eh=0|n.SHA384_IV[8],this.El=0|n.SHA384_IV[9],this.Fh=0|n.SHA384_IV[10],this.Fl=0|n.SHA384_IV[11],this.Gh=0|n.SHA384_IV[12],this.Gl=0|n.SHA384_IV[13],this.Hh=0|n.SHA384_IV[14],this.Hl=0|n.SHA384_IV[15]}}t.SHA384=g;const y=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),m=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class A extends v{constructor(){super(28),this.Ah=0|y[0],this.Al=0|y[1],this.Bh=0|y[2],this.Bl=0|y[3],this.Ch=0|y[4],this.Cl=0|y[5],this.Dh=0|y[6],this.Dl=0|y[7],this.Eh=0|y[8],this.El=0|y[9],this.Fh=0|y[10],this.Fl=0|y[11],this.Gh=0|y[12],this.Gl=0|y[13],this.Hh=0|y[14],this.Hl=0|y[15]}}t.SHA512_224=A;class b extends v{constructor(){super(32),this.Ah=0|m[0],this.Al=0|m[1],this.Bh=0|m[2],this.Bl=0|m[3],this.Ch=0|m[4],this.Cl=0|m[5],this.Dh=0|m[6],this.Dl=0|m[7],this.Eh=0|m[8],this.El=0|m[9],this.Fh=0|m[10],this.Fl=0|m[11],this.Gh=0|m[12],this.Gl=0|m[13],this.Hh=0|m[14],this.Hl=0|m[15]}}t.SHA512_256=b,t.sha256=(0,a.createHasher)(()=>new c),t.sha224=(0,a.createHasher)(()=>new u),t.sha512=(0,a.createHasher)(()=>new v),t.sha384=(0,a.createHasher)(()=>new g),t.sha512_256=(0,a.createHasher)(()=>new b),t.sha512_224=(0,a.createHasher)(()=>new A)},5391(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.shake256=t.shake128=t.keccak_512=t.keccak_384=t.keccak_256=t.keccak_224=t.sha3_512=t.sha3_384=t.sha3_256=t.sha3_224=t.Keccak=void 0,t.keccakP=A;const n=r(3842),i=r(11),a=BigInt(0),o=BigInt(1),s=BigInt(2),c=BigInt(7),u=BigInt(256),d=BigInt(113),l=[],h=[],f=[];for(let e=0,t=o,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],l.push(2*(5*n+r)),h.push((e+1)*(e+2)/2%64);let i=a;for(let e=0;e<7;e++)t=(t<<o^(t>>c)*d)%u,t&s&&(i^=o<<(o<<BigInt(e))-o);f.push(i)}const p=(0,n.split)(f,!0),v=p[0],g=p[1],y=(e,t,r)=>r>32?(0,n.rotlBH)(e,t,r):(0,n.rotlSH)(e,t,r),m=(e,t,r)=>r>32?(0,n.rotlBL)(e,t,r):(0,n.rotlSL)(e,t,r);function A(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,a=r[i],o=r[i+1],s=y(a,o,1)^r[n],c=m(a,o,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=h[r],a=y(t,i,n),o=m(t,i,n),s=l[r];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=v[n],e[1]^=g[n]}(0,i.clean)(r)}class b extends i.Hash{constructor(e,t,r,n=!1,a=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=a,(0,i.anumber)(r),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,i.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,i.swap32IfBE)(this.state32),A(this.state32,this.rounds),(0,i.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(e){(0,i.aexists)(this),e=(0,i.toBytes)(e),(0,i.abytes)(e);const{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){const a=Math.min(t-this.pos,n-i);for(let t=0;t<a;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){(0,i.aexists)(this,!1),(0,i.abytes)(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();const a=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+a),n),this.posOut+=a,n+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,i.anumber)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,i.aoutput)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,i.clean)(this.state)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:a}=this;return e||(e=new b(t,r,n,a,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=a,e.destroyed=this.destroyed,e}}t.Keccak=b;const S=(e,t,r)=>(0,i.createHasher)(()=>new b(t,e,r));t.sha3_224=S(6,144,28),t.sha3_256=S(6,136,32),t.sha3_384=S(6,104,48),t.sha3_512=S(6,72,64),t.keccak_224=S(1,144,28),t.keccak_256=S(1,136,32),t.keccak_384=S(1,104,48),t.keccak_512=S(1,72,64);const _=(e,t,r)=>(0,i.createXOFer)((n={})=>new b(t,e,void 0===n.dkLen?r:n.dkLen,!0));t.shake128=_(31,168,16),t.shake256=_(31,136,32)},11(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=i,t.anumber=a,t.abytes=o,t.ahash=function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");a(e.outputLen),a(e.blockLen)},t.aexists=function(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},t.aoutput=function(e,t){o(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)},t.u8=function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},t.u32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))},t.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)},t.createView=function(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)},t.rotr=function(e,t){return e<<32-t|e>>>t},t.rotl=function(e,t){return e<<t|e>>>32-t>>>0},t.byteSwap=s,t.byteSwap32=c,t.bytesToHex=function(e){if(o(e),u)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=d[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(u)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=l(e.charCodeAt(i)),a=l(e.charCodeAt(i+1));if(void 0===r||void 0===a){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+a}return n},t.asyncLoop=async function(e,r,n){let i=Date.now();for(let a=0;a<e;a++){n(a);const e=Date.now()-i;e>=0&&e<r||(await(0,t.nextTick)(),i+=e)}},t.utf8ToBytes=h,t.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},t.toBytes=f,t.kdfInputToBytes=function(e){return"string"==typeof e&&(e=h(e)),o(e),e},t.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];o(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r},t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("options should be object or undefined");return Object.assign(e,t)},t.createHasher=p,t.createOptHasher=v,t.createXOFer=g,t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));if(n.crypto&&"function"==typeof n.crypto.randomBytes)return Uint8Array.from(n.crypto.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")};const n=r(9517);function i(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function a(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function o(e,...t){if(!i(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function s(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function c(e){for(let t=0;t<e.length;t++)e[t]=s(e[t]);return e}t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],t.swap8IfBE=t.isLE?e=>e:e=>s(e),t.byteSwapIfBE=t.swap8IfBE,t.swap32IfBE=t.isLE?e=>e:c;const u=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),d=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function l(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function h(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function f(e){return"string"==typeof e&&(e=h(e)),o(e),e}function p(e){const t=t=>e().update(f(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function v(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}function g(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}t.nextTick=async()=>{},t.Hash=class{},t.wrapConstructor=p,t.wrapConstructorWithOpts=v,t.wrapXOFConstructorWithOpts=g},5628(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.keccak512=t.keccak384=t.keccak256=t.keccak224=void 0;const n=r(5391),i=r(7393);t.keccak224=(0,i.wrapHash)(n.keccak_224),t.keccak256=(()=>{const e=(0,i.wrapHash)(n.keccak_256);return e.create=n.keccak_256.create,e})(),t.keccak384=(0,i.wrapHash)(n.keccak_384),t.keccak512=(0,i.wrapHash)(n.keccak_512)},6997(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const n=r(4072),i=r(7393);t.sha256=(0,i.wrapHash)(n.sha256)},7393(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.assertBytes=t.assertBool=t.utf8ToBytes=t.toHex=t.createView=t.concatBytes=t.bytesToHex=void 0,t.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},t.hexToBytes=function(e){const t=e.startsWith("0x")?e.substring(2):e;return(0,a.hexToBytes)(t)},t.equalsBytes=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},t.wrapHash=function(e){return t=>((0,i.abytes)(t),e(t))};const n=r(6839);Object.defineProperty(t,"assertBool",{enumerable:!0,get:function(){return n.abool}});const i=r(681);Object.defineProperty(t,"assertBytes",{enumerable:!0,get:function(){return i.abytes}});const a=r(11);var o=r(11);Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return o.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return o.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return o.createView}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return o.bytesToHex}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return o.utf8ToBytes}})},1757(e,t){var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function i(e,t,n){var i=null;if(void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return t=n.ref,{$$typeof:r,type:e,key:i,ref:void 0!==t?t:null,props:n}}t.Fragment=n,t.jsx=i,t.jsxs=i},2942(e,t){var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),p=Symbol.iterator,v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function m(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||v}function A(){}function b(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||v}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},A.prototype=m.prototype;var S=b.prototype=new A;S.constructor=b,g(S,m.prototype),S.isPureReactComponent=!0;var _=Array.isArray;function E(){}var C={H:null,A:null,T:null,S:null},w=Object.prototype.hasOwnProperty;function I(e,t,n){var i=n.ref;return{$$typeof:r,type:e,key:t,ref:void 0!==i?i:null,props:n}}function k(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var P=/\/+/g;function O(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36);var r,n}function T(e,t,i,a,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c,u,d=!1;if(null===e)d=!0;else switch(s){case"bigint":case"string":case"number":d=!0;break;case"object":switch(e.$$typeof){case r:case n:d=!0;break;case h:return T((d=e._init)(e._payload),t,i,a,o)}}if(d)return o=o(e),d=""===a?"."+O(e,0):a,_(o)?(i="",null!=d&&(i=d.replace(P,"$&/")+"/"),T(o,t,i,"",function(e){return e})):null!=o&&(k(o)&&(c=o,u=i+(null==o.key||e&&e.key===o.key?"":(""+o.key).replace(P,"$&/")+"/")+d,o=I(c.type,u,c.props)),t.push(o)),1;d=0;var l,f=""===a?".":a+":";if(_(e))for(var v=0;v<e.length;v++)d+=T(a=e[v],t,i,s=f+O(a,v),o);else if("function"==typeof(v=null===(l=e)||"object"!=typeof l?null:"function"==typeof(l=p&&l[p]||l["@@iterator"])?l:null))for(e=v.call(e),v=0;!(a=e.next()).done;)d+=T(a=a.value,t,i,s=f+O(a,v++),o);else if("object"===s){if("function"==typeof e.then)return T(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(E,E):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),t,i,a,o);throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return d}function x(e,t,r){if(null==e)return e;var n=[],i=0;return T(e,n,"","",function(e){return t.call(r,e,i++)}),n}function H(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var L="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},M={map:x,forEach:function(e,t,r){x(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return x(e,function(){t++}),t},toArray:function(e){return x(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};t.Activity=f,t.Children=M,t.Component=m,t.Fragment=i,t.Profiler=o,t.PureComponent=b,t.StrictMode=a,t.Suspense=d,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,t.__COMPILER_RUNTIME={__proto__:null,c:function(e){return C.H.useMemoCache(e)}},t.cache=function(e){return function(){return e.apply(null,arguments)}},t.cacheSignal=function(){return null},t.cloneElement=function(e,t,r){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var n=g({},e.props),i=e.key;if(null!=t)for(a in void 0!==t.key&&(i=""+t.key),t)!w.call(t,a)||"key"===a||"__self"===a||"__source"===a||"ref"===a&&void 0===t.ref||(n[a]=t[a]);var a=arguments.length-2;if(1===a)n.children=r;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];n.children=o}return I(e.type,i,n)},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:s,_context:e},e},t.createElement=function(e,t,r){var n,i={},a=null;if(null!=t)for(n in void 0!==t.key&&(a=""+t.key),t)w.call(t,n)&&"key"!==n&&"__self"!==n&&"__source"!==n&&(i[n]=t[n]);var o=arguments.length-2;if(1===o)i.children=r;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(n in o=e.defaultProps)void 0===i[n]&&(i[n]=o[n]);return I(e,a,i)},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.isValidElement=k,t.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:H}},t.memo=function(e,t){return{$$typeof:l,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=C.T,r={};C.T=r;try{var n=e(),i=C.S;null!==i&&i(r,n),"object"==typeof n&&null!==n&&"function"==typeof n.then&&n.then(E,L)}catch(e){L(e)}finally{null!==t&&null!==r.types&&(t.types=r.types),C.T=t}},t.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},t.use=function(e){return C.H.use(e)},t.useActionState=function(e,t,r){return C.H.useActionState(e,t,r)},t.useCallback=function(e,t){return C.H.useCallback(e,t)},t.useContext=function(e){return C.H.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e,t){return C.H.useDeferredValue(e,t)},t.useEffect=function(e,t){return C.H.useEffect(e,t)},t.useEffectEvent=function(e){return C.H.useEffectEvent(e)},t.useId=function(){return C.H.useId()},t.useImperativeHandle=function(e,t,r){return C.H.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return C.H.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return C.H.useLayoutEffect(e,t)},t.useMemo=function(e,t){return C.H.useMemo(e,t)},t.useOptimistic=function(e,t){return C.H.useOptimistic(e,t)},t.useReducer=function(e,t,r){return C.H.useReducer(e,t,r)},t.useRef=function(e){return C.H.useRef(e)},t.useState=function(e){return C.H.useState(e)},t.useSyncExternalStore=function(e,t,r){return C.H.useSyncExternalStore(e,t,r)},t.useTransition=function(){return C.H.useTransition()},t.version="19.2.6"},489(e,t,r){e.exports=r(2942)},1325(e,t,r){e.exports=r(1757)},8718(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.FormoAnalytics=void 0;var s=r(9478),c=r(49),u=r(6517),d=r(2257),l=r(4992),h=r(4203),f=r(3312),p=r(9582),v=r(6653),g=r(5896),y=r(2657),m=r(4657),A=r(4586),b=r(9879),S=r(7392),_=r(5707),E=r(9308),C=r(1951),w=r(6053),I=function(){function e(e,t){void 0===t&&(t={});var r,n,i,a=this;if(this.writeKey=e,this.options=t,this._chainState={evm:{},solana:{}},this._announcedConnect=new WeakMap,this._providerChainIds=new WeakMap,this._providerChainGenerations=new WeakMap,this._providerListenersMap=new Map,this._providers=[],this._trackedProviders=new Set,this._processingAccountsChanged=!1,this._seenProviders=new Set,this.isWagmiMode=!1,this.isEvmDisabled=!1,this._currentUrl="",this._pageHooksDisposed=!1,this.currentUserId="",this.config={writeKey:e},this.options=t,this.isWagmiMode=!!t.wagmi,this.isEvmDisabled=!1===t.evm,this.crossSubdomainCookies=null===(r=t.crossSubdomainCookies)||void 0===r||r,t.crossSubdomainCookies=this.crossSubdomainCookies,this.session=new g.FormoAnalyticsSession,this.currentUserId=(0,u.cookie)().get(c.SESSION_USER_ID_KEY)||void 0,this.identify=this.identify.bind(this),this.connect=this.connect.bind(this),this.disconnect=this.disconnect.bind(this),this.chain=this.chain.bind(this),this.signature=this.signature.bind(this),this.transaction=this.transaction.bind(this),this.detect=this.detect.bind(this),this.track=this.track.bind(this),this.page=this.page.bind(this),this.reset=this.reset.bind(this),this.cleanup=this.cleanup.bind(this),this.optOutTracking=this.optOutTracking.bind(this),this.optInTracking=this.optInTracking.bind(this),this.hasOptedOutTracking=this.hasOptedOutTracking.bind(this),this.isAutocaptureEnabled=this.isAutocaptureEnabled.bind(this),this.syncPrivyActiveChain=this.syncPrivyActiveChain.bind(this),this.isTrackingSuppressed=this.isTrackingSuppressed.bind(this),this.getTrackedProvidersCount=this.getTrackedProvidersCount.bind(this),this.getProviderState=this.getProviderState.bind(this),this.syncWalletState=this.syncWalletState.bind(this),f.Logger.init({enabled:(null===(n=t.logger)||void 0===n?void 0:n.enabled)||!1,enabledLevels:(null===(i=t.logger)||void 0===i?void 0:i.levels)||[]}),this.eventManager=new l.EventManager(new h.EventQueue(this.config.writeKey,{apiHost:t.apiHost||c.EVENTS_API_HOST,flushAt:t.flushAt,retryCount:t.retryCount,maxQueueSize:t.maxQueueSize,flushInterval:t.flushInterval,errorHandler:t.errorHandler,canSend:function(){return!a.hasOptedOutTracking()}}),t),this.hasOptedOutTracking()&&f.logger.info("User has previously opted out of tracking"),this.isEvmDisabled)f.logger.info("FormoAnalytics: EVM provider tracking disabled");else if(this.isWagmiMode&&t.wagmi)f.logger.info("FormoAnalytics: Initializing in Wagmi mode"),this.wagmiHandler=new _.WagmiEventHandler(this,t.wagmi.config,t.wagmi.queryClient);else{var o=void 0,s=t.provider;s?o=s:"undefined"!=typeof window&&window.ethereum&&(o=window.ethereum),o&&this.trackEIP1193Provider(o)}t.solana&&(this.solanaManager=new C.SolanaManager(this,t.solana)),this._currentUrl=window.location.href,this.loadActiveWallet(),this.trackPageHit(),this.trackPageHits()}return Object.defineProperty(e.prototype,"_provider",{get:function(){return this._chainState.evm.provider},set:function(e){var t=this._chainState.evm.provider;this.forgetConnectRecord(t,e),this._chainState.evm.provider=e},enumerable:!1,configurable:!0}),e.prototype.forgetConnectRecord=function(e,t){e&&e!==t&&this._announcedConnect.delete(e)},Object.defineProperty(e.prototype,"_evmAddress",{get:function(){return this._chainState.evm.address},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_evmChainId",{get:function(){return this._chainState.evm.chainId},enumerable:!1,configurable:!0}),e.prototype.isProviderMismatch=function(e){return null!=this._provider&&this._provider!==e},e.init=function(t,r){return i(this,void 0,void 0,function(){var n,i;return a(this,function(a){switch(a.label){case 0:return(0,u.initStorageManager)(t),(n=new e(t,r)).isEvmDisabled?(f.logger.info("FormoAnalytics: Skipping provider detection (EVM disabled)"),[3,5]):[3,1];case 1:return n.isWagmiMode?[3,4]:(i=n,[4,n.getProviders()]);case 2:return i._providers=a.sent(),[4,n.detectWallets(n._providers)];case 3:return a.sent(),n.trackProviders(n._providers),[3,5];case 4:f.logger.info("FormoAnalytics: Skipping provider detection (Wagmi mode)"),a.label=5;case 5:return[2,n]}})})},e.prototype.page=function(e,t,r,n,o){return i(this,void 0,void 0,function(){return a(this,function(i){switch(i.label){case 0:return[4,this.trackPageHit(e,t,r,n,o)];case 1:return i.sent(),[2]}})})},e.prototype.reset=function(){this.currentUserId=void 0,this.currentAddress=void 0,this.currentChainId=void 0;var e=this._chainState.evm.provider;this._chainState={evm:{provider:e},solana:{}},this._activeNamespace=void 0,(0,u.cookie)().remove(c.LOCAL_ANONYMOUS_ID_KEY),(0,u.cookie)().remove(c.SESSION_USER_ID_KEY),(0,u.cookie)().remove(g.SESSION_WALLET_DETECTED_KEY),(0,u.cookie)().remove(g.SESSION_WALLET_IDENTIFIED_KEY),(0,u.cookie)().remove(c.ACTIVE_WALLET_KEY),(0,u.session)().remove(c.SESSION_TRAFFIC_SOURCE_KEY)},e.prototype.cleanup=function(){if(f.logger.debug("FormoAnalytics: Cleaning up resources"),this.eventManager.clear(),this.wagmiHandler&&(this.wagmiHandler.cleanup(),this.wagmiHandler=void 0),this.solanaManager&&(this.solanaManager.cleanup(),this.solanaManager=void 0),!this.isWagmiMode)for(var e=0,t=Array.from(this._trackedProviders);e<t.length;e++){var r=t[e];this.untrackProvider(r)}this._pageHooksDisposed=!0,"undefined"!=typeof window&&(this._onPopStateListener&&(window.removeEventListener("popstate",this._onPopStateListener),this._onPopStateListener=void 0),this._onLocationChangeListener&&(window.removeEventListener("locationchange",this._onLocationChangeListener),this._onLocationChangeListener=void 0)),f.logger.debug("FormoAnalytics: Cleanup complete")},e.prototype.connect=function(e,t,r,n){return i(this,arguments,void 0,function(e,t,r,n){var i,o=e.chainId,s=e.address;return a(this,function(e){switch(e.label){case 0:return null==o?(f.logger.warn("Connect: Chain ID cannot be null or undefined"),[2]):s?(i=(0,m.validateAddress)(s,o))?this.isTrackingSuppressed()?(f.logger.info("connect() skipped: tracking is suppressed for this visitor or environment"),[2]):(this.setChainState(o,{address:i}),[4,this.trackEvent(c.EventType.CONNECT,{chainId:o,address:i},t,r,n)]):(f.logger.warn('Connect: Invalid address provided ("'.concat(s,'"). Please provide a valid EVM or Solana address.')),[2]):(f.logger.warn("Connect: Address cannot be empty"),[2]);case 1:return e.sent(),[2]}})})},e.prototype.disconnect=function(e,t,r,o){return i(this,void 0,void 0,function(){var i,s,u,d,l;return a(this,function(a){switch(a.label){case 0:return i=(null==e?void 0:e.chainId)||this.currentChainId,s=(null==e?void 0:e.address)||this.currentAddress,u=(0,E.isSolanaChainId)(i),d=!u&&this._provider?this.getProviderInfo(this._provider):null,f.logger.info("Disconnect: Emitting disconnect event with:",{chainId:i,address:s,providerName:null==d?void 0:d.name,rdns:null==d?void 0:d.rdns}),l=n(n({},d&&{providerName:d.name,rdns:d.rdns}),t),[4,this.trackEvent(c.EventType.DISCONNECT,n(n({},i&&{chainId:i}),s&&{address:s}),l,r,o)];case 1:return a.sent(),this.clearChainState(i),f.logger.info("Wallet disconnected: Cleared currentAddress, currentChainId, and provider"),[2]}})})},e.prototype.chain=function(e,t,r,n){return i(this,arguments,void 0,function(e,t,r,n){var i=e.chainId,o=e.address;return a(this,function(e){switch(e.label){case 0:return i&&0!==Number(i)?isNaN(Number(i))?(f.logger.warn("FormoAnalytics::chain: chainId must be a valid decimal number"),[2]):o||this.currentAddress?(this.setChainState(i,{}),[4,this.trackEvent(c.EventType.CHAIN,{chainId:i,address:o||this.currentAddress},t,r,n)]):(f.logger.warn("FormoAnalytics::chain: address was empty and no previous address has been recorded"),[2]):(f.logger.warn("FormoAnalytics::chain: chainId cannot be empty or 0"),[2]);case 1:return e.sent(),[2]}})})},e.prototype.signature=function(e,t,r,n){return i(this,arguments,void 0,function(e,t,r,n){var i=e.status,o=e.chainId,s=e.address,u=e.message;return a(this,function(e){switch(e.label){case 0:return[4,this.trackEvent(c.EventType.SIGNATURE,{status:i,chainId:o,address:s,message:u},t,r,n)];case 1:return e.sent(),[2]}})})},e.prototype.transaction=function(e,t,r,o){return i(this,arguments,void 0,function(e,t,r,i){var o=e.status,s=e.chainId,u=e.address,d=e.data,l=e.to,h=e.value,f=e.transactionHash,p=e.function_name,v=e.function_args;return a(this,function(e){switch(e.label){case 0:return[4,this.trackEvent(c.EventType.TRANSACTION,n(n(n({status:o,chainId:s,address:u,data:d,to:l,value:h},f&&{transactionHash:f}),p&&{function_name:p}),v&&{function_args:v}),t,r,i)];case 1:return e.sent(),[2]}})})},e.prototype.identify=function(e,t,r,o){return i(this,void 0,void 0,function(){var i,s,l,h,p,v,g,y,A,b,S,_,E,C,I,k,P,O,T,x,H,L;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,14,,15]),(i=e)&&"string"==typeof i.id&&void 0===i.address?(s=null!=t?t:{},[4,(0,w.identifyPrivyUser)(this,i,{activeAddress:s.activeAddress,properties:s.properties})]):[3,2];case 1:return a.sent(),[2];case 2:if(l=e,h=t,this.isTrackingSuppressed()||this.isCurrentChainExcluded())return f.logger.info("identify() skipped: tracking is suppressed for this visitor, environment, or chain"),[2];if(l)return[3,12];f.logger.info("Auto-identifying with providers:",this._providers.map(function(e){return e.info.name})),p=0,v=this._providers,a.label=3;case 3:if(!(p<v.length))return[3,11];if(g=v[p],!(y=g.provider))return[3,10];a.label=4;case 4:return a.trys.push([4,9,,10]),[4,this.getAddress(y)];case 5:return(A=a.sent())?(b=(0,m.validateAndChecksumAddress)(A),f.logger.info("Auto-identify: Checking deduplication",{validAddress:b,rdns:g.info.rdns,providerName:g.info.name,isAlreadyIdentified:!!b&&this.session.isWalletIdentified(b,g.info.rdns,void 0,h)}),!b||this.session.isWalletIdentified(b,g.info.rdns,void 0,h)?[3,7]:(f.logger.info("Auto-identifying",b,g.info.name,g.info.rdns),[4,this.identify({address:b,providerName:g.info.name,rdns:g.info.rdns},h,r,o)])):[3,8];case 6:return a.sent(),[3,8];case 7:b&&f.logger.info("Auto-identify: Skipping already identified wallet",b,g.info.name,g.info.rdns),a.label=8;case 8:return[3,10];case 9:return S=a.sent(),f.logger.error("Failed to identify provider ".concat(g.info.name,":"),S),[3,10];case 10:return p++,[3,3];case 11:return[2];case 12:return _=l.address,E=l.providerName,C=l.userId,I=l.rdns,k=l.setActive,_?(f.logger.info("Identify",_,C,E,I),(P=(0,m.validateAddress)(_))?(!1!==k&&(this.currentAddress=P,this.persistActiveWallet(),C&&(this.currentUserId=C,O=(0,d.getIdentityCookieDomain)(this.crossSubdomainCookies),(0,u.cookie)().set(c.SESSION_USER_ID_KEY,C,n(n({path:"/"},(0,d.getIdentityCookieSecurity)()),O?{domain:O}:{})))),T=this.session.isWalletIdentified(P,I||"",C,h),f.logger.debug("Identify: Checking deduplication",{validAddress:P,rdns:I,providerName:E,userId:C,isAlreadyIdentified:T}),T?(f.logger.info("Identify: Wallet ".concat(E||"Unknown"," with address ").concat(P," already identified in this session (rdns: ").concat(I||"empty",")")),[2]):(this.session.markWalletIdentified(P,I||"",C,h),[4,this.trackEvent(c.EventType.IDENTIFY,{address:P,providerName:E,userId:C,rdns:I},h,r,o)])):(null===(L=f.logger.warn)||void 0===L||L.call(f.logger,"Invalid address provided to identify:",_),[2])):(null===(H=f.logger.warn)||void 0===H||H.call(f.logger,"identify() called without address - address is required"),[2]);case 13:return a.sent(),[3,15];case 14:return x=a.sent(),f.logger.log("identify error",x),[3,15];case 15:return[2]}})})},e.prototype.syncPrivyActiveChain=function(e,t){if(void 0!==this.currentChainId&&null!==this.currentChainId){var r,n=null==e?void 0:e.toLowerCase();"solana"===n?r=!0:("ethereum"===n||!n&&t&&/^0x[0-9a-f]{40}$/i.test(t))&&(r=!1),void 0!==r&&r!==(0,E.isSolanaChainId)(this.currentChainId)&&(this.currentChainId=void 0,this.persistActiveWallet())}},e.prototype.detect=function(e,t,r,n){return i(this,arguments,void 0,function(e,t,r,n){var i=e.providerName,o=e.rdns;return a(this,function(e){switch(e.label){case 0:return this.isTrackingSuppressed()?(f.logger.info("detect() skipped: tracking is suppressed for this visitor or environment"),[2]):this.session.isWalletDetected(o)?[2,f.logger.warn("Detect: Wallet ".concat(i," already detected in this session"))]:(this.session.markWalletDetected(o),[4,this.trackEvent(c.EventType.DETECT,{providerName:i,rdns:o},t,r,n)]);case 1:return e.sent(),[2]}})})},e.prototype.track=function(e,t,r,n){return i(this,void 0,void 0,function(){return a(this,function(i){switch(i.label){case 0:return[4,this.trackEvent(c.EventType.TRACK,{event:e},t,r,n)];case 1:return i.sent(),[2]}})})},e.prototype.willTrackEvent=function(e){return this.shouldTrack(e)},e.prototype.optOutTracking=function(){f.logger.info("Opting out of tracking"),(0,p.setConsentFlag)(this.writeKey,c.CONSENT_OPT_OUT_KEY,"true"),this.eventManager.clear(),this.reset(),f.logger.info("Successfully opted out of tracking")},e.prototype.optInTracking=function(){var e;f.logger.info("Opting back into tracking"),(0,p.removeConsentFlag)(this.writeKey,c.CONSENT_OPT_OUT_KEY),null===(e=this.wagmiHandler)||void 0===e||e.retryAdoption(),f.logger.info("Successfully opted back into tracking")},e.prototype.hasOptedOutTracking=function(){return"true"===(0,p.getConsentFlag)(this.writeKey,c.CONSENT_OPT_OUT_KEY)},e.prototype.trackEIP1193Provider=function(e){if(f.logger.info("trackEIP1193Provider",e),this.isWagmiMode)f.logger.debug("trackEIP1193Provider: Skipping EIP-1193 provider tracking (Wagmi mode - using connector system instead)");else try{if(!(0,v.isValidProvider)(e))return void f.logger.warn("trackEIP1193Provider: Invalid provider - missing required methods");if(this._trackedProviders.has(e))return void f.logger.warn("trackEIP1193Provider: Provider already tracked");this.registerAccountsChangedListener(e),this.registerChainChangedListener(e),this.isAutocaptureEnabled("connect")?this.registerConnectListener(e):this.registerConnectChainObserver(e),this.seedProviderChainFromState(e),this.isAutocaptureEnabled("signature")||this.isAutocaptureEnabled("transaction")?this.registerRequestListeners(e):f.logger.debug("TrackProvider: Skipping request wrapping (both signature and transaction autocapture disabled)"),this.registerDisconnectListener(e),this._trackedProviders.add(e)}catch(e){f.logger.error("Error tracking provider:",e)}},e.prototype.trackProviders=function(e){try{for(var t=0,r=e;t<r.length;t++){var n=r[t],i=null==n?void 0:n.provider;i&&!this._trackedProviders.has(i)&&this.trackEIP1193Provider(i)}}catch(e){f.logger.error("Failed to track EIP-6963 providers during initialization:",e)}},e.prototype.addProviderListener=function(e,t,r){var n=this._providerListenersMap.get(e)||{};n[t]=r,this._providerListenersMap.set(e,n)},e.prototype.registerAccountsChangedListener=function(e){var t=this;f.logger.info("registerAccountsChangedListener");var r=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.onAccountsChanged(e,r[0])};e.on("accountsChanged",r),this.addProviderListener(e,"accountsChanged",r)},e.prototype.onAccountsChanged=function(e,t){return i(this,void 0,void 0,function(){return a(this,function(r){switch(r.label){case 0:if(f.logger.info("onAccountsChanged",t),this._processingAccountsChanged)return f.logger.debug("OnAccountsChanged: Already processing accountsChanged, skipping",{provider:this.getProviderInfo(e).name}),[2];this._processingAccountsChanged=!0,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this._handleAccountsChanged(e,t)];case 2:return r.sent(),[3,4];case 3:return this._processingAccountsChanged=!1,[7];case 4:return[2]}})})},e.prototype._handleAccountsChanged=function(e,t){return i(this,void 0,void 0,function(){var r,n,i,o,s,c,u,d,l,h;return a(this,function(a){switch(a.label){case 0:if(0!==t.length)return[3,9];if(this._provider!==e)return[3,7];if(f.logger.info("OnAccountsChanged: Detecting disconnect, current state:",{evmAddress:this._evmAddress,evmChainId:this._evmChainId,providerMatch:this._provider===e}),this._announcedConnect.delete(e),!this.isAutocaptureEnabled("disconnect"))return[3,5];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.disconnect({chainId:this._evmChainId,address:this._evmAddress})];case 2:return a.sent(),[3,4];case 3:return r=a.sent(),f.logger.error("Failed to disconnect provider on accountsChanged",r),[3,4];case 4:return[3,6];case 5:f.logger.debug("OnAccountsChanged: Disconnect event skipped (autocapture.disconnect: false)"),this.clearChainState("evm"),a.label=6;case 6:return[3,8];case 7:f.logger.info("OnAccountsChanged: Ignoring disconnect for non-active provider"),a.label=8;case 8:return[2];case 9:if(!(n=(0,m.validateAndChecksumAddress)(t[0])))return f.logger.warn("onAccountsChanged: Invalid address received",t[0]),[2];if(!this._provider||this._provider===e)return[3,25];i=this._evmAddress,o=(0,m.validateAndChecksumAddress)(n),f.logger.info("OnAccountsChanged: Different provider attempting to connect",{activeProvider:this.getProviderInfo(this._provider).name,eventProvider:this.getProviderInfo(e).name,currentStoredAddress:i,newProviderAddress:o}),a.label=10;case 10:return a.trys.push([10,21,,25]),[4,this.getAccounts(this._provider)];case 11:return s=a.sent(),f.logger.info("OnAccountsChanged: Checking current provider accounts",{activeProvider:this.getProviderInfo(this._provider).name,accountsLength:s?s.length:0,accounts:s}),s&&s.length>0?o&&i&&o!==i?(f.logger.info("OnAccountsChanged: Different address detected, switching providers despite current provider having accounts",{activeProvider:this.getProviderInfo(this._provider).name,eventProvider:this.getProviderInfo(e).name,currentAddress:i,newAddress:o,reason:"Address mismatch indicates wallet switch"}),this.isAutocaptureEnabled("disconnect")?[4,this.disconnect({chainId:this._evmChainId,address:this._evmAddress})]:[3,13]):[3,15]:[3,17];case 12:return a.sent(),[3,14];case 13:f.logger.debug("OnAccountsChanged: Disconnect event skipped during provider switch (autocapture.disconnect: false)"),this.clearChainState("evm"),a.label=14;case 14:return this.clearActiveProvider(),[3,16];case 15:return f.logger.info("OnAccountsChanged: Current provider still has accounts and same address, ignoring new provider",{activeProvider:this.getProviderInfo(this._provider).name,eventProvider:this.getProviderInfo(e).name,activeProviderAccountsCount:s.length,currentAddress:i,newAddress:o}),[2];case 16:return[3,20];case 17:return f.logger.info("OnAccountsChanged: Current provider has no accounts, switching to new provider",{oldProvider:this.getProviderInfo(this._provider).name,newProvider:this.getProviderInfo(e).name,reason:"Current provider has no accounts"}),this.isAutocaptureEnabled("disconnect")?[4,this.disconnect({chainId:this._evmChainId,address:this._evmAddress})]:[3,19];case 18:return a.sent(),[3,20];case 19:f.logger.debug("OnAccountsChanged: Disconnect event skipped for old provider (autocapture.disconnect: false)"),this.clearChainState("evm"),a.label=20;case 20:return[3,25];case 21:return c=a.sent(),f.logger.warn("OnAccountsChanged: Could not check current provider accounts, switching to new provider",{error:c instanceof Error?c.message:String(c),errorType:c instanceof Error?c.constructor.name:typeof c,oldProvider:this._provider?this.getProviderInfo(this._provider).name:"unknown",newProvider:this.getProviderInfo(e).name,reason:"Could not check current provider accounts"}),this.isAutocaptureEnabled("disconnect")?[4,this.disconnect({chainId:this._evmChainId,address:this._evmAddress})]:[3,23];case 22:return a.sent(),[3,24];case 23:f.logger.debug("OnAccountsChanged: Disconnect event skipped for failed provider check (autocapture.disconnect: false)"),this.clearChainState("evm"),a.label=24;case 24:return[3,25];case 25:return this._provider||(this._provider=e),this._provider===e&&n===this._evmAddress||(u=this.resolveChainIdForProvider(e),d=!this._evmAddress,this.isTrackingSuppressed()?this.clearStaleEvmWalletOnSwitchWhileSuppressed(n):this.setChainState("evm",{address:n,chainId:u}),l=this.getProviderInfo(e),h=u||0,this.isAutocaptureEnabled("connect")&&this.shouldReportConnect(e,n)?(f.logger.info("OnAccountsChanged: Detected wallet connection, emitting connect event",{chainId:u,address:n,wasDisconnected:d,providerName:l.name,rdns:l.rdns,hasChainId:!!u}),0===h&&f.logger.info("OnAccountsChanged: Using fallback chainId 0 for connect event"),this.markConnectReported(e,n,h),this.connect({chainId:h,address:n},{providerName:l.name,rdns:l.rdns}).catch(function(e){f.logger.error("Failed to track connect event during account change:",e)})):f.logger.debug("OnAccountsChanged: Connect event skipped (autocapture.connect: false)",{chainId:u,address:n,providerName:l.name})),[2]}})})},e.prototype.registerChainChangedListener=function(e){var t=this;f.logger.info("registerChainChangedListener");var r=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.onChainChanged(e,r[0])};e.on("chainChanged",r),this.addProviderListener(e,"chainChanged",r)},e.prototype.onChainChanged=function(e,t){return i(this,void 0,void 0,function(){var r,n;return a(this,function(i){switch(i.label){case 0:if(f.logger.info("onChainChanged",t),r=(0,S.parseChainId)(t),this.rememberProviderChain(e,r),!this.isAutocaptureEnabled("chain")&&e!==this._provider)return[2];if(this.isProviderMismatch(e)&&this.handleProviderMismatch(e),!this._evmAddress)return f.logger.info("OnChainChanged: No current address, user appears disconnected"),[2,Promise.resolve()];this._provider||(this._provider=e),this.setChainState("evm",{chainId:r}),i.label=1;case 1:return i.trys.push([1,5,,6]),this.isAutocaptureEnabled("chain")?[4,this.chain({chainId:r,address:this._evmAddress})]:[3,3];case 2:return i.sent(),[3,4];case 3:f.logger.debug("OnChainChanged: Chain event skipped (autocapture.chain: false)",{chainId:this._evmChainId,address:this._evmAddress}),i.label=4;case 4:return[3,6];case 5:return n=i.sent(),f.logger.error("OnChainChanged: Failed to emit chain event:",n),[3,6];case 6:return[2]}})})},e.prototype.registerConnectChainObserver=function(e){var t=this,r=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r[0];"string"==typeof(null==i?void 0:i.chainId)&&t.rememberProviderChain(e,(0,S.parseChainId)(i.chainId))};e.on("connect",r),this.addProviderListener(e,"connect",r)},e.prototype.shouldReportConnect=function(e,t){var r=this._announcedConnect.get(e);return!r||r.address.toLowerCase()!==t.toLowerCase()},e.prototype.markConnectReported=function(e,t,r){this.willTrackEvent(r)&&this._announcedConnect.set(e,{address:t,chainId:r})},e.prototype.registerConnectListener=function(e){var t=this;f.logger.info("registerConnectListener");var r=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r[0];t.onConnected(e,i)};e.on("connect",r),this.addProviderListener(e,"connect",r)},e.prototype.registerDisconnectListener=function(e){var t=this;f.logger.info("registerDisconnectListener");var r=function(r){return i(t,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:if(this._provider!==e)return[2];if(this._announcedConnect.delete(e),f.logger.info("OnDisconnect: Wallet disconnect event received, current state:",{currentAddress:this._evmAddress,currentChainId:this._evmChainId}),!this.isAutocaptureEnabled("disconnect"))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.disconnect({chainId:this._evmChainId,address:this._evmAddress})];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),f.logger.error("Error during disconnect in disconnect listener",t),[3,4];case 4:return[3,6];case 5:f.logger.debug("OnDisconnect: Disconnect event skipped (autocapture.disconnect: false)"),this.clearChainState("evm"),r.label=6;case 6:return[2]}})})};e.on("disconnect",r),this.addProviderListener(e,"disconnect",r)},e.prototype.onConnected=function(e,t){return i(this,void 0,void 0,function(){var r,n,i,o,s,c,u;return a(this,function(a){switch(a.label){case 0:f.logger.info("onConnected",t),a.label=1;case 1:return a.trys.push([1,3,,4]),(null==t?void 0:t.chainId)&&"string"==typeof t.chainId?(r=(0,S.parseChainId)(t.chainId),this.rememberProviderChain(e,r),[4,this.getAddress(e)]):[2];case 2:return n=a.sent(),r&&n&&(i=!this._evmAddress,this._provider||(this._provider=e),(o=this._provider===e)&&(this.isTrackingSuppressed()?this.clearStaleEvmWalletOnSwitchWhileSuppressed(n):this.setChainState("evm",{chainId:r,address:(0,m.validateAndChecksumAddress)(n)||void 0})),o&&this._evmAddress&&this.shouldReportConnect(e,n)?(c=this.getProviderInfo(e),s=r||0,this.isAutocaptureEnabled("connect")?(f.logger.info("OnConnected: Detected wallet connection, emitting connect event",{chainId:r,wasDisconnected:i,providerName:c.name,rdns:c.rdns,hasChainId:!!r,isActiveProvider:o}),0===s&&f.logger.info("OnConnected: Using fallback chainId 0 for connect event"),this.markConnectReported(e,n,s),this.connect({chainId:s,address:n},{providerName:c.name,rdns:c.rdns}).catch(function(e){f.logger.error("Failed to track connect event during provider connection:",e)})):f.logger.debug("OnConnected: Connect event skipped (autocapture.connect: false)",{chainId:r,address:n,providerName:c.name})):n&&!o&&(c=this.getProviderInfo(e),f.logger.debug("OnConnected: Skipping connect event for non-active provider",{chainId:r,providerName:c.name,rdns:c.rdns,isActiveProvider:o,activeProviderInfo:this._provider?this.getProviderInfo(this._provider):null}))),[3,4];case 3:return u=a.sent(),f.logger.error("Error handling connect event",u),[3,4];case 4:return[2]}})})},e.prototype.registerRequestListeners=function(e){var t=this;if(f.logger.info("registerRequestListeners"),e){var r=e.request;if(this.isProviderAlreadyWrapped(e,r))f.logger.info("Provider already wrapped with our SDK; skipping request wrapping.");else{var o=e.request.bind(e),s=function(r){return i(t,[r],void 0,function(t){var r,s,c,u,d,l,h,p,v,g,m,A=this,b=t.method,_=t.params;return a(this,function(t){switch(t.label){case 0:if("eth_chainId"===b)return r=null!==(m=this._providerChainGenerations.get(e))&&void 0!==m?m:0,[2,o({method:b,params:_}).then(function(t){var n;return r===(null!==(n=A._providerChainGenerations.get(e))&&void 0!==n?n:0)&&"string"==typeof t&&A.rememberProviderChain(e,(0,S.parseChainId)(t)),t})];if(!Array.isArray(_)||!["eth_signTypedData_v4","personal_sign"].includes(b))return[3,4];if(!this.isAutocaptureEnabled("signature"))return f.logger.debug("Signature event skipped (autocapture.signature: false)",{method:b}),[2,o({method:b,params:_})];(s=o({method:b,params:_})).catch(function(){}),c=this.resolveChainIdForProvider(e),i(A,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.signature(n({status:y.SignatureStatus.REQUESTED},this.buildSignatureEventPayload(b,_,void 0,c,e)))];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),f.logger.error("Formo: Failed to track signature request",t),[3,3];case 3:return[2]}})}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,s];case 2:return(u=t.sent())&&i(A,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.signature(n({status:y.SignatureStatus.CONFIRMED},this.buildSignatureEventPayload(b,_,u,c,e)))];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),f.logger.error("Formo: Failed to track signature confirmation",t),[3,3];case 3:return[2]}})}),[2,u];case 3:throw d=t.sent(),4001===(null==(g=d)?void 0:g.code)&&i(A,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.signature(n({status:y.SignatureStatus.REJECTED},this.buildSignatureEventPayload(b,_,void 0,c,e)))];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),f.logger.error("Formo: Failed to track signature rejection",t),[3,3];case 3:return[2]}})}),d;case 4:if(!Array.isArray(_)||"eth_sendTransaction"!==b||!_[0])return[3,8];if(!this.isAutocaptureEnabled("transaction"))return f.logger.debug("Transaction event skipped (autocapture.transaction: false)",{method:b}),[2,o({method:b,params:_})];(l=o({method:b,params:_})).catch(function(){}),h=this.resolveChainIdForProvider(e),i(A,void 0,void 0,function(){var t,r;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.buildTransactionEventPayload(_,e,h)];case 1:return t=i.sent(),[4,this.transaction(n({status:y.TransactionStatus.STARTED},t))];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),f.logger.error("Formo: Failed to track transaction start",r),[3,4];case 4:return[2]}})}),t.label=5;case 5:return t.trys.push([5,7,,8]),[4,l];case 6:return p=t.sent(),i(A,void 0,void 0,function(){var t,r;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.buildTransactionEventPayload(_,e,h)];case 1:return t=i.sent(),[4,this.transaction(n(n({status:y.TransactionStatus.BROADCASTED},t),{transactionHash:p}))];case 2:return i.sent(),this.pollTransactionReceipt(e,p,t),[3,4];case 3:return r=i.sent(),f.logger.error("Formo: Failed to track transaction broadcast",r),[3,4];case 4:return[2]}})}),[2,p];case 7:throw v=t.sent(),4001===(null==(g=v)?void 0:g.code)&&i(A,void 0,void 0,function(){var t,r;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.buildTransactionEventPayload(_,e,h)];case 1:return t=i.sent(),[4,this.transaction(n({status:y.TransactionStatus.REJECTED},t))];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),f.logger.error("Formo: Failed to track transaction rejection",r),[3,4];case 4:return[2]}})}),v;case 8:return[2,o({method:b,params:_})]}})})};s[y.WRAPPED_REQUEST_SYMBOL]=!0,e[y.WRAPPED_REQUEST_REF_SYMBOL]=s;try{e.request=s}catch(e){f.logger.warn("Failed to wrap provider.request; skipping",e)}}}else f.logger.error("Provider not found for request (signature, transaction) tracking")},e.prototype.onLocationChange=function(){return i(this,void 0,void 0,function(){var e;return a(this,function(t){return this._currentUrl!==window.location.href&&(this._currentUrl=window.location.href,null===(e=this.wagmiHandler)||void 0===e||e.retryAdoption(),this.trackPageHit()),[2]})})},e.prototype.trackPageHits=function(){var t=this;e.installHistoryHooksOnce(),this._onPopStateListener=function(){return t.onLocationChange()},this._onLocationChangeListener=function(){return t.onLocationChange()},window.addEventListener("popstate",this._onPopStateListener),window.addEventListener("locationchange",this._onLocationChangeListener)},e.installHistoryHooksOnce=function(){if("undefined"!=typeof history&&"undefined"!=typeof window){var e=Symbol.for("formo.historyWrapped");if(!history[e]){history[e]=!0;var t=function(){return window.dispatchEvent(new window.Event("locationchange"))},r=history.pushState;history.pushState=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=r.apply(this,e);return t(),i};var n=history.replaceState;history.replaceState=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=n.apply(this,e);return t(),i}}}},e.prototype.trackPageHit=function(e,t,r,n,o){return i(this,void 0,void 0,function(){var s=this;return a(this,function(u){return this.shouldTrack()?(setTimeout(function(){s._pageHooksDisposed||i(s,void 0,void 0,function(){var i;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.trackEvent(c.EventType.PAGE,{category:e,name:t},r,n,o)];case 1:return a.sent(),[3,3];case 2:return i=a.sent(),f.logger.error("Formo: Failed to track page hit",i),[3,3];case 3:return[2]}})})},300),[2]):(f.logger.info("Track page hit: Skipping event due to tracking configuration"),[2])})})},e.prototype.trackEvent=function(e,t,r,o,s){return i(this,void 0,void 0,function(){var i;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.shouldTrack(null==t?void 0:t.chainId)?[4,this.eventManager.addEvent(n(n({type:e},t),{properties:r,context:o,callback:s}),this.currentAddress,this.currentUserId)]:(f.logger.info("Skipping ".concat(e," event due to tracking configuration")),[2]);case 1:return a.sent(),[3,3];case 2:return i=a.sent(),f.logger.error("Error tracking event:",i),[3,3];case 3:return[2]}})})},e.prototype.isTrackingSuppressed=function(){return this.hasOptedOutTracking()||this.isCurrentEnvironmentExcluded()},e.prototype.isCurrentChainExcluded=function(e){if(null===this.options.tracking||"object"!=typeof this.options.tracking||Array.isArray(this.options.tracking))return!1;var t=this.options.tracking.excludeChains,r=void 0===t?[]:t;if(0===r.length)return!1;var n=null!=e?e:this.currentChainId;return 0===n||void 0!==n&&r.includes(n)},e.prototype.isCurrentEnvironmentExcluded=function(){return this.isTimezoneExcluded()||this.isHostExcluded()||this.isPathExcluded()},e.prototype.isHostExcluded=function(){var e=this.options.tracking;if(null===e||"object"!=typeof e||Array.isArray(e))return!1;if("undefined"==typeof window)return!1;var t=e.excludeHosts;return(void 0===t?[]:t).includes(window.location.hostname)},e.prototype.isPathExcluded=function(){var e=this.options.tracking;if(null===e||"object"!=typeof e||Array.isArray(e))return!1;if("undefined"==typeof window)return!1;var t=e.excludePaths;return(void 0===t?[]:t).includes(window.location.pathname)},e.prototype.isPersistedIdentityPurgeRequired=function(){return this.hasOptedOutTracking()||this.isTimezoneExcluded()},e.prototype.isTimezoneExcluded=function(){var e=this.options.tracking;if(null===e||"object"!=typeof e||Array.isArray(e))return!1;var t=e.excludeTimezones,r=void 0===t?[]:t;if(0===r.length)return!1;var n=(0,A.getTimezone)();if(!n)return!1;var i=n.toLowerCase();return r.some(function(e){return"string"==typeof e&&e.toLowerCase()===i})},e.prototype.shouldTrack=function(e){if(this.hasOptedOutTracking())return!1;if("boolean"==typeof this.options.tracking)return this.options.tracking;if(null!==this.options.tracking&&"object"==typeof this.options.tracking&&!Array.isArray(this.options.tracking)){var t=this.options.tracking.excludeChains,r=void 0===t?[]:t;if(this.isCurrentEnvironmentExcluded())return!1;var n=null!=e?e:this.currentChainId;if(r.length>0){if(0===n)return!1;if(n&&r.includes(n))return!1}return!0}return!(0,b.isLocalhost)()},e.prototype.isAutocaptureEnabled=function(e){return void 0===this.options.autocapture||("boolean"==typeof this.options.autocapture?this.options.autocapture:null===this.options.autocapture||"object"!=typeof this.options.autocapture||!1!==this.options.autocapture[e])},e.prototype.getProviderInfo=function(e){var t=this._providers.find(function(t){return t.provider===e});if(t)return{name:t.info.name,rdns:t.info.rdns};var r=(0,v.detectInjectedProviderInfo)(e);return{name:r.name,rdns:r.rdns}},e.prototype.getProviders=function(){return i(this,void 0,void 0,function(){var e,t,r,n,c,u,d,l,h,p=this;return a(this,function(g){if(e=(0,s.createStore)(),t=e.getProviders(),e.subscribe(function(e){t=e;for(var r=e.filter(function(e){var t=null==e?void 0:e.provider;return t&&!p._seenProviders.has(t)}),n=0,o=r;n<o.length;n++){var s=o[n];p.safeAddProviderDetail(s)}var c=e.filter(function(e){var t=null==e?void 0:e.provider;return!!t&&!p._trackedProviders.has(t)});c.length>0&&(p.trackProviders(c),i(p,void 0,void 0,function(){var e;return a(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.detectWallets(c)];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),f.logger.error("Formo: Failed to detect wallets",e),[3,3];case 3:return[2]}})})),p.cleanupUnavailableProviders()}),0===t.length){if(r="undefined"!=typeof window?window.ethereum:void 0){if(this._injectedProviderDetail&&this._injectedProviderDetail.provider===r)return this._trackedProviders.has(r)||this.trackEIP1193Provider(r),this._providers.some(function(e){return e.provider===r})||(this._providers=o(o([],this._providers,!0),[this._injectedProviderDetail],!1)),[2,this._providers];this._trackedProviders.has(r)||this.trackEIP1193Provider(r),n=(0,v.detectInjectedProviderInfo)(r),c={provider:r,info:n},this._injectedProviderDetail=c,this.safeAddProviderDetail(c)}return[2,this._providers]}for(u=t.filter(function(e){var t=null==e?void 0:e.provider;return t&&!p._seenProviders.has(t)}),d=0,l=u;d<l.length;d++)h=l[d],this.safeAddProviderDetail(h);return[2,this._providers]})})},Object.defineProperty(e.prototype,"providers",{get:function(){return this._providers},enumerable:!1,configurable:!0}),e.prototype.detectWallets=function(e){return i(this,void 0,void 0,function(){var t,r,n,i;return a(this,function(a){switch(a.label){case 0:a.trys.push([0,5,,6]),t=0,r=e,a.label=1;case 1:return t<r.length?(n=r[t],[4,this.detect({providerName:null==n?void 0:n.info.name,rdns:null==n?void 0:n.info.rdns})]):[3,4];case 2:a.sent(),a.label=3;case 3:return t++,[3,1];case 4:return[3,6];case 5:return i=a.sent(),f.logger.error("Error detect all wallets:",i),[3,6];case 6:return[2]}})})},Object.defineProperty(e.prototype,"provider",{get:function(){return this._provider},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"solana",{get:function(){return this.solanaManager||(this.solanaManager=new C.SolanaManager(this)),this.solanaManager},enumerable:!1,configurable:!0}),e.prototype.getAddress=function(e){return i(this,void 0,void 0,function(){var t,r,n;return a(this,function(i){switch(i.label){case 0:if(this._chainState.evm.address)return[2,this._chainState.evm.address];if(!(t=e||this.provider))return f.logger.info("The provider is not set"),[2,null];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.getAccounts(t)];case 2:return(r=i.sent())&&r.length>0?[2,(0,m.validateAndChecksumAddress)(r[0])||null]:[3,4];case 3:return 4001!==(null==(n=i.sent())?void 0:n.code)&&f.logger.error("FormoAnalytics::getAccounts: eth_accounts threw an error",n),[2,null];case 4:return[2,null]}})})},e.prototype.getAccounts=function(e){return i(this,void 0,void 0,function(){var t,r,n;return a(this,function(i){switch(i.label){case 0:t=e||this.provider,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null==t?void 0:t.request({method:"eth_accounts"})];case 2:return(r=i.sent())&&0!==r.length?[2,r.map(function(e){return(0,m.validateAndChecksumAddress)(e)}).filter(function(e){return void 0!==e})]:[2,null];case 3:return 4001!==(null==(n=i.sent())?void 0:n.code)&&f.logger.error("FormoAnalytics::getAccounts: eth_accounts threw an error",n),[2,null];case 4:return[2]}})})},e.prototype.resolveChainIdForProvider=function(e){return e?this._providerChainIds.get(e)||(e===this._provider&&this._evmChainId?this._evmChainId:0):this._evmChainId||0},e.prototype.rememberProviderChain=function(e,t){e&&t&&(this.bumpProviderChainGeneration(e),this._providerChainIds.set(e,t),e===this._provider&&"evm"===this._activeNamespace&&this._evmChainId!==t&&this.setChainState("evm",{chainId:t}))},e.prototype.bumpProviderChainGeneration=function(e){var t,r=(null!==(t=this._providerChainGenerations.get(e))&&void 0!==t?t:0)+1;return this._providerChainGenerations.set(e,r),r},e.prototype.seedProviderChainFromState=function(e){var t=e.chainId,r="string"==typeof t?(0,S.parseChainId)(t):"number"==typeof t?t:void 0;this.rememberProviderChain(e,r)},e.prototype.getCurrentChainId=function(e){return i(this,void 0,void 0,function(){var t,r,n;return a(this,function(i){switch(i.label){case 0:if(!(t=e||this.provider))return f.logger.error("Provider not set for chain ID"),[2,0];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,t.request({method:"eth_chainId"})];case 2:return(r=i.sent())?[2,(0,S.parseChainId)(r)]:(f.logger.info("Chain id not found"),[2,0]);case 3:return n=i.sent(),f.logger.error("eth_chainId threw an error:",n),[2,0];case 4:return[2]}})})},e.prototype.buildSignatureEventPayload=function(e,t,r,i,a){var o,s="personal_sign"===e?t[1]:t[0],c=(0,m.validateAndChecksumAddress)(s);if(!c)throw new Error("Invalid address in signature payload: ".concat(s));var u=null!==(o=null!=i?i:this._evmChainId)&&void 0!==o?o:void 0;a&&a!==this._provider&&this._provider||this.backfillActiveWallet(c,u,a);var d={chainId:u,address:c};if("personal_sign"===e){var l=Buffer.from(t[0].slice(2),"hex").toString("utf8");return n(n({},d),{message:l})}return n(n({},d),{message:t[1]})},e.prototype.buildTransactionEventPayload=function(e,t,r){return i(this,void 0,void 0,function(){var n,i,o,s,c,u,d;return a(this,function(a){if(n=e[0],i=n.data,o=n.from,s=n.to,c=n.value,!(u=(0,m.validateAndChecksumAddress)(o)))throw new Error("Invalid address in transaction payload: ".concat(o));return d=null!=r?r:this.resolveChainIdForProvider(t),t&&t!==this._provider&&this._provider||this.backfillActiveWallet(u,d,t),[2,{chainId:d,data:i,address:u,to:s,value:c}]})})},e.prototype.backfillActiveWallet=function(e,t,r){if(r&&void 0!==t&&0!==t){var n=this._providerChainIds.get(r);void 0!==n&&n!==t&&(t=n)}if(!this.isTrackingSuppressed()){var i=this._evmAddress;i?void 0!==t&&i.toLowerCase()===e.toLowerCase()&&this._evmChainId!==t&&this.setChainState("evm",{address:i,chainId:t}):this.setChainState("evm",{address:e,chainId:t})}},e.prototype.clearStaleEvmWalletOnSwitchWhileSuppressed=function(e){var t=this._chainState.evm.address,r=(0,m.validateAndChecksumAddress)(e);t&&r&&r!==t&&this.clearChainState("evm")},e.prototype.pollTransactionReceipt=function(e,t,r){return i(this,arguments,void 0,function(e,t,r,o,s){var c,u,d=this;return void 0===o&&(o=10),void 0===s&&(s=3e3),a(this,function(l){return c=0,e?(u=function(){return i(d,void 0,void 0,function(){var i,d;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,e.request({method:"eth_getTransactionReceipt",params:[t]})];case 1:if(i=a.sent()){if("0x1"===i.status||1===i.status)return this.transaction(n(n({status:y.TransactionStatus.CONFIRMED},r),{transactionHash:t})),[2];if("0x0"===i.status||0===i.status)return this.transaction(n(n({status:y.TransactionStatus.REVERTED},r),{transactionHash:t})),[2]}return[3,3];case 2:return d=a.sent(),f.logger.error("Error polling transaction receipt",d),[3,3];case 3:return++c<o&&setTimeout(u,s),[2]}})})},u(),[2]):[2]})})},e.prototype.removeProviderListeners=function(e){var t=this._providerListenersMap.get(e);if(t){for(var r=0,n=Object.entries(t);r<n.length;r++){var i=n[r],a=i[0],o=i[1];try{e.removeListener(a,o)}catch(e){f.logger.warn("Failed to remove listener for ".concat(String(a)),e)}}this._providerListenersMap.delete(e)}},e.prototype.untrackProvider=function(e){try{this.removeProviderListeners(e),this._trackedProviders.delete(e),this._provider===e&&this.clearActiveProvider()}catch(e){f.logger.warn("Failed to untrack provider",e)}},e.prototype.getTrackedProvidersCount=function(){return this._trackedProviders.size},e.prototype.getProviderState=function(){return{totalProviders:this._providers.length,trackedProviders:this._trackedProviders.size,seenProviders:this._seenProviders.size,activeProvider:!!this._provider}},e.prototype.cleanupUnavailableProviders=function(){for(var e=new Set(this._providers.map(function(e){return e.provider})),t=0,r=Array.from(this._trackedProviders);t<r.length;t++){var n=r[t];e.has(n)||(f.logger.info("Cleaning up unavailable provider: ".concat(n.constructor.name)),this.untrackProvider(n))}},e.prototype.isProviderAlreadyWrapped=function(e,t){return!(!t||"function"!=typeof t||!t[y.WRAPPED_REQUEST_SYMBOL]||e[y.WRAPPED_REQUEST_REF_SYMBOL]!==t)},e.prototype.handleProviderMismatch=function(e){this._provider?this.setChainState("evm",{address:void 0,chainId:void 0,provider:e}):this._provider=e},e.prototype.getNamespace=function(e){return(0,E.isSolanaChainId)(e)?"solana":"evm"},e.prototype.setChainState=function(e,t){var r="string"==typeof e?e:this.getNamespace(e),n=this._chainState[r];"address"in t&&(n.address=t.address),"chainId"in t?n.chainId=t.chainId:"number"==typeof e&&(n.chainId=e),"evm"===r&&"provider"in t&&(this.forgetConnectRecord(n.provider,t.provider),n.provider=t.provider),this._activeNamespace=r,this.syncDerivedState()},e.prototype.clearChainState=function(e){"evm"===("string"==typeof e?e:this.getNamespace(e))?(this.forgetConnectRecord(this._chainState.evm.provider,void 0),this._chainState.evm={}):this._chainState.solana={},this.syncDerivedState()},e.prototype.syncWalletState=function(e){var t=e.chainId,r=e.address;if(this.isTrackingSuppressed()){if(!r)return void(null!=t?this.clearChainState(t):(this.clearChainState("evm"),this.clearChainState("solana")));if(null==t)return;var n=this.getNamespace(t),i=this._chainState[n].address,a=(0,m.validateAddress)(r,t);i&&a&&a!==i&&this.clearChainState(t)}else if(r){if(null!=t){var o=(0,m.validateAddress)(r,t);o?this.setChainState(t,{address:o}):f.logger.warn('syncWalletState: invalid address ("'.concat(r,'") for chain ').concat(t))}}else null!=t?this.clearChainState(t):(this.clearChainState("evm"),this.clearChainState("solana"))},e.prototype.syncDerivedState=function(){var e=this._activeNamespace;if(e){var t=this._chainState[e];if(t.address||t.chainId)return this.currentAddress=t.address,this.currentChainId=t.chainId,void this.persistActiveWallet()}var r="evm"===e?"solana":"evm",n=this._chainState[r];if(n.address||n.chainId)return this.currentAddress=n.address,this.currentChainId=n.chainId,this._activeNamespace=r,void this.persistActiveWallet();this.currentAddress=void 0,this.currentChainId=void 0,this.persistActiveWallet()},e.prototype.persistActiveWallet=function(){try{if(this.isPersistedIdentityPurgeRequired())return void(0,u.cookie)().remove(c.ACTIVE_WALLET_KEY);if(this.currentAddress){if(this.isHostExcluded()||this.isPathExcluded())return;var e=JSON.stringify(n({address:this.currentAddress},void 0!==this.currentChainId&&{chainId:this.currentChainId})),t=(0,d.getIdentityCookieDomain)(this.crossSubdomainCookies);(0,u.cookie)().set(c.ACTIVE_WALLET_KEY,e,n(n({path:"/",expires:new Date(Date.now()+c.ACTIVE_WALLET_TTL_MS).toUTCString()},(0,d.getIdentityCookieSecurity)()),t?{domain:t}:{}))}else(0,u.cookie)().remove(c.ACTIVE_WALLET_KEY)}catch(e){f.logger.warn("Failed to persist current wallet snapshot",e)}},e.prototype.loadActiveWallet=function(){try{if(this.isPersistedIdentityPurgeRequired())return void(0,u.cookie)().remove(c.ACTIVE_WALLET_KEY);if(this.isHostExcluded()||this.isPathExcluded())return;var e=(0,u.cookie)().get(c.ACTIVE_WALLET_KEY);if(!e)return;var t=JSON.parse(e);if(!(null==t?void 0:t.address))return;var r=(0,E.isSolanaChainId)(t.chainId)?"solana":"evm",n=(0,m.validateAddress)(t.address,t.chainId);if(!n)return void(0,u.cookie)().remove(c.ACTIVE_WALLET_KEY);var i=this._chainState[r];i.address=n,void 0!==t.chainId&&(i.chainId=t.chainId),this._activeNamespace=r,this.currentAddress=n,this.currentChainId=t.chainId}catch(e){f.logger.warn("Failed to restore persisted wallet snapshot",e),(0,u.cookie)().remove(c.ACTIVE_WALLET_KEY)}},e.prototype.clearActiveProvider=function(){this._provider=void 0},e.prototype.safeAddProviderDetail=function(e){var t=null==e?void 0:e.provider;return!!t&&(this._providers.some(function(e){return e.provider===t})?(this._seenProviders.add(t),!1):(this._providers=o(o([],this._providers,!0),[e],!1),this._seenProviders.add(t),!0))},e}();t.FormoAnalytics=I},4245(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.useFormo=t.FormoAnalyticsProvider=t.FormoAnalyticsContext=void 0;var o=r(1325),s=r(489),c=r(8718),u=r(6517),d=r(3312),l={chain:function(){return Promise.resolve()},page:function(){return Promise.resolve()},reset:function(){},cleanup:function(){},detect:function(){return Promise.resolve()},connect:function(){return Promise.resolve()},disconnect:function(){return Promise.resolve()},signature:function(){return Promise.resolve()},transaction:function(){return Promise.resolve()},identify:function(){return Promise.resolve()},track:function(){return Promise.resolve()},optOutTracking:function(){},optInTracking:function(){},hasOptedOutTracking:function(){return!1}};t.FormoAnalyticsContext=(0,s.createContext)(l),t.FormoAnalyticsProvider=function(e){var t=e.writeKey,r=e.disabled,i=void 0!==r&&r,a=e.children;return t?i?(d.logger.warn("FormoAnalytics is disabled"),(0,o.jsx)(o.Fragment,{children:a})):(0,o.jsx)(h,n({},e)):(d.logger.error("FormoAnalyticsProvider: No Write Key provided"),(0,o.jsx)(o.Fragment,{children:a}))};var h=function(e){var r=e.writeKey,n=e.options,h=e.children,f=(0,s.useState)(l),p=f[0],v=f[1],g=(0,s.useRef)(l);(0,u.initStorageManager)(r);var y=(0,s.useMemo)(function(){if(!n)return"undefined";var e={tracking:n.tracking,autocapture:n.autocapture,crossSubdomainCookies:n.crossSubdomainCookies,apiHost:n.apiHost,flushAt:n.flushAt,flushInterval:n.flushInterval,retryCount:n.retryCount,maxQueueSize:n.maxQueueSize,logger:n.logger,referral:n.referral,hasProvider:!!n.provider,hasWagmi:!!n.wagmi,hasReady:!!n.ready};try{return JSON.stringify(e)}catch(e){return d.logger.warn("Failed to serialize options, using timestamp",e),Date.now().toString()}},[n]);return(0,s.useEffect)(function(){var e=!1;return i(void 0,void 0,void 0,function(){var t,i;return a(this,function(a){switch(a.label){case 0:g.current&&g.current!==l&&(d.logger.log("Cleaning up existing FormoAnalytics SDK instance before re-initialization"),g.current.cleanup(),g.current=l,v(l)),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,c.FormoAnalytics.init(r,n)];case 2:return t=a.sent(),e?(d.logger.log("Component unmounted during initialization, cleaning up SDK"),t.cleanup()):(v(t),g.current=t,d.logger.log("Successfully initialized FormoAnalytics SDK")),[3,4];case 3:return i=a.sent(),e||d.logger.error("Failed to initialize FormoAnalytics SDK",i),[3,4];case 4:return[2]}})}),function(){e=!0,g.current&&g.current!==l&&(d.logger.log("Cleaning up FormoAnalytics SDK instance"),g.current.cleanup(),g.current=l)}},[r,y]),(0,o.jsx)(t.FormoAnalyticsContext.Provider,{value:p,children:h})};t.useFormo=function(){var e=(0,s.useContext)(t.FormoAnalyticsContext);return e||d.logger.warn("useFormo called without a valid context"),e}},6079(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},n=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.detectBrowser=function(){var e=this;return a?Promise.resolve(a):i||(i=r(e,void 0,void 0,function(){var e,t;return n(this,function(r){switch(r.label){case 0:return e=function(){try{return void 0!==globalThis.navigator?globalThis.navigator.userAgent:""}catch(e){return""}}(),[4,o().catch(function(){return!1})];case 1:return t=r.sent(),a=t?"brave":function(e){return/Firefox\/\d+/i.test(e)?"firefox":/Edg\/\d+/i.test(e)?"edge":/OPR\/\d+/i.test(e)?"opera":/Safari\/\d+/i.test(e)&&!/Chrome\/\d+/i.test(e)?"safari":/Chrome\/\d+/i.test(e)?"chrome":"unknown"}(e),[2,a]}})}).finally(function(){i=null}))};var i=null,a=null;function o(){return r(this,void 0,void 0,function(){var e,t,r,i;return n(this,function(n){switch(n.label){case 0:if(!(e=void 0!==globalThis.navigator?globalThis.navigator:void 0))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),(null===(r=e.brave)||void 0===r?void 0:r.isBrave)?[4,e.brave.isBrave().catch(function(){return!1})]:[3,3];case 2:if(n.sent())return[2,!0];n.label=3;case 3:return[3,5];case 4:return n.sent(),[3,5];case 5:try{if(null==(t=null===(i=e.userAgentData)||void 0===i?void 0:i.brands)?void 0:t.some(function(e){return/Brave/i.test(e.brand)}))return[2,!0]}catch(e){}try{if(/Brave/i.test(e.userAgent))return[2,!0]}catch(e){}return[2,!1]}})})}},9582(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.setConsentFlag=function(e,t,r){var n;if("undefined"!=typeof document){var o=a(e,t),s=new Date(Date.now()+31536e6).toUTCString(),c="https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol),u=(0,i.getApexDomain)(),d=u?"; domain=.".concat(u):"";u&&(document.cookie="".concat(o,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;")),document.cookie="".concat(o,"=").concat(encodeURIComponent(r),"; expires=").concat(s,"; path=/").concat(d,"; SameSite=Strict").concat(c?"; Secure":"")}},t.getConsentFlag=function(e,t){if("undefined"==typeof document)return null;for(var r=a(e,t),n=0,i=document.cookie.split(";");n<i.length;n++){var o=i[n].trim(),s=o.indexOf("=");if(-1!==s){var c=o.substring(0,s),u=o.substring(s+1);if(c===r)return decodeURIComponent(u||"")}}return null},t.removeConsentFlag=function(e,t){!function(e){if("undefined"!=typeof document){document.cookie="".concat(e,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;");var t=(0,i.getApexDomain)();t&&(document.cookie="".concat(e,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.").concat(t,";"))}}(a(e,t))};var n=r(625),i=r(9037);function a(e,t){return"formo_".concat((0,n.secureHash)(e),"_").concat(t)}},88(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCKED_ADDRESSES=t.DEAD_ADDRESS=t.ZERO_ADDRESS=t.CONSENT_OPT_OUT_KEY=t.LOCAL_ANONYMOUS_ID_KEY=t.ACTIVE_WALLET_TTL_MS=t.ACTIVE_WALLET_KEY=t.SESSION_USER_ID_KEY=t.SESSION_TRAFFIC_SOURCE_KEY=void 0,t.SESSION_TRAFFIC_SOURCE_KEY="traffic-source",t.SESSION_USER_ID_KEY="user-id",t.ACTIVE_WALLET_KEY="active-wallet",t.ACTIVE_WALLET_TTL_MS=864e5,t.LOCAL_ANONYMOUS_ID_KEY="anonymous-id",t.CONSENT_OPT_OUT_KEY="opt-out-tracking",t.ZERO_ADDRESS="0x0000000000000000000000000000000000000000",t.DEAD_ADDRESS="0x000000000000000000000000000000000000dEaD",t.BLOCKED_ADDRESSES=[t.ZERO_ADDRESS,t.DEAD_ADDRESS]},3787(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.COUNTRY_LIST=t.EVENTS_API_REQUEST_HEADER=t.EVENTS_API_HOST=t.EVENTS_API_ORIGIN=void 0,t.EVENTS_API_ORIGIN="https://events.formo.so",t.EVENTS_API_HOST="".concat(t.EVENTS_API_ORIGIN,"/v0/raw_events"),t.EVENTS_API_REQUEST_HEADER=function(e){return{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)}},t.COUNTRY_LIST={"Africa/Abidjan":"CI","Africa/Accra":"GH","Africa/Addis_Ababa":"ET","Africa/Algiers":"DZ","Africa/Asmara":"ER","Africa/Asmera":"ER","Africa/Bamako":"ML","Africa/Bangui":"CF","Africa/Banjul":"GM","Africa/Bissau":"GW","Africa/Blantyre":"MW","Africa/Brazzaville":"CG","Africa/Bujumbura":"BI","Africa/Cairo":"EG","Africa/Casablanca":"MA","Africa/Ceuta":"ES","Africa/Conakry":"GN","Africa/Dakar":"SN","Africa/Dar_es_Salaam":"TZ","Africa/Djibouti":"DJ","Africa/Douala":"CM","Africa/El_Aaiun":"EH","Africa/Freetown":"SL","Africa/Gaborone":"BW","Africa/Harare":"ZW","Africa/Johannesburg":"ZA","Africa/Juba":"SS","Africa/Kampala":"UG","Africa/Khartoum":"SD","Africa/Kigali":"RW","Africa/Kinshasa":"CD","Africa/Lagos":"NG","Africa/Libreville":"GA","Africa/Lome":"TG","Africa/Luanda":"AO","Africa/Lubumbashi":"CD","Africa/Lusaka":"ZM","Africa/Malabo":"GQ","Africa/Maputo":"MZ","Africa/Maseru":"LS","Africa/Mbabane":"SZ","Africa/Mogadishu":"SO","Africa/Monrovia":"LR","Africa/Nairobi":"KE","Africa/Ndjamena":"TD","Africa/Niamey":"NE","Africa/Nouakchott":"MR","Africa/Ouagadougou":"BF","Africa/Porto-Novo":"BJ","Africa/Sao_Tome":"ST","Africa/Timbuktu":"ML","Africa/Tripoli":"LY","Africa/Tunis":"TN","Africa/Windhoek":"NA","America/Adak":"US","America/Anchorage":"US","America/Anguilla":"AI","America/Antigua":"AG","America/Araguaina":"BR","America/Argentina/Buenos_Aires":"AR","America/Argentina/Catamarca":"AR","America/Argentina/ComodRivadavia":"AR","America/Argentina/Cordoba":"AR","America/Argentina/Jujuy":"AR","America/Argentina/La_Rioja":"AR","America/Argentina/Mendoza":"AR","America/Argentina/Rio_Gallegos":"AR","America/Argentina/Salta":"AR","America/Argentina/San_Juan":"AR","America/Argentina/San_Luis":"AR","America/Argentina/Tucuman":"AR","America/Argentina/Ushuaia":"AR","America/Aruba":"AW","America/Asuncion":"PY","America/Atikokan":"CA","America/Atka":"US","America/Bahia":"BR","America/Bahia_Banderas":"MX","America/Barbados":"BB","America/Belem":"BR","America/Belize":"BZ","America/Blanc-Sablon":"CA","America/Boa_Vista":"BR","America/Bogota":"CO","America/Boise":"US","America/Buenos_Aires":"AR","America/Cambridge_Bay":"CA","America/Campo_Grande":"BR","America/Cancun":"MX","America/Caracas":"VE","America/Catamarca":"AR","America/Cayenne":"GF","America/Cayman":"KY","America/Chicago":"US","America/Chihuahua":"MX","America/Ciudad_Juarez":"MX","America/Coral_Harbour":"CA","America/Cordoba":"AR","America/Costa_Rica":"CR","America/Creston":"CA","America/Cuiaba":"BR","America/Curacao":"CW","America/Danmarkshavn":"GL","America/Dawson":"CA","America/Dawson_Creek":"CA","America/Denver":"US","America/Detroit":"US","America/Dominica":"DM","America/Edmonton":"CA","America/Eirunepe":"BR","America/El_Salvador":"SV","America/Ensenada":"MX","America/Fort_Nelson":"CA","America/Fort_Wayne":"US","America/Fortaleza":"BR","America/Glace_Bay":"CA","America/Godthab":"GL","America/Goose_Bay":"CA","America/Grand_Turk":"TC","America/Grenada":"GD","America/Guadeloupe":"GP","America/Guatemala":"GT","America/Guayaquil":"EC","America/Guyana":"GY","America/Halifax":"CA","America/Havana":"CU","America/Hermosillo":"MX","America/Indiana/Indianapoli":"US","America/Indiana/Knox":"US","America/Indiana/Marengo":"US","America/Indiana/Petersburg":"US","America/Indiana/Tell_City":"US","America/Indiana/Vevay":"US","America/Indiana/Vincennes":"US","America/Indiana/Winamac":"US","America/Indianapoli":"US","America/Inuvik":"CA","America/Iqaluit":"CA","America/Jamaica":"JM","America/Jujuy":"AR","America/Juneau":"US","America/Kentucky/Louisville":"US","America/Kentucky/Monticello":"US","America/Knox_IN":"US","America/Kralendijk":"BQ","America/La_Paz":"BO","America/Lima":"PE","America/Los_Angeles":"US","America/Louisville":"US","America/Lower_Princes":"SX","America/Maceio":"BR","America/Managua":"NI","America/Manaus":"BR","America/Marigot":"MF","America/Martinique":"MQ","America/Matamoros":"MX","America/Mazatlan":"MX","America/Mendoza":"AR","America/Menominee":"US","America/Merida":"MX","America/Metlakatla":"US","America/Mexico_City":"MX","America/Miquelon":"PM","America/Moncton":"CA","America/Monterrey":"MX","America/Montevideo":"UY","America/Montreal":"CA","America/Montserrat":"MS","America/Nassau":"BS","America/New_York":"US","America/Nipigon":"CA","America/Nome":"US","America/Noronha":"BR","America/North_Dakota/Beulah":"US","America/North_Dakota/Center":"US","America/North_Dakota/New_Salem":"US","America/Nuuk":"GL","America/Ojinaga":"MX","America/Panama":"PA","America/Pangnirtung":"CA","America/Paramaribo":"SR","America/Phoenix":"US","America/Port-au-Prince":"HT","America/Port_of_Spain":"TT","America/Porto_Acre":"BR","America/Porto_Velho":"BR","America/Puerto_Rico":"PR","America/Punta_Arenas":"CL","America/Rainy_River":"CA","America/Rankin_Inlet":"CA","America/Recife":"BR","America/Regina":"CA","America/Resolute":"CA","America/Rio_Branco":"BR","America/Rosario":"AR","America/Santa_Isabel":"MX","America/Santarem":"BR","America/Santiago":"CL","America/Santo_Domingo":"DO","America/Sao_Paulo":"BR","America/Scoresbysund":"GL","America/Shiprock":"US","America/Sitka":"US","America/St_Barthelemy":"BL","America/St_Johns":"CA","America/St_Kitts":"KN","America/St_Lucia":"LC","America/St_Thomas":"VI","America/St_Vincent":"VC","America/Swift_Current":"CA","America/Tegucigalpa":"HN","America/Thule":"GL","America/Thunder_Bay":"CA","America/Tijuana":"MX","America/Toronto":"CA","America/Tortola":"VG","America/Vancouver":"CA","America/Virgin":"VI","America/Whitehorse":"CA","America/Winnipeg":"CA","America/Yakutat":"US","America/Yellowknife":"CA","Antarctica/Casey":"AQ","Antarctica/Davis":"AQ","Antarctica/DumontDUrville":"AQ","Antarctica/Macquarie":"AU","Antarctica/Mawson":"AQ","Antarctica/McMurdo":"AQ","Antarctica/Palmer":"AQ","Antarctica/Rothera":"AQ","Antarctica/South_Pole":"AQ","Antarctica/Syowa":"AQ","Antarctica/Troll":"AQ","Antarctica/Vostok":"AQ","Arctic/Longyearbyen":"SJ","Asia/Aden":"YE","Asia/Almaty":"KZ","Asia/Amman":"JO","Asia/Anadyr":"RU","Asia/Aqtau":"KZ","Asia/Aqtobe":"KZ","Asia/Ashgabat":"TM","Asia/Ashkhabad":"TM","Asia/Atyrau":"KZ","Asia/Baghdad":"IQ","Asia/Bahrain":"BH","Asia/Baku":"AZ","Asia/Bangkok":"TH","Asia/Barnaul":"RU","Asia/Beirut":"LB","Asia/Bishkek":"KG","Asia/Brunei":"BN","Asia/Calcutta":"IN","Asia/Chita":"RU","Asia/Choibalsan":"MN","Asia/Chongqing":"CN","Asia/Chungking":"CN","Asia/Colombo":"LK","Asia/Dacca":"BD","Asia/Damascus":"SY","Asia/Dhaka":"BD","Asia/Dili":"TL","Asia/Dubai":"AE","Asia/Dushanbe":"TJ","Asia/Famagusta":"CY","Asia/Gaza":"PS","Asia/Harbin":"CN","Asia/Hebron":"PS","Asia/Ho_Chi_Minh":"VN","Asia/Hong_Kong":"HK","Asia/Hovd":"MN","Asia/Irkutsk":"RU","Asia/Istanbul":"TR","Asia/Jakarta":"ID","Asia/Jayapura":"ID","Asia/Jerusalem":"IL","Asia/Kabul":"AF","Asia/Kamchatka":"RU","Asia/Karachi":"PK","Asia/Kashgar":"CN","Asia/Kathmandu":"NP","Asia/Katmandu":"NP","Asia/Khandyga":"RU","Asia/Kolkata":"IN","Asia/Kostanay":"KZ","Asia/Krasnoyarsk":"RU","Asia/Kuala_Lumpur":"MY","Asia/Kuching":"MY","Asia/Kuwait":"KW","Asia/Macao":"MO","Asia/Macau":"MO","Asia/Magadan":"RU","Asia/Makassar":"ID","Asia/Manila":"PH","Asia/Muscat":"OM","Asia/Nicosia":"CY","Asia/Novokuznetsk":"RU","Asia/Novosibirsk":"RU","Asia/Omsk":"RU","Asia/Oral":"KZ","Asia/Phnom_Penh":"KH","Asia/Pontianak":"ID","Asia/Pyongyang":"KP","Asia/Qatar":"QA","Asia/Qostanay":"KZ","Asia/Qyzylorda":"KZ","Asia/Rangoon":"MM","Asia/Riyadh":"SA","Asia/Saigon":"VN","Asia/Sakhalin":"RU","Asia/Samarkand":"UZ","Asia/Seoul":"KR","Asia/Shanghai":"CN","Asia/Singapore":"SG","Asia/Srednekolymsk":"RU","Asia/Taipei":"TW","Asia/Tashkent":"UZ","Asia/Tbilisi":"GE","Asia/Tehran":"IR","Asia/Tel_Aviv":"IL","Asia/Thimbu":"BT","Asia/Thimphu":"BT","Asia/Tokyo":"JP","Asia/Tomsk":"RU","Asia/Ujung_Pandang":"ID","Asia/Ulaanbaatar":"MN","Asia/Ulan_Bator":"MN","Asia/Urumqi":"CN","Asia/Ust-Nera":"RU","Asia/Vientiane":"LA","Asia/Vladivostok":"RU","Asia/Yakutsk":"RU","Asia/Yangon":"MM","Asia/Yekaterinburg":"RU","Asia/Yerevan":"AM","Atlantic/Azores":"PT","Atlantic/Bermuda":"BM","Atlantic/Canary":"ES","Atlantic/Cape_Verde":"CV","Atlantic/Faeroe":"FO","Atlantic/Faroe":"FO","Atlantic/Jan_Mayen":"SJ","Atlantic/Madeira":"PT","Atlantic/Reykjavik":"IS","Atlantic/South_Georgia":"GS","Atlantic/St_Helena":"SH","Atlantic/Stanley":"FK","Australia/ACT":"AU","Australia/Adelaide":"AU","Australia/Brisbane":"AU","Australia/Broken_Hill":"AU","Australia/Canberra":"AU","Australia/Currie":"AU","Australia/Darwin":"AU","Australia/Eucla":"AU","Australia/Hobart":"AU","Australia/LHI":"AU","Australia/Lindeman":"AU","Australia/Lord_Howe":"AU","Australia/Melbourne":"AU","Australia/North":"AU","Australia/NSW":"AU","Australia/Perth":"AU","Australia/Queensland":"AU","Australia/South":"AU","Australia/Sydney":"AU","Australia/Tasmania":"AU","Australia/Victoria":"AU","Australia/West":"AU","Australia/Yancowinna":"AU","Brazil/Acre":"BR","Brazil/DeNoronha":"BR","Brazil/East":"BR","Brazil/West":"BR","Canada/Atlantic":"CA","Canada/Central":"CA","Canada/Eastern":"CA","Canada/Mountain":"CA","Canada/Newfoundland":"CA","Canada/Pacific":"CA","Canada/Saskatchewan":"CA","Canada/Yukon":"CA","Chile/Continental":"CL","Chile/EasterIsland":"CL",Cuba:"CU",Egypt:"EG",Eire:"IE","Europe/Amsterdam":"NL","Europe/Andorra":"AD","Europe/Astrakhan":"RU","Europe/Athens":"GR","Europe/Belfast":"GB","Europe/Belgrade":"RS","Europe/Berlin":"DE","Europe/Bratislava":"SK","Europe/Brussels":"BE","Europe/Bucharest":"RO","Europe/Budapest":"HU","Europe/Busingen":"DE","Europe/Chisinau":"MD","Europe/Copenhagen":"DK","Europe/Dublin":"IE","Europe/Gibraltar":"GI","Europe/Guernsey":"GG","Europe/Helsinki":"FI","Europe/Isle_of_Man":"IM","Europe/Istanbul":"TR","Europe/Jersey":"JE","Europe/Kaliningrad":"RU","Europe/Kiev":"UA","Europe/Kirov":"RU","Europe/Kyiv":"UA","Europe/Lisbon":"PT","Europe/Ljubljana":"SI","Europe/London":"GB","Europe/Luxembourg":"LU","Europe/Madrid":"ES","Europe/Malta":"MT","Europe/Mariehamn":"AX","Europe/Minsk":"BY","Europe/Monaco":"MC","Europe/Moscow":"RU","Europe/Nicosia":"CY","Europe/Oslo":"NO","Europe/Paris":"FR","Europe/Podgorica":"ME","Europe/Prague":"CZ","Europe/Riga":"LV","Europe/Rome":"IT","Europe/Samara":"RU","Europe/San_Marino":"SM","Europe/Sarajevo":"BA","Europe/Saratov":"RU","Europe/Simferopol":"RU","Europe/Skopje":"MK","Europe/Sofia":"BG","Europe/Stockholm":"SE","Europe/Tallinn":"EE","Europe/Tirane":"AL","Europe/Tiraspol":"MD","Europe/Ulyanovsk":"RU","Europe/Uzhgorod":"UA","Europe/Vaduz":"LI","Europe/Vatican":"VA","Europe/Vienna":"AT","Europe/Vilnius":"LT","Europe/Volgograd":"RU","Europe/Warsaw":"PL","Europe/Zagreb":"HR","Europe/Zaporozhye":"UA","Europe/Zurich":"CH",GB:"GB","GB-Eire":"GB",Hongkong:"HK",Iceland:"IS","Indian/Antananarivo":"MG","Indian/Chagos":"IO","Indian/Christmas":"CX","Indian/Cocos":"CC","Indian/Comoro":"KM","Indian/Kerguelen":"TF","Indian/Mahe":"SC","Indian/Maldives":"MV","Indian/Mauritius":"MU","Indian/Mayotte":"YT","Indian/Reunion":"RE",Iran:"IR",Israel:"IL",Jamaica:"JM",Japan:"JP",Kwajalein:"MH",Libya:"LY","Mexico/BajaNorte":"MX","Mexico/BajaSur":"MX","Mexico/General":"MX",Navajo:"US",NZ:"NZ","NZ-CHAT":"NZ","Pacific/Apia":"WS","Pacific/Auckland":"NZ","Pacific/Bougainville":"PG","Pacific/Chatham":"NZ","Pacific/Chuuk":"FM","Pacific/Easter":"CL","Pacific/Efate":"VU","Pacific/Enderbury":"KI","Pacific/Fakaofo":"TK","Pacific/Fiji":"FJ","Pacific/Funafuti":"TV","Pacific/Galapagos":"EC","Pacific/Gambier":"PF","Pacific/Guadalcanal":"SB","Pacific/Guam":"GU","Pacific/Honolulu":"US","Pacific/Johnston":"UM","Pacific/Kanton":"KI","Pacific/Kiritimati":"KI","Pacific/Kosrae":"FM","Pacific/Kwajalein":"MH","Pacific/Majuro":"MH","Pacific/Marquesas":"PF","Pacific/Midway":"UM","Pacific/Nauru":"NR","Pacific/Niue":"NU","Pacific/Norfolk":"NF","Pacific/Noumea":"NC","Pacific/Pago_Pago":"AS","Pacific/Palau":"PW","Pacific/Pitcairn":"PN","Pacific/Pohnpei":"FM","Pacific/Ponape":"FM","Pacific/Port_Moresby":"PG","Pacific/Rarotonga":"CK","Pacific/Saipan":"MP","Pacific/Samoa":"AS","Pacific/Tahiti":"PF","Pacific/Tarawa":"KI","Pacific/Tongatapu":"TO","Pacific/Truk":"FM","Pacific/Wake":"UM","Pacific/Wallis":"WF","Pacific/Yap":"FM",Poland:"PL",Portugal:"PT",PRC:"CN",ROC:"TW",ROK:"KR",Singapore:"SG",Turkey:"TR","US/Alaska":"US","US/Aleutian":"US","US/Arizona":"US","US/Central":"US","US/East-Indiana":"US","US/Eastern":"US","US/Hawaii":"US","US/Indiana-Starke":"US","US/Michigan":"US","US/Mountain":"US","US/Pacific":"US","US/Samoa":"AS","W-SU":"RU"}},1556(e,t){var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.EventChannel=t.EventType=void 0,function(e){e.PAGE="page",e.IDENTIFY="identify",e.DETECT="detect",e.CONNECT="connect",e.DISCONNECT="disconnect",e.CHAIN="chain",e.SIGNATURE="signature",e.TRANSACTION="transaction",e.TRACK="track"}(r||(t.EventType=r={})),function(e){e.WEB="web",e.MOBILE="mobile",e.SERVER="server",e.SOURCE="source"}(n||(t.EventChannel=n={}))},49(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(88),t),i(r(3787),t),i(r(1556),t)},5164(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.isSolanaChainId=t.DEFAULT_SOLANA_CHAIN_ID=t.SOLANA_CHAIN_IDS=t.SolanaManager=t.parsePrivyProperties=t.formofy=void 0,i(r(8718),t),i(r(2657),t);var a=r(6271);Object.defineProperty(t,"formofy",{enumerable:!0,get:function(){return a.formofy}});var o=r(4328);Object.defineProperty(t,"parsePrivyProperties",{enumerable:!0,get:function(){return o.parsePrivyProperties}});var s=r(9308);Object.defineProperty(t,"SolanaManager",{enumerable:!0,get:function(){return s.SolanaManager}});var c=r(9308);Object.defineProperty(t,"SOLANA_CHAIN_IDS",{enumerable:!0,get:function(){return c.SOLANA_CHAIN_IDS}}),Object.defineProperty(t,"DEFAULT_SOLANA_CHAIN_ID",{enumerable:!0,get:function(){return c.DEFAULT_SOLANA_CHAIN_ID}}),Object.defineProperty(t,"isSolanaChainId",{enumerable:!0,get:function(){return c.isSolanaChainId}})},4416(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EventFactory=void 0;var c=r(49),u=r(9629),d=r(4657),l=r(8081),h=r(9879),f=r(3312),p=s(r(2817)),v=r(6517),g=r(5479),y=r(9165),m=r(6949),A=r(9293),b=r(6079),S=/^[A-Z]{2}$/,_=function(){function e(e){var t,r,i=this;this.extractUTMParameters=function(e){var t={utm_campaign:"",utm_content:"",utm_medium:"",utm_source:"",utm_term:""};try{new URL(e).searchParams.forEach(function(e,r){r.startsWith("utm_")&&(t[r]=e.trim())})}catch(e){}return t},this.extractClickIdParameters=function(e){for(var t={},r=0,n=y.CLICK_ID_PARAMS;r<n.length;r++){var i=n[r],a=e.searchParams.get(i);t[i]=a?a.trim():""}return t},this.extractReferralParameter=function(e){for(var t,r,n,a=0,o=(null===(t=i.options)||void 0===t?void 0:t.referral)&&null!==(r=i.options.referral.queryParams)&&void 0!==r?r:y.DEFAULT_REFERRAL_PARAMS;a<o.length;a++){var s=o[a],c=null===(n=e.searchParams.get(s))||void 0===n?void 0:n.trim();if(c)return c}if(i.compiledPathPattern){var u=e.pathname.match(i.compiledPathPattern);if(u&&u[1]){var d=u[1].trim();if(d)return d}}return""},this.getExternalReferrer=function(){var e,t=document.referrer;if(!t)return"";try{var r=null===(e=globalThis.location)||void 0===e?void 0:e.hostname;if(r&&new URL(t).hostname===r)return""}catch(e){}return i.redactUrl(t)},this.getTrafficSources=function(e){for(var t=new URL(e),r=(0,m.sanitizeTrafficSources)(n(n(n({},i.extractUTMParameters(e)),i.extractClickIdParameters(t)),{ref:i.extractReferralParameter(t),referrer:i.getExternalReferrer()})),a=(0,m.sanitizeTrafficSources)(i.redactStoredTrafficSources((0,v.session)().get(c.SESSION_TRAFFIC_SOURCE_KEY)||{})),o={},s=0,u=y.CLICK_ID_PARAMS;s<u.length;s++){var d=u[s];o[d]=r[d]||(null==a?void 0:a[d])||""}var l=n({ref:r.ref||(null==a?void 0:a.ref)||"",referrer:(null==a?void 0:a.referrer)||r.referrer||"",utm_campaign:r.utm_campaign||(null==a?void 0:a.utm_campaign)||"",utm_content:r.utm_content||(null==a?void 0:a.utm_content)||"",utm_medium:r.utm_medium||(null==a?void 0:a.utm_medium)||"",utm_source:r.utm_source||(null==a?void 0:a.utm_source)||"",utm_term:r.utm_term||(null==a?void 0:a.utm_term)||""},o),f=Object.keys(l).reduce(function(e,t){var r=l[t];return(0,h.isUndefined)(r)||""===r||(e[t]=r),e},{});return Object.keys(f).length&&(0,v.session)().set(c.SESSION_TRAFFIC_SOURCE_KEY,f),l},this.getPageProperties=function(e){var t=n({},e),r=null;try{r=new URL(globalThis.location.href),i.redactQueryParams(r),i.normalizeUrlPath(r)}catch(e){}(0,h.isUndefined)(t.url)&&(t.url=r?r.href:globalThis.location.href),(0,h.isUndefined)(t.path)&&(t.path=r?r.pathname:globalThis.location.pathname),(0,h.isUndefined)(t.hash)&&(t.hash=globalThis.location.hash),(0,h.isUndefined)(t.query)&&(t.query=r?r.search.slice(1):globalThis.location.search.slice(1));try{r&&r.searchParams.forEach(function(e,r){(0,h.isUndefined)(t[r])&&!y.PAGE_PROPERTIES_EXCLUDED_FIELDS.has(r)&&(t[r]=e)})}catch(e){f.logger.error("Error parsing query parameters for page properties:",e)}return t},this.options=e;var a=null==e?void 0:e.tracking,s="object"==typeof a&&null!==(t=a.excludeQueryParams)&&void 0!==t?t:[];if(this.excludedQueryParams=new Set(o(o([],y.DEFAULT_EXCLUDED_QUERY_PARAMS,!0),s,!0).map(function(e){return e.toLowerCase()})),null===(r=null==e?void 0:e.referral)||void 0===r?void 0:r.pathPattern)try{this.compiledPathPattern=new RegExp(e.referral.pathPattern)}catch(t){f.logger.warn("Invalid referral path pattern: ".concat(e.referral.pathPattern,". Error: ").concat(t))}}return e.prototype.validateEventAddress=function(e,t){return e&&(0,d.validateAddress)(e,t)||null},e.prototype.getTimezone=function(){return(0,u.getTimezone)()},e.prototype.getLocation=function(){try{var e=this.getTimezone();if(!e)return"";var t=c.COUNTRY_LIST[e];return"string"==typeof t&&S.test(t)?t:""}catch(e){return f.logger.error("Error resolving location:",e),""}},e.prototype.getLanguage=function(){try{return(navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language)||"en"}catch(e){return f.logger.error("Error resolving language:",e),"en"}},e.prototype.getLibraryVersion=function(){return g.version},e.prototype.isExcludedQueryParam=function(e){return this.excludedQueryParams.has(e.toLowerCase())},e.prototype.normalizeUrlPath=function(e){"/"!==e.pathname&&(e.pathname=e.pathname.replace(/\/+$/,""))},e.prototype.redactQueryParams=function(e){var t=this,r=new Set;e.searchParams.forEach(function(e,n){t.isExcludedQueryParam(n)&&r.add(n)}),r.forEach(function(t){return e.searchParams.delete(t)})},e.prototype.redactUrl=function(e){if(!e)return e;try{var t=new URL(e);return this.redactQueryParams(t),this.normalizeUrlPath(t),t.href}catch(t){return e}},e.prototype.redactStoredTrafficSources=function(e){for(var t={},r=0,n=Object.keys(e);r<n.length;r++){var i=n[r],a=e[i];"referrer"===i?t[i]=this.redactUrl(a||""):this.isExcludedQueryParam(i)?t[i]="":t[i]=a}return t},e.prototype.getScreen=function(){var e,t;try{return{screen_width:(null===(e=globalThis.screen)||void 0===e?void 0:e.width)||0,screen_height:(null===(t=globalThis.screen)||void 0===t?void 0:t.height)||0,screen_density:globalThis.devicePixelRatio||1,viewport_width:globalThis.innerWidth||0,viewport_height:globalThis.innerHeight||0}}catch(e){return f.logger.error("Error resolving screen properties:",e),{screen_width:0,screen_height:0,screen_density:1,viewport_width:0,viewport_height:0}}},e.prototype.generateContext=function(e){return i(this,void 0,void 0,function(){var t,r,i,o,s,c,u;return a(this,function(a){switch(a.label){case 0:return[4,(0,b.detectBrowser)()];case 1:return t=a.sent(),r=this.getLanguage(),i=this.getTimezone(),o=this.getLocation(),s=this.getLibraryVersion(),c=this.redactUrl(globalThis.location.href),u=n(n(n({user_agent:globalThis.navigator.userAgent,locale:r,timezone:i,location:o},this.getTrafficSources(c)),{page_title:document.title,page_url:c,library_name:"Formo Web SDK",library_version:s,browser:t}),this.getScreen()),[2,(0,p.default)(u,e||{})]}})})},e.prototype.getEnrichedEvent=function(e,t){return i(this,void 0,void 0,function(){var r,n,i,o,s,d,h;return a(this,function(a){switch(a.label){case 0:return s={},[4,this.generateContext(t)];case 1:return s.context=a.sent(),s.original_timestamp=(0,l.getCurrentTimeFormatted)(),s.user_id=e.user_id,s.type=e.type,s.channel=y.CHANNEL,s.version=y.VERSION,(r=s).anonymous_id=(0,A.generateAnonymousId)(c.LOCAL_ANONYMOUS_ID_KEY,null===(d=this.options)||void 0===d?void 0:d.crossSubdomainCookies),n=null===(h=e.properties)||void 0===h?void 0:h.chainId,i=this.validateEventAddress(e.address,n),r.address=i,void 0===(o=(0,p.default)(e,r)).event&&(o.event=null),void 0===o.properties&&(o.properties=null),[2,(0,u.toSnakeCase)(o)]}})})},e.prototype.generatePageEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i,s;return a(this,function(a){return(i=n({},null!=r?r:{})).category=e,i.name=t,i=this.getPageProperties(i),s={properties:i,type:"page"},[2,this.getEnrichedEvent(s,o)]})})},e.prototype.generateDetectWalletEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({providerName:e,rdns:t},r),type:"detect"},[2,this.getEnrichedEvent(i,o)]})})},e.prototype.generateIdentifyEvent=function(e,t,r,o,s,c){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n(n(n({},void 0!==e&&{providerName:e}),void 0!==t&&{rdns:t}),s),user_id:o,address:r,type:"identify"},[2,this.getEnrichedEvent(i,c)]})})},e.prototype.generateConnectEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({chainId:e},r),address:t,type:"connect"},[2,this.getEnrichedEvent(i,o)]})})},e.prototype.generateDisconnectEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({chainId:e},r),address:t,type:"disconnect"},[2,this.getEnrichedEvent(i,o)]})})},e.prototype.generateChainChangedEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({chainId:e},r),address:t,type:"chain"},[2,this.getEnrichedEvent(i,o)]})})},e.prototype.generateSignatureEvent=function(e,t,r,o,s,c){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({status:e,chainId:t,message:o},s),address:r,type:"signature"},[2,this.getEnrichedEvent(i,c)]})})},e.prototype.generateTransactionEvent=function(e,t,r,o,s,c,u,d,l,h,f){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n(n(n(n(n(n(n({status:e,chainId:t},o&&{data:o}),s&&{to:s}),c&&{value:c}),u&&{transactionHash:u}),d&&{function_name:d}),l&&{function_args:l}),h),address:r,type:"transaction"},[2,this.getEnrichedEvent(i,f)]})})},e.prototype.generateTrackEvent=function(e,t,r){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n(n(n(n({},t),void 0!==(null==t?void 0:t.revenue)&&{revenue:Number(t.revenue),currency:("string"==typeof(null==t?void 0:t.currency)?t.currency:"USD").toLowerCase()}),void 0!==(null==t?void 0:t.points)&&{points:Number(t.points)}),void 0!==(null==t?void 0:t.volume)&&{volume:Number(t.volume)}),event:e,type:"track"},[2,this.getEnrichedEvent(i,r)]})})},e.prototype.create=function(e,t,r){return i(this,void 0,void 0,function(){var n,i,o,s;return a(this,function(a){switch(a.label){case 0:switch(n={},e.type){case"page":return[3,1];case"detect":return[3,3];case"identify":return[3,5];case"chain":return[3,7];case"connect":return[3,9];case"disconnect":return[3,11];case"signature":return[3,13];case"transaction":return[3,15];case"track":return[3,17]}return[3,17];case 1:return[4,this.generatePageEvent(e.category,e.name,e.properties,e.context)];case 2:case 4:case 6:case 8:case 10:case 12:case 14:case 16:case 18:return n=a.sent(),[3,19];case 3:return[4,this.generateDetectWalletEvent(e.providerName,e.rdns,e.properties,e.context)];case 5:return[4,this.generateIdentifyEvent(e.providerName,e.rdns,e.address,e.userId,e.properties,e.context)];case 7:return[4,this.generateChainChangedEvent(e.chainId,e.address,e.properties,e.context)];case 9:return[4,this.generateConnectEvent(e.chainId,e.address,e.properties,e.context)];case 11:return[4,this.generateDisconnectEvent(e.chainId,e.address,e.properties,e.context)];case 13:return[4,this.generateSignatureEvent(e.status,e.chainId,e.address,e.message,e.properties,e.context)];case 15:return[4,this.generateTransactionEvent(e.status,e.chainId,e.address,e.data,e.to,e.value,e.transactionHash,e.function_name,e.function_args,e.properties,e.context)];case 17:return[4,this.generateTrackEvent(e.event,e.properties,e.context)];case 19:return void 0!==n.address&&null!==n.address||"identify"===e.type||(i="chainId"in e?e.chainId:void 0,n.address=this.validateEventAddress(t,i)),n.user_id="identify"===e.type?null!==(s=null!==(o=n.user_id)&&void 0!==o?o:r)&&void 0!==s?s:null:r||null,[2,n]}})})},e}();t.EventFactory=_},1457(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},a=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.EventManager=void 0;var o=r(3312),s=r(4416),c=r(4657),u=function(){function e(e,t){this.eventQueue=e,this.eventFactory=new s.EventFactory(t)}return e.prototype.addEvent=function(e,t,r){return n(this,void 0,void 0,function(){var n,s,u;return i(this,function(i){switch(i.label){case 0:return n=e.callback,s=a(e,["callback"]),[4,this.eventFactory.create(s,t,r)];case 1:return(u=i.sent()).address&&(0,c.isBlockedAddress)(u.address)?(o.logger.warn("Event blocked: Address ".concat(u.address," is in the blocked list and cannot emit events")),[2]):(this.eventQueue.enqueue(u,function(e,t,r){e?o.logger.error("Error sending events:",e):o.logger.info("Events sent successfully: ".concat(r.length," events")),null==n||n(e,t,r)}),[2])}})})},e.prototype.clear=function(){this.eventQueue.clear()},e}();t.EventManager=u},9165(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.PAGE_PROPERTIES_EXCLUDED_FIELDS=t.DEFAULT_REFERRAL_PARAMS=t.DEFAULT_EXCLUDED_QUERY_PARAMS=t.CLICK_ID_PARAMS=t.VERSION=t.CHANNEL=void 0,t.CHANNEL="web",t.VERSION="0";var n=["gclid","gad_source","fbclid","msclkid","twclid","li_fat_id","rdt_cid","ttclid"];t.CLICK_ID_PARAMS=n,t.DEFAULT_EXCLUDED_QUERY_PARAMS=["privy_oauth_code","privy_oauth_state","privy_oauth_provider"];var i=["ref","referral","refcode","af","referrer"];t.DEFAULT_REFERRAL_PARAMS=i;var a=new Set(r(r(r(["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],i,!0),n,!0),["category","name","url","path","hash","query"],!1));t.PAGE_PROPERTIES_EXCLUDED_FIELDS=a},4992(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4416),t),i(r(1457),t),i(r(8962),t)},6949(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.sanitizeTrafficSources=t.sanitizeUtm=t.sanitizeRef=t.sanitizeClickId=void 0;var i=r(9165),a=/^[A-Za-z0-9._-]{1,255}$/,o=/^[A-Za-z0-9._-]{1,64}$/,s=/[<>"'`\\\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2060\ufeff\ufffd]/,c=/^\s*(javascript|data|vbscript):/i,u=function(e){return a.test(e)?e:""};t.sanitizeClickId=u;var d=function(e){return o.test(e)?e:""};t.sanitizeRef=d;var l=function(e){return e.length<=255&&!s.test(e)&&!c.test(e)?e:""};t.sanitizeUtm=l;var h=new Set(i.CLICK_ID_PARAMS);t.sanitizeTrafficSources=function(e){for(var t=n({},e),r=0,i=Object.keys(t);r<i.length;r++){var a=i[r],o=t[a];"string"==typeof o&&""!==o&&"referrer"!==a&&(h.has(a)?t[a]=u(o):t[a]="ref"===a?d(o):l(o))}return t}},8962(e,t){Object.defineProperty(t,"__esModule",{value:!0})},9293(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.generateAnonymousId=void 0;var i=r(9629),a=r(6517),o=r(2257);t.generateAnonymousId=function(e,t){var r=(0,a.cookie)().get(e),s=r&&"string"==typeof r?r:(0,i.generateNativeUUID)(),c=(0,o.getIdentityCookieDomain)(t);return(0,a.cookie)().set(e,s,n(n({expires:new Date(Date.now()+31536e6).toUTCString(),path:"/"},(0,o.getIdentityCookieSecurity)()),c?{domain:c}:{})),s}},7688(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},n=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},i=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return r(this,void 0,void 0,function(){var r,a,o,s,c,u,d,l,h;return n(this,function(f){switch(f.label){case 0:a=(r=t||{}).retries,o=void 0===a?0:a,s=r.retryDelay,c=r.retryOn,u=i(r,["retries","retryDelay","retryOn"]),d=function(t){var r,i,a,d;return n(this,function(n){switch(n.label){case 0:r=t===o,n.label=1;case 1:return n.trys.push([1,6,,10]),[4,globalThis.fetch(e,u)];case 2:return(i=n.sent()).ok||r?[2,{value:i}]:((a=new Error(i.statusText)).response=i,(null==c?void 0:c(t,a,i))?s?[4,new Promise(function(e){return setTimeout(e,s(t))})]:[3,4]:[3,5]);case 3:n.sent(),n.label=4;case 4:return[2,"continue"];case 5:return[2,{value:i}];case 6:if(d=n.sent(),r)throw d;return(null==c?void 0:c(t,d,null))?s?[4,new Promise(function(e){return setTimeout(e,s(t))})]:[3,8]:[3,9];case 7:n.sent(),n.label=8;case 8:return[2,"continue"];case 9:throw d;case 10:return[2]}})},l=0,f.label=1;case 1:return l<=o?[5,d(l)]:[3,4];case 2:if("object"==typeof(h=f.sent()))return[2,h.value];f.label=3;case 3:return l++,[3,1];case 4:throw new Error("Unexpected: retry loop exited without returning or throwing")}})})}},5135(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});var a=r(6271);i(r(5164),t),i(r(4245),t),"undefined"!=typeof window&&(window.formofy=a.formofy)},6271(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.formofy=function(e,t){e&&"undefined"!=typeof window?n.FormoAnalytics.init(e,t).then(function(e){if(window.formo=e,null==t?void 0:t.ready)try{t.ready(e)}catch(e){console.error("Error in FormoAnalytics ready callback:",e)}}).catch(function(e){return console.error("Error initializing FormoAnalytics:",e)}):console.warn("FormoAnalytics not found")};var n=r(8718)},7378(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.logger=t.Logger=void 0;var n=function(){function e(e,t){void 0===e&&(e=!1),void 0===t&&(t=[]),this.enabled=e,this.enabledLevels=new Set(t)}return e.init=function(t){var r=e.getInstance();void 0!==t.enabled&&r.setEnabled(t.enabled),void 0!==t.enabledLevels&&r.setEnabledLevels(t.enabledLevels)},e.getInstance=function(t){var r,n;return e.instance||(e.instance=new e(null!==(r=null==t?void 0:t.enabled)&&void 0!==r&&r,null!==(n=null==t?void 0:t.enabledLevels)&&void 0!==n?n:[])),e.instance},e.prototype.setEnabled=function(e){this.enabled=e},e.prototype.isLoggingEnabled=function(){return this.enabled},e.prototype.setEnabledLevels=function(e){this.enabledLevels=new Set(e)},e.prototype.getEnabledLevels=function(){return Array.from(this.enabledLevels)},e.prototype.shouldLog=function(e){return!!this.enabled&&this.enabledLevels.has(e)},e.prototype.formatMessage=function(e){var t=(new Date).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});return"[Formo SDK][".concat(t,"] ").concat(e)},e.prototype.debug=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("debug")&&console.debug.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.info=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("info")&&console.info.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.warn=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("warn")&&console.warn.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.error=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("error")&&console.error.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.trace=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("trace")&&console.trace.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.log=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.info.apply(this,r([e],t,!1))},e}();t.Logger=n,t.logger=n.getInstance()},3312(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7378),t),i(r(9954),t)},9954(e,t){Object.defineProperty(t,"__esModule",{value:!0})},4328(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parsePrivyProperties=void 0;var n=r(6053);Object.defineProperty(t,"parsePrivyProperties",{enumerable:!0,get:function(){return n.parsePrivyProperties}})},6053(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},s=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.parsePrivyProperties=f,t.identifyPrivyUser=function(e,t){return i(this,arguments,void 0,function(e,t,r){var i,o,s,u,d,l,p,v,g,y,m,A,b,S,_;return void 0===r&&(r={}),a(this,function(a){switch(a.label){case 0:if(!e||!t)return[2,void 0];if(null===(A=(i=e).isTrackingSuppressed)||void 0===A?void 0:A.call(i))return[2,void 0];if(o=f(t),s=o.properties,0===(u=o.wallets).length)return c.logger.info("identifyPrivyUser: user has no linked wallets; nothing to identify",t.id),[2,void 0];d=n(n({},s),r.properties),l=function(e,t,r){if(t)return e.find(function(e){return h(e.address,t)});if(r){var n=e.find(function(e){return h(e.address,r)});if(n)return n}var i=e.filter(function(e){return!e.isEmbedded});return i.length>0?i[i.length-1]:e[e.length-1]}(u,null!==(b=r.activeAddress)&&void 0!==b?b:i.currentAddress,null===(S=t.wallet)||void 0===S?void 0:S.address),null===(_=i.syncPrivyActiveChain)||void 0===_||_.call(i,null==l?void 0:l.chainType,null==l?void 0:l.address),p=i.identify.bind(e),v=0,g=u,a.label=1;case 1:return v<g.length?(y=g[v],m=n(n({},d),{is_embedded:y.isEmbedded}),y.walletClient&&(m.wallet_client=y.walletClient),y.chainType&&(m.chain_type=y.chainType),[4,p({address:y.address,userId:t.id,setActive:y===l},m)]):[3,4];case 2:a.sent(),a.label=3;case 3:return v++,[3,1];case 4:return[2,l?{address:l.address,chainType:l.chainType}:void 0]}})})};var c=r(3312);function u(e){return("wallet"===e.type||"smart_wallet"===e.type)&&!!e.address}function d(e){if(e instanceof Date){var t=e.getTime();return Number.isNaN(t)?void 0:t}if("number"==typeof e){if(!Number.isFinite(e))return;return e<1e11?1e3*e:e}if("string"==typeof e){var r=Date.parse(e);return Number.isNaN(r)?void 0:r}}var l=/^0x[0-9a-f]{40}$/i;function h(e,t){return l.test(e)&&l.test(t)?e.toLowerCase()===t.toLowerCase():e===t}function f(e){var t,r,n,i,a,c,h,f,p,v,g,y,m,A,b,S,_,E,C=e.linkedAccounts||[],w={privyDid:e.id,privyCreatedAt:d(e.createdAt)};if((null===(t=e.email)||void 0===t?void 0:t.address)&&(w.email=e.email.address),(null===(r=e.phone)||void 0===r?void 0:r.number)&&(w.phone=e.phone.number),(null===(n=e.apple)||void 0===n?void 0:n.email)&&(w.apple=e.apple.email),(null===(i=e.discord)||void 0===i?void 0:i.username)&&(w.discord=e.discord.username),(null===(a=e.farcaster)||void 0===a?void 0:a.username)&&(w.farcaster=e.farcaster.username),(null===(c=e.github)||void 0===c?void 0:c.username)&&(w.github=e.github.username),(null===(h=e.google)||void 0===h?void 0:h.email)&&(w.google=e.google.email),(null===(f=e.instagram)||void 0===f?void 0:f.username)&&(w.instagram=e.instagram.username),(null===(p=e.line)||void 0===p?void 0:p.email)&&(w.line=e.line.email),(null===(v=e.linkedin)||void 0===v?void 0:v.email)&&(w.linkedin=e.linkedin.email),(null===(g=e.spotify)||void 0===g?void 0:g.email)&&(w.spotify=e.spotify.email),(null===(y=e.telegram)||void 0===y?void 0:y.username)&&(w.telegram=e.telegram.username),(null===(m=e.tiktok)||void 0===m?void 0:m.username)&&(w.tiktok=e.tiktok.username),(null===(A=e.twitch)||void 0===A?void 0:A.username)&&(w.twitch=e.twitch.username),(null===(b=e.twitter)||void 0===b?void 0:b.username)&&(w.twitter=e.twitter.username),!w.email){var I=C.find(function(e){return"email"===e.type});(null==I?void 0:I.address)&&(w.email=I.address)}if(!w.phone){var k=C.find(function(e){return"phone"===e.type});(null==k?void 0:k.number)&&(w.phone=k.number)}if(!w.apple){var P=C.find(function(e){return"apple_oauth"===e.type});(null==P?void 0:P.email)&&(w.apple=P.email)}if(!w.discord){var O=C.find(function(e){return"discord_oauth"===e.type});(null==O?void 0:O.username)&&(w.discord=O.username)}if(!w.farcaster){var T=C.find(function(e){return"farcaster"===e.type});(null==T?void 0:T.username)?w.farcaster=T.username:(null==T?void 0:T.displayName)&&(w.farcaster=T.displayName)}if(!w.github){var x=C.find(function(e){return"github_oauth"===e.type});(null==x?void 0:x.username)&&(w.github=x.username)}if(!w.google){var H=C.find(function(e){return"google_oauth"===e.type});(null==H?void 0:H.email)&&(w.google=H.email)}if(!w.instagram){var L=C.find(function(e){return"instagram_oauth"===e.type});(null==L?void 0:L.username)&&(w.instagram=L.username)}if(!w.line){var M=C.find(function(e){return"line_oauth"===e.type});(null==M?void 0:M.email)&&(w.line=M.email)}if(!w.linkedin){var D=C.find(function(e){return"linkedin_oauth"===e.type});(null==D?void 0:D.email)&&(w.linkedin=D.email)}if(!w.spotify){var R=C.find(function(e){return"spotify_oauth"===e.type});(null==R?void 0:R.email)&&(w.spotify=R.email)}if(!w.telegram){var j=C.find(function(e){return"telegram"===e.type});(null==j?void 0:j.username)?w.telegram=j.username:(null==j?void 0:j.telegramUserId)&&(w.telegram=j.telegramUserId)}if(!w.tiktok){var U=C.find(function(e){return"tiktok_oauth"===e.type});(null==U?void 0:U.username)&&(w.tiktok=U.username)}if(!w.twitch){var N=C.find(function(e){return"twitch_oauth"===e.type});(null==N?void 0:N.username)?w.twitch=N.username:(null==N?void 0:N.email)&&(w.twitch=N.email)}if(!w.twitter){var B=C.find(function(e){return"twitter_oauth"===e.type});(null==B?void 0:B.username)&&(w.twitter=B.username)}var W=C.find(function(e){return"custom_auth"===e.type});(null==W?void 0:W.customUserId)&&(w.customUserId=W.customUserId),w.email||(w.google?w.email=w.google:w.apple?w.email=w.apple:w.linkedin&&(w.email=w.linkedin));for(var F=[],K=0,V=C;K<V.length;K++){var G=V[K];if(u(G))F.push({address:G.address,walletClient:null!==(S=G.walletClientType||G.walletClient)&&void 0!==S?S:void 0,chainType:null!==(_=G.chainType)&&void 0!==_?_:void 0,isEmbedded:"privy"===G.walletClientType||"privy"===G.walletClient});else if("cross_app"===G.type)for(var z=0,Y=s(s([],G.embeddedWallets||[],!0),G.smartWallets||[],!0);z<Y.length;z++){var q=Y[z];(null==q?void 0:q.address)&&F.push({address:q.address,walletClient:"cross_app",chainType:null!==(E=q.chainType)&&void 0!==E?E:void 0,isEmbedded:!0,fromCrossApp:!0})}}for(var Q=new Map,J=[],X=0,Z=F;X<Z.length;X++){var $=Z[X],ee=l.test($.address)?$.address.toLowerCase():$.address,te=Q.get(ee);void 0!==te?!$.fromCrossApp&&J[te].fromCrossApp&&(J[te]=$):(Q.set(ee,J.length),J.push($))}var re=J.map(function(e){return e.fromCrossApp,o(e,["fromCrossApp"])});return{properties:w,wallets:re}}},1794(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PROVIDER_ICON=void 0,t.detectInjectedProviderInfo=function(e){for(var n="Injected Provider",i="io.injected.provider",a=e,o=0,s=r;o<s.length;o++){var c=s[o];if(a[c.flag]){n=c.name,i=c.rdns;break}}return{name:n,rdns:i,uuid:"injected-".concat(i.replace(/[^a-zA-Z0-9]/g,"-")),icon:t.DEFAULT_PROVIDER_ICON}},t.isValidProvider=function(e){return!!e&&"function"==typeof e.request&&"function"==typeof e.on&&"function"==typeof e.removeListener},t.DEFAULT_PROVIDER_ICON="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiBmaWxsPSIjRkZGIi8+CjxwYXRoIGQ9Ik0xNiA4TDggMjRoMTZMMTYgOHoiIGZpbGw9IiMzMzMiLz4KPC9zdmc+Cg==";var r=[{flag:"isMetaMask",name:"MetaMask",rdns:"io.metamask"},{flag:"isCoinbaseWallet",name:"Coinbase Wallet",rdns:"com.coinbase.wallet"},{flag:"isWalletConnect",name:"WalletConnect",rdns:"com.walletconnect"},{flag:"isTrust",name:"Trust Wallet",rdns:"com.trustwallet"},{flag:"isBraveWallet",name:"Brave Wallet",rdns:"com.brave.wallet"},{flag:"isPhantom",name:"Phantom",rdns:"app.phantom"}]},6653(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PROVIDER_ICON=t.isValidProvider=t.detectInjectedProviderInfo=void 0;var n=r(1794);Object.defineProperty(t,"detectInjectedProviderInfo",{enumerable:!0,get:function(){return n.detectInjectedProviderInfo}}),Object.defineProperty(t,"isValidProvider",{enumerable:!0,get:function(){return n.isValidProvider}}),Object.defineProperty(t,"DEFAULT_PROVIDER_ICON",{enumerable:!0,get:function(){return n.DEFAULT_PROVIDER_ICON}})},5796(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EventQueue=void 0;var s=r(9879),c=r(9629),u=r(3312),d=r(49),l=o(r(7688)),h=function(){},f=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];try{e.apply(void 0,t)}catch(e){}},p=65536,v=function(){function e(e,t){var r=this;this.queue=[],this.queueByteSize=0,this.payloadHashes=new Set,this.onPageLeave=function(e){var t=!1,r=!1;function n(){t||(t=!0,e(r),setTimeout(function(){t=!1},0))}globalThis.addEventListener("beforeunload",function(){r=!1,n()}),globalThis.addEventListener("blur",function(){r=!0,n()}),globalThis.addEventListener("focus",function(){t=!1}),document.addEventListener("pagehide",function(){r="hidden"!==document.visibilityState,n()}),document.addEventListener("visibilitychange",function(){r="hidden"!==document.visibilityState,"hidden"===document.visibilityState?n():t=!1})},t=t||{},this.queue=[],this.writeKey=e,this.apiHost=t.apiHost,this.canSend=t.canSend,this.retryCount=(0,c.clampNumber)(t.retryCount||3,5,1),this.flushAt=(0,c.clampNumber)(t.flushAt||20,20,1),this.maxQueueSize=(0,c.clampNumber)(t.maxQueueSize||512e3,512e3,200),this.flushIntervalMs=(0,c.clampNumber)(t.flushInterval||3e4,3e5,1e4),this.flushed=!1,this.errorHandler=t.errorHandler,this.pendingFlush=null,this.timer=null,this.onPageLeave(function(e){return i(r,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return!1!==e?[3,2]:[4,this.flush(void 0,!0)];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}return e.prototype.generateMessageId=function(e){return i(this,void 0,void 0,function(){var t,r,i;return a(this,function(a){return t=(0,c.toDateHourMinute)(new Date(e.original_timestamp)),r=n(n({},e),{original_timestamp:t}),i=JSON.stringify(r),[2,(0,c.hash)(i)]})})},e.prototype.clear=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.queue=[],this.queueByteSize=0,this.payloadHashes.clear()},e.prototype.enqueue=function(e,t){return i(this,void 0,void 0,function(){var r,i,o,s;return a(this,function(a){switch(a.label){case 0:return t=t||h,this.canSend&&!this.canSend()?(this.clear(),[2]):[4,this.generateMessageId(e)];case 1:return r=a.sent(),this.isDuplicate(r)?(u.logger.warn("Event already enqueued, try again after ".concat((0,c.millisecondsToSecond)(this.flushIntervalMs)," seconds.")),[2]):((i={message:n(n({},e),{message_id:r}),callback:t,byteSize:0}).byteSize=JSON.stringify({message:i.message}).length,this.queue.push(i),this.queueByteSize+=i.byteSize,u.logger.log("Event enqueued: ".concat((0,c.getActionDescriptor)(e.type,e.properties))),this.flushed?(o=this.queue.length>=this.flushAt,s=this.queueByteSize>=this.maxQueueSize,o||s?(this.flush(),[2]):(this.flushIntervalMs&&!this.timer&&(this.timer=setTimeout(this.flush.bind(this),this.flushIntervalMs)),[2])):(this.flushed=!0,this.flush(),[2]))}})})},e.prototype.flush=function(e){return i(this,arguments,void 0,function(e,t){var r,i,o,s,c,u,d,l=this;return void 0===t&&(t=!1),a(this,function(a){switch(a.label){case 0:return e=e||h,this.timer&&(clearTimeout(this.timer),this.timer=null),this.canSend&&!this.canSend()?(this.clear(),f(e),[2,Promise.resolve()]):this.queue.length?this.pendingFlush?t?[3,2]:[4,this.pendingFlush]:[3,2]:(f(e),[2,Promise.resolve()]);case 1:a.sent(),a.label=2;case 2:for(r=this.queue.splice(0,t?this.queue.length:this.flushAt),i=0,o=r;i<o.length;i++)s=o[i],this.payloadHashes.delete(s.message.message_id),this.queueByteSize-=s.byteSize;return 0===this.queue.length&&(this.queueByteSize=0),c=(new Date).toISOString(),u=r.map(function(e){return n(n({},e.message),{sent_at:c})}),d=this.splitIntoBatches(r,u),[2,this.pendingFlush=this.sendBatches(d,u).then(function(t){return t?(f(e,t,u),"function"==typeof l.errorHandler&&f(l.errorHandler,t)):f(e,void 0,u),Promise.resolve(u)}).catch(function(t){f(e,t,u),"function"==typeof l.errorHandler&&f(l.errorHandler,t)})]}})})},e.byteLength=function(e){return(new TextEncoder).encode(e).byteLength},e.prototype.splitIntoBatches=function(t,r){var n=JSON.stringify(r);if(e.byteLength(n)<=p)return[{data:r,items:t,keepalive:!0}];for(var i=[],a=[],o=[],s=2,c=0;c<r.length;c++){var u=r[c],d=e.byteLength(JSON.stringify(u)),l=s+(a.length>0?1:0)+d;l>p?(a.length>0&&i.push({data:a,items:o,keepalive:!0}),d+2>p?(i.push({data:[u],items:[t[c]],keepalive:!1}),a=[],o=[],s=2):(a=[u],o=[t[c]],s=2+d)):(a.push(u),o.push(t[c]),s=l)}return a.length>0&&i.push({data:a,items:o,keepalive:!0}),i},e.prototype.sendBatches=function(e,t){return i(this,void 0,void 0,function(){var r,n,i,o,s,c,u,h,p=this;return a(this,function(a){switch(a.label){case 0:n=0,i=e,a.label=1;case 1:if(!(n<i.length))return[3,6];if(o=i[n],this.canSend&&!this.canSend())return[3,6];a.label=2;case 2:return a.trys.push([2,4,,5]),s=JSON.stringify(o.data),[4,(0,l.default)("".concat(this.apiHost),{headers:(0,d.EVENTS_API_REQUEST_HEADER)(this.writeKey),method:"POST",body:s,keepalive:o.keepalive,retries:this.retryCount,retryDelay:function(e){return 1e3*Math.pow(2,e)},retryOn:function(e,t,r){return p.isErrorRetryable(t,r)}})];case 3:if(!(c=a.sent()).ok)throw(u=new Error(c.statusText||"HTTP ".concat(c.status))).response=c,u;return o.items.forEach(function(e){var r=e.message,n=e.callback;return f(n,void 0,r,t)}),[3,5];case 4:return h=a.sent(),r=r||h,o.items.forEach(function(e){var r=e.message,n=e.callback;return f(n,h,r,t)}),[3,5];case 5:return n++,[3,1];case 6:return[2,r]}})})},e.prototype.isErrorRetryable=function(e,t){var r,n;if(e&&(0,s.isNetworkError)(e))return!0;var i=null!==(r=null==t?void 0:t.status)&&void 0!==r?r:null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status;return!!i&&(i>=500&&i<=599||429===i)},e.prototype.isDuplicate=function(e){return!!this.payloadHashes.has(e)||(this.payloadHashes.add(e),!1)},e}();t.EventQueue=v},4203(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5796),t),i(r(4407),t)},4407(e,t){Object.defineProperty(t,"__esModule",{value:!0})},5896(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.FormoAnalyticsSession=t.SESSION_WALLET_IDENTIFIED_KEY=t.SESSION_WALLET_DETECTED_KEY=void 0;var i=r(6517),a=r(2257),o=r(3312);function s(e,t){if(void 0===t&&(t=new Set),void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e){if(null===e)return"null";if("bigint"==typeof e)return"bigint:".concat(e.toString());if("number"==typeof e)return Number.isFinite(e)?JSON.stringify(e):"null";if("object"!=typeof e)return JSON.stringify(e);if(t.has(e))return'"[circular]"';t.add(e);try{var r=e.toJSON;if("function"==typeof r)return s(r.call(e),t);if(Array.isArray(e))return"[".concat(e.map(function(e){var r;return null!==(r=s(e,t))&&void 0!==r?r:"null"}).join(","),"]");for(var n=e,i=[],a=0,o=Object.keys(n).sort();a<o.length;a++){var c=o[a],u=s(n[c],t);void 0!==u&&i.push("".concat(JSON.stringify(c),":").concat(u))}return"{".concat(i.join(","),"}")}finally{t.delete(e)}}}function c(e){var t;if(e){var r;try{var n=s(e);if(void 0===n||"{}"===n)return;r=n}catch(e){return null===(t=o.logger.warn)||void 0===t||t.call(o.logger,"Session: failed to fingerprint identify properties",e),"nohash"}for(var i=2166136261,a=16777619,c=0;c<r.length;c++){var u=r.charCodeAt(c);i^=u,i=Math.imul(i,16777619),a^=u+c,a=Math.imul(a,2246822507)}return"".concat((i>>>0).toString(36)).concat((a>>>0).toString(36))}}function u(e){return encodeURIComponent(e).length}t.SESSION_WALLET_DETECTED_KEY="wallet-detected",t.SESSION_WALLET_IDENTIFIED_KEY="wallet-identified";var d=function(){function e(){}return e.prototype.generateIdentificationKey=function(e,t,r,n){return this.buildIdentificationKey(e,t,r,n).key},e.prototype.buildIdentificationKey=function(e,t,r,n){var i=c(n),a=[encodeURIComponent(e)];if(r||i){a.push(encodeURIComponent(t||"")),a.push(encodeURIComponent(r||""));var o=a.join(":");return i&&a.push(i),{key:a.join(":"),identityPrefix:o}}return t&&a.push(encodeURIComponent(t)),{key:a.join(":")}},e.prototype.isWalletDetected=function(e){var r;return((null===(r=(0,i.cookie)().get(t.SESSION_WALLET_DETECTED_KEY))||void 0===r?void 0:r.split(","))||[]).includes(e)},e.prototype.markWalletDetected=function(e){var r,o=(null===(r=(0,i.cookie)().get(t.SESSION_WALLET_DETECTED_KEY))||void 0===r?void 0:r.split(","))||[];o.includes(e)||(o.push(e),o.length>20&&o.splice(0,o.length-20),(0,i.cookie)().set(t.SESSION_WALLET_DETECTED_KEY,o.join(","),n({expires:new Date(Date.now()+864e5).toUTCString(),path:"/"},(0,a.getIdentityCookieSecurity)())))},e.prototype.isWalletIdentified=function(e,r,n,a){var s=this.generateIdentificationKey(e,r,n,a),c=(0,i.cookie)().get(t.SESSION_WALLET_IDENTIFIED_KEY),u=((null==c?void 0:c.split(","))||[]).includes(s);return o.logger.debug("Session: Checking wallet identification",{identifiedKey:s,isIdentified:u,hasRdns:!!r}),u},e.prototype.markWalletIdentified=function(e,r,s,c){var d,l=this.buildIdentificationKey(e,r,s,c),h=l.key,f=l.identityPrefix,p=(null===(d=(0,i.cookie)().get(t.SESSION_WALLET_IDENTIFIED_KEY))||void 0===d?void 0:d.split(","))||[];if(p.includes(h))o.logger.info("Session: Wallet already marked as identified",{identifiedKey:h,existingWallets:p,hasRdns:!!r});else{f&&(p=p.filter(function(e){return e!==f&&!e.startsWith("".concat(f,":"))})),p.push(h);for(var v=p.join(",");p.length>1&&u(v)>3584;)p.shift(),v=p.join(",");(0,i.cookie)().set(t.SESSION_WALLET_IDENTIFIED_KEY,v,n({expires:new Date(Date.now()+864e5).toUTCString(),path:"/"},(0,a.getIdentityCookieSecurity)())),o.logger.debug("Session: Marked wallet as identified",{identifiedKey:h,hasRdns:!!r})}},e}();t.FormoAnalyticsSession=d},1951(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.SolanaManager=void 0;var n=r(3312),i=r(8898),a=function(){function e(e,t){this.formo=e,(null==t?void 0:t.store)?(n.logger.info("SolanaManager: Initializing store-based Solana tracking"),this.storeHandler=new i.SolanaStoreHandler(e,t.store,{cluster:t.cluster})):(null==t?void 0:t.cluster)&&(this.pendingCluster=t.cluster)}return e.prototype.setStore=function(e,t){var r;null===(r=this.storeHandler)||void 0===r||r.cleanup(),this.storeHandler=new i.SolanaStoreHandler(this.formo,e,{cluster:(null==t?void 0:t.cluster)||this.pendingCluster}),this.pendingCluster=void 0},e.prototype.setCluster=function(e){this.storeHandler?this.storeHandler.setCluster(e):this.pendingCluster=e},e.prototype.cleanup=function(){var e;null===(e=this.storeHandler)||void 0===e||e.cleanup(),this.storeHandler=void 0},e}();t.SolanaManager=a},8898(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SolanaStoreHandler=void 0;var i=r(4164),a=r(3312),o=r(9485),s=r(3236);function c(e,t,r){if(void 0===t&&(t=1e3),void 0===r&&(r=500),e.size>t)for(var n=Array.from(e),i=0;i<r&&i<n.length;i++)e.delete(n[i])}var u=function(){function e(e,t,r){this.unsubscribers=[],this.lastWalletStatus="disconnected",this.processedTransactions=new Set,this.startedTransactions=new Set,this.transactionSenders=new Map,this.formo=e,this.store=t,this.explicitCluster=!!(null==r?void 0:r.cluster),this.cluster=(null==r?void 0:r.cluster)||this.detectClusterFromStore(t)||"mainnet-beta",this.chainId=o.SOLANA_CHAIN_IDS[this.cluster],a.logger.info("SolanaStoreHandler: Initializing framework-kit store integration",{cluster:this.cluster,chainId:this.chainId}),this.setupWalletSubscription(),this.setupTransactionSubscription(),this.setupClusterSubscription(),this.checkInitialWalletState()}return e.prototype.setCluster=function(e){this.explicitCluster=!0;var t=this.cluster;this.cluster=e,this.chainId=o.SOLANA_CHAIN_IDS[e],t!==e&&this.lastAddress&&(this.lastChainId=this.chainId,this.formo.isAutocaptureEnabled("chain")&&this.formo.chain({chainId:this.chainId,address:this.lastAddress}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting chain event",e)}))},e.prototype.getChainId=function(){return this.chainId},e.prototype.resolveCurrentChainId=function(){if(!this.explicitCluster){var e=this.detectClusterFromStore(this.store);e&&(this.cluster=e,this.chainId=o.SOLANA_CHAIN_IDS[e])}return this.chainId},e.prototype.setupWalletSubscription=function(){var e=this,t=this.store.getState().wallet,r=this.store.subscribe(function(r){var n=r.wallet;if(n!==t){var i=t;t=n,e.handleWalletChange(n,i)}});this.unsubscribers.push(r),a.logger.info("SolanaStoreHandler: Wallet subscription set up")},e.prototype.checkInitialWalletState=function(){var e,t=this.store.getState().wallet;if("connected"===t.status){var r=t.session.account.address;if(r&&!(0,s.isBlockedSolanaAddress)(r)&&(this.lastWalletStatus="connected",this.lastAddress=r,this.lastChainId=this.chainId,a.logger.info("SolanaStoreHandler: Already connected on initialization",{address:r,chainId:this.chainId}),this.formo.isAutocaptureEnabled("connect"))){var n=(null===(e=t.session.connector)||void 0===e?void 0:e.name)||t.connectorId;this.formo.connect({chainId:this.chainId,address:r},{providerName:n,rdns:"sol.wallet.".concat(n.toLowerCase().replace(/\s+/g,""))}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting initial connect",e)})}}this.lastWalletStatus=t.status},e.prototype.handleWalletChange=function(e,t){if("connected"===t.status&&"connected"!==e.status&&this.handleDisconnect(),"connected"===e.status&&"connected"!==t.status)this.handleConnect(e);else if("connected"===e.status&&"connected"===t.status){var r=e.session.account.address!==t.session.account.address,n=e.connectorId!==t.connectorId;(r||n)&&(this.handleDisconnect(),this.handleConnect(e))}this.lastWalletStatus=e.status},e.prototype.handleConnect=function(e){var t,r=e.session.account.address;if(r&&!(0,s.isBlockedSolanaAddress)(r)){var n=this.resolveCurrentChainId();if(this.lastAddress=r,this.lastChainId=n,a.logger.info("SolanaStoreHandler: Wallet connected",{address:r,chainId:n,connector:e.connectorId}),this.formo.isAutocaptureEnabled("connect")){var i=(null===(t=e.session.connector)||void 0===t?void 0:t.name)||e.connectorId;this.formo.connect({chainId:n,address:r},{providerName:i,rdns:"sol.wallet.".concat(i.toLowerCase().replace(/\s+/g,""))}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting connect",e)})}}},e.prototype.handleDisconnect=function(){this.lastAddress&&(a.logger.info("SolanaStoreHandler: Wallet disconnected",{address:this.lastAddress,chainId:this.lastChainId}),this.formo.isAutocaptureEnabled("disconnect")&&this.formo.disconnect({chainId:this.lastChainId,address:this.lastAddress}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting disconnect",e)}),this.lastAddress=void 0,this.lastChainId=void 0)},e.prototype.setupClusterSubscription=function(){var e=this,t=this.store.getState().cluster.endpoint,r=this.store.subscribe(function(r){var n=r.cluster.endpoint;n!==t&&(t=n,e.handleClusterChange(n))});this.unsubscribers.push(r),a.logger.info("SolanaStoreHandler: Cluster subscription set up")},e.prototype.handleClusterChange=function(e){if(!this.explicitCluster){var t=this.detectClusterFromEndpoint(e);if(t){var r=this.cluster;t!==r&&(this.cluster=t,this.chainId=o.SOLANA_CHAIN_IDS[t],a.logger.info("SolanaStoreHandler: Cluster changed",{from:r,to:t,chainId:this.chainId}),this.lastAddress&&(this.lastChainId=this.chainId,this.formo.isAutocaptureEnabled("chain")&&this.formo.chain({chainId:this.chainId,address:this.lastAddress}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting chain event",e)})))}}},e.prototype.setupTransactionSubscription=function(){var e=this,t=this.store.getState().transactions,r=this.store.subscribe(function(r){var n=r.transactions;if(n!==t){var i=t;t=n,e.handleTransactionChanges(n,i)}});this.unsubscribers.push(r),a.logger.info("SolanaStoreHandler: Transaction subscription set up")},e.prototype.handleTransactionChanges=function(e,t){for(var r,n=0,i=Object.entries(e);n<i.length;n++){var a=i[n],o=a[0],s=a[1],c=t[o];if(!c||c.status!==s.status){var u=this.lastAddress||(null===(r=this.transactionSenders.get(o))||void 0===r?void 0:r.address);u&&this.handleTransactionStatusChange(o,s,c,u)}}},e.prototype.handleTransactionStatusChange=function(e,t,r,o){var s=this.chainId,u="".concat(e,":").concat(t.status);if(!this.processedTransactions.has(u)&&(this.processedTransactions.add(u),c(this.processedTransactions),this.formo.isAutocaptureEnabled("transaction")))switch(t.status){case"sending":this.startedTransactions.has(e)||(this.startedTransactions.add(e),c(this.startedTransactions),this.transactionSenders.set(e,{address:o,chainId:s}),this.formo.transaction({status:i.TransactionStatus.STARTED,chainId:s,address:o}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting transaction STARTED",e)}));break;case"waiting":if(f=t.signature){this.transactionSenders.has(e)||this.transactionSenders.set(e,{address:o,chainId:s});var d=this.transactionSenders.get(e);this.formo.transaction({status:i.TransactionStatus.BROADCASTED,chainId:d.chainId,address:d.address,transactionHash:f}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting transaction BROADCASTED",e)})}break;case"confirmed":var l=(null==(d=this.transactionSenders.get(e))?void 0:d.address)||o,h=(null==d?void 0:d.chainId)||s,f=t.signature;a.logger.info("SolanaStoreHandler: Transaction confirmed",{key:e,signature:f}),this.formo.transaction(n({status:i.TransactionStatus.CONFIRMED,chainId:h,address:l},f&&{transactionHash:f})).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting transaction CONFIRMED",e)}),this.transactionSenders.delete(e);break;case"failed":l=(null==(d=this.transactionSenders.get(e))?void 0:d.address)||o,h=(null==d?void 0:d.chainId)||s,f=t.signature;var p=null==r?void 0:r.status,v="waiting"===p?i.TransactionStatus.REVERTED:i.TransactionStatus.REJECTED;a.logger.info("SolanaStoreHandler: Transaction failed",{key:e,signature:f,status:v,prevStatus:p}),this.formo.transaction(n({status:v,chainId:h,address:l},f&&{transactionHash:f})).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting transaction event",e)}),this.transactionSenders.delete(e)}},e.prototype.detectClusterFromStore=function(e){try{var t=e.getState().cluster.endpoint;return this.detectClusterFromEndpoint(t)}catch(e){return null}},e.prototype.detectClusterFromEndpoint=function(e){if(!e)return null;var t=e.toLowerCase();return t.includes("devnet")?"devnet":t.includes("testnet")?"testnet":t.includes("localhost")||t.includes("127.0.0.1")?"localnet":t.includes("mainnet")?"mainnet-beta":null},e.prototype.cleanup=function(){a.logger.debug("SolanaStoreHandler: Cleaning up");for(var e=0,t=this.unsubscribers;e<t.length;e++){var r=t[e];try{r()}catch(e){a.logger.error("SolanaStoreHandler: Error during cleanup",e)}}this.unsubscribers=[],this.processedTransactions.clear(),this.startedTransactions.clear(),this.transactionSenders.clear(),this.lastAddress=void 0,this.lastChainId=void 0,a.logger.debug("SolanaStoreHandler: Cleanup complete")},e}();t.SolanaStoreHandler=u},3236(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SOLANA_SYSTEM_ADDRESSES=void 0,t.isSolanaAddress=n,t.getValidSolanaAddress=i,t.isSolanaSystemAddress=a,t.isBlockedSolanaAddress=function(e){var t=i(e);return!!t&&!!a(t)},t.publicKeyToAddress=function(e){if(!e)return null;try{var t=e.toBase58();return n(t)?t:null}catch(e){return null}},t.areSolanaAddressesEqual=function(e,t){var r=i(e),n=i(t);return!(!r||!n)&&r===n};var r=new Set("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function n(e){if("string"!=typeof e)return!1;var t=e.trim();return!(t.length<32||t.length>44)&&function(e){for(var t=0;t<e.length;t++)if(!r.has(e[t]))return!1;return!0}(t)}function i(e){if(!e)return null;if("object"==typeof e&&"toBase58"in e)try{var t=e.toBase58();return n(t)?t:null}catch(e){return null}if("string"==typeof e){var r=e.trim();return n(r)?r:null}return null}function a(e){var r=i(e);return!!r&&Object.values(t.SOLANA_SYSTEM_ADDRESSES).includes(r)}t.SOLANA_SYSTEM_ADDRESSES={SYSTEM_PROGRAM:"11111111111111111111111111111111",TOKEN_PROGRAM:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",TOKEN_2022_PROGRAM:"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",ASSOCIATED_TOKEN_PROGRAM:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",RENT_SYSVAR:"SysvarRent111111111111111111111111111111111",CLOCK_SYSVAR:"SysvarC1ock11111111111111111111111111111111"}},9308(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.SolanaManager=t.SolanaStoreHandler=void 0;var a=r(8898);Object.defineProperty(t,"SolanaStoreHandler",{enumerable:!0,get:function(){return a.SolanaStoreHandler}});var o=r(1951);Object.defineProperty(t,"SolanaManager",{enumerable:!0,get:function(){return o.SolanaManager}}),i(r(9485),t),i(r(6720),t),i(r(3236),t)},6720(e,t){Object.defineProperty(t,"__esModule",{value:!0})},9485(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_SOLANA_CHAIN_ID=t.SOLANA_CLUSTERS_BY_ID=t.SOLANA_CHAIN_IDS=void 0,t.isSolanaChainId=function(e){return null!=e&&Object.values(t.SOLANA_CHAIN_IDS).includes(e)},t.SOLANA_CHAIN_IDS={"mainnet-beta":900001,testnet:900002,devnet:900003,localnet:900004},t.SOLANA_CLUSTERS_BY_ID={900001:"mainnet-beta",900002:"testnet",900003:"devnet",900004:"localnet"},t.DEFAULT_SOLANA_CHAIN_ID=t.SOLANA_CHAIN_IDS["mainnet-beta"]},2073(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StorageManager=void 0;var i=r(3312),a=n(r(8410)),o=n(r(7363)),s=n(r(7772)),c=["cookieStorage","localStorage","sessionStorage","memoryStorage"],u=function(){function e(e){this.writeKey=e,this.storages=new Map}return e.prototype.getStorage=function(e){if(!this.storages.has(e)){for(var t=this.createStorage(e),r=e;!t.isAvailable();){var n=c.indexOf(r);if(-1===n||n+1>=c.length){t=this.createStorage("memoryStorage");break}var a=r;r=c[n+1],i.logger.warn("Storage ".concat(a," is not available, trying ").concat(r)),t=this.createStorage(r)}this.storages.set(e,t)}return this.storages.get(e)},e.prototype.createStorage=function(e){switch(e){case"cookieStorage":return new a.default(this.writeKey);case"localStorage":case"sessionStorage":return new s.default(this.writeKey,this.getWebStorage(e));default:return new o.default(this.writeKey)}},e.prototype.getWebStorage=function(e){try{var t="localStorage"===e?localStorage:sessionStorage;return null!=t?t:null}catch(e){return null}},e}();t.StorageManager=u},701(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(9693),i=r(625),a=function(){function e(e){this.writeKey=e}return e.prototype.getKey=function(e){return"".concat(n.KEY_PREFIX,"_").concat((0,i.secureHash)(this.writeKey),"_").concat(e)},e}();t.default=a},8410(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=a(r(701)),s=r(9037),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.isAvailable=function(){return"undefined"!=typeof document&&"string"==typeof document.cookie},t.prototype.set=function(e,t,r){var n=null==r?void 0:r.expires,i=null==r?void 0:r.maxAge,a=(null==r?void 0:r.path)||"/",o=(null==r?void 0:r.domain)||"",c=null==r?void 0:r.sameSite,u=(null==r?void 0:r.secure)||!1,d=encodeURIComponent(this.getKey(e));if(o)document.cookie="".concat(d,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=").concat(a,";");else{var l=(0,s.getApexDomain)();l&&(document.cookie="".concat(d,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=").concat(a,"; domain=.").concat(l))}var h="".concat(d,"=").concat(encodeURIComponent(t));i?h+="; max-age="+i:n&&(h+="; expires="+n),a&&(h+="; path="+a),o&&(h+="; domain="+o),c&&(h+="; samesite="+c),u&&(h+="; secure"),document.cookie=h},t.prototype.get=function(e){var t=document.cookie.match(new RegExp("(?:^|; )".concat(encodeURIComponent(this.getKey(e)),"=([^;]*)")));return t?decodeURIComponent(t[1]):null},t.prototype.remove=function(e){var t=encodeURIComponent(this.getKey(e));document.cookie="".concat(t,"=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT");var r=(0,s.getApexDomain)();r&&(document.cookie="".concat(t,"=; path=/; domain=.").concat(r,"; expires=Thu, 01 Jan 1970 00:00:00 GMT"))},t}(o.default);t.default=c},7363(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.memoryStorage={},t}return i(t,e),t.prototype.isAvailable=function(){return!0},t.prototype.set=function(e,t){this.memoryStorage[this.getKey(e)]=t},t.prototype.get=function(e){return this.memoryStorage[this.getKey(e)]||null},t.prototype.remove=function(e){delete this.memoryStorage[this.getKey(e)]},t}(a(r(701)).default);t.default=o},7772(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(3312),s=r(9693),c=function(e){function t(t,r){var n=e.call(this,t)||this;return n.backend=r,n}return i(t,e),t.prototype.isAvailable=function(){try{var e="__storage_test__";return this.backend.setItem(e,"1"),this.backend.removeItem(e),!0}catch(e){return!1}},t.prototype.set=function(e,t){"boolean"==typeof t&&(t=!0===t?"true":"false"),"object"==typeof t&&(t=s.JSON_PREFIX+JSON.stringify(t)),this.backend.setItem(this.getKey(e),t)},t.prototype.get=function(e){var t=this.backend.getItem(this.getKey(e));if(!t||"string"!=typeof t)return null;if(["null","undefined"].some(function(e){return e==t}))return null;if(t.startsWith(s.JSON_PREFIX))try{return JSON.parse(t.slice(s.JSON_PREFIX.length))}catch(e){return o.logger.error("[FORMO_ERROR] ".concat(this.backend.constructor.name," failed to parse JSON"),e),null}return["true","false"].some(function(e){return e==t})?JSON.parse(t):t},t.prototype.remove=function(e){this.backend.removeItem(this.getKey(e))},t}(a(r(701)).default);t.default=c},9693(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.KEY_PREFIX=t.JSON_PREFIX=void 0,t.JSON_PREFIX="__json=",t.KEY_PREFIX="formo"},2257(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getIdentityCookieDomain=function(e){if(void 0===e&&(e=!0),!e)return"";var t=(0,n.getApexDomain)();return t?".".concat(t):""},t.getIdentityCookieSecurity=function(){var e;return{sameSite:"lax",secure:"undefined"!=typeof window&&"https:"===(null===(e=window.location)||void 0===e?void 0:e.protocol)}};var n=r(9037)},6517(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.memory=t.session=t.local=t.cookie=void 0,t.initStorageManager=function(e){o||(o=new a.StorageManager(e))};var a=r(2073);i(r(2305),t);var o=null;function s(e){if(!o)throw new Error("StorageManager not initialized. Call initStorageManager(writeKey) first.");return o.getStorage(e)}t.cookie=function(){return s("cookieStorage")},t.local=function(){return s("localStorage")},t.session=function(){return s("sessionStorage")},t.memory=function(){return s("memoryStorage")}},2305(e,t){Object.defineProperty(t,"__esModule",{value:!0})},4312(e,t){Object.defineProperty(t,"__esModule",{value:!0})},4164(e,t){var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionStatus=t.SignatureStatus=void 0,function(e){e.REQUESTED="requested",e.REJECTED="rejected",e.CONFIRMED="confirmed"}(r||(t.SignatureStatus=r={})),function(e){e.STARTED="started",e.REJECTED="rejected",e.BROADCASTED="broadcasted",e.CONFIRMED="confirmed",e.REVERTED="reverted"}(n||(t.TransactionStatus=n={}))},2657(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4312),t),i(r(4164),t),i(r(7896),t)},7896(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.WRAPPED_REQUEST_REF_SYMBOL=t.WRAPPED_REQUEST_SYMBOL=void 0,t.WRAPPED_REQUEST_SYMBOL=Symbol("formoWrappedRequest"),t.WRAPPED_REQUEST_REF_SYMBOL=Symbol("formoWrappedRequestRef")},4657(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.validateAddress=t.validateAndChecksumAddress=t.toChecksumAddress=t.isBlockedAddress=t.getValidAddress=t.isValidAddress=void 0;var n=r(5628),i=r(7393),a=r(9879),o=r(1592),s=r(49),c=r(3236),u=r(9485),d=function(e){return"string"==typeof e&&""!==e.trim()&&(0,a.isAddress)(e.trim())?e.trim():null};t.isValidAddress=function(e){return null!==d(e)},t.getValidAddress=function(e){return d(e)},t.isBlockedAddress=function(e){if(!e||"string"!=typeof e)return!1;var t=e.trim().toLowerCase();return!(!t||!t.startsWith("0x")||42!==t.length)&&s.BLOCKED_ADDRESSES.some(function(e){return e.toLowerCase()===t})},t.toChecksumAddress=function(e){if(!(0,a.isAddress)(e,!1))throw new Error("Invalid address "+e);var t=e.toLowerCase().replace(/^0x/i,""),r=(0,a.uint8ArrayToHexString)((0,n.keccak256)((0,a.ensureIfUint8Array)((0,i.utf8ToBytes)(t))));if((0,o.isNullish)(r)||"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"===r)return"";for(var s="0x",c=r.replace(/^0x/i,""),u=0;u<t.length;u+=1)parseInt(c[u],16)>7?s+=t[u].toUpperCase():s+=t[u];return s},t.validateAndChecksumAddress=function(e){var r=(0,t.getValidAddress)(e);return r?(0,t.toChecksumAddress)(r):void 0},t.validateAddress=function(e,r){var n=Object.values(u.SOLANA_CHAIN_IDS);return null!=r&&n.includes(r)?(0,c.getValidSolanaAddress)(e)||void 0:null!=r?(0,t.validateAndChecksumAddress)(e):(0,t.validateAndChecksumAddress)(e)||(0,c.isSolanaAddress)(e)&&(0,c.getValidSolanaAddress)(e)||void 0}},7916(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getActionDescriptor=void 0,t.getActionDescriptor=function(e,t){var r=e;return(null==t?void 0:t.status)&&(r+=" ".concat(t.status)),"connect"!==e&&"disconnect"!==e||!(null==t?void 0:t.rdns)||(r+=" (".concat(t.rdns,")")),r}},7392(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.parseChainId=function(e){return"string"!=typeof e?0:e.startsWith("0x")||e.startsWith("0X")?parseInt(e,16):parseInt(e,10)}},1349(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.clampNumber=t.toDateHourMinute=t.millisecondsToSecond=void 0,t.toSnakeCase=function(e,t){void 0===t&&(t=[]);var r=function(e){return Array.isArray(e)?e.map(r):null!==e&&"object"==typeof e?Object.keys(e).reduce(function(n,i){return n[t.includes(i)?i:i.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toLowerCase()]=t.includes(i)?e[i]:r(e[i]),n},{}):e};return r(e)},t.millisecondsToSecond=function(e){return Math.ceil(e/1e3)},t.toDateHourMinute=function(e){return e.getUTCFullYear()+"-"+("0"+(e.getUTCMonth()+1)).slice(-2)+"-"+("0"+e.getUTCDate()).slice(-2)+" "+("0"+e.getUTCHours()).slice(-2)+":"+("0"+e.getUTCMinutes()).slice(-2)},t.clampNumber=function(e,t,r){return Math.min(Math.max(e,r),t)}},9037(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getApexDomain=function(){if("undefined"==typeof window)return null;if(void 0!==r)return r;var e=window.location.hostname;if("localhost"===e||/^\d+\.\d+\.\d+\.\d+$/.test(e))return r=null,null;var t=e.split(".");if(t.length<2)return r=null,null;for(var n=2;n<=t.length;n++){var a=t.slice(-n).join(".");if(i(a))return r=a,a}return r=null,null},t._resetApexDomainCache=function(){r=void 0};var r,n="__formo_domain_probe";function i(e){var t="probe";document.cookie="".concat(n,"=").concat(t,"; domain=.").concat(e,"; path=/; max-age=10");var r=-1!==document.cookie.indexOf("".concat(n,"=").concat(t));return document.cookie="".concat(n,"=; domain=.").concat(e,"; path=/; max-age=0"),r}},6262(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.hash=function(e){return n(this,void 0,void 0,function(){var t,r;return i(this,function(n){return t=(0,o.utf8ToBytes)(e),r=(0,a.sha256)(t),[2,(0,o.bytesToHex)(r)]})})},t.generateNativeUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;var t=Array.from(e).map(function(e){return e.toString(16).padStart(2,"0")}).join("");return"".concat(t.slice(0,8),"-").concat(t.slice(8,12),"-").concat(t.slice(12,16),"-").concat(t.slice(16,20),"-").concat(t.slice(20))}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})};var a=r(6997),o=r(7393)},625(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.secureHash=function(e){var t=(0,i.utf8ToBytes)(e),r=(0,n.sha256)(t);return(0,i.bytesToHex)(r).slice(0,8)};var n=r(6997),i=r(7393)},9629(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4657),t),i(r(7916),t),i(r(1349),t),i(r(6262),t),i(r(625),t),i(r(4586),t)},2817(e,t){function r(e,t){var r=null!=e?e:{},i=null!=t?t:{},a={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(a[o]=Object.prototype.hasOwnProperty.call(i,o)?n(r[o],i[o]):r[o]);for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(Object.prototype.hasOwnProperty.call(a,o)||(a[o]=i[o]));return a}function n(e,t){return i(e)&&i(t)?r(e,t):t}function i(e){return"[object Object]"===Object.prototype.toString.call(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.mergeDeepRight=r,t.default=r},8081(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getFormattedTimestamp=t.getCurrentTimeFormatted=void 0;var r=function(e){return e.toISOString()};t.getFormattedTimestamp=r,t.getCurrentTimeFormatted=function(){return r(new Date)}},4586(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getTimezone=void 0;var n=r(3312);t.getTimezone=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch(e){return n.logger.error("Error resolving timezone:",e),""}}},8939(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.checkAddressChecksum=t.isAddress=void 0,t.ensureIfUint8Array=s;var n=r(9874),i=r(5628),a=r(7393),o=r(8090);function s(e){var t;return e instanceof Uint8Array||"Uint8Array"!==(null===(t=null==e?void 0:e.constructor)||void 0===t?void 0:t.name)?e:Uint8Array.from(e)}t.isAddress=function(e,r){return void 0===r&&(r=!0),!("string"!=typeof e&&!(0,n.isUint8Array)(e))&&(i=(0,n.isUint8Array)(e)?(0,n.uint8ArrayToHexString)(e):"string"!=typeof e||(0,o.isHexStrict)(e)||e.toLowerCase().startsWith("0x")?e:"0x".concat(e),!!/^(0x)?[0-9a-f]{40}$/i.test(i)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(i)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(i))||!r||(0,t.checkAddressChecksum)(i)));var i},t.checkAddressChecksum=function(e){if(!/^(0x)?[0-9a-f]{40}$/i.test(e))return!1;for(var t=e.slice(2),r=(0,a.utf8ToBytes)(t.toLowerCase()),o=(0,n.uint8ArrayToHexString)((0,i.keccak256)(s(r))).slice(2),c=0;c<40;c+=1)if(parseInt(o[c],16)>7&&t[c].toUpperCase()!==t[c]||parseInt(o[c],16)<=7&&t[c].toLowerCase()!==t[c])return!1;return!0}},2886(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLocalhost=void 0,t.isLocalhost=function(){return/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*:)*?:?0*1$/.test(window.location.hostname)||"file:"===window.location.protocol}},9090(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.objectToString=t.isPrimitive=t.isError=t.isDate=t.isRegExp=t.isObjectAndNotNull=t.isObject=t.isNumber=t.isBoolean=t.isArray=t.isBigInt=t.isDefinedNotNullAndNotEmptyString=t.isDefinedAndNotNull=t.isDefined=t.isTypeOfError=t.isNullOrUndefined=t.isUndefined=t.isNull=t.isString=t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e&&Boolean(e.constructor&&e.call&&e.apply)},t.isString=function(e){return"string"==typeof e};var r=function(e){return null===e};t.isNull=r;var n=function(e){return void 0===e};t.isUndefined=n;var i=function(e){return r(e)||n(e)};t.isNullOrUndefined=i,t.isBigInt=function(e){return"bigint"==typeof e},t.isDefined=function(e){return!n(e)};var a=function(e){return!i(e)};t.isDefinedAndNotNull=a,t.isDefinedNotNullAndNotEmptyString=function(e){return a(e)&&""!==e},t.isTypeOfError=function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}};var o=function(e){return Array.isArray(e)};t.isArray=o,t.isBoolean=function(e){return"boolean"==typeof e},t.isNumber=function(e){return"number"==typeof e};var s=function(e){return"object"==typeof e};t.isObject=s,t.isObjectAndNotNull=function(e){return!r(e)&&s(e)&&!o(e)},t.isRegExp=function(e){return s(e)&&"[object RegExp]"===c(e)},t.isDate=function(e){return s(e)&&"[object Date]"===c(e)},t.isError=function(e){return s(e)&&("[object Error]"===c(e)||e instanceof Error)},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e};var c=function(e){return Object.prototype.toString.call(e)};t.objectToString=c},9879(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(8939),t),i(r(2886),t),i(r(9090),t),i(r(2921),t),i(r(1592),t),i(r(8090),t),i(r(9874),t)},2921(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNetworkError=function(e){return!(!e||(t=e,a=r.call(t),"[object Error]"!==a&&"[object DOMException]"!==a)||!n.has(e.name)||"string"!=typeof e.message)&&("Load failed"===e.message?void 0===e.stack:i.has(e.message));var t,a};var r=Object.prototype.toString,n=new Set(["TypeError","TimeoutError","NetworkError"]),i=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated","The operation was aborted due to timeout"])},1592(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNullish=void 0,t.isNullish=function(e){return null==e}},8090(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isHexStrict=void 0,t.isHexStrict=function(e){return"string"==typeof e&&/^((-)?0x[0-9a-f]+|(0x))$/i.test(e)}},9874(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isUint8Array=function(e){var t,r;return e instanceof Uint8Array||"Uint8Array"===(null===(t=null==e?void 0:e.constructor)||void 0===t?void 0:t.name)||"Buffer"===(null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)},t.uint8ArrayToHexString=function(e){for(var t="0x",r=0,n=e;r<n.length;r++){var i=n[r].toString(16);t+=1===i.length?"0".concat(i):i}return t}},5479(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="1.35.2"},8788(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WagmiEventHandler=t.MARKER_GRACE_MS=void 0,t.__resetSeededWallet=function(){v.clear(),A.forEach(function(e){return clearTimeout(e)}),A.clear(),m.clear(),d.clear(),f.clear(),p.forEach(function(e){return clearTimeout(e)}),p.clear()};var o=r(4164),s=r(3312),c=r(5170),u=new Set(["status","chainId","address","data","to","value","transactionHash","function_name","function_args"]),d=new Set,l=new WeakMap,h=function(e,t){return"".concat(e,":").concat(t.toLowerCase())};t.MARKER_GRACE_MS=3e3;var f=new Map,p=new Map,v=new Map,g=new WeakMap,y=0,m=new Map,A=new Map;function b(e,t){var r;return t&&(null===(r=l.get(t))||void 0===r?void 0:r.has(e))?"exact":d.has(e)?"recent":"none"}function S(e,t){var r;d.delete(e),t&&(null===(r=l.get(t))||void 0===r||r.delete(e))}function _(e,t){var r;if(t){var n=null!==(r=l.get(t))&&void 0!==r?r:new Set;n.add(e),l.set(t,n)}d.add(e)}function E(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("bigint"==typeof e)return Number(e);if("string"==typeof e&&""!==e.trim()){var t=(e.startsWith("0x"),Number(e));return Number.isFinite(t)?t:void 0}}function C(e){if("string"==typeof e)return e;if(e&&"object"==typeof e){var t=e.address;if("string"==typeof t)return t}}function w(e,t,r){if(void 0===t&&(t=1e3),void 0===r&&(r=500),e.size>t)for(var n=Array.from(e),i=0;i<r&&i<n.length;i++)e.delete(n[i])}var I=function(){function e(e,t,r){this.unsubscribers=[],this.trackingState={isProcessing:!1},this.disposed=!1,this.reconciling=!1,this.transitionGeneration=0,this.missedDisconnect=!1,this.processedMutations=new Set,this.processedQueries=new Set,this.formo=e,this.wagmiConfig=t,this.queryClient=r,s.logger.info("WagmiEventHandler: Initializing Wagmi integration");var n,i,a,o,c,u=this.pruneMarkersForLostWallets();!function(e,t){var r;if(f.set(e,(null!==(r=f.get(e))&&void 0!==r?r:0)+1),t){var n=p.get(e);n&&(clearTimeout(n),p.delete(e))}}(this.formo.writeKey,u),this.ownerKey=(n=this.formo.writeKey,i=t,(a=g.get(i))||(a="cfg".concat(y+=1),g.set(i,a)),"".concat(n,":").concat(a)),v.set(this.ownerKey,this),o=this.ownerKey,(c=A.get(o))&&(clearTimeout(c),A.delete(o)),this.setupConnectionListeners(),this.seedFromCurrentState(),this.queryClient?(this.setupMutationTracking(),this.setupQueryTracking()):s.logger.warn("WagmiEventHandler: QueryClient not provided, signature and transaction events will not be tracked")}return e.prototype.pruneMarkersForLostWallets=function(){var e,t=this;try{e=this.getState()}catch(e){return!1}var r="".concat(this.formo.writeKey,":"),n=new Set;e.connections.forEach(function(e){e.accounts.forEach(function(e){return n.add(h(t.formo.writeKey,e))})});var i=!1;return d.forEach(function(e){e.startsWith(r)&&(n.has(e)?i=!0:d.delete(e))}),i},Object.defineProperty(e.prototype,"isEmittingOwner",{get:function(){if(!this.ownerKey)return!0;var e=v.get(this.ownerKey);return e?e===this:(v.set(this.ownerKey,this),!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pendingTransactions",{get:function(){var e,t=null!==(e=this.ownerKey)&&void 0!==e?e:"",r=m.get(t);return r||(r=new Map,m.set(t,r)),r},enumerable:!1,configurable:!0}),e.prototype.setupConnectionListeners=function(){var e=this;s.logger.info("WagmiEventHandler: Setting up connection listeners");var t=this.wagmiConfig.subscribe(function(e){return e.status},function(t,r){e.handleStatusChange(t,r)});this.unsubscribers.push(t);var r=this.wagmiConfig.subscribe(function(t){var r;return null!==(r=e.getActiveConnectionChainId(t))&&void 0!==r?r:t.chainId},function(t,r){e.handleChainChange(t,r)});this.unsubscribers.push(r);var n=this.wagmiConfig.subscribe(function(t){var r,n;return"".concat(null!==(r=t.current)&&void 0!==r?r:"","|").concat(null!==(n=e.getConnectedAddress(t))&&void 0!==n?n:"")},function(t,r){var n=t.split("|")[1],i=(null!=r?r:"|").split("|")[1];e.handleActiveAddressChange(n||void 0,i||void 0)});this.unsubscribers.push(n),s.logger.info("WagmiEventHandler: Connection listeners set up successfully")},e.prototype.seedFromCurrentState=function(){var e,t;try{var r=this.getState();if("connected"!==r.status)return;var i=this.getConnectedAddress(r),a=null!==(e=this.getActiveConnectionChainId(r))&&void 0!==e?e:r.chainId;if(!i||void 0===a)return void s.logger.debug("WagmiEventHandler: Connected at init but address or chainId is missing, nothing to seed",{address:i,chainId:a});if(s.logger.info("WagmiEventHandler: Adopting connection that predates this handler",{address:i,chainId:a}),this.formo.syncWalletState({chainId:a,address:i}),(null===(t=this.formo.currentAddress)||void 0===t?void 0:t.toLowerCase())!==i.toLowerCase())return void s.logger.debug("WagmiEventHandler: Central state declined the connection, not seeding",{address:i,chainId:a});if(this.trackingState.lastAddress=i,this.trackingState.lastChainId=a,this.trackingState.lastStatus=r.status,this.trackingState.lastConnectionId=r.current,!this.formo.isAutocaptureEnabled("connect")||!this.isEmittingOwner)return void s.logger.debug("WagmiEventHandler: Connect autocapture disabled, adopted without emitting",{address:i,chainId:a});if(!this.formo.willTrackEvent(a))return void s.logger.debug("WagmiEventHandler: Connect would not be tracked, adopted without emitting",{address:i,chainId:a});var o=h(this.formo.writeKey,i),c=r.current?r.connections.get(r.current):void 0;if("none"!==b(o,c))return void s.logger.debug("WagmiEventHandler: Wallet already adopted this page load, not re-emitting connect",{address:i});_(o,c);var u=this.getConnectorName(r);Promise.resolve(this.formo.connect({chainId:a,address:i},n({},u&&{providerName:u}))).catch(function(e){S(o,c),s.logger.error("WagmiEventHandler: Error emitting seeded connect event:",e)})}catch(e){s.logger.error("WagmiEventHandler: Error seeding from current state:",e)}},e.prototype.restoreCentralStateFromTracking=function(){var e,t=this.trackingState,r=t.lastAddress,n=t.lastChainId;r&&void 0!==n&&((null===(e=this.formo.currentAddress)||void 0===e?void 0:e.toLowerCase())===r.toLowerCase()&&this.formo.currentChainId===n||(s.logger.info("WagmiEventHandler: Restoring central state a stale disconnect cleared",{address:r,chainId:n}),this.formo.syncWalletState({chainId:n,address:r})))},e.prototype.releaseTrackedWallet=function(){var e=this.trackingState.lastAddress;this.trackingState.lastAddress=void 0,this.trackingState.lastChainId=void 0,this.trackingState.lastConnectionId=void 0,e&&d.delete(h(this.formo.writeKey,e))},e.prototype.retryAdoption=function(){this.disposed||(this.trackingState.lastAddress&&!this.tracksLiveWallet()&&(s.logger.debug("WagmiEventHandler: Tracked wallet is no longer the live one, releasing before retry",{tracked:this.trackingState.lastAddress}),this.releaseTrackedWallet()),this.resyncCentralState(),this.trackingState.lastAddress&&this.isCurrentWalletAnnounced()||this.seedFromCurrentState())},e.prototype.tracksLiveWallet=function(){var e=this.trackingState.lastAddress;if(!e)return!1;try{var t=this.getState();if("connected"!==t.status)return!1;var r=this.getConnectedAddress(t);return!!r&&r.toLowerCase()===e.toLowerCase()}catch(e){return s.logger.error("WagmiEventHandler: Error reading state to compare wallets:",e),!1}},e.prototype.resyncCentralState=function(){var e,t=this.trackingState,r=t.lastAddress,n=t.lastChainId;r&&void 0!==n&&((null===(e=this.formo.currentAddress)||void 0===e?void 0:e.toLowerCase())===r.toLowerCase()&&this.formo.currentChainId===n||(s.logger.info("WagmiEventHandler: Re-syncing central state for a tracked wallet",{address:r,chainId:n}),this.formo.syncWalletState({chainId:n,address:r})))},e.prototype.isCurrentWalletAnnounced=function(){var e,t=this.trackingState.lastAddress;if(!t)return!1;try{var r=this.getState();e=r.current?r.connections.get(r.current):void 0}catch(e){}return"none"!==b(h(this.formo.writeKey,t),e)},e.prototype.handleStatusChange=function(e,t){return i(this,void 0,void 0,function(){var r,i,o,c,u,l,f,p,v,g,y,m,A,E;return a(this,function(a){switch(a.label){case 0:if(this.trackingState.isProcessing)return"disconnected"===e&&(this.missedDisconnect=!0),s.logger.debug("WagmiEventHandler: Already processing status change, skipping"),[2];this.trackingState.isProcessing=!0,this.transitionGeneration+=1,a.label=1;case 1:return a.trys.push([1,14,15,16]),r=this.getState(),i=this.getConnectedAddress(r),o=null!==(y=this.getActiveConnectionChainId(r))&&void 0!==y?y:r.chainId,s.logger.info("WagmiEventHandler: Status changed",{status:e,prevStatus:t,address:i,chainId:o}),"disconnected"===e&&this.trackingState.lastAddress?(c=this.trackingState.lastAddress,u=this.trackingState.lastChainId,this.trackingState.lastConnectionId=void 0,this.trackingState.lastAddress=void 0,this.trackingState.lastChainId=void 0,this.pendingChainId=void 0,this.missedDisconnect=!1,d.delete(h(this.formo.writeKey,c)),this.formo.isAutocaptureEnabled("disconnect")&&this.isEmittingOwner?[4,this.formo.disconnect({chainId:u,address:c})]:[3,3]):[3,4];case 2:return a.sent(),[3,4];case 3:this.formo.syncWalletState({chainId:u}),a.label=4;case 4:return"connected"!==e||"connected"===t?[3,13]:i&&void 0!==o?(null===(m=this.trackingState.lastAddress)||void 0===m?void 0:m.toLowerCase())!==i.toLowerCase()?[3,9]:this.trackingState.lastChainId===o?[3,7]:this.pendingChainId!==o?[3,6]:(this.pendingChainId=void 0,s.logger.info("WagmiEventHandler: Re-entry carries a chain the subscription dropped, emitting it",{address:i,from:this.trackingState.lastChainId,to:o}),[4,this.handleChainChange(o,this.trackingState.lastChainId)]):[3,13];case 5:return a.sent(),this.trackingState.lastStatus=e,[2];case 6:return s.logger.info("WagmiEventHandler: Tracked wallet re-entered connected on a different chain",{address:i,from:this.trackingState.lastChainId,to:o}),this.formo.syncWalletState({chainId:o,address:i}),(null===(A=this.formo.currentAddress)||void 0===A?void 0:A.toLowerCase())===i.toLowerCase()?this.trackingState.lastChainId=o:(s.logger.debug("WagmiEventHandler: Central state declined the re-entry chain, dropping the wallet",{address:i,chainId:o}),this.releaseTrackedWallet()),[3,8];case 7:s.logger.debug("WagmiEventHandler: Ignoring re-entry to connected for an already tracked wallet",{address:i,chainId:o}),a.label=8;case 8:return this.trackingState.lastStatus=e,[2];case 9:if(this.formo.syncWalletState({chainId:o,address:i}),(null===(E=this.formo.currentAddress)||void 0===E?void 0:E.toLowerCase())!==i.toLowerCase())return s.logger.debug("WagmiEventHandler: Central state declined the connection, not adopting",{address:i,chainId:o}),this.trackingState.lastStatus=e,[2];if(this.trackingState.lastAddress=i,this.trackingState.lastChainId=o,this.trackingState.lastConnectionId=r.current,!(this.formo.isAutocaptureEnabled("connect")&&this.isEmittingOwner&&this.formo.willTrackEvent(o)))return[3,13];if(l=h(this.formo.writeKey,i),f=r.current?r.connections.get(r.current):void 0,"none"!==b(l,f))return s.logger.debug("WagmiEventHandler: Connect already announced for this wallet, not emitting again",{address:i}),this.trackingState.lastStatus=e,[2];_(l,f),p=this.getConnectorName(r),a.label=10;case 10:return a.trys.push([10,12,,13]),[4,this.formo.connect({chainId:o,address:i},n({},p&&{providerName:p}))];case 11:return a.sent(),[3,13];case 12:throw v=a.sent(),S(l,f),v;case 13:return this.trackingState.lastStatus=e,[3,16];case 14:return g=a.sent(),s.logger.error("WagmiEventHandler: Error handling status change:",g),[3,16];case 15:return this.trackingState.isProcessing=!1,this.reconcileWithLiveState(),[7];case 16:return[2]}})})},e.prototype.reconcileWithLiveState=function(){var e=this;if(!this.disposed&&!this.trackingState.isProcessing&&!this.reconciling){var t;try{t=this.getState()}catch(e){return void s.logger.error("WagmiEventHandler: Error reading state to reconcile:",e)}if("connected"===t.status||"disconnected"===t.status){var r="connected"===t.status?this.getConnectedAddress(t):void 0,n=this.trackingState.lastAddress;if(r||n)if(r&&n){if(r.toLowerCase()===n.toLowerCase()){if(this.missedDisconnect){this.missedDisconnect=!1,s.logger.info("WagmiEventHandler: A disconnect/reconnect cycle completed while the lock was held",{address:r}),this.reconciling=!0;try{this.handleStatusChange("disconnected","connected").then(function(){return e.retryAdoption()})}finally{this.reconciling=!1}return}this.resyncCentralState();var i=this.pendingChainId;return void(void 0!==i&&(this.pendingChainId=void 0,i!==this.trackingState.lastChainId&&(s.logger.info("WagmiEventHandler: Replaying a chain change dropped while reconnecting",{address:r,from:this.trackingState.lastChainId,to:i}),this.handleChainChange(i,this.trackingState.lastChainId))))}s.logger.info("WagmiEventHandler: Wallet changed while the lock was held, re-adopting",{from:n,to:r}),this.reconciling=!0;try{this.releaseTrackedWallet(),this.seedFromCurrentState()}finally{this.reconciling=!1}}else{this.reconciling=!0;try{r?(s.logger.info("WagmiEventHandler: Reconnect landed while the lock was held, adopting it",{address:r}),this.retryAdoption()):(s.logger.info("WagmiEventHandler: Disconnect landed while the lock was held, applying it",{address:n}),this.handleStatusChange("disconnected","connected"))}finally{this.reconciling=!1}}}}},e.prototype.handleActiveAddressChange=function(e,t){return i(this,void 0,void 0,function(){var r,i,o,c,u,l,f,p,v,g,y,m,A,E,C,w,I,k,P,O,T,x;return a(this,function(a){switch(a.label){case 0:if("connected"!==(r=this.getState()).status)return[2];if(i=this.trackingState.lastConnectionId,o=!!i&&!r.connections.has(i),c=void 0!==this.trackingState.lastConnectionId&&void 0!==r.current&&r.current!==this.trackingState.lastConnectionId,!o&&!c){if(!e||e===t)return[2];if((null===(I=this.trackingState.lastAddress)||void 0===I?void 0:I.toLowerCase())===e.toLowerCase())return[2]}return c&&!o&&e&&(null===(k=this.trackingState.lastAddress)||void 0===k?void 0:k.toLowerCase())===e.toLowerCase()?(u=null!==(P=this.getActiveConnectionChainId(r))&&void 0!==P?P:r.chainId,s.logger.info("WagmiEventHandler: Active connection changed for the same account",{address:e,from:this.trackingState.lastConnectionId,to:r.current}),this.trackingState.lastConnectionId=r.current,void 0===u||u===this.trackingState.lastChainId?[3,2]:[4,this.applyChainForTrackedWallet(e,u)]):[3,3];case 1:a.sent(),a.label=2;case 2:return[2];case 3:return e?(l=++this.transitionGeneration,void 0===(f=null!==(O=this.getActiveConnectionChainId(r))&&void 0!==O?O:r.chainId)?[2]:o?t&&this.isAddressConnected(r,t)?(s.logger.info("WagmiEventHandler: Tracked connector fell away, account still connected elsewhere",{address:t,connection:r.current}),this.trackingState.lastConnectionId=r.current,(null===(T=this.trackingState.lastAddress)||void 0===T?void 0:T.toLowerCase())!==e.toLowerCase()?[3,6]:this.trackingState.lastChainId===f?[3,5]:[4,this.applyChainForTrackedWallet(e,f)]):[3,7]:[3,14]):[2];case 4:a.sent(),a.label=5;case 5:return[2];case 6:return[3,14];case 7:if(!t)return[3,14];if(s.logger.info("WagmiEventHandler: Tracked connector disconnected, wagmi fell back to another connection",{disconnected:t,fallback:e}),p=this.trackingState.lastChainId,this.releaseTrackedWallet(),!this.formo.isAutocaptureEnabled("disconnect")||!this.isEmittingOwner)return[3,12];a.label=8;case 8:return a.trys.push([8,10,,11]),[4,this.formo.disconnect({chainId:p,address:t})];case 9:return a.sent(),[3,11];case 10:return v=a.sent(),s.logger.error("WagmiEventHandler: Error tracking connector fallback disconnect:",v),[3,11];case 11:return[3,13];case 12:this.formo.syncWalletState({chainId:p}),a.label=13;case 13:g=void 0;try{g=this.getState()}catch(e){}if(y=!this.disposed&&"connected"===(null==g?void 0:g.status)&&g.current===r.current,l!==this.transitionGeneration||!y)return s.logger.debug("WagmiEventHandler: A newer transition superseded this one, stopping",{address:e}),this.restoreCentralStateFromTracking(),[2];a.label=14;case 14:if(s.logger.info("WagmiEventHandler: Active account switched",{from:t,to:e,chainId:f}),this.formo.syncWalletState({chainId:f,address:e}),(null===(x=this.formo.currentAddress)||void 0===x?void 0:x.toLowerCase())!==e.toLowerCase())return s.logger.debug("WagmiEventHandler: Central state declined the switched account, not adopting",{address:e,chainId:f}),this.releaseTrackedWallet(),[2];if(this.trackingState.lastAddress=e,this.trackingState.lastChainId=f,this.trackingState.lastConnectionId=r.current,!(this.formo.isAutocaptureEnabled("connect")&&this.isEmittingOwner&&this.formo.willTrackEvent(f)))return[3,18];if(t&&!this.isAddressConnected(r,t)&&d.delete(h(this.formo.writeKey,t)),m=h(this.formo.writeKey,e),A=r.current?r.connections.get(r.current):void 0,E="none"!==b(m,A),_(m,A),E)return s.logger.debug("WagmiEventHandler: Fallback connection was already announced, not re-emitting connect",{address:e}),[2];a.label=15;case 15:return a.trys.push([15,17,,18]),C=this.getConnectorName(r),[4,this.formo.connect({chainId:f,address:e},n({},C&&{providerName:C}))];case 16:return a.sent(),[3,18];case 17:return w=a.sent(),S(m,A),s.logger.error("WagmiEventHandler: Error tracking account switch:",w),[3,18];case 18:return[2]}})})},e.prototype.applyChainForTrackedWallet=function(e,t){return i(this,void 0,void 0,function(){var r,n;return a(this,function(i){switch(i.label){case 0:if(this.formo.syncWalletState({chainId:t,address:e}),(null===(n=this.formo.currentAddress)||void 0===n?void 0:n.toLowerCase())!==e.toLowerCase())return s.logger.debug("WagmiEventHandler: Central state declined the new chain, dropping the wallet",{address:e,chainId:t}),this.releaseTrackedWallet(),[2];if(this.trackingState.lastChainId=t,!this.formo.isAutocaptureEnabled("chain")||!this.isEmittingOwner)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.formo.chain({chainId:t,address:e})];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),s.logger.error("WagmiEventHandler: Error tracking chain change:",r),[3,4];case 4:return[2]}})})},e.prototype.handleChainChange=function(e,t){return i(this,void 0,void 0,function(){var r,n,i,o;return a(this,function(a){switch(a.label){case 0:return e===t||void 0===e?[2]:"connected"!==(r=this.getState()).status?(this.pendingChainId=e,[2]):(this.pendingChainId=void 0,(n=this.getConnectedAddress(r))?void 0!==this.trackingState.lastConnectionId&&void 0!==r.current&&r.current!==this.trackingState.lastConnectionId?(s.logger.debug("WagmiEventHandler: Chain change belongs to a connection not adopted yet, deferring",{chainId:e,from:this.trackingState.lastConnectionId,to:r.current}),[2]):(i=!!this.trackingState.lastAddress,o=this.isCurrentWalletAnnounced(),i&&o||(this.retryAdoption(),o||!this.isCurrentWalletAnnounced())?(s.logger.info("WagmiEventHandler: Chain changed",{chainId:e,prevChainId:t,address:n}),[4,this.applyChainForTrackedWallet(n,e)]):[2]):(s.logger.warn("WagmiEventHandler: Chain changed but no address found"),[2]));case 1:return a.sent(),[2]}})})},e.prototype.setupMutationTracking=function(){var e=this;if(this.queryClient){s.logger.info("WagmiEventHandler: Setting up mutation tracking");var t=this.queryClient.getMutationCache().subscribe(function(t){e.handleMutationEvent(t)});this.unsubscribers.push(t),s.logger.info("WagmiEventHandler: Mutation tracking set up successfully")}},e.prototype.setupQueryTracking=function(){var e=this;if(this.queryClient){s.logger.info("WagmiEventHandler: Setting up query tracking");var t=this.queryClient.getQueryCache().subscribe(function(t){e.handleQueryEvent(t)});this.unsubscribers.push(t),s.logger.info("WagmiEventHandler: Query tracking set up successfully")}},e.prototype.handleQueryEvent=function(e){if("updated"===e.type&&this.isEmittingOwner){var t=e.query,r=t.queryKey;if(r&&0!==r.length){var n=r[0];if("waitForTransactionReceipt"===n){var i=t.state,a=i.data,o=null==a?void 0:a.status,c="".concat(t.queryHash,":").concat(i.status,":").concat(o||"");this.processedQueries.has(c)?s.logger.debug("WagmiEventHandler: Skipping duplicate query event",{queryType:n,queryHash:t.queryHash,status:i.status,receiptStatus:o}):(this.processedQueries.add(c),s.logger.debug("WagmiEventHandler: Query event",{queryType:n,queryHash:t.queryHash,status:i.status}),this.handleTransactionReceiptQuery(t),w(this.processedQueries))}}}},e.prototype.handleTransactionReceiptQuery=function(e){var t,r;if(this.formo.isAutocaptureEnabled("transaction")){var i=e.state,a=e.queryKey;if("success"===i.status){var c=a[1],u=null==c?void 0:c.hash,d=null==c?void 0:c.chainId;if(u){var l=u.toLowerCase(),h=this.pendingTransactions.get(l);if(h){var f=h.address,p=h.chainIdWasExplicit?h.chainId:null!==(t=null!=d?d:h.chainId)&&void 0!==t?t:this.trackingState.lastChainId;if(f)try{var v=i.data;if("success"!==(null==v?void 0:v.status)&&"reverted"!==(null==v?void 0:v.status))return void s.logger.debug("WagmiEventHandler: Receipt without explicit success/reverted status; ignoring",{transactionHash:u,status:null==v?void 0:v.status});var g="reverted"===v.status?o.TransactionStatus.REVERTED:o.TransactionStatus.CONFIRMED;s.logger.info("WagmiEventHandler: Tracking transaction confirmation",{status:g,transactionHash:u,address:f,chainId:p,blockNumber:null===(r=null==v?void 0:v.blockNumber)||void 0===r?void 0:r.toString()}),this.formo.transaction(n(n(n(n(n({status:g,chainId:p||0,address:f,transactionHash:u},(null==h?void 0:h.data)&&{data:h.data}),(null==h?void 0:h.to)&&{to:h.to}),(null==h?void 0:h.value)&&{value:h.value}),(null==h?void 0:h.function_name)&&{function_name:h.function_name}),(null==h?void 0:h.function_args)&&{function_args:h.function_args}),null==h?void 0:h.safeFunctionArgs),this.pendingTransactions.delete(l)}catch(e){s.logger.error("WagmiEventHandler: Error handling transaction receipt query:",e)}else s.logger.warn("WagmiEventHandler: Transaction receipt query but no address available")}else s.logger.debug("WagmiEventHandler: Receipt for unobserved tx hash; ignoring",{transactionHash:u})}else s.logger.warn("WagmiEventHandler: Transaction receipt query but no hash found")}}},e.prototype.handleMutationEvent=function(e){if("updated"===e.type&&this.isEmittingOwner){var t=e.mutation,r=t.options.mutationKey;if(r&&0!==r.length){var n=r[0],i=t.state,a="".concat(t.mutationId,":").concat(i.status);this.processedMutations.has(a)?s.logger.debug("WagmiEventHandler: Skipping duplicate mutation event",{mutationType:n,mutationId:t.mutationId,status:i.status}):(this.processedMutations.add(a),s.logger.debug("WagmiEventHandler: Mutation event",{mutationType:n,mutationId:t.mutationId,status:i.status}),"signMessage"!==n&&"signTypedData"!==n||this.handleSignatureMutation(n,t),"sendTransaction"!==n&&"writeContract"!==n||this.handleTransactionMutation(n,t),w(this.processedMutations))}}},e.prototype.handleSignatureMutation=function(e,t){var r,n,i,a;if(this.formo.isAutocaptureEnabled("signature")){var c=t.state,u=c.variables||{},d=null!==(a=null!==(i=null!==(n=E(null===(r=u.domain)||void 0===r?void 0:r.chainId))&&void 0!==n?n:E(u.chainId))&&void 0!==i?i:this.trackingState.lastChainId)&&void 0!==a?a:0,l=C(u.account)||this.trackingState.lastAddress;if(l)try{var h;if("pending"===c.status)h=o.SignatureStatus.REQUESTED;else if("success"===c.status)h=o.SignatureStatus.CONFIRMED;else{if("error"!==c.status)return;h=o.SignatureStatus.REJECTED}var f;f="signMessage"===e?u.message||"":JSON.stringify(u.message||u.types||{}),s.logger.info("WagmiEventHandler: Tracking signature event",{status:h,mutationType:e,address:l,chainId:d}),this.formo.signature({status:h,chainId:d,address:l,message:f})}catch(e){s.logger.error("WagmiEventHandler: Error handling signature mutation:",e)}else s.logger.warn("WagmiEventHandler: Signature event but no address available")}},e.prototype.handleTransactionMutation=function(e,t){var r;if(this.formo.isAutocaptureEnabled("transaction")){var i=t.state,a=i.variables||{},d=E(a.chainId),l=null!=d?d:this.trackingState.lastChainId,h=C(a.account)||a.from||this.trackingState.lastAddress;if(h)try{var f,p=void 0;if("pending"===i.status)f=o.TransactionStatus.STARTED;else if("success"===i.status)f=o.TransactionStatus.BROADCASTED,p=i.data;else{if("error"!==i.status)return;f=o.TransactionStatus.REJECTED}var v=void 0,g=void 0,y=void 0,m=void 0,A=null===(r=a.value)||void 0===r?void 0:r.toString();if("writeContract"===e){var b=a.abi,S=a.functionName,_=a.args,w=a.address,I=a.dataSuffix;if(g=w,y=S,b&&S){m=(0,c.extractFunctionArgs)(b,S,_);var k=(0,c.encodeWriteContractData)(b,S,_);k&&(v=(0,c.concatCalldataWithSuffix)(k,I),s.logger.debug("WagmiEventHandler: Encoded writeContract data",v.substring(0,10)))}}else v=a.data,g=a.to;s.logger.info("WagmiEventHandler: Tracking transaction event",{status:f,mutationType:e,address:h,chainId:l,transactionHash:p,function_name:y});var P=(0,c.buildSafeFunctionArgs)(m,u);if(f===o.TransactionStatus.BROADCASTED&&p){var O=p.toLowerCase(),T=n(n(n(n(n(n(n(n({address:h},void 0!==l&&{chainId:l}),{chainIdWasExplicit:void 0!==d}),v&&{data:v}),g&&{to:g}),A&&{value:A}),y&&{function_name:y}),m&&{function_args:m}),P&&{safeFunctionArgs:P});if(this.pendingTransactions.set(O,T),s.logger.debug("WagmiEventHandler: Stored pending transaction for confirmation",{transactionHash:O}),this.pendingTransactions.size>100)for(var x=Array.from(this.pendingTransactions.keys()),H=0;H<50&&H<x.length;H++)this.pendingTransactions.delete(x[H])}this.formo.transaction(n(n(n(n(n(n({status:f,chainId:l||0,address:h},v&&{data:v}),g&&{to:g}),A&&{value:A}),p&&{transactionHash:p}),y&&{function_name:y}),m&&{function_args:m}),P)}catch(e){s.logger.error("WagmiEventHandler: Error handling transaction mutation:",e)}else s.logger.warn("WagmiEventHandler: Transaction event but no address available")}},e.prototype.getState=function(){return"function"==typeof this.wagmiConfig.getState?this.wagmiConfig.getState():this.wagmiConfig.state?this.wagmiConfig.state:(s.logger.warn("WagmiEventHandler: Unable to get state from config, returning default state"),{status:"disconnected",connections:new Map,current:void 0,chainId:void 0})},e.prototype.getActiveConnectionChainId=function(e){var t;if(e.current)return null===(t=e.connections.get(e.current))||void 0===t?void 0:t.chainId},e.prototype.getConnectedAddress=function(e){if(e.current){var t=e.connections.get(e.current);if(t&&0!==t.accounts.length)return t.accounts[0]}},e.prototype.isAddressConnected=function(e,t){var r=t.toLowerCase(),n=!1;return e.connections.forEach(function(e){!n&&e.accounts.some(function(e){return e.toLowerCase()===r})&&(n=!0)}),n},e.prototype.getConnectorName=function(e){if(e.current){var t=e.connections.get(e.current);return null==t?void 0:t.connector.name}},e.prototype.cleanup=function(){if(s.logger.debug("WagmiEventHandler: Cleaning up subscriptions"),!this.disposed){this.disposed=!0,this.transitionGeneration+=1,this.ownerKey&&v.get(this.ownerKey)===this&&v.delete(this.ownerKey);var e=function(e){var r,n,i,a=Math.max(0,(null!==(r=f.get(e))&&void 0!==r?r:0)-1);f.set(e,a);var o=0===a;if(a>0||p.has(e))return o;var s=setTimeout(function(){p.delete(e);var t="".concat(e,":");d.forEach(function(e){e.startsWith(t)&&d.delete(e)})},t.MARKER_GRACE_MS);return null===(i=(n=s).unref)||void 0===i||i.call(n),p.set(e,s),o}(this.formo.writeKey);e&&this.ownerKey&&function(e){var r,n;if(!A.has(e)){var i=setTimeout(function(){A.delete(e),m.delete(e)},t.MARKER_GRACE_MS);null===(n=(r=i).unref)||void 0===n||n.call(r),A.set(e,i)}}(this.ownerKey)}for(var r=0,n=this.unsubscribers;r<n.length;r++){var i=n[r];try{i()}catch(e){s.logger.error("WagmiEventHandler: Error during cleanup:",e)}}this.unsubscribers=[],this.processedMutations.clear(),this.processedQueries.clear(),s.logger.debug("WagmiEventHandler: Cleanup complete")},e}();t.WagmiEventHandler=I},5707(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.WagmiEventHandler=void 0;var n=r(8788);Object.defineProperty(t,"WagmiEventHandler",{enumerable:!0,get:function(){return n.WagmiEventHandler}})},5170(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.flattenObject=a,t.concatCalldataWithSuffix=function(e,t){if(!t||"0x"===t)return e;var r=s();if(null==r?void 0:r.concatHex)return r.concatHex([e,t]);var n=t.replace(/^0x/i,"");return"".concat(e).concat(n)},t.encodeWriteContractData=function(e,t,r){try{var n=s();return n?n.encodeFunctionData({abi:e,functionName:t,args:r||[]}):void i.logger.debug("WagmiEventHandler: viem not available, cannot encode function data")}catch(e){return void i.logger.warn("WagmiEventHandler: Failed to encode function data",e)}},t.extractFunctionArgs=function(e,t,r){if(e&&t&&r&&Array.isArray(r))try{var n=e.find(function(e){return"function"===e.type&&e.name===t});if(!(null==n?void 0:n.inputs)||!Array.isArray(n.inputs))return;var a={};return n.inputs.forEach(function(e,t){if(t<r.length){var n=r[t],i=e.name||"arg".concat(t);a[i]=o(n)}}),a}catch(e){return void i.logger.warn("WagmiEventHandler: Failed to extract function args",e)}},t.buildSafeFunctionArgs=function(e,t){if(e){for(var r={},n=0,o=Object.entries(e);n<o.length;n++){var s=o[n],c=s[0],u=s[1],d=t.has(c)?"arg_".concat(c):c;if(r[d]=u,null!==u&&"object"==typeof u&&!Array.isArray(u))for(var l=a(u,d),h=0,f=Object.entries(l);h<f.length;h++){var p=f[h],v=p[0],g=p[1];v in r?i.logger.debug("WagmiEventHandler: Skipping flattened key collision",{flatKey:v,existingValue:r[v]}):r[v]=g}}return r}};var n,i=r(3312);function a(e,t){void 0===t&&(t="");for(var r={},n=0,i=Object.entries(e);n<i.length;n++){var o=i[n],s=o[0],c=o[1],u=t?"".concat(t,"_").concat(s):s;if(null===c||"object"!=typeof c||Array.isArray(c))r[u]=c;else{var d=a(c,u);Object.assign(r,d)}}return r}function o(e){if("bigint"==typeof e)return e.toString();if(Array.isArray(e))return e.map(o);if(null!==e&&"object"==typeof e){for(var t={},r=0,n=Object.entries(e);r<n.length;r++){var i=n[r],a=i[0],s=i[1];t[a]=o(s)}return t}return e}function s(){if(void 0!==n)return n;try{var e=r(Object(function(){var e=new Error("Cannot find module 'viem'");throw e.code="MODULE_NOT_FOUND",e}()));if(null==e?void 0:e.encodeFunctionData)return n={encodeFunctionData:e.encodeFunctionData,concatHex:e.concatHex}}catch(e){}return n=null,null}},9478(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.requestProviders=t.announceProvider=t.createStore=void 0;var n=r(4887);Object.defineProperty(t,"createStore",{enumerable:!0,get:function(){return n.createStore}});var i=r(8919);Object.defineProperty(t,"announceProvider",{enumerable:!0,get:function(){return i.announceProvider}}),Object.defineProperty(t,"requestProviders",{enumerable:!0,get:function(){return i.requestProviders}})},4887(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.createStore=void 0;const n=r(8919);t.createStore=function(){const e=new Set;let t=[];const r=()=>(0,n.requestProviders)(r=>{t.some(({info:e})=>e.uuid===r.info.uuid)||(t=[...t,r],e.forEach(e=>e(t,{added:[r]})))});let i=r();return{_listeners:()=>e,clear(){e.forEach(e=>e([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),i?.()},findProvider:({rdns:e})=>t.find(t=>t.info.rdns===e),getProviders:()=>t,reset(){this.clear(),i?.(),i=r()},subscribe:(r,{emitImmediately:n}={})=>(e.add(r),n&&r(t,{added:t}),()=>e.delete(r))}}},8919(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.requestProviders=t.announceProvider=void 0,t.announceProvider=function(e){const t=new CustomEvent("eip6963:announceProvider",{detail:Object.freeze(e)});window.dispatchEvent(t);const r=()=>window.dispatchEvent(t);return window.addEventListener("eip6963:requestProvider",r),()=>window.removeEventListener("eip6963:requestProvider",r)},t.requestProviders=function(e){if("undefined"==typeof window)return;const t=t=>e(t.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}}},t={},r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}(5135);return r.FormoAnalytics})());
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("FormoAnalytics",[],t):"object"==typeof exports?exports.FormoAnalytics=t():e.FormoAnalytics=t()}(self,()=>(()=>{"use strict";var e={6839(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.notImplemented=t.bitMask=void 0,t.isBytes=i,t.abytes=a,t.abool=function(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)},t.numberToHexUnpadded=o,t.hexToNumber=s,t.bytesToHex=l,t.hexToBytes=h,t.bytesToNumberBE=function(e){return s(l(e))},t.bytesToNumberLE=function(e){return a(e),s(l(Uint8Array.from(e).reverse()))},t.numberToBytesBE=f,t.numberToBytesLE=function(e,t){return f(e,t).reverse()},t.numberToVarBytesBE=function(e){return h(o(e))},t.ensureBytes=function(e,t,r){let n;if("string"==typeof t)try{n=h(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!i(t))throw new Error(e+" must be hex string or Uint8Array");n=Uint8Array.from(t)}const a=n.length;if("number"==typeof r&&a!==r)throw new Error(e+" of length "+r+" expected, got "+a);return n},t.concatBytes=p,t.equalBytes=function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r},t.utf8ToBytes=function(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))},t.inRange=g,t.aInRange=function(e,t,r,n){if(!g(t,r,n))throw new Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)},t.bitLen=function(e){let t;for(t=0;e>r;e>>=n,t+=1);return t},t.bitGet=function(e,t){return e>>BigInt(t)&n},t.bitSet=function(e,t,i){return e|(i?n:r)<<BigInt(t)},t.createHmacDrbg=function(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=y(e),i=y(e),a=0;const o=()=>{n.fill(1),i.fill(0),a=0},s=(...e)=>r(i,n,...e),c=(e=y(0))=>{i=s(m([0]),e),n=s(),0!==e.length&&(i=s(m([1]),e),n=s())},u=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=s();const t=n.slice();r.push(t),e+=n.length}return p(...r)};return(e,t)=>{let r;for(o(),c(e);!(r=t(u()));)c();return o(),r}},t.validateObject=function(e,t,r={}){const n=(t,r,n)=>{const i=b[r];if("function"!=typeof i)throw new Error("invalid validator function");const a=e[t];if(!(n&&void 0===a||i(a,e)))throw new Error("param "+String(t)+" is invalid. Expected "+r+", got "+a)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e},t.memoized=function(e){const t=new WeakMap;return(r,...n)=>{const i=t.get(r);if(void 0!==i)return i;const a=e(r,...n);return t.set(r,a),a}};const r=BigInt(0),n=BigInt(1);function i(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function a(e){if(!i(e))throw new Error("Uint8Array expected")}function o(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function s(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?r:BigInt("0x"+e)}const c="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,u=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function l(e){if(a(e),c)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=u[e[r]];return t}function d(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function h(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(c)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=d(e.charCodeAt(i)),a=d(e.charCodeAt(i+1));if(void 0===r||void 0===a){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+a}return n}function f(e,t){return h(e.toString(16).padStart(2*t,"0"))}function p(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];a(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r}const v=e=>"bigint"==typeof e&&r<=e;function g(e,t,r){return v(e)&&v(t)&&v(r)&&t<=e&&e<r}t.bitMask=e=>(n<<BigInt(e))-n;const y=e=>new Uint8Array(e),m=e=>Uint8Array.from(e),b={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||i(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};t.notImplemented=()=>{throw new Error("not implemented")}},681(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.aoutput=t.anumber=t.aexists=t.abytes=void 0;const n=r(11);t.abytes=n.abytes,t.aexists=n.aexists,t.anumber=n.anumber,t.aoutput=n.aoutput},7734(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.SHA512_IV=t.SHA384_IV=t.SHA224_IV=t.SHA256_IV=t.HashMD=void 0,t.setBigUint64=i,t.Chi=function(e,t,r){return e&t^~e&r},t.Maj=function(e,t,r){return e&t^e&r^t&r};const n=r(11);function i(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),a=BigInt(4294967295),o=Number(r>>i&a),s=Number(r&a),c=n?4:0,u=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+u,s,n)}class a extends n.Hash{constructor(e,t,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=(0,n.createView)(this.buffer)}update(e){(0,n.aexists)(this),e=(0,n.toBytes)(e),(0,n.abytes)(e);const{view:t,buffer:r,blockLen:i}=this,a=e.length;for(let o=0;o<a;){const s=Math.min(i-this.pos,a-o);if(s===i){const t=(0,n.createView)(e);for(;i<=a-o;o+=i)this.process(t,o);continue}r.set(e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.aexists)(this),(0,n.aoutput)(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:a,isLE:o}=this;let{pos:s}=this;t[s++]=128,(0,n.clean)(this.buffer.subarray(s)),this.padOffset>a-s&&(this.process(r,0),s=0);for(let e=s;e<a;e++)t[e]=0;i(r,a-8,BigInt(8*this.length),o),this.process(r,0);const c=(0,n.createView)(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=u/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)c.setUint32(4*e,d[e],o)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}t.HashMD=a,t.SHA256_IV=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.SHA224_IV=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),t.SHA384_IV=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),t.SHA512_IV=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])},3842(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.toBig=t.shrSL=t.shrSH=t.rotrSL=t.rotrSH=t.rotrBL=t.rotrBH=t.rotr32L=t.rotr32H=t.rotlSL=t.rotlSH=t.rotlBL=t.rotlBH=t.add5L=t.add5H=t.add4L=t.add4H=t.add3L=t.add3H=void 0,t.add=b,t.fromBig=i,t.split=a;const r=BigInt(2**32-1),n=BigInt(32);function i(e,t=!1){return t?{h:Number(e&r),l:Number(e>>n&r)}:{h:0|Number(e>>n&r),l:0|Number(e&r)}}function a(e,t=!1){const r=e.length;let n=new Uint32Array(r),a=new Uint32Array(r);for(let o=0;o<r;o++){const{h:r,l:s}=i(e[o],t);[n[o],a[o]]=[r,s]}return[n,a]}const o=(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0);t.toBig=o;const s=(e,t,r)=>e>>>r;t.shrSH=s;const c=(e,t,r)=>e<<32-r|t>>>r;t.shrSL=c;const u=(e,t,r)=>e>>>r|t<<32-r;t.rotrSH=u;const l=(e,t,r)=>e<<32-r|t>>>r;t.rotrSL=l;const d=(e,t,r)=>e<<64-r|t>>>r-32;t.rotrBH=d;const h=(e,t,r)=>e>>>r-32|t<<64-r;t.rotrBL=h;const f=(e,t)=>t;t.rotr32H=f;const p=(e,t)=>e;t.rotr32L=p;const v=(e,t,r)=>e<<r|t>>>32-r;t.rotlSH=v;const g=(e,t,r)=>t<<r|e>>>32-r;t.rotlSL=g;const y=(e,t,r)=>t<<r-32|e>>>64-r;t.rotlBH=y;const m=(e,t,r)=>e<<r-32|t>>>64-r;function b(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}t.rotlBL=m;const A=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);t.add3L=A;const S=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;t.add3H=S;const w=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);t.add4L=w;const E=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;t.add4H=E;const _=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);t.add5L=_;const C=(e,t,r,n,i,a)=>t+r+n+i+a+(e/2**32|0)|0;t.add5H=C;const I={fromBig:i,split:a,toBig:o,shrSH:s,shrSL:c,rotrSH:u,rotrSL:l,rotrBH:d,rotrBL:h,rotr32H:f,rotr32L:p,rotlSH:v,rotlSL:g,rotlBH:y,rotlBL:m,add:b,add3L:A,add3H:S,add4L:w,add4H:E,add5H:C,add5L:_};t.default=I},9517(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0},4072(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.sha512_224=t.sha512_256=t.sha384=t.sha512=t.sha224=t.sha256=t.SHA512_256=t.SHA512_224=t.SHA384=t.SHA512=t.SHA224=t.SHA256=void 0;const n=r(7734),i=r(3842),a=r(11),o=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s=new Uint32Array(64);class c extends n.HashMD{constructor(e=32){super(64,e,8,!1),this.A=0|n.SHA256_IV[0],this.B=0|n.SHA256_IV[1],this.C=0|n.SHA256_IV[2],this.D=0|n.SHA256_IV[3],this.E=0|n.SHA256_IV[4],this.F=0|n.SHA256_IV[5],this.G=0|n.SHA256_IV[6],this.H=0|n.SHA256_IV[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:a,G:o,H:s}=this;return[e,t,r,n,i,a,o,s]}set(e,t,r,n,i,a,o,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|a,this.G=0|o,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)s[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=s[e-15],r=s[e-2],n=(0,a.rotr)(t,7)^(0,a.rotr)(t,18)^t>>>3,i=(0,a.rotr)(r,17)^(0,a.rotr)(r,19)^r>>>10;s[e]=i+s[e-7]+n+s[e-16]|0}let{A:r,B:i,C:c,D:u,E:l,F:d,G:h,H:f}=this;for(let e=0;e<64;e++){const t=f+((0,a.rotr)(l,6)^(0,a.rotr)(l,11)^(0,a.rotr)(l,25))+(0,n.Chi)(l,d,h)+o[e]+s[e]|0,p=((0,a.rotr)(r,2)^(0,a.rotr)(r,13)^(0,a.rotr)(r,22))+(0,n.Maj)(r,i,c)|0;f=h,h=d,d=l,l=u+t|0,u=c,c=i,i=r,r=t+p|0}r=r+this.A|0,i=i+this.B|0,c=c+this.C|0,u=u+this.D|0,l=l+this.E|0,d=d+this.F|0,h=h+this.G|0,f=f+this.H|0,this.set(r,i,c,u,l,d,h,f)}roundClean(){(0,a.clean)(s)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,a.clean)(this.buffer)}}t.SHA256=c;class u extends c{constructor(){super(28),this.A=0|n.SHA224_IV[0],this.B=0|n.SHA224_IV[1],this.C=0|n.SHA224_IV[2],this.D=0|n.SHA224_IV[3],this.E=0|n.SHA224_IV[4],this.F=0|n.SHA224_IV[5],this.G=0|n.SHA224_IV[6],this.H=0|n.SHA224_IV[7]}}t.SHA224=u;const l=(()=>i.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),d=(()=>l[0])(),h=(()=>l[1])(),f=new Uint32Array(80),p=new Uint32Array(80);class v extends n.HashMD{constructor(e=64){super(128,e,16,!1),this.Ah=0|n.SHA512_IV[0],this.Al=0|n.SHA512_IV[1],this.Bh=0|n.SHA512_IV[2],this.Bl=0|n.SHA512_IV[3],this.Ch=0|n.SHA512_IV[4],this.Cl=0|n.SHA512_IV[5],this.Dh=0|n.SHA512_IV[6],this.Dl=0|n.SHA512_IV[7],this.Eh=0|n.SHA512_IV[8],this.El=0|n.SHA512_IV[9],this.Fh=0|n.SHA512_IV[10],this.Fl=0|n.SHA512_IV[11],this.Gh=0|n.SHA512_IV[12],this.Gl=0|n.SHA512_IV[13],this.Hh=0|n.SHA512_IV[14],this.Hl=0|n.SHA512_IV[15]}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:u,Fh:l,Fl:d,Gh:h,Gl:f,Hh:p,Hl:v}=this;return[e,t,r,n,i,a,o,s,c,u,l,d,h,f,p,v]}set(e,t,r,n,i,a,o,s,c,u,l,d,h,f,p,v){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|a,this.Dh=0|o,this.Dl=0|s,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|d,this.Gh=0|h,this.Gl=0|f,this.Hh=0|p,this.Hl=0|v}process(e,t){for(let r=0;r<16;r++,t+=4)f[r]=e.getUint32(t),p[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|f[e-15],r=0|p[e-15],n=i.rotrSH(t,r,1)^i.rotrSH(t,r,8)^i.shrSH(t,r,7),a=i.rotrSL(t,r,1)^i.rotrSL(t,r,8)^i.shrSL(t,r,7),o=0|f[e-2],s=0|p[e-2],c=i.rotrSH(o,s,19)^i.rotrBH(o,s,61)^i.shrSH(o,s,6),u=i.rotrSL(o,s,19)^i.rotrBL(o,s,61)^i.shrSL(o,s,6),l=i.add4L(a,u,p[e-7],p[e-16]),d=i.add4H(l,n,c,f[e-7],f[e-16]);f[e]=0|d,p[e]=0|l}let{Ah:r,Al:n,Bh:a,Bl:o,Ch:s,Cl:c,Dh:u,Dl:l,Eh:v,El:g,Fh:y,Fl:m,Gh:b,Gl:A,Hh:S,Hl:w}=this;for(let e=0;e<80;e++){const t=i.rotrSH(v,g,14)^i.rotrSH(v,g,18)^i.rotrBH(v,g,41),E=i.rotrSL(v,g,14)^i.rotrSL(v,g,18)^i.rotrBL(v,g,41),_=v&y^~v&b,C=g&m^~g&A,I=i.add5L(w,E,C,h[e],p[e]),k=i.add5H(I,S,t,_,d[e],f[e]),O=0|I,P=i.rotrSH(r,n,28)^i.rotrBH(r,n,34)^i.rotrBH(r,n,39),T=i.rotrSL(r,n,28)^i.rotrBL(r,n,34)^i.rotrBL(r,n,39),x=r&a^r&s^a&s,L=n&o^n&c^o&c;S=0|b,w=0|A,b=0|y,A=0|m,y=0|v,m=0|g,({h:v,l:g}=i.add(0|u,0|l,0|k,0|O)),u=0|s,l=0|c,s=0|a,c=0|o,a=0|r,o=0|n;const H=i.add3L(O,T,L);r=i.add3H(H,k,P,x),n=0|H}({h:r,l:n}=i.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:a,l:o}=i.add(0|this.Bh,0|this.Bl,0|a,0|o)),({h:s,l:c}=i.add(0|this.Ch,0|this.Cl,0|s,0|c)),({h:u,l}=i.add(0|this.Dh,0|this.Dl,0|u,0|l)),({h:v,l:g}=i.add(0|this.Eh,0|this.El,0|v,0|g)),({h:y,l:m}=i.add(0|this.Fh,0|this.Fl,0|y,0|m)),({h:b,l:A}=i.add(0|this.Gh,0|this.Gl,0|b,0|A)),({h:S,l:w}=i.add(0|this.Hh,0|this.Hl,0|S,0|w)),this.set(r,n,a,o,s,c,u,l,v,g,y,m,b,A,S,w)}roundClean(){(0,a.clean)(f,p)}destroy(){(0,a.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}t.SHA512=v;class g extends v{constructor(){super(48),this.Ah=0|n.SHA384_IV[0],this.Al=0|n.SHA384_IV[1],this.Bh=0|n.SHA384_IV[2],this.Bl=0|n.SHA384_IV[3],this.Ch=0|n.SHA384_IV[4],this.Cl=0|n.SHA384_IV[5],this.Dh=0|n.SHA384_IV[6],this.Dl=0|n.SHA384_IV[7],this.Eh=0|n.SHA384_IV[8],this.El=0|n.SHA384_IV[9],this.Fh=0|n.SHA384_IV[10],this.Fl=0|n.SHA384_IV[11],this.Gh=0|n.SHA384_IV[12],this.Gl=0|n.SHA384_IV[13],this.Hh=0|n.SHA384_IV[14],this.Hl=0|n.SHA384_IV[15]}}t.SHA384=g;const y=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),m=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class b extends v{constructor(){super(28),this.Ah=0|y[0],this.Al=0|y[1],this.Bh=0|y[2],this.Bl=0|y[3],this.Ch=0|y[4],this.Cl=0|y[5],this.Dh=0|y[6],this.Dl=0|y[7],this.Eh=0|y[8],this.El=0|y[9],this.Fh=0|y[10],this.Fl=0|y[11],this.Gh=0|y[12],this.Gl=0|y[13],this.Hh=0|y[14],this.Hl=0|y[15]}}t.SHA512_224=b;class A extends v{constructor(){super(32),this.Ah=0|m[0],this.Al=0|m[1],this.Bh=0|m[2],this.Bl=0|m[3],this.Ch=0|m[4],this.Cl=0|m[5],this.Dh=0|m[6],this.Dl=0|m[7],this.Eh=0|m[8],this.El=0|m[9],this.Fh=0|m[10],this.Fl=0|m[11],this.Gh=0|m[12],this.Gl=0|m[13],this.Hh=0|m[14],this.Hl=0|m[15]}}t.SHA512_256=A,t.sha256=(0,a.createHasher)(()=>new c),t.sha224=(0,a.createHasher)(()=>new u),t.sha512=(0,a.createHasher)(()=>new v),t.sha384=(0,a.createHasher)(()=>new g),t.sha512_256=(0,a.createHasher)(()=>new A),t.sha512_224=(0,a.createHasher)(()=>new b)},5391(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.shake256=t.shake128=t.keccak_512=t.keccak_384=t.keccak_256=t.keccak_224=t.sha3_512=t.sha3_384=t.sha3_256=t.sha3_224=t.Keccak=void 0,t.keccakP=b;const n=r(3842),i=r(11),a=BigInt(0),o=BigInt(1),s=BigInt(2),c=BigInt(7),u=BigInt(256),l=BigInt(113),d=[],h=[],f=[];for(let e=0,t=o,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],d.push(2*(5*n+r)),h.push((e+1)*(e+2)/2%64);let i=a;for(let e=0;e<7;e++)t=(t<<o^(t>>c)*l)%u,t&s&&(i^=o<<(o<<BigInt(e))-o);f.push(i)}const p=(0,n.split)(f,!0),v=p[0],g=p[1],y=(e,t,r)=>r>32?(0,n.rotlBH)(e,t,r):(0,n.rotlSH)(e,t,r),m=(e,t,r)=>r>32?(0,n.rotlBL)(e,t,r):(0,n.rotlSL)(e,t,r);function b(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,a=r[i],o=r[i+1],s=y(a,o,1)^r[n],c=m(a,o,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=h[r],a=y(t,i,n),o=m(t,i,n),s=d[r];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=v[n],e[1]^=g[n]}(0,i.clean)(r)}class A extends i.Hash{constructor(e,t,r,n=!1,a=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=a,(0,i.anumber)(r),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,i.u32)(this.state)}clone(){return this._cloneInto()}keccak(){(0,i.swap32IfBE)(this.state32),b(this.state32,this.rounds),(0,i.swap32IfBE)(this.state32),this.posOut=0,this.pos=0}update(e){(0,i.aexists)(this),e=(0,i.toBytes)(e),(0,i.abytes)(e);const{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){const a=Math.min(t-this.pos,n-i);for(let t=0;t<a;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){(0,i.aexists)(this,!1),(0,i.abytes)(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();const a=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+a),n),this.posOut+=a,n+=a}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,i.anumber)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,i.aoutput)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,i.clean)(this.state)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:a}=this;return e||(e=new A(t,r,n,a,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=a,e.destroyed=this.destroyed,e}}t.Keccak=A;const S=(e,t,r)=>(0,i.createHasher)(()=>new A(t,e,r));t.sha3_224=S(6,144,28),t.sha3_256=S(6,136,32),t.sha3_384=S(6,104,48),t.sha3_512=S(6,72,64),t.keccak_224=S(1,144,28),t.keccak_256=S(1,136,32),t.keccak_384=S(1,104,48),t.keccak_512=S(1,72,64);const w=(e,t,r)=>(0,i.createXOFer)((n={})=>new A(t,e,void 0===n.dkLen?r:n.dkLen,!0));t.shake128=w(31,168,16),t.shake256=w(31,136,32)},11(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.wrapXOFConstructorWithOpts=t.wrapConstructorWithOpts=t.wrapConstructor=t.Hash=t.nextTick=t.swap32IfBE=t.byteSwapIfBE=t.swap8IfBE=t.isLE=void 0,t.isBytes=i,t.anumber=a,t.abytes=o,t.ahash=function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");a(e.outputLen),a(e.blockLen)},t.aexists=function(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")},t.aoutput=function(e,t){o(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)},t.u8=function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},t.u32=function(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))},t.clean=function(...e){for(let t=0;t<e.length;t++)e[t].fill(0)},t.createView=function(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)},t.rotr=function(e,t){return e<<32-t|e>>>t},t.rotl=function(e,t){return e<<t|e>>>32-t>>>0},t.byteSwap=s,t.byteSwap32=c,t.bytesToHex=function(e){if(o(e),u)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=l[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(u)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){const r=d(e.charCodeAt(i)),a=d(e.charCodeAt(i+1));if(void 0===r||void 0===a){const t=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+i)}n[t]=16*r+a}return n},t.asyncLoop=async function(e,r,n){let i=Date.now();for(let a=0;a<e;a++){n(a);const e=Date.now()-i;e>=0&&e<r||(await(0,t.nextTick)(),i+=e)}},t.utf8ToBytes=h,t.bytesToUtf8=function(e){return(new TextDecoder).decode(e)},t.toBytes=f,t.kdfInputToBytes=function(e){return"string"==typeof e&&(e=h(e)),o(e),e},t.concatBytes=function(...e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];o(n),t+=n.length}const r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){const i=e[t];r.set(i,n),n+=i.length}return r},t.checkOpts=function(e,t){if(void 0!==t&&"[object Object]"!=={}.toString.call(t))throw new Error("options should be object or undefined");return Object.assign(e,t)},t.createHasher=p,t.createOptHasher=v,t.createXOFer=g,t.randomBytes=function(e=32){if(n.crypto&&"function"==typeof n.crypto.getRandomValues)return n.crypto.getRandomValues(new Uint8Array(e));if(n.crypto&&"function"==typeof n.crypto.randomBytes)return Uint8Array.from(n.crypto.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")};const n=r(9517);function i(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function a(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function o(e,...t){if(!i(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function s(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function c(e){for(let t=0;t<e.length;t++)e[t]=s(e[t]);return e}t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],t.swap8IfBE=t.isLE?e=>e:e=>s(e),t.byteSwapIfBE=t.swap8IfBE,t.swap32IfBE=t.isLE?e=>e:c;const u=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),l=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function d(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function h(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function f(e){return"string"==typeof e&&(e=h(e)),o(e),e}function p(e){const t=t=>e().update(f(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function v(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}function g(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}t.nextTick=async()=>{},t.Hash=class{},t.wrapConstructor=p,t.wrapConstructorWithOpts=v,t.wrapXOFConstructorWithOpts=g},5628(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.keccak512=t.keccak384=t.keccak256=t.keccak224=void 0;const n=r(5391),i=r(7393);t.keccak224=(0,i.wrapHash)(n.keccak_224),t.keccak256=(()=>{const e=(0,i.wrapHash)(n.keccak_256);return e.create=n.keccak_256.create,e})(),t.keccak384=(0,i.wrapHash)(n.keccak_384),t.keccak512=(0,i.wrapHash)(n.keccak_512)},6997(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const n=r(4072),i=r(7393);t.sha256=(0,i.wrapHash)(n.sha256)},7393(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.assertBytes=t.assertBool=t.utf8ToBytes=t.toHex=t.createView=t.concatBytes=t.bytesToHex=void 0,t.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},t.hexToBytes=function(e){const t=e.startsWith("0x")?e.substring(2):e;return(0,a.hexToBytes)(t)},t.equalsBytes=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},t.wrapHash=function(e){return t=>((0,i.abytes)(t),e(t))};const n=r(6839);Object.defineProperty(t,"assertBool",{enumerable:!0,get:function(){return n.abool}});const i=r(681);Object.defineProperty(t,"assertBytes",{enumerable:!0,get:function(){return i.abytes}});const a=r(11);var o=r(11);Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return o.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return o.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return o.createView}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return o.bytesToHex}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return o.utf8ToBytes}})},1757(e,t){var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function i(e,t,n){var i=null;if(void 0!==n&&(i=""+n),void 0!==t.key&&(i=""+t.key),"key"in t)for(var a in n={},t)"key"!==a&&(n[a]=t[a]);else n=t;return t=n.ref,{$$typeof:r,type:e,key:i,ref:void 0!==t?t:null,props:n}}t.Fragment=n,t.jsx=i,t.jsxs=i},2942(e,t){var r=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),p=Symbol.iterator,v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,y={};function m(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||v}function b(){}function A(e,t,r){this.props=e,this.context=t,this.refs=y,this.updater=r||v}m.prototype.isReactComponent={},m.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},m.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=m.prototype;var S=A.prototype=new b;S.constructor=A,g(S,m.prototype),S.isPureReactComponent=!0;var w=Array.isArray;function E(){}var _={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function I(e,t,n){var i=n.ref;return{$$typeof:r,type:e,key:t,ref:void 0!==i?i:null,props:n}}function k(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}var O=/\/+/g;function P(e,t){return"object"==typeof e&&null!==e&&null!=e.key?(r=""+e.key,n={"=":"=0",":":"=2"},"$"+r.replace(/[=:]/g,function(e){return n[e]})):t.toString(36);var r,n}function T(e,t,i,a,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c,u,l=!1;if(null===e)l=!0;else switch(s){case"bigint":case"string":case"number":l=!0;break;case"object":switch(e.$$typeof){case r:case n:l=!0;break;case h:return T((l=e._init)(e._payload),t,i,a,o)}}if(l)return o=o(e),l=""===a?"."+P(e,0):a,w(o)?(i="",null!=l&&(i=l.replace(O,"$&/")+"/"),T(o,t,i,"",function(e){return e})):null!=o&&(k(o)&&(c=o,u=i+(null==o.key||e&&e.key===o.key?"":(""+o.key).replace(O,"$&/")+"/")+l,o=I(c.type,u,c.props)),t.push(o)),1;l=0;var d,f=""===a?".":a+":";if(w(e))for(var v=0;v<e.length;v++)l+=T(a=e[v],t,i,s=f+P(a,v),o);else if("function"==typeof(v=null===(d=e)||"object"!=typeof d?null:"function"==typeof(d=p&&d[p]||d["@@iterator"])?d:null))for(e=v.call(e),v=0;!(a=e.next()).done;)l+=T(a=a.value,t,i,s=f+P(a,v++),o);else if("object"===s){if("function"==typeof e.then)return T(function(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch("string"==typeof e.status?e.then(E,E):(e.status="pending",e.then(function(t){"pending"===e.status&&(e.status="fulfilled",e.value=t)},function(t){"pending"===e.status&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}(e),t,i,a,o);throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return l}function x(e,t,r){if(null==e)return e;var n=[],i=0;return T(e,n,"","",function(e){return t.call(r,e,i++)}),n}function L(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var H="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},M={map:x,forEach:function(e,t,r){x(e,function(){t.apply(this,arguments)},r)},count:function(e){var t=0;return x(e,function(){t++}),t},toArray:function(e){return x(e,function(e){return e})||[]},only:function(e){if(!k(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};t.Activity=f,t.Children=M,t.Component=m,t.Fragment=i,t.Profiler=o,t.PureComponent=A,t.StrictMode=a,t.Suspense=l,t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_,t.__COMPILER_RUNTIME={__proto__:null,c:function(e){return _.H.useMemoCache(e)}},t.cache=function(e){return function(){return e.apply(null,arguments)}},t.cacheSignal=function(){return null},t.cloneElement=function(e,t,r){if(null==e)throw Error("The argument must be a React element, but you passed "+e+".");var n=g({},e.props),i=e.key;if(null!=t)for(a in void 0!==t.key&&(i=""+t.key),t)!C.call(t,a)||"key"===a||"__self"===a||"__source"===a||"ref"===a&&void 0===t.ref||(n[a]=t[a]);var a=arguments.length-2;if(1===a)n.children=r;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];n.children=o}return I(e.type,i,n)},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider=e,e.Consumer={$$typeof:s,_context:e},e},t.createElement=function(e,t,r){var n,i={},a=null;if(null!=t)for(n in void 0!==t.key&&(a=""+t.key),t)C.call(t,n)&&"key"!==n&&"__self"!==n&&"__source"!==n&&(i[n]=t[n]);var o=arguments.length-2;if(1===o)i.children=r;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(n in o=e.defaultProps)void 0===i[n]&&(i[n]=o[n]);return I(e,a,i)},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.isValidElement=k,t.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:L}},t.memo=function(e,t){return{$$typeof:d,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=_.T,r={};_.T=r;try{var n=e(),i=_.S;null!==i&&i(r,n),"object"==typeof n&&null!==n&&"function"==typeof n.then&&n.then(E,H)}catch(e){H(e)}finally{null!==t&&null!==r.types&&(t.types=r.types),_.T=t}},t.unstable_useCacheRefresh=function(){return _.H.useCacheRefresh()},t.use=function(e){return _.H.use(e)},t.useActionState=function(e,t,r){return _.H.useActionState(e,t,r)},t.useCallback=function(e,t){return _.H.useCallback(e,t)},t.useContext=function(e){return _.H.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e,t){return _.H.useDeferredValue(e,t)},t.useEffect=function(e,t){return _.H.useEffect(e,t)},t.useEffectEvent=function(e){return _.H.useEffectEvent(e)},t.useId=function(){return _.H.useId()},t.useImperativeHandle=function(e,t,r){return _.H.useImperativeHandle(e,t,r)},t.useInsertionEffect=function(e,t){return _.H.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return _.H.useLayoutEffect(e,t)},t.useMemo=function(e,t){return _.H.useMemo(e,t)},t.useOptimistic=function(e,t){return _.H.useOptimistic(e,t)},t.useReducer=function(e,t,r){return _.H.useReducer(e,t,r)},t.useRef=function(e){return _.H.useRef(e)},t.useState=function(e){return _.H.useState(e)},t.useSyncExternalStore=function(e,t,r){return _.H.useSyncExternalStore(e,t,r)},t.useTransition=function(){return _.H.useTransition()},t.version="19.2.6"},489(e,t,r){e.exports=r(2942)},1325(e,t,r){e.exports=r(1757)},8718(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.FormoAnalytics=void 0;var o=r(49),s=r(6517),c=r(2257),u=r(4992),l=r(4203),d=r(3312),h=r(9582),f=r(5896),p=r(4657),v=r(8834),g=r(2690),y=r(2598),m=r(5620),b=r(7295),A=r(7392),S=r(5707),w=r(9308),E=r(1951),_=r(6053),C=function(){function e(e,t){void 0===t&&(t={});var r,n,i,a=this;if(this.writeKey=e,this.options=t,this._announcedConnect=new WeakMap,this.isWagmiMode=!1,this.isEvmDisabled=!1,this._currentUrl="",this._pageHooksDisposed=!1,this.currentUserId="",this.config={writeKey:e},this.options=t,this.isWagmiMode=!!t.wagmi,this.isEvmDisabled=!1===t.evm,this.crossSubdomainCookies=null===(r=t.crossSubdomainCookies)||void 0===r||r,t.crossSubdomainCookies=this.crossSubdomainCookies,this.session=new f.FormoAnalyticsSession,this.currentUserId=(0,s.cookie)().get(o.SESSION_USER_ID_KEY)||void 0,this.identify=this.identify.bind(this),this.connect=this.connect.bind(this),this.disconnect=this.disconnect.bind(this),this.chain=this.chain.bind(this),this.signature=this.signature.bind(this),this.transaction=this.transaction.bind(this),this.detect=this.detect.bind(this),this.track=this.track.bind(this),this.page=this.page.bind(this),this.reset=this.reset.bind(this),this.cleanup=this.cleanup.bind(this),this.optOutTracking=this.optOutTracking.bind(this),this.optInTracking=this.optInTracking.bind(this),this.hasOptedOutTracking=this.hasOptedOutTracking.bind(this),this.isAutocaptureEnabled=this.isAutocaptureEnabled.bind(this),this.syncPrivyActiveChain=this.syncPrivyActiveChain.bind(this),this.isTrackingSuppressed=this.isTrackingSuppressed.bind(this),this.getTrackedProvidersCount=this.getTrackedProvidersCount.bind(this),this.getProviderState=this.getProviderState.bind(this),this.syncWalletState=this.syncWalletState.bind(this),d.Logger.init({enabled:(null===(n=t.logger)||void 0===n?void 0:n.enabled)||!1,enabledLevels:(null===(i=t.logger)||void 0===i?void 0:i.levels)||[]}),this.evm=new y.EvmProviderRegistry({activeProvider:function(){return a.wallet.provider},activeChainId:function(){return a.wallet.evmChainId},knownEvmAddress:function(){return a.wallet.evmAddress},onChainObserved:function(e,t){e===a.wallet.provider&&"evm"===a.wallet.activeNamespace&&a.wallet.evmChainId!==t&&a.wallet.set("evm",{chainId:t})}}),this.wallet=new g.WalletStateStore({isPersistedIdentityPurgeRequired:function(){return a.trackingPolicy.isPersistedIdentityPurgeRequired()},isPageExcluded:function(){return a.trackingPolicy.isPageExcluded()},isTrackingSuppressed:function(){return a.trackingPolicy.isTrackingSuppressed()},crossSubdomainCookies:function(){return a.crossSubdomainCookies},providerChainId:function(e){return a.evm.chainIdOf(e)},onProviderDisplaced:function(e){return a.evmEvents.forgetAnnouncedConnect(e)}}),this.evmRequests=new b.EvmRequestTracker(this.wallet,this.evm,{isAutocaptureEnabled:function(e){return a.isAutocaptureEnabled(e)},signature:function(e,t){return a.signature(e,t)},transaction:function(e,t){return a.transaction(e,t)}}),this.evmEvents=new m.EvmEventTracker(this.wallet,this.evm,{isAutocaptureEnabled:function(e){return a.isAutocaptureEnabled(e)},isTrackingSuppressed:function(){return a.isTrackingSuppressed()},willTrackEvent:function(e){return a.willTrackEvent(e)},isWagmiMode:function(){return a.isWagmiMode},connect:function(e,t){return a.connect(e,t)},disconnect:function(e){return a.disconnect(e)},chain:function(e,t){return a.chain(e,t)},detect:function(e){return a.detect(e)},registerRequestListeners:function(e){return a.evmRequests.registerRequestListeners(e)}}),this.trackingPolicy=new v.TrackingPolicy({options:function(){return a.options},hasOptedOut:function(){return a.hasOptedOutTracking()},currentChainId:function(){return a.currentChainId}}),this.eventManager=new u.EventManager(new l.EventQueue(this.config.writeKey,{apiHost:t.apiHost||o.EVENTS_API_HOST,flushAt:t.flushAt,retryCount:t.retryCount,maxQueueSize:t.maxQueueSize,flushInterval:t.flushInterval,errorHandler:t.errorHandler,canSend:function(){return!a.hasOptedOutTracking()}}),t),this.hasOptedOutTracking()&&d.logger.info("User has previously opted out of tracking"),this.isEvmDisabled)d.logger.info("FormoAnalytics: EVM provider tracking disabled");else if(this.isWagmiMode&&t.wagmi)d.logger.info("FormoAnalytics: Initializing in Wagmi mode"),this.wagmiHandler=new S.WagmiEventHandler(this,t.wagmi.config,t.wagmi.queryClient);else{var c=void 0,h=t.provider;h?c=h:"undefined"!=typeof window&&window.ethereum&&(c=window.ethereum),c&&this.evmEvents.trackEIP1193Provider(c)}t.solana&&(this.solanaManager=new E.SolanaManager(this,t.solana)),this._currentUrl=window.location.href,this.wallet.load(),this.trackPageHit(),this.trackPageHits()}return Object.defineProperty(e.prototype,"_provider",{get:function(){return this.wallet.provider},set:function(e){this.wallet.provider=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_evmAddress",{get:function(){return this.wallet.evmAddress},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_evmChainId",{get:function(){return this.wallet.evmChainId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentAddress",{get:function(){return this.wallet.address},set:function(e){this.wallet.setActiveAddress(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentChainId",{get:function(){return this.wallet.chainId},set:function(e){this.wallet.setActiveChainId(e)},enumerable:!1,configurable:!0}),e.init=function(t,r){return i(this,void 0,void 0,function(){var n,i;return a(this,function(a){switch(a.label){case 0:return(0,s.initStorageManager)(t),(n=new e(t,r)).isEvmDisabled?(d.logger.info("FormoAnalytics: Skipping provider detection (EVM disabled)"),[3,5]):[3,1];case 1:return n.isWagmiMode?[3,4]:[4,n.evmEvents.getProviders()];case 2:return i=a.sent(),[4,n.evmEvents.detectWallets(i)];case 3:return a.sent(),n.evmEvents.trackProviders(i),[3,5];case 4:d.logger.info("FormoAnalytics: Skipping provider detection (Wagmi mode)"),a.label=5;case 5:return[2,n]}})})},e.prototype.page=function(e,t,r,n,o){return i(this,void 0,void 0,function(){return a(this,function(i){switch(i.label){case 0:return[4,this.trackPageHit(e,t,r,n,o)];case 1:return i.sent(),[2]}})})},e.prototype.reset=function(){this.currentUserId=void 0,this.wallet.reset(),(0,s.cookie)().remove(o.LOCAL_ANONYMOUS_ID_KEY),(0,s.cookie)().remove(o.SESSION_USER_ID_KEY),(0,s.cookie)().remove(f.SESSION_WALLET_DETECTED_KEY),(0,s.cookie)().remove(f.SESSION_WALLET_IDENTIFIED_KEY),(0,s.cookie)().remove(o.ACTIVE_WALLET_KEY),(0,s.session)().remove(o.SESSION_TRAFFIC_SOURCE_KEY)},e.prototype.cleanup=function(){if(d.logger.debug("FormoAnalytics: Cleaning up resources"),this.eventManager.close(),this.evmRequests.cleanup(),this.evmEvents.cleanup(),this.wagmiHandler&&(this.wagmiHandler.cleanup(),this.wagmiHandler=void 0),this.solanaManager&&(this.solanaManager.cleanup(),this.solanaManager=void 0),!this.isWagmiMode)for(var e=0,t=this.evm.trackedProviders();e<t.length;e++){var r=t[e];this.evmEvents.untrackProvider(r)}this._pageHooksDisposed=!0,"undefined"!=typeof window&&(this._onPopStateListener&&(window.removeEventListener("popstate",this._onPopStateListener),this._onPopStateListener=void 0),this._onLocationChangeListener&&(window.removeEventListener("locationchange",this._onLocationChangeListener),this._onLocationChangeListener=void 0)),d.logger.debug("FormoAnalytics: Cleanup complete")},e.prototype.connect=function(e,t,r,n){return i(this,arguments,void 0,function(e,t,r,n){var i,s=e.chainId,c=e.address;return a(this,function(e){switch(e.label){case 0:return null==s?(d.logger.warn("Connect: Chain ID cannot be null or undefined"),[2]):c?(i=(0,p.validateAddress)(c,s))?this.isTrackingSuppressed()?(d.logger.info("connect() skipped: tracking is suppressed for this visitor or environment"),[2]):(this.wallet.observe(this.wallet.namespaceOf(s)),this.setChainState(s,{address:i}),[4,this.trackEvent(o.EventType.CONNECT,{chainId:s,address:i},t,r,n)]):(d.logger.warn('Connect: Invalid address provided ("'.concat(c,'"). Please provide a valid EVM or Solana address.')),[2]):(d.logger.warn("Connect: Address cannot be empty"),[2]);case 1:return e.sent(),[2]}})})},e.prototype.disconnect=function(e,t,r,s){return i(this,void 0,void 0,function(){var i,c,u,l,h,f,p;return a(this,function(a){switch(a.label){case 0:return i=(null==e?void 0:e.chainId)||this.currentChainId,c=(null==e?void 0:e.address)||this.currentAddress,u=(0,w.isSolanaChainId)(i),l=!u&&this._provider?this.getProviderInfo(this._provider):null,d.logger.info("Disconnect: Emitting disconnect event with:",{chainId:i,address:c,providerName:null==l?void 0:l.name,rdns:null==l?void 0:l.rdns}),h=n(n({},l&&{providerName:l.name,rdns:l.rdns}),t),f=this.wallet.namespaceOf(i),this.wallet.beginDisconnect(f),p=this.wallet.snapshot(f),[4,this.trackEvent(o.EventType.DISCONNECT,n(n({},i&&{chainId:i}),c&&{address:c}),h,r,s)];case 1:return a.sent(),this.wallet.isUnchangedSince(f,p)?(this.clearChainState(i),d.logger.info("Wallet disconnected: Cleared currentAddress, currentChainId, and provider"),[2]):(d.logger.info("Disconnect: A new session claimed this namespace while the event was in flight; leaving its state intact"),[2])}})})},e.prototype.setChainState=function(e,t){this.wallet.set(e,t)},e.prototype.clearChainState=function(e){this.wallet.clear(e)},e.prototype.syncWalletState=function(e){this.wallet.syncWalletState(e)},e.prototype.clearActiveProvider=function(){this.wallet.clearProvider()},e.prototype.backfillActiveWallet=function(e,t,r){this.wallet.backfill(e,t,r)},e.prototype.clearStaleEvmWalletOnSwitchWhileSuppressed=function(e){this.wallet.clearStaleEvmWalletOnSwitchWhileSuppressed(e)},e.prototype.addProviderListener=function(e,t,r){this.evm.addListener(e,t,r)},e.prototype.removeProviderListeners=function(e){this.evm.removeListeners(e)},e.prototype.getProviderInfo=function(e){return this.evm.infoFor(e)},e.prototype.isProviderAlreadyWrapped=function(e,t){return this.evm.isWrapped(e,t)},e.prototype.resolveChainIdForProvider=function(e){return this.evm.resolveChainId(e)},e.prototype.rememberProviderChain=function(e,t){this.evm.rememberChain(e,t)},e.prototype.getAddress=function(e){return i(this,void 0,void 0,function(){return a(this,function(t){return[2,this.evm.addressOf(e)]})})},e.prototype.getAccounts=function(e){return i(this,void 0,void 0,function(){return a(this,function(t){return[2,this.evm.accountsOf(e)]})})},e.prototype.chain=function(e,t,r,n){return i(this,arguments,void 0,function(e,t,r,n){var i=e.chainId,s=e.address;return a(this,function(e){switch(e.label){case 0:return i&&0!==Number(i)?isNaN(Number(i))?(d.logger.warn("FormoAnalytics::chain: chainId must be a valid decimal number"),[2]):s||this.currentAddress?(this.setChainState(i,{}),[4,this.trackEvent(o.EventType.CHAIN,{chainId:i,address:s||this.currentAddress},t,r,n)]):(d.logger.warn("FormoAnalytics::chain: address was empty and no previous address has been recorded"),[2]):(d.logger.warn("FormoAnalytics::chain: chainId cannot be empty or 0"),[2]);case 1:return e.sent(),[2]}})})},e.prototype.signature=function(e,t,r,n){return i(this,arguments,void 0,function(e,t,r,n){var i=e.status,s=e.chainId,c=e.address,u=e.message;return a(this,function(e){switch(e.label){case 0:return[4,this.trackEvent(o.EventType.SIGNATURE,{status:i,chainId:s,address:c,message:u},t,r,n)];case 1:return e.sent(),[2]}})})},e.prototype.transaction=function(e,t,r,s){return i(this,arguments,void 0,function(e,t,r,i){var s=e.status,c=e.chainId,u=e.address,l=e.data,d=e.to,h=e.value,f=e.transactionHash,p=e.function_name,v=e.function_args;return a(this,function(e){switch(e.label){case 0:return[4,this.trackEvent(o.EventType.TRANSACTION,n(n(n({status:s,chainId:c,address:u,data:l,to:d,value:h},f&&{transactionHash:f}),p&&{function_name:p}),v&&{function_args:v}),t,r,i)];case 1:return e.sent(),[2]}})})},e.prototype.identify=function(e,t,r,u){return i(this,void 0,void 0,function(){var i,l,h,f,v,g,y,m,b,A,S,w,E,C,I,k,O,P,T,x,L,H;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,14,,15]),(i=e)&&"string"==typeof i.id&&void 0===i.address?(l=null!=t?t:{},[4,(0,_.identifyPrivyUser)(this,i,{activeAddress:l.activeAddress,properties:l.properties})]):[3,2];case 1:return a.sent(),[2];case 2:if(h=e,f=t,this.isTrackingSuppressed()||this.trackingPolicy.isChainExcluded())return d.logger.info("identify() skipped: tracking is suppressed for this visitor, environment, or chain"),[2];if(h)return[3,12];d.logger.info("Auto-identifying with providers:",this.evm.all.map(function(e){return e.info.name})),v=0,g=this.evm.all,a.label=3;case 3:if(!(v<g.length))return[3,11];if(y=g[v],!(m=y.provider))return[3,10];a.label=4;case 4:return a.trys.push([4,9,,10]),[4,this.getAddress(m)];case 5:return(b=a.sent())?(A=(0,p.validateAndChecksumAddress)(b),d.logger.info("Auto-identify: Checking deduplication",{validAddress:A,rdns:y.info.rdns,providerName:y.info.name,isAlreadyIdentified:!!A&&this.session.isWalletIdentified(A,y.info.rdns,void 0,f)}),!A||this.session.isWalletIdentified(A,y.info.rdns,void 0,f)?[3,7]:(d.logger.info("Auto-identifying",A,y.info.name,y.info.rdns),[4,this.identify({address:A,providerName:y.info.name,rdns:y.info.rdns},f,r,u)])):[3,8];case 6:return a.sent(),[3,8];case 7:A&&d.logger.info("Auto-identify: Skipping already identified wallet",A,y.info.name,y.info.rdns),a.label=8;case 8:return[3,10];case 9:return S=a.sent(),d.logger.error("Failed to identify provider ".concat(y.info.name,":"),S),[3,10];case 10:return v++,[3,3];case 11:return[2];case 12:return w=h.address,E=h.providerName,C=h.userId,I=h.rdns,k=h.setActive,w?(d.logger.info("Identify",w,C,E,I),(O=(0,p.validateAddress)(w))?(!1!==k&&(this.wallet.setActiveAddress(O),C&&(this.currentUserId=C,P=(0,c.getIdentityCookieDomain)(this.crossSubdomainCookies),(0,s.cookie)().set(o.SESSION_USER_ID_KEY,C,n(n({path:"/"},(0,c.getIdentityCookieSecurity)()),P?{domain:P}:{})))),T=this.session.isWalletIdentified(O,I||"",C,f),d.logger.debug("Identify: Checking deduplication",{validAddress:O,rdns:I,providerName:E,userId:C,isAlreadyIdentified:T}),T?(d.logger.info("Identify: Wallet ".concat(E||"Unknown"," with address ").concat(O," already identified in this session (rdns: ").concat(I||"empty",")")),[2]):(this.session.markWalletIdentified(O,I||"",C,f),[4,this.trackEvent(o.EventType.IDENTIFY,{address:O,providerName:E,userId:C,rdns:I},f,r,u)])):(null===(H=d.logger.warn)||void 0===H||H.call(d.logger,"Invalid address provided to identify:",w),[2])):(null===(L=d.logger.warn)||void 0===L||L.call(d.logger,"identify() called without address - address is required"),[2]);case 13:return a.sent(),[3,15];case 14:return x=a.sent(),d.logger.log("identify error",x),[3,15];case 15:return[2]}})})},e.prototype.syncPrivyActiveChain=function(e,t){if(void 0!==this.currentChainId&&null!==this.currentChainId){var r,n=null==e?void 0:e.toLowerCase();"solana"===n?r=!0:("ethereum"===n||!n&&t&&/^0x[0-9a-f]{40}$/i.test(t))&&(r=!1),void 0!==r&&r!==(0,w.isSolanaChainId)(this.currentChainId)&&this.wallet.setActiveChainId(void 0)}},e.prototype.detect=function(e,t,r,n){return i(this,arguments,void 0,function(e,t,r,n){var i=e.providerName,s=e.rdns;return a(this,function(e){switch(e.label){case 0:return this.isTrackingSuppressed()?(d.logger.info("detect() skipped: tracking is suppressed for this visitor or environment"),[2]):this.session.isWalletDetected(s)?[2,d.logger.warn("Detect: Wallet ".concat(i," already detected in this session"))]:(this.session.markWalletDetected(s),[4,this.trackEvent(o.EventType.DETECT,{providerName:i,rdns:s},t,r,n)]);case 1:return e.sent(),[2]}})})},e.prototype.track=function(e,t,r,n){return i(this,void 0,void 0,function(){return a(this,function(i){switch(i.label){case 0:return[4,this.trackEvent(o.EventType.TRACK,{event:e},t,r,n)];case 1:return i.sent(),[2]}})})},e.prototype.willTrackEvent=function(e){return this.shouldTrack(e)},e.prototype.optOutTracking=function(){d.logger.info("Opting out of tracking"),(0,h.setConsentFlag)(this.writeKey,o.CONSENT_OPT_OUT_KEY,"true"),this.eventManager.clear(),this.reset(),d.logger.info("Successfully opted out of tracking")},e.prototype.optInTracking=function(){var e;d.logger.info("Opting back into tracking"),(0,h.removeConsentFlag)(this.writeKey,o.CONSENT_OPT_OUT_KEY),null===(e=this.wagmiHandler)||void 0===e||e.retryAdoption(),d.logger.info("Successfully opted back into tracking")},e.prototype.hasOptedOutTracking=function(){return"true"===(0,h.getConsentFlag)(this.writeKey,o.CONSENT_OPT_OUT_KEY)},e.prototype.onLocationChange=function(){return i(this,void 0,void 0,function(){var e;return a(this,function(t){return this._currentUrl!==window.location.href&&(this._currentUrl=window.location.href,null===(e=this.wagmiHandler)||void 0===e||e.retryAdoption(),this.trackPageHit()),[2]})})},e.prototype.trackPageHits=function(){var t=this;e.installHistoryHooksOnce(),this._onPopStateListener=function(){return t.onLocationChange()},this._onLocationChangeListener=function(){return t.onLocationChange()},window.addEventListener("popstate",this._onPopStateListener),window.addEventListener("locationchange",this._onLocationChangeListener)},e.installHistoryHooksOnce=function(){if("undefined"!=typeof history&&"undefined"!=typeof window){var e=Symbol.for("formo.historyWrapped");if(!history[e]){history[e]=!0;var t=function(){return window.dispatchEvent(new window.Event("locationchange"))},r=history.pushState;history.pushState=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=r.apply(this,e);return t(),i};var n=history.replaceState;history.replaceState=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var i=n.apply(this,e);return t(),i}}}},e.prototype.trackPageHit=function(e,t,r,n,s){return i(this,void 0,void 0,function(){var c=this;return a(this,function(u){return this.shouldTrack()?(setTimeout(function(){c._pageHooksDisposed||i(c,void 0,void 0,function(){var i;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.trackEvent(o.EventType.PAGE,{category:e,name:t},r,n,s)];case 1:return a.sent(),[3,3];case 2:return i=a.sent(),d.logger.error("Formo: Failed to track page hit",i),[3,3];case 3:return[2]}})})},300),[2]):(d.logger.info("Track page hit: Skipping event due to tracking configuration"),[2])})})},e.prototype.trackEvent=function(e,t,r,o,s){return i(this,void 0,void 0,function(){var i;return a(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.shouldTrack(null==t?void 0:t.chainId)?[4,this.eventManager.addEvent(n(n({type:e},t),{properties:r,context:o,callback:s}),this.currentAddress,this.currentUserId)]:(d.logger.info("Skipping ".concat(e," event due to tracking configuration")),[2]);case 1:return a.sent(),[3,3];case 2:return i=a.sent(),d.logger.error("Error tracking event:",i),[3,3];case 3:return[2]}})})},e.prototype.isTrackingSuppressed=function(){return this.trackingPolicy.isTrackingSuppressed()},e.prototype.shouldTrack=function(e){return this.trackingPolicy.shouldTrack({chainId:e})},e.prototype.isAutocaptureEnabled=function(e){return this.trackingPolicy.isAutocaptureEnabled(e)},Object.defineProperty(e.prototype,"providers",{get:function(){return this.evm.all},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"provider",{get:function(){return this._provider},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"solana",{get:function(){return this.solanaManager||(this.solanaManager=new E.SolanaManager(this)),this.solanaManager},enumerable:!1,configurable:!0}),e.prototype.getCurrentChainId=function(e){return i(this,void 0,void 0,function(){var t,r,n;return a(this,function(i){switch(i.label){case 0:if(!(t=e||this.provider))return d.logger.error("Provider not set for chain ID"),[2,0];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,t.request({method:"eth_chainId"})];case 2:return(r=i.sent())?[2,(0,A.parseChainId)(r)]:(d.logger.info("Chain id not found"),[2,0]);case 3:return n=i.sent(),d.logger.error("eth_chainId threw an error:",n),[2,0];case 4:return[2]}})})},e.prototype.getTrackedProvidersCount=function(){return this.evm.counts.trackedProviders},e.prototype.getProviderState=function(){return n(n({},this.evm.counts),{activeProvider:!!this._provider})},e}();t.FormoAnalytics=C},4245(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.useFormo=t.FormoAnalyticsProvider=t.FormoAnalyticsContext=void 0;var o=r(1325),s=r(489),c=r(8718),u=r(6517),l=r(3312),d={chain:function(){return Promise.resolve()},page:function(){return Promise.resolve()},reset:function(){},cleanup:function(){},detect:function(){return Promise.resolve()},connect:function(){return Promise.resolve()},disconnect:function(){return Promise.resolve()},signature:function(){return Promise.resolve()},transaction:function(){return Promise.resolve()},identify:function(){return Promise.resolve()},track:function(){return Promise.resolve()},optOutTracking:function(){},optInTracking:function(){},hasOptedOutTracking:function(){return!1}};t.FormoAnalyticsContext=(0,s.createContext)(d),t.FormoAnalyticsProvider=function(e){var t=e.writeKey,r=e.disabled,i=void 0!==r&&r,a=e.children;return t?i?(l.logger.warn("FormoAnalytics is disabled"),(0,o.jsx)(o.Fragment,{children:a})):(0,o.jsx)(h,n({},e)):(l.logger.error("FormoAnalyticsProvider: No Write Key provided"),(0,o.jsx)(o.Fragment,{children:a}))};var h=function(e){var r=e.writeKey,n=e.options,h=e.children,f=(0,s.useState)(d),p=f[0],v=f[1],g=(0,s.useRef)(d);(0,u.initStorageManager)(r);var y=(0,s.useMemo)(function(){if(!n)return"undefined";var e={tracking:n.tracking,autocapture:n.autocapture,crossSubdomainCookies:n.crossSubdomainCookies,apiHost:n.apiHost,flushAt:n.flushAt,flushInterval:n.flushInterval,retryCount:n.retryCount,maxQueueSize:n.maxQueueSize,logger:n.logger,referral:n.referral,hasProvider:!!n.provider,hasWagmi:!!n.wagmi,hasReady:!!n.ready};try{return JSON.stringify(e)}catch(e){return l.logger.warn("Failed to serialize options, using timestamp",e),Date.now().toString()}},[n]);return(0,s.useEffect)(function(){var e=!1;return i(void 0,void 0,void 0,function(){var t,i;return a(this,function(a){switch(a.label){case 0:g.current&&g.current!==d&&(l.logger.log("Cleaning up existing FormoAnalytics SDK instance before re-initialization"),g.current.cleanup(),g.current=d,v(d)),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,c.FormoAnalytics.init(r,n)];case 2:return t=a.sent(),e?(l.logger.log("Component unmounted during initialization, cleaning up SDK"),t.cleanup()):(v(t),g.current=t,l.logger.log("Successfully initialized FormoAnalytics SDK")),[3,4];case 3:return i=a.sent(),e||l.logger.error("Failed to initialize FormoAnalytics SDK",i),[3,4];case 4:return[2]}})}),function(){e=!0,g.current&&g.current!==d&&(l.logger.log("Cleaning up FormoAnalytics SDK instance"),g.current.cleanup(),g.current=d)}},[r,y]),(0,o.jsx)(t.FormoAnalyticsContext.Provider,{value:p,children:h})};t.useFormo=function(){var e=(0,s.useContext)(t.FormoAnalyticsContext);return e||l.logger.warn("useFormo called without a valid context"),e}},6079(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},n=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.detectBrowser=function(){var e=this;return a?Promise.resolve(a):i||(i=r(e,void 0,void 0,function(){var e,t;return n(this,function(r){switch(r.label){case 0:return e=function(){try{return void 0!==globalThis.navigator?globalThis.navigator.userAgent:""}catch(e){return""}}(),[4,o().catch(function(){return!1})];case 1:return t=r.sent(),a=t?"brave":function(e){return/Firefox\/\d+/i.test(e)?"firefox":/Edg\/\d+/i.test(e)?"edge":/OPR\/\d+/i.test(e)?"opera":/Safari\/\d+/i.test(e)&&!/Chrome\/\d+/i.test(e)?"safari":/Chrome\/\d+/i.test(e)?"chrome":"unknown"}(e),[2,a]}})}).finally(function(){i=null}))};var i=null,a=null;function o(){return r(this,void 0,void 0,function(){var e,t,r,i;return n(this,function(n){switch(n.label){case 0:if(!(e=void 0!==globalThis.navigator?globalThis.navigator:void 0))return[2,!1];n.label=1;case 1:return n.trys.push([1,4,,5]),(null===(r=e.brave)||void 0===r?void 0:r.isBrave)?[4,e.brave.isBrave().catch(function(){return!1})]:[3,3];case 2:if(n.sent())return[2,!0];n.label=3;case 3:return[3,5];case 4:return n.sent(),[3,5];case 5:try{if(null==(t=null===(i=e.userAgentData)||void 0===i?void 0:i.brands)?void 0:t.some(function(e){return/Brave/i.test(e.brand)}))return[2,!0]}catch(e){}try{if(/Brave/i.test(e.userAgent))return[2,!0]}catch(e){}return[2,!1]}})})}},9582(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.setConsentFlag=function(e,t,r){var n;if("undefined"!=typeof document){var o=a(e,t),s=new Date(Date.now()+31536e6).toUTCString(),c="https:"===(null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.protocol),u=(0,i.getApexDomain)(),l=u?"; domain=.".concat(u):"";u&&(document.cookie="".concat(o,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;")),document.cookie="".concat(o,"=").concat(encodeURIComponent(r),"; expires=").concat(s,"; path=/").concat(l,"; SameSite=Strict").concat(c?"; Secure":"")}},t.getConsentFlag=function(e,t){if("undefined"==typeof document)return null;for(var r=a(e,t),n=0,i=document.cookie.split(";");n<i.length;n++){var o=i[n].trim(),s=o.indexOf("=");if(-1!==s){var c=o.substring(0,s),u=o.substring(s+1);if(c===r)return decodeURIComponent(u||"")}}return null},t.removeConsentFlag=function(e,t){!function(e){if("undefined"!=typeof document){document.cookie="".concat(e,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;");var t=(0,i.getApexDomain)();t&&(document.cookie="".concat(e,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/; domain=.").concat(t,";"))}}(a(e,t))};var n=r(625),i=r(9037);function a(e,t){return"formo_".concat((0,n.secureHash)(e),"_").concat(t)}},88(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BLOCKED_ADDRESSES=t.DEAD_ADDRESS=t.ZERO_ADDRESS=t.CONSENT_OPT_OUT_KEY=t.LOCAL_ANONYMOUS_ID_KEY=t.ACTIVE_WALLET_TTL_MS=t.ACTIVE_WALLET_KEY=t.SESSION_USER_ID_KEY=t.SESSION_TRAFFIC_SOURCE_KEY=void 0,t.SESSION_TRAFFIC_SOURCE_KEY="traffic-source",t.SESSION_USER_ID_KEY="user-id",t.ACTIVE_WALLET_KEY="active-wallet",t.ACTIVE_WALLET_TTL_MS=864e5,t.LOCAL_ANONYMOUS_ID_KEY="anonymous-id",t.CONSENT_OPT_OUT_KEY="opt-out-tracking",t.ZERO_ADDRESS="0x0000000000000000000000000000000000000000",t.DEAD_ADDRESS="0x000000000000000000000000000000000000dEaD",t.BLOCKED_ADDRESSES=[t.ZERO_ADDRESS,t.DEAD_ADDRESS]},3787(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.COUNTRY_LIST=t.EVENTS_API_REQUEST_HEADER=t.EVENTS_API_HOST=t.EVENTS_API_ORIGIN=void 0,t.EVENTS_API_ORIGIN="https://events.formo.so",t.EVENTS_API_HOST="".concat(t.EVENTS_API_ORIGIN,"/v0/raw_events"),t.EVENTS_API_REQUEST_HEADER=function(e){return{"Content-Type":"application/json",Authorization:"Bearer ".concat(e)}},t.COUNTRY_LIST={"Africa/Abidjan":"CI","Africa/Accra":"GH","Africa/Addis_Ababa":"ET","Africa/Algiers":"DZ","Africa/Asmara":"ER","Africa/Asmera":"ER","Africa/Bamako":"ML","Africa/Bangui":"CF","Africa/Banjul":"GM","Africa/Bissau":"GW","Africa/Blantyre":"MW","Africa/Brazzaville":"CG","Africa/Bujumbura":"BI","Africa/Cairo":"EG","Africa/Casablanca":"MA","Africa/Ceuta":"ES","Africa/Conakry":"GN","Africa/Dakar":"SN","Africa/Dar_es_Salaam":"TZ","Africa/Djibouti":"DJ","Africa/Douala":"CM","Africa/El_Aaiun":"EH","Africa/Freetown":"SL","Africa/Gaborone":"BW","Africa/Harare":"ZW","Africa/Johannesburg":"ZA","Africa/Juba":"SS","Africa/Kampala":"UG","Africa/Khartoum":"SD","Africa/Kigali":"RW","Africa/Kinshasa":"CD","Africa/Lagos":"NG","Africa/Libreville":"GA","Africa/Lome":"TG","Africa/Luanda":"AO","Africa/Lubumbashi":"CD","Africa/Lusaka":"ZM","Africa/Malabo":"GQ","Africa/Maputo":"MZ","Africa/Maseru":"LS","Africa/Mbabane":"SZ","Africa/Mogadishu":"SO","Africa/Monrovia":"LR","Africa/Nairobi":"KE","Africa/Ndjamena":"TD","Africa/Niamey":"NE","Africa/Nouakchott":"MR","Africa/Ouagadougou":"BF","Africa/Porto-Novo":"BJ","Africa/Sao_Tome":"ST","Africa/Timbuktu":"ML","Africa/Tripoli":"LY","Africa/Tunis":"TN","Africa/Windhoek":"NA","America/Adak":"US","America/Anchorage":"US","America/Anguilla":"AI","America/Antigua":"AG","America/Araguaina":"BR","America/Argentina/Buenos_Aires":"AR","America/Argentina/Catamarca":"AR","America/Argentina/ComodRivadavia":"AR","America/Argentina/Cordoba":"AR","America/Argentina/Jujuy":"AR","America/Argentina/La_Rioja":"AR","America/Argentina/Mendoza":"AR","America/Argentina/Rio_Gallegos":"AR","America/Argentina/Salta":"AR","America/Argentina/San_Juan":"AR","America/Argentina/San_Luis":"AR","America/Argentina/Tucuman":"AR","America/Argentina/Ushuaia":"AR","America/Aruba":"AW","America/Asuncion":"PY","America/Atikokan":"CA","America/Atka":"US","America/Bahia":"BR","America/Bahia_Banderas":"MX","America/Barbados":"BB","America/Belem":"BR","America/Belize":"BZ","America/Blanc-Sablon":"CA","America/Boa_Vista":"BR","America/Bogota":"CO","America/Boise":"US","America/Buenos_Aires":"AR","America/Cambridge_Bay":"CA","America/Campo_Grande":"BR","America/Cancun":"MX","America/Caracas":"VE","America/Catamarca":"AR","America/Cayenne":"GF","America/Cayman":"KY","America/Chicago":"US","America/Chihuahua":"MX","America/Ciudad_Juarez":"MX","America/Coral_Harbour":"CA","America/Cordoba":"AR","America/Costa_Rica":"CR","America/Creston":"CA","America/Cuiaba":"BR","America/Curacao":"CW","America/Danmarkshavn":"GL","America/Dawson":"CA","America/Dawson_Creek":"CA","America/Denver":"US","America/Detroit":"US","America/Dominica":"DM","America/Edmonton":"CA","America/Eirunepe":"BR","America/El_Salvador":"SV","America/Ensenada":"MX","America/Fort_Nelson":"CA","America/Fort_Wayne":"US","America/Fortaleza":"BR","America/Glace_Bay":"CA","America/Godthab":"GL","America/Goose_Bay":"CA","America/Grand_Turk":"TC","America/Grenada":"GD","America/Guadeloupe":"GP","America/Guatemala":"GT","America/Guayaquil":"EC","America/Guyana":"GY","America/Halifax":"CA","America/Havana":"CU","America/Hermosillo":"MX","America/Indiana/Indianapoli":"US","America/Indiana/Knox":"US","America/Indiana/Marengo":"US","America/Indiana/Petersburg":"US","America/Indiana/Tell_City":"US","America/Indiana/Vevay":"US","America/Indiana/Vincennes":"US","America/Indiana/Winamac":"US","America/Indianapoli":"US","America/Inuvik":"CA","America/Iqaluit":"CA","America/Jamaica":"JM","America/Jujuy":"AR","America/Juneau":"US","America/Kentucky/Louisville":"US","America/Kentucky/Monticello":"US","America/Knox_IN":"US","America/Kralendijk":"BQ","America/La_Paz":"BO","America/Lima":"PE","America/Los_Angeles":"US","America/Louisville":"US","America/Lower_Princes":"SX","America/Maceio":"BR","America/Managua":"NI","America/Manaus":"BR","America/Marigot":"MF","America/Martinique":"MQ","America/Matamoros":"MX","America/Mazatlan":"MX","America/Mendoza":"AR","America/Menominee":"US","America/Merida":"MX","America/Metlakatla":"US","America/Mexico_City":"MX","America/Miquelon":"PM","America/Moncton":"CA","America/Monterrey":"MX","America/Montevideo":"UY","America/Montreal":"CA","America/Montserrat":"MS","America/Nassau":"BS","America/New_York":"US","America/Nipigon":"CA","America/Nome":"US","America/Noronha":"BR","America/North_Dakota/Beulah":"US","America/North_Dakota/Center":"US","America/North_Dakota/New_Salem":"US","America/Nuuk":"GL","America/Ojinaga":"MX","America/Panama":"PA","America/Pangnirtung":"CA","America/Paramaribo":"SR","America/Phoenix":"US","America/Port-au-Prince":"HT","America/Port_of_Spain":"TT","America/Porto_Acre":"BR","America/Porto_Velho":"BR","America/Puerto_Rico":"PR","America/Punta_Arenas":"CL","America/Rainy_River":"CA","America/Rankin_Inlet":"CA","America/Recife":"BR","America/Regina":"CA","America/Resolute":"CA","America/Rio_Branco":"BR","America/Rosario":"AR","America/Santa_Isabel":"MX","America/Santarem":"BR","America/Santiago":"CL","America/Santo_Domingo":"DO","America/Sao_Paulo":"BR","America/Scoresbysund":"GL","America/Shiprock":"US","America/Sitka":"US","America/St_Barthelemy":"BL","America/St_Johns":"CA","America/St_Kitts":"KN","America/St_Lucia":"LC","America/St_Thomas":"VI","America/St_Vincent":"VC","America/Swift_Current":"CA","America/Tegucigalpa":"HN","America/Thule":"GL","America/Thunder_Bay":"CA","America/Tijuana":"MX","America/Toronto":"CA","America/Tortola":"VG","America/Vancouver":"CA","America/Virgin":"VI","America/Whitehorse":"CA","America/Winnipeg":"CA","America/Yakutat":"US","America/Yellowknife":"CA","Antarctica/Casey":"AQ","Antarctica/Davis":"AQ","Antarctica/DumontDUrville":"AQ","Antarctica/Macquarie":"AU","Antarctica/Mawson":"AQ","Antarctica/McMurdo":"AQ","Antarctica/Palmer":"AQ","Antarctica/Rothera":"AQ","Antarctica/South_Pole":"AQ","Antarctica/Syowa":"AQ","Antarctica/Troll":"AQ","Antarctica/Vostok":"AQ","Arctic/Longyearbyen":"SJ","Asia/Aden":"YE","Asia/Almaty":"KZ","Asia/Amman":"JO","Asia/Anadyr":"RU","Asia/Aqtau":"KZ","Asia/Aqtobe":"KZ","Asia/Ashgabat":"TM","Asia/Ashkhabad":"TM","Asia/Atyrau":"KZ","Asia/Baghdad":"IQ","Asia/Bahrain":"BH","Asia/Baku":"AZ","Asia/Bangkok":"TH","Asia/Barnaul":"RU","Asia/Beirut":"LB","Asia/Bishkek":"KG","Asia/Brunei":"BN","Asia/Calcutta":"IN","Asia/Chita":"RU","Asia/Choibalsan":"MN","Asia/Chongqing":"CN","Asia/Chungking":"CN","Asia/Colombo":"LK","Asia/Dacca":"BD","Asia/Damascus":"SY","Asia/Dhaka":"BD","Asia/Dili":"TL","Asia/Dubai":"AE","Asia/Dushanbe":"TJ","Asia/Famagusta":"CY","Asia/Gaza":"PS","Asia/Harbin":"CN","Asia/Hebron":"PS","Asia/Ho_Chi_Minh":"VN","Asia/Hong_Kong":"HK","Asia/Hovd":"MN","Asia/Irkutsk":"RU","Asia/Istanbul":"TR","Asia/Jakarta":"ID","Asia/Jayapura":"ID","Asia/Jerusalem":"IL","Asia/Kabul":"AF","Asia/Kamchatka":"RU","Asia/Karachi":"PK","Asia/Kashgar":"CN","Asia/Kathmandu":"NP","Asia/Katmandu":"NP","Asia/Khandyga":"RU","Asia/Kolkata":"IN","Asia/Kostanay":"KZ","Asia/Krasnoyarsk":"RU","Asia/Kuala_Lumpur":"MY","Asia/Kuching":"MY","Asia/Kuwait":"KW","Asia/Macao":"MO","Asia/Macau":"MO","Asia/Magadan":"RU","Asia/Makassar":"ID","Asia/Manila":"PH","Asia/Muscat":"OM","Asia/Nicosia":"CY","Asia/Novokuznetsk":"RU","Asia/Novosibirsk":"RU","Asia/Omsk":"RU","Asia/Oral":"KZ","Asia/Phnom_Penh":"KH","Asia/Pontianak":"ID","Asia/Pyongyang":"KP","Asia/Qatar":"QA","Asia/Qostanay":"KZ","Asia/Qyzylorda":"KZ","Asia/Rangoon":"MM","Asia/Riyadh":"SA","Asia/Saigon":"VN","Asia/Sakhalin":"RU","Asia/Samarkand":"UZ","Asia/Seoul":"KR","Asia/Shanghai":"CN","Asia/Singapore":"SG","Asia/Srednekolymsk":"RU","Asia/Taipei":"TW","Asia/Tashkent":"UZ","Asia/Tbilisi":"GE","Asia/Tehran":"IR","Asia/Tel_Aviv":"IL","Asia/Thimbu":"BT","Asia/Thimphu":"BT","Asia/Tokyo":"JP","Asia/Tomsk":"RU","Asia/Ujung_Pandang":"ID","Asia/Ulaanbaatar":"MN","Asia/Ulan_Bator":"MN","Asia/Urumqi":"CN","Asia/Ust-Nera":"RU","Asia/Vientiane":"LA","Asia/Vladivostok":"RU","Asia/Yakutsk":"RU","Asia/Yangon":"MM","Asia/Yekaterinburg":"RU","Asia/Yerevan":"AM","Atlantic/Azores":"PT","Atlantic/Bermuda":"BM","Atlantic/Canary":"ES","Atlantic/Cape_Verde":"CV","Atlantic/Faeroe":"FO","Atlantic/Faroe":"FO","Atlantic/Jan_Mayen":"SJ","Atlantic/Madeira":"PT","Atlantic/Reykjavik":"IS","Atlantic/South_Georgia":"GS","Atlantic/St_Helena":"SH","Atlantic/Stanley":"FK","Australia/ACT":"AU","Australia/Adelaide":"AU","Australia/Brisbane":"AU","Australia/Broken_Hill":"AU","Australia/Canberra":"AU","Australia/Currie":"AU","Australia/Darwin":"AU","Australia/Eucla":"AU","Australia/Hobart":"AU","Australia/LHI":"AU","Australia/Lindeman":"AU","Australia/Lord_Howe":"AU","Australia/Melbourne":"AU","Australia/North":"AU","Australia/NSW":"AU","Australia/Perth":"AU","Australia/Queensland":"AU","Australia/South":"AU","Australia/Sydney":"AU","Australia/Tasmania":"AU","Australia/Victoria":"AU","Australia/West":"AU","Australia/Yancowinna":"AU","Brazil/Acre":"BR","Brazil/DeNoronha":"BR","Brazil/East":"BR","Brazil/West":"BR","Canada/Atlantic":"CA","Canada/Central":"CA","Canada/Eastern":"CA","Canada/Mountain":"CA","Canada/Newfoundland":"CA","Canada/Pacific":"CA","Canada/Saskatchewan":"CA","Canada/Yukon":"CA","Chile/Continental":"CL","Chile/EasterIsland":"CL",Cuba:"CU",Egypt:"EG",Eire:"IE","Europe/Amsterdam":"NL","Europe/Andorra":"AD","Europe/Astrakhan":"RU","Europe/Athens":"GR","Europe/Belfast":"GB","Europe/Belgrade":"RS","Europe/Berlin":"DE","Europe/Bratislava":"SK","Europe/Brussels":"BE","Europe/Bucharest":"RO","Europe/Budapest":"HU","Europe/Busingen":"DE","Europe/Chisinau":"MD","Europe/Copenhagen":"DK","Europe/Dublin":"IE","Europe/Gibraltar":"GI","Europe/Guernsey":"GG","Europe/Helsinki":"FI","Europe/Isle_of_Man":"IM","Europe/Istanbul":"TR","Europe/Jersey":"JE","Europe/Kaliningrad":"RU","Europe/Kiev":"UA","Europe/Kirov":"RU","Europe/Kyiv":"UA","Europe/Lisbon":"PT","Europe/Ljubljana":"SI","Europe/London":"GB","Europe/Luxembourg":"LU","Europe/Madrid":"ES","Europe/Malta":"MT","Europe/Mariehamn":"AX","Europe/Minsk":"BY","Europe/Monaco":"MC","Europe/Moscow":"RU","Europe/Nicosia":"CY","Europe/Oslo":"NO","Europe/Paris":"FR","Europe/Podgorica":"ME","Europe/Prague":"CZ","Europe/Riga":"LV","Europe/Rome":"IT","Europe/Samara":"RU","Europe/San_Marino":"SM","Europe/Sarajevo":"BA","Europe/Saratov":"RU","Europe/Simferopol":"RU","Europe/Skopje":"MK","Europe/Sofia":"BG","Europe/Stockholm":"SE","Europe/Tallinn":"EE","Europe/Tirane":"AL","Europe/Tiraspol":"MD","Europe/Ulyanovsk":"RU","Europe/Uzhgorod":"UA","Europe/Vaduz":"LI","Europe/Vatican":"VA","Europe/Vienna":"AT","Europe/Vilnius":"LT","Europe/Volgograd":"RU","Europe/Warsaw":"PL","Europe/Zagreb":"HR","Europe/Zaporozhye":"UA","Europe/Zurich":"CH",GB:"GB","GB-Eire":"GB",Hongkong:"HK",Iceland:"IS","Indian/Antananarivo":"MG","Indian/Chagos":"IO","Indian/Christmas":"CX","Indian/Cocos":"CC","Indian/Comoro":"KM","Indian/Kerguelen":"TF","Indian/Mahe":"SC","Indian/Maldives":"MV","Indian/Mauritius":"MU","Indian/Mayotte":"YT","Indian/Reunion":"RE",Iran:"IR",Israel:"IL",Jamaica:"JM",Japan:"JP",Kwajalein:"MH",Libya:"LY","Mexico/BajaNorte":"MX","Mexico/BajaSur":"MX","Mexico/General":"MX",Navajo:"US",NZ:"NZ","NZ-CHAT":"NZ","Pacific/Apia":"WS","Pacific/Auckland":"NZ","Pacific/Bougainville":"PG","Pacific/Chatham":"NZ","Pacific/Chuuk":"FM","Pacific/Easter":"CL","Pacific/Efate":"VU","Pacific/Enderbury":"KI","Pacific/Fakaofo":"TK","Pacific/Fiji":"FJ","Pacific/Funafuti":"TV","Pacific/Galapagos":"EC","Pacific/Gambier":"PF","Pacific/Guadalcanal":"SB","Pacific/Guam":"GU","Pacific/Honolulu":"US","Pacific/Johnston":"UM","Pacific/Kanton":"KI","Pacific/Kiritimati":"KI","Pacific/Kosrae":"FM","Pacific/Kwajalein":"MH","Pacific/Majuro":"MH","Pacific/Marquesas":"PF","Pacific/Midway":"UM","Pacific/Nauru":"NR","Pacific/Niue":"NU","Pacific/Norfolk":"NF","Pacific/Noumea":"NC","Pacific/Pago_Pago":"AS","Pacific/Palau":"PW","Pacific/Pitcairn":"PN","Pacific/Pohnpei":"FM","Pacific/Ponape":"FM","Pacific/Port_Moresby":"PG","Pacific/Rarotonga":"CK","Pacific/Saipan":"MP","Pacific/Samoa":"AS","Pacific/Tahiti":"PF","Pacific/Tarawa":"KI","Pacific/Tongatapu":"TO","Pacific/Truk":"FM","Pacific/Wake":"UM","Pacific/Wallis":"WF","Pacific/Yap":"FM",Poland:"PL",Portugal:"PT",PRC:"CN",ROC:"TW",ROK:"KR",Singapore:"SG",Turkey:"TR","US/Alaska":"US","US/Aleutian":"US","US/Arizona":"US","US/Central":"US","US/East-Indiana":"US","US/Eastern":"US","US/Hawaii":"US","US/Indiana-Starke":"US","US/Michigan":"US","US/Mountain":"US","US/Pacific":"US","US/Samoa":"AS","W-SU":"RU"}},1556(e,t){var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.EventChannel=t.EventType=void 0,function(e){e.PAGE="page",e.IDENTIFY="identify",e.DETECT="detect",e.CONNECT="connect",e.DISCONNECT="disconnect",e.CHAIN="chain",e.SIGNATURE="signature",e.TRANSACTION="transaction",e.TRACK="track"}(r||(t.EventType=r={})),function(e){e.WEB="web",e.MOBILE="mobile",e.SERVER="server",e.SOURCE="source"}(n||(t.EventChannel=n={}))},49(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(88),t),i(r(3787),t),i(r(1556),t)},5164(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.isSolanaChainId=t.DEFAULT_SOLANA_CHAIN_ID=t.SOLANA_CHAIN_IDS=t.SolanaManager=t.parsePrivyProperties=t.formofy=void 0,i(r(8718),t),i(r(2657),t);var a=r(6271);Object.defineProperty(t,"formofy",{enumerable:!0,get:function(){return a.formofy}});var o=r(4328);Object.defineProperty(t,"parsePrivyProperties",{enumerable:!0,get:function(){return o.parsePrivyProperties}});var s=r(9308);Object.defineProperty(t,"SolanaManager",{enumerable:!0,get:function(){return s.SolanaManager}});var c=r(9308);Object.defineProperty(t,"SOLANA_CHAIN_IDS",{enumerable:!0,get:function(){return c.SOLANA_CHAIN_IDS}}),Object.defineProperty(t,"DEFAULT_SOLANA_CHAIN_ID",{enumerable:!0,get:function(){return c.DEFAULT_SOLANA_CHAIN_ID}}),Object.defineProperty(t,"isSolanaChainId",{enumerable:!0,get:function(){return c.isSolanaChainId}})},4416(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EventFactory=void 0;var c=r(49),u=r(9629),l=r(4657),d=r(8081),h=r(9879),f=r(3312),p=s(r(2817)),v=r(6517),g=r(5479),y=r(9165),m=r(6949),b=r(9293),A=r(6079),S=/^[A-Z]{2}$/,w=function(){function e(e){var t,r,i=this;this.extractUTMParameters=function(e){var t={utm_campaign:"",utm_content:"",utm_medium:"",utm_source:"",utm_term:""};try{new URL(e).searchParams.forEach(function(e,r){r.startsWith("utm_")&&(t[r]=e.trim())})}catch(e){}return t},this.extractClickIdParameters=function(e){for(var t={},r=0,n=y.CLICK_ID_PARAMS;r<n.length;r++){var i=n[r],a=e.searchParams.get(i);t[i]=a?a.trim():""}return t},this.extractReferralParameter=function(e){for(var t,r,n,a=0,o=(null===(t=i.options)||void 0===t?void 0:t.referral)&&null!==(r=i.options.referral.queryParams)&&void 0!==r?r:y.DEFAULT_REFERRAL_PARAMS;a<o.length;a++){var s=o[a],c=null===(n=e.searchParams.get(s))||void 0===n?void 0:n.trim();if(c)return c}if(i.compiledPathPattern){var u=e.pathname.match(i.compiledPathPattern);if(u&&u[1]){var l=u[1].trim();if(l)return l}}return""},this.getExternalReferrer=function(){var e,t=document.referrer;if(!t)return"";try{var r=null===(e=globalThis.location)||void 0===e?void 0:e.hostname;if(r&&new URL(t).hostname===r)return""}catch(e){}return i.redactUrl(t)},this.getTrafficSources=function(e){for(var t=new URL(e),r=(0,m.sanitizeTrafficSources)(n(n(n({},i.extractUTMParameters(e)),i.extractClickIdParameters(t)),{ref:i.extractReferralParameter(t),referrer:i.getExternalReferrer()})),a=(0,m.sanitizeTrafficSources)(i.redactStoredTrafficSources((0,v.session)().get(c.SESSION_TRAFFIC_SOURCE_KEY)||{})),o={},s=0,u=y.CLICK_ID_PARAMS;s<u.length;s++){var l=u[s];o[l]=r[l]||(null==a?void 0:a[l])||""}var d=n({ref:r.ref||(null==a?void 0:a.ref)||"",referrer:(null==a?void 0:a.referrer)||r.referrer||"",utm_campaign:r.utm_campaign||(null==a?void 0:a.utm_campaign)||"",utm_content:r.utm_content||(null==a?void 0:a.utm_content)||"",utm_medium:r.utm_medium||(null==a?void 0:a.utm_medium)||"",utm_source:r.utm_source||(null==a?void 0:a.utm_source)||"",utm_term:r.utm_term||(null==a?void 0:a.utm_term)||""},o),f=Object.keys(d).reduce(function(e,t){var r=d[t];return(0,h.isUndefined)(r)||""===r||(e[t]=r),e},{});return Object.keys(f).length&&(0,v.session)().set(c.SESSION_TRAFFIC_SOURCE_KEY,f),d},this.getPageProperties=function(e){var t=n({},e),r=null;try{r=new URL(globalThis.location.href),i.redactQueryParams(r),i.normalizeUrlPath(r)}catch(e){}(0,h.isUndefined)(t.url)&&(t.url=r?r.href:globalThis.location.href),(0,h.isUndefined)(t.path)&&(t.path=r?r.pathname:globalThis.location.pathname),(0,h.isUndefined)(t.hash)&&(t.hash=globalThis.location.hash),(0,h.isUndefined)(t.query)&&(t.query=r?r.search.slice(1):globalThis.location.search.slice(1));try{r&&r.searchParams.forEach(function(e,r){(0,h.isUndefined)(t[r])&&!y.PAGE_PROPERTIES_EXCLUDED_FIELDS.has(r)&&(t[r]=e)})}catch(e){f.logger.error("Error parsing query parameters for page properties:",e)}return t},this.options=e;var a=null==e?void 0:e.tracking,s="object"==typeof a&&null!==(t=a.excludeQueryParams)&&void 0!==t?t:[];if(this.excludedQueryParams=new Set(o(o([],y.DEFAULT_EXCLUDED_QUERY_PARAMS,!0),s,!0).map(function(e){return e.toLowerCase()})),null===(r=null==e?void 0:e.referral)||void 0===r?void 0:r.pathPattern)try{this.compiledPathPattern=new RegExp(e.referral.pathPattern)}catch(t){f.logger.warn("Invalid referral path pattern: ".concat(e.referral.pathPattern,". Error: ").concat(t))}}return e.prototype.validateEventAddress=function(e,t){return e&&(0,l.validateAddress)(e,t)||null},e.prototype.getTimezone=function(){return(0,u.getTimezone)()},e.prototype.getLocation=function(){try{var e=this.getTimezone();if(!e)return"";var t=c.COUNTRY_LIST[e];return"string"==typeof t&&S.test(t)?t:""}catch(e){return f.logger.error("Error resolving location:",e),""}},e.prototype.getLanguage=function(){try{return(navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language)||"en"}catch(e){return f.logger.error("Error resolving language:",e),"en"}},e.prototype.getLibraryVersion=function(){return g.version},e.prototype.isExcludedQueryParam=function(e){return this.excludedQueryParams.has(e.toLowerCase())},e.prototype.normalizeUrlPath=function(e){"/"!==e.pathname&&(e.pathname=e.pathname.replace(/\/+$/,""))},e.prototype.redactQueryParams=function(e){var t=this,r=new Set;e.searchParams.forEach(function(e,n){t.isExcludedQueryParam(n)&&r.add(n)}),r.forEach(function(t){return e.searchParams.delete(t)})},e.prototype.redactUrl=function(e){if(!e)return e;try{var t=new URL(e);return this.redactQueryParams(t),this.normalizeUrlPath(t),t.href}catch(t){return e}},e.prototype.redactStoredTrafficSources=function(e){for(var t={},r=0,n=Object.keys(e);r<n.length;r++){var i=n[r],a=e[i];"referrer"===i?t[i]=this.redactUrl(a||""):this.isExcludedQueryParam(i)?t[i]="":t[i]=a}return t},e.prototype.getScreen=function(){var e,t;try{return{screen_width:(null===(e=globalThis.screen)||void 0===e?void 0:e.width)||0,screen_height:(null===(t=globalThis.screen)||void 0===t?void 0:t.height)||0,screen_density:globalThis.devicePixelRatio||1,viewport_width:globalThis.innerWidth||0,viewport_height:globalThis.innerHeight||0}}catch(e){return f.logger.error("Error resolving screen properties:",e),{screen_width:0,screen_height:0,screen_density:1,viewport_width:0,viewport_height:0}}},e.prototype.generateContext=function(e){return i(this,void 0,void 0,function(){var t,r,i,o,s,c,u;return a(this,function(a){switch(a.label){case 0:return[4,(0,A.detectBrowser)()];case 1:return t=a.sent(),r=this.getLanguage(),i=this.getTimezone(),o=this.getLocation(),s=this.getLibraryVersion(),c=this.redactUrl(globalThis.location.href),u=n(n(n({user_agent:globalThis.navigator.userAgent,locale:r,timezone:i,location:o},this.getTrafficSources(c)),{page_title:document.title,page_url:c,library_name:"Formo Web SDK",library_version:s,browser:t}),this.getScreen()),[2,(0,p.default)(u,e||{})]}})})},e.prototype.getEnrichedEvent=function(e,t){return i(this,void 0,void 0,function(){var r,n,i,o,s,l,h;return a(this,function(a){switch(a.label){case 0:return s={},[4,this.generateContext(t)];case 1:return s.context=a.sent(),s.original_timestamp=(0,d.getCurrentTimeFormatted)(),s.user_id=e.user_id,s.type=e.type,s.channel=y.CHANNEL,s.version=y.VERSION,(r=s).anonymous_id=(0,b.generateAnonymousId)(c.LOCAL_ANONYMOUS_ID_KEY,null===(l=this.options)||void 0===l?void 0:l.crossSubdomainCookies),n=null===(h=e.properties)||void 0===h?void 0:h.chainId,i=this.validateEventAddress(e.address,n),r.address=i,void 0===(o=(0,p.default)(e,r)).event&&(o.event=null),void 0===o.properties&&(o.properties=null),[2,(0,u.toSnakeCase)(o)]}})})},e.prototype.generatePageEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i,s;return a(this,function(a){return(i=n({},null!=r?r:{})).category=e,i.name=t,i=this.getPageProperties(i),s={properties:i,type:"page"},[2,this.getEnrichedEvent(s,o)]})})},e.prototype.generateDetectWalletEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({providerName:e,rdns:t},r),type:"detect"},[2,this.getEnrichedEvent(i,o)]})})},e.prototype.generateIdentifyEvent=function(e,t,r,o,s,c){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n(n(n({},void 0!==e&&{providerName:e}),void 0!==t&&{rdns:t}),s),user_id:o,address:r,type:"identify"},[2,this.getEnrichedEvent(i,c)]})})},e.prototype.generateConnectEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({chainId:e},r),address:t,type:"connect"},[2,this.getEnrichedEvent(i,o)]})})},e.prototype.generateDisconnectEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({chainId:e},r),address:t,type:"disconnect"},[2,this.getEnrichedEvent(i,o)]})})},e.prototype.generateChainChangedEvent=function(e,t,r,o){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({chainId:e},r),address:t,type:"chain"},[2,this.getEnrichedEvent(i,o)]})})},e.prototype.generateSignatureEvent=function(e,t,r,o,s,c){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n({status:e,chainId:t,message:o},s),address:r,type:"signature"},[2,this.getEnrichedEvent(i,c)]})})},e.prototype.generateTransactionEvent=function(e,t,r,o,s,c,u,l,d,h,f){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n(n(n(n(n(n(n({status:e,chainId:t},o&&{data:o}),s&&{to:s}),c&&{value:c}),u&&{transactionHash:u}),l&&{function_name:l}),d&&{function_args:d}),h),address:r,type:"transaction"},[2,this.getEnrichedEvent(i,f)]})})},e.prototype.generateTrackEvent=function(e,t,r){return i(this,void 0,void 0,function(){var i;return a(this,function(a){return i={properties:n(n(n(n({},t),void 0!==(null==t?void 0:t.revenue)&&{revenue:Number(t.revenue),currency:("string"==typeof(null==t?void 0:t.currency)?t.currency:"USD").toLowerCase()}),void 0!==(null==t?void 0:t.points)&&{points:Number(t.points)}),void 0!==(null==t?void 0:t.volume)&&{volume:Number(t.volume)}),event:e,type:"track"},[2,this.getEnrichedEvent(i,r)]})})},e.prototype.create=function(e,t,r){return i(this,void 0,void 0,function(){var n,i,o,s;return a(this,function(a){switch(a.label){case 0:switch(n={},e.type){case"page":return[3,1];case"detect":return[3,3];case"identify":return[3,5];case"chain":return[3,7];case"connect":return[3,9];case"disconnect":return[3,11];case"signature":return[3,13];case"transaction":return[3,15];case"track":return[3,17]}return[3,17];case 1:return[4,this.generatePageEvent(e.category,e.name,e.properties,e.context)];case 2:case 4:case 6:case 8:case 10:case 12:case 14:case 16:case 18:return n=a.sent(),[3,19];case 3:return[4,this.generateDetectWalletEvent(e.providerName,e.rdns,e.properties,e.context)];case 5:return[4,this.generateIdentifyEvent(e.providerName,e.rdns,e.address,e.userId,e.properties,e.context)];case 7:return[4,this.generateChainChangedEvent(e.chainId,e.address,e.properties,e.context)];case 9:return[4,this.generateConnectEvent(e.chainId,e.address,e.properties,e.context)];case 11:return[4,this.generateDisconnectEvent(e.chainId,e.address,e.properties,e.context)];case 13:return[4,this.generateSignatureEvent(e.status,e.chainId,e.address,e.message,e.properties,e.context)];case 15:return[4,this.generateTransactionEvent(e.status,e.chainId,e.address,e.data,e.to,e.value,e.transactionHash,e.function_name,e.function_args,e.properties,e.context)];case 17:return[4,this.generateTrackEvent(e.event,e.properties,e.context)];case 19:return void 0!==n.address&&null!==n.address||"identify"===e.type||(i="chainId"in e?e.chainId:void 0,n.address=this.validateEventAddress(t,i)),n.user_id="identify"===e.type?null!==(s=null!==(o=n.user_id)&&void 0!==o?o:r)&&void 0!==s?s:null:r||null,[2,n]}})})},e}();t.EventFactory=w},1457(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},a=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.EventManager=void 0;var o=r(3312),s=r(4416),c=r(4657),u=function(){function e(e,t){this.eventQueue=e,this.eventFactory=new s.EventFactory(t)}return e.prototype.addEvent=function(e,t,r){return n(this,void 0,void 0,function(){var n,s,u;return i(this,function(i){switch(i.label){case 0:return n=e.callback,s=a(e,["callback"]),[4,this.eventFactory.create(s,t,r)];case 1:return(u=i.sent()).address&&(0,c.isBlockedAddress)(u.address)?(o.logger.warn("Event blocked: Address ".concat(u.address," is in the blocked list and cannot emit events")),[2]):(this.eventQueue.enqueue(u,function(e,t,r){e?o.logger.error("Error sending events:",e):o.logger.info("Events sent successfully: ".concat(r.length," events")),null==n||n(e,t,r)}),[2])}})})},e.prototype.clear=function(){this.eventQueue.clear()},e.prototype.close=function(){this.eventQueue.close()},e}();t.EventManager=u},9165(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.PAGE_PROPERTIES_EXCLUDED_FIELDS=t.DEFAULT_REFERRAL_PARAMS=t.DEFAULT_EXCLUDED_QUERY_PARAMS=t.CLICK_ID_PARAMS=t.VERSION=t.CHANNEL=void 0,t.CHANNEL="web",t.VERSION="0";var n=["gclid","gad_source","fbclid","msclkid","twclid","li_fat_id","rdt_cid","ttclid"];t.CLICK_ID_PARAMS=n,t.DEFAULT_EXCLUDED_QUERY_PARAMS=["privy_oauth_code","privy_oauth_state","privy_oauth_provider"];var i=["ref","referral","refcode","af","referrer"];t.DEFAULT_REFERRAL_PARAMS=i;var a=new Set(r(r(r(["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],i,!0),n,!0),["category","name","url","path","hash","query"],!1));t.PAGE_PROPERTIES_EXCLUDED_FIELDS=a},4992(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4416),t),i(r(1457),t),i(r(8962),t)},6949(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.sanitizeTrafficSources=t.sanitizeUtm=t.sanitizeRef=t.sanitizeClickId=void 0;var i=r(9165),a=/^[A-Za-z0-9._-]{1,255}$/,o=/^[A-Za-z0-9._-]{1,64}$/,s=/[<>"'`\\\u0000-\u001f\u007f-\u009f\u200b-\u200f\u2028-\u202e\u2060\ufeff\ufffd]/,c=/^\s*(javascript|data|vbscript):/i,u=function(e){return a.test(e)?e:""};t.sanitizeClickId=u;var l=function(e){return o.test(e)?e:""};t.sanitizeRef=l;var d=function(e){return e.length<=255&&!s.test(e)&&!c.test(e)?e:""};t.sanitizeUtm=d;var h=new Set(i.CLICK_ID_PARAMS);t.sanitizeTrafficSources=function(e){for(var t=n({},e),r=0,i=Object.keys(t);r<i.length;r++){var a=i[r],o=t[a];"string"==typeof o&&""!==o&&"referrer"!==a&&(h.has(a)?t[a]=u(o):t[a]="ref"===a?l(o):d(o))}return t}},8962(e,t){Object.defineProperty(t,"__esModule",{value:!0})},9293(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.generateAnonymousId=void 0;var i=r(9629),a=r(6517),o=r(2257);t.generateAnonymousId=function(e,t){var r=(0,a.cookie)().get(e),s=r&&"string"==typeof r?r:(0,i.generateNativeUUID)(),c=(0,o.getIdentityCookieDomain)(t);return(0,a.cookie)().set(e,s,n(n({expires:new Date(Date.now()+31536e6).toUTCString(),path:"/"},(0,o.getIdentityCookieSecurity)()),c?{domain:c}:{})),s}},5620(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.EvmEventTracker=void 0;var a=r(9478),o=r(3312),s=r(7392),c=r(4657),u=r(6653),l=function(){function e(e,t,r){this.wallet=e,this.registry=t,this.deps=r,this._announcedConnect=new WeakMap}return e.prototype.cleanup=function(){var e;try{null===(e=this.unsubscribeDiscovery)||void 0===e||e.call(this)}catch(e){o.logger.warn("Failed to unsubscribe from provider discovery",e)}this.unsubscribeDiscovery=void 0},e.prototype.forgetAnnouncedConnect=function(e){this._announcedConnect.delete(e)},e.prototype.isProviderMismatch=function(e){return null!=this.wallet.provider&&this.wallet.provider!==e},e.prototype.trackEIP1193Provider=function(e){if(o.logger.info("trackEIP1193Provider",e),this.deps.isWagmiMode())o.logger.debug("trackEIP1193Provider: Skipping EIP-1193 provider tracking (Wagmi mode - using connector system instead)");else try{if(!(0,u.isValidProvider)(e))return void o.logger.warn("trackEIP1193Provider: Invalid provider - missing required methods");if(this.registry.isTracked(e))return void o.logger.warn("trackEIP1193Provider: Provider already tracked");if(this.registerAccountsChangedListener(e),this.registerChainChangedListener(e),this.deps.isAutocaptureEnabled("connect")?this.registerConnectListener(e):this.registerConnectChainObserver(e),this.seedProviderChainFromState(e),!this.deps.registerRequestListeners(e))return void o.logger.warn("TrackProvider: Could not wrap provider; leaving it untracked");this.registerDisconnectListener(e),this.registry.markTracked(e)}catch(e){o.logger.error("Error tracking provider:",e)}},e.prototype.trackProviders=function(e){try{for(var t=0,r=e;t<r.length;t++){var n=r[t],i=null==n?void 0:n.provider;i&&!this.registry.isTracked(i)&&this.trackEIP1193Provider(i)}}catch(e){o.logger.error("Failed to track EIP-6963 providers during initialization:",e)}},e.prototype.registerAccountsChangedListener=function(e){var t=this;o.logger.info("registerAccountsChangedListener");var r=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.onAccountsChanged(e,r[0])};e.on("accountsChanged",r),this.registry.addListener(e,"accountsChanged",r)},e.prototype.onAccountsChanged=function(e,t){return n(this,void 0,void 0,function(){var r,n;return i(this,function(i){switch(i.label){case 0:return o.logger.info("onAccountsChanged",t),r=t.length>0||this.wallet.provider===e,n=r?this.wallet.observe("evm"):this.wallet.currentObservation("evm"),[4,this._handleAccountsChanged(e,t,n)];case 1:return i.sent(),[2]}})})},e.prototype._handleAccountsChanged=function(e,t,r){return n(this,void 0,void 0,function(){var n,a,s,u,l,d,h,f,p,v;return i(this,function(i){switch(i.label){case 0:if(0!==t.length)return[3,9];if(this.wallet.provider!==e)return[3,7];if(o.logger.info("OnAccountsChanged: Detecting disconnect, current state:",{evmAddress:this.wallet.evmAddress,evmChainId:this.wallet.evmChainId,providerMatch:this.wallet.provider===e}),this._announcedConnect.delete(e),!this.deps.isAutocaptureEnabled("disconnect"))return[3,5];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.deps.disconnect({chainId:this.wallet.evmChainId,address:this.wallet.evmAddress})];case 2:return i.sent(),[3,4];case 3:return n=i.sent(),o.logger.error("Failed to disconnect provider on accountsChanged",n),[3,4];case 4:return[3,6];case 5:o.logger.debug("OnAccountsChanged: Disconnect event skipped (autocapture.disconnect: false)"),this.wallet.beginDisconnect("evm"),this.wallet.clear("evm"),i.label=6;case 6:return[3,8];case 7:o.logger.info("OnAccountsChanged: Ignoring disconnect for non-active provider"),i.label=8;case 8:return[2];case 9:if(!(a=(0,c.validateAndChecksumAddress)(t[0])))return o.logger.warn("onAccountsChanged: Invalid address received",t[0]),[2];if(!this.wallet.provider||this.wallet.provider===e)return[3,26];s=this.wallet.evmAddress,u=(0,c.validateAndChecksumAddress)(a),o.logger.info("OnAccountsChanged: Different provider attempting to connect",{activeProvider:this.registry.infoFor(this.wallet.provider).name,eventProvider:this.registry.infoFor(e).name,currentStoredAddress:s,newProviderAddress:u}),i.label=10;case 10:return i.trys.push([10,22,,26]),[4,this.registry.accountsOf(this.wallet.provider)];case 11:return l=i.sent(),this.wallet.isCurrent(r)?(o.logger.info("OnAccountsChanged: Checking current provider accounts",{activeProvider:this.registry.infoFor(this.wallet.provider).name,accountsLength:l?l.length:0,accounts:l}),l&&l.length>0?u&&s&&u!==s?(o.logger.info("OnAccountsChanged: Different address detected, switching providers despite current provider having accounts",{activeProvider:this.registry.infoFor(this.wallet.provider).name,eventProvider:this.registry.infoFor(e).name,currentAddress:s,newAddress:u,reason:"Address mismatch indicates wallet switch"}),this.deps.isAutocaptureEnabled("disconnect")?[4,this.deps.disconnect({chainId:this.wallet.evmChainId,address:this.wallet.evmAddress})]:[3,13]):[3,15]:[3,17]):[2];case 12:return i.sent(),[3,14];case 13:o.logger.debug("OnAccountsChanged: Disconnect event skipped during provider switch (autocapture.disconnect: false)"),this.wallet.clear("evm"),i.label=14;case 14:return this.wallet.isCurrent(r)?(this.wallet.clearProvider(),[3,16]):[2];case 15:return o.logger.info("OnAccountsChanged: Current provider still has accounts and same address, ignoring new provider",{activeProvider:this.registry.infoFor(this.wallet.provider).name,eventProvider:this.registry.infoFor(e).name,activeProviderAccountsCount:l.length,currentAddress:s,newAddress:u}),[2];case 16:return[3,21];case 17:return o.logger.info("OnAccountsChanged: Current provider has no accounts, switching to new provider",{oldProvider:this.registry.infoFor(this.wallet.provider).name,newProvider:this.registry.infoFor(e).name,reason:"Current provider has no accounts"}),this.deps.isAutocaptureEnabled("disconnect")?[4,this.deps.disconnect({chainId:this.wallet.evmChainId,address:this.wallet.evmAddress})]:[3,19];case 18:return i.sent(),[3,20];case 19:o.logger.debug("OnAccountsChanged: Disconnect event skipped for old provider (autocapture.disconnect: false)"),this.wallet.clear("evm"),i.label=20;case 20:if(!this.wallet.isCurrent(r))return[2];i.label=21;case 21:return[3,26];case 22:return d=i.sent(),o.logger.warn("OnAccountsChanged: Could not check current provider accounts, switching to new provider",{error:d instanceof Error?d.message:String(d),errorType:d instanceof Error?d.constructor.name:typeof d,oldProvider:this.wallet.provider?this.registry.infoFor(this.wallet.provider).name:"unknown",newProvider:this.registry.infoFor(e).name,reason:"Could not check current provider accounts"}),this.deps.isAutocaptureEnabled("disconnect")?[4,this.deps.disconnect({chainId:this.wallet.evmChainId,address:this.wallet.evmAddress})]:[3,24];case 23:return i.sent(),[3,25];case 24:o.logger.debug("OnAccountsChanged: Disconnect event skipped for failed provider check (autocapture.disconnect: false)"),this.wallet.clear("evm"),i.label=25;case 25:return this.wallet.isCurrent(r)?[3,26]:[2];case 26:return this.wallet.provider||(this.wallet.provider=e),this.wallet.provider===e&&a===this.wallet.evmAddress||(h=this.registry.resolveChainId(e),f=!this.wallet.evmAddress,this.deps.isTrackingSuppressed()?this.wallet.clearStaleEvmWalletOnSwitchWhileSuppressed(a):this.wallet.set("evm",{address:a,chainId:h}),p=this.registry.infoFor(e),v=h||0,this.deps.isAutocaptureEnabled("connect")&&this.shouldReportConnect(e,a)?(o.logger.info("OnAccountsChanged: Detected wallet connection, emitting connect event",{chainId:h,address:a,wasDisconnected:f,providerName:p.name,rdns:p.rdns,hasChainId:!!h}),0===v&&o.logger.info("OnAccountsChanged: Using fallback chainId 0 for connect event"),this.markConnectReported(e,a,v),this.deps.connect({chainId:v,address:a},{providerName:p.name,rdns:p.rdns}).catch(function(e){o.logger.error("Failed to track connect event during account change:",e)})):o.logger.debug("OnAccountsChanged: Connect event skipped (autocapture.connect: false)",{chainId:h,address:a,providerName:p.name})),[2]}})})},e.prototype.registerChainChangedListener=function(e){var t=this;o.logger.info("registerChainChangedListener");var r=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.onChainChanged(e,r[0])};e.on("chainChanged",r),this.registry.addListener(e,"chainChanged",r)},e.prototype.onChainChanged=function(e,t){return n(this,void 0,void 0,function(){var r,n;return i(this,function(i){switch(i.label){case 0:if(o.logger.info("onChainChanged",t),r=(0,s.parseChainId)(t),this.registry.rememberChain(e,r),!this.deps.isAutocaptureEnabled("chain")&&e!==this.wallet.provider)return[2];if(this.isProviderMismatch(e)){if("solana"===this.wallet.activeNamespace)return[2];this.handleProviderMismatch(e)}if(!this.wallet.evmAddress)return o.logger.info("OnChainChanged: No current address, user appears disconnected"),[2,Promise.resolve()];this.wallet.provider||(this.wallet.provider=e),this.wallet.set("evm",{chainId:r}),i.label=1;case 1:return i.trys.push([1,5,,6]),this.deps.isAutocaptureEnabled("chain")?[4,this.deps.chain({chainId:r,address:this.wallet.evmAddress})]:[3,3];case 2:return i.sent(),[3,4];case 3:o.logger.debug("OnChainChanged: Chain event skipped (autocapture.chain: false)",{chainId:this.wallet.evmChainId,address:this.wallet.evmAddress}),i.label=4;case 4:return[3,6];case 5:return n=i.sent(),o.logger.error("OnChainChanged: Failed to emit chain event:",n),[3,6];case 6:return[2]}})})},e.prototype.registerConnectChainObserver=function(e){var t=this,r=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r[0];"string"==typeof(null==i?void 0:i.chainId)&&t.registry.rememberChain(e,(0,s.parseChainId)(i.chainId))};e.on("connect",r),this.registry.addListener(e,"connect",r)},e.prototype.shouldReportConnect=function(e,t){var r=this._announcedConnect.get(e);return!r||r.address.toLowerCase()!==t.toLowerCase()},e.prototype.markConnectReported=function(e,t,r){this.deps.willTrackEvent(r)&&this._announcedConnect.set(e,{address:t,chainId:r})},e.prototype.registerConnectListener=function(e){var t=this;o.logger.info("registerConnectListener");var r=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var i=r[0];t.onConnected(e,i)};e.on("connect",r),this.registry.addListener(e,"connect",r)},e.prototype.registerDisconnectListener=function(e){var t=this;o.logger.info("registerDisconnectListener");var r=function(r){return n(t,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:if(this.wallet.provider!==e)return[2];if(this._announcedConnect.delete(e),o.logger.info("OnDisconnect: Wallet disconnect event received, current state:",{currentAddress:this.wallet.evmAddress,currentChainId:this.wallet.evmChainId}),!this.deps.isAutocaptureEnabled("disconnect"))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.deps.disconnect({chainId:this.wallet.evmChainId,address:this.wallet.evmAddress})];case 2:return r.sent(),[3,4];case 3:return t=r.sent(),o.logger.error("Error during disconnect in disconnect listener",t),[3,4];case 4:return[3,6];case 5:o.logger.debug("OnDisconnect: Disconnect event skipped (autocapture.disconnect: false)"),this.wallet.beginDisconnect("evm"),this.wallet.clear("evm"),r.label=6;case 6:return[2]}})})};e.on("disconnect",r),this.registry.addListener(e,"disconnect",r)},e.prototype.onConnected=function(e,t){return n(this,void 0,void 0,function(){var r,n,a,u,l,d,h,f,p,v,g;return i(this,function(i){switch(i.label){case 0:o.logger.info("onConnected",t),r=this.wallet.disconnectsSoFar("evm"),n=this.wallet.currentObservation("evm"),i.label=1;case 1:return i.trys.push([1,3,,4]),(null==t?void 0:t.chainId)&&"string"==typeof t.chainId?(a=(0,s.parseChainId)(t.chainId),this.registry.rememberChain(e,a),[4,this.registry.addressOf(e)]):[2];case 2:return u=i.sent(),this.wallet.disconnectsSoFar("evm")!==r?(o.logger.info("onConnected: The wallet disconnected after this observation began; dropping it"),[2]):(l=this.wallet.evmAddress,d=!!l&&!!u&&l.toLowerCase()!==u.toLowerCase(),e===this.wallet.provider&&!this.wallet.isCurrent(n)&&d?(o.logger.info("onConnected: A newer signal from this provider has overtaken this connect observation; dropping it"),[2]):(a&&u&&(h=!this.wallet.evmAddress,this.wallet.provider||(this.wallet.provider=e),(f=this.wallet.provider===e)&&(this.deps.isTrackingSuppressed()?this.wallet.clearStaleEvmWalletOnSwitchWhileSuppressed(u):this.wallet.set("evm",{chainId:a,address:(0,c.validateAndChecksumAddress)(u)||void 0})),f&&this.wallet.evmAddress&&this.shouldReportConnect(e,u)?(v=this.registry.infoFor(e),p=a||0,this.deps.isAutocaptureEnabled("connect")?(o.logger.info("OnConnected: Detected wallet connection, emitting connect event",{chainId:a,wasDisconnected:h,providerName:v.name,rdns:v.rdns,hasChainId:!!a,isActiveProvider:f}),0===p&&o.logger.info("OnConnected: Using fallback chainId 0 for connect event"),this.markConnectReported(e,u,p),this.deps.connect({chainId:p,address:u},{providerName:v.name,rdns:v.rdns}).catch(function(e){o.logger.error("Failed to track connect event during provider connection:",e)})):o.logger.debug("OnConnected: Connect event skipped (autocapture.connect: false)",{chainId:a,address:u,providerName:v.name})):u&&!f&&(v=this.registry.infoFor(e),o.logger.debug("OnConnected: Skipping connect event for non-active provider",{chainId:a,providerName:v.name,rdns:v.rdns,isActiveProvider:f,activeProviderInfo:this.wallet.provider?this.registry.infoFor(this.wallet.provider):null}))),[3,4]));case 3:return g=i.sent(),o.logger.error("Error handling connect event",g),[3,4];case 4:return[2]}})})},e.prototype.getProviders=function(){return n(this,void 0,void 0,function(){var e,t,r,s,c,l,d,h,f,p=this;return i(this,function(v){if(e=(0,a.createStore)(),t=e.getProviders(),this.unsubscribeDiscovery=e.subscribe(function(e){t=e;for(var r=e.filter(function(e){var t=null==e?void 0:e.provider;return t&&!p.registry.isSeen(t)}),a=0,s=r;a<s.length;a++){var c=s[a];p.registry.add(c)}var u=e.filter(function(e){var t=null==e?void 0:e.provider;return!!t&&!p.registry.isTracked(t)});u.length>0&&(p.trackProviders(u),n(p,void 0,void 0,function(){var e;return i(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.detectWallets(u)];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),o.logger.error("Formo: Failed to detect wallets",e),[3,3];case 3:return[2]}})})),p.cleanupUnavailableProviders(e)}),0===t.length){if(r="undefined"!=typeof window?window.ethereum:void 0){if(this.registry.injected&&this.registry.injected.provider===r)return this.registry.isTracked(r)||this.trackEIP1193Provider(r),this.registry.add(this.registry.injected),[2,this.registry.all];this.registry.isTracked(r)||this.trackEIP1193Provider(r),s=(0,u.detectInjectedProviderInfo)(r),c={provider:r,info:s},this.registry.injected=c,this.registry.add(c)}return[2,this.registry.all]}for(l=t.filter(function(e){var t=null==e?void 0:e.provider;return t&&!p.registry.isSeen(t)}),d=0,h=l;d<h.length;d++)f=h[d],this.registry.add(f);return[2,this.registry.all]})})},e.prototype.detectWallets=function(e){return n(this,void 0,void 0,function(){var t,r,n,a;return i(this,function(i){switch(i.label){case 0:i.trys.push([0,5,,6]),t=0,r=e,i.label=1;case 1:return t<r.length?(n=r[t],[4,this.deps.detect({providerName:null==n?void 0:n.info.name,rdns:null==n?void 0:n.info.rdns})]):[3,4];case 2:i.sent(),i.label=3;case 3:return t++,[3,1];case 4:return[3,6];case 5:return a=i.sent(),o.logger.error("Error detect all wallets:",a),[3,6];case 6:return[2]}})})},e.prototype.seedProviderChainFromState=function(e){var t=e.chainId,r="string"==typeof t?(0,s.parseChainId)(t):"number"==typeof t?t:void 0;this.registry.rememberChain(e,r)},e.prototype.untrackProvider=function(e){try{this.registry.removeListeners(e),0===this.registry.attachedEvents(e).length&&this.registry.forgetTracked(e),this.wallet.provider===e&&this.wallet.clearProvider()}catch(e){o.logger.warn("Failed to untrack provider",e)}},e.prototype.cleanupUnavailableProviders=function(e){for(var t=new Set(e.map(function(e){return e.provider})),r=0,n=this.registry.trackedProviders();r<n.length;r++){var i=n[r];t.has(i)||(o.logger.info("Cleaning up unavailable provider: ".concat(i.constructor.name)),this.untrackProvider(i))}},e.prototype.handleProviderMismatch=function(e){this.wallet.provider?this.wallet.set("evm",{address:void 0,chainId:void 0,provider:e}):this.wallet.provider=e},e}();t.EvmEventTracker=l},2598(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.EvmProviderRegistry=void 0;var o=r(3312),s=r(4657),c=r(6653),u=r(2657),l=function(){function e(e){this.deps=e,this.details=[],this.tracked=new Set,this.seen=new Set,this.chainIds=new WeakMap,this.chainGenerations=new WeakMap,this.listeners=new Map}return Object.defineProperty(e.prototype,"all",{get:function(){return this.details},enumerable:!1,configurable:!0}),e.prototype.isTracked=function(e){return this.tracked.has(e)},e.prototype.markTracked=function(e){this.tracked.add(e)},e.prototype.forgetTracked=function(e){this.tracked.delete(e)},e.prototype.trackedProviders=function(){return Array.from(this.tracked)},e.prototype.isSeen=function(e){return this.seen.has(e)},Object.defineProperty(e.prototype,"injected",{get:function(){return this.injectedDetail},set:function(e){this.injectedDetail=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"counts",{get:function(){return{totalProviders:this.details.length,trackedProviders:this.tracked.size,seenProviders:this.seen.size}},enumerable:!1,configurable:!0}),e.prototype.add=function(e){var t=null==e?void 0:e.provider;return!!t&&!this.details.some(function(e){return e.provider===t})&&(this.details=a(a([],this.details,!0),[e],!1),this.seen.add(t),!0)},e.prototype.infoFor=function(e){var t=this.details.find(function(t){return t.provider===e});if(t)return{name:t.info.name,rdns:t.info.rdns};var r=(0,c.detectInjectedProviderInfo)(e);return{name:r.name,rdns:r.rdns}},e.prototype.addListener=function(e,t,r){var n=this.listeners.get(e)||{};n[t]=r,this.listeners.set(e,n)},e.prototype.removeListeners=function(e){var t=this.listeners.get(e);if(t){for(var r={},n=0,i=Object.entries(t);n<i.length;n++){var a=i[n],s=a[0],c=a[1];try{e.removeListener(s,c)}catch(e){o.logger.warn("Failed to remove listener for ".concat(String(s)),e),r[s]=c}}Object.keys(r).length>0?this.listeners.set(e,r):this.listeners.delete(e)}},e.prototype.attachedEvents=function(e){var t;return Object.keys(null!==(t=this.listeners.get(e))&&void 0!==t?t:{})},e.prototype.isWrapped=function(e,t){return!(!t||"function"!=typeof t||!t[u.WRAPPED_REQUEST_SYMBOL]||e[u.WRAPPED_REQUEST_REF_SYMBOL]!==t)},e.prototype.chainIdOf=function(e){return this.chainIds.get(e)},e.prototype.bumpChainGeneration=function(e){var t,r=(null!==(t=this.chainGenerations.get(e))&&void 0!==t?t:0)+1;return this.chainGenerations.set(e,r),r},e.prototype.chainGeneration=function(e){var t;return null!==(t=this.chainGenerations.get(e))&&void 0!==t?t:0},e.prototype.rememberChain=function(e,t){e&&t&&(this.bumpChainGeneration(e),this.chainIds.set(e,t),this.deps.onChainObserved(e,t))},e.prototype.resolveChainId=function(e){if(e){var t=this.chainIds.get(e);if(t)return t;var r=this.deps.activeChainId();return e===this.deps.activeProvider()&&r?r:0}return this.deps.activeChainId()||0},e.prototype.addressOf=function(e){return n(this,void 0,void 0,function(){var t,r,n,a;return i(this,function(i){switch(i.label){case 0:return t=this.deps.activeProvider(),r=e||t,e&&e!==t||!(n=this.deps.knownEvmAddress())?r?[4,this.accountsOf(r)]:(o.logger.info("The provider is not set"),[2,null]):[2,n];case 1:return(a=i.sent())&&a.length>0?[2,(0,s.validateAndChecksumAddress)(a[0])||null]:[2,null]}})})},e.prototype.accountsOf=function(e){return n(this,void 0,void 0,function(){var t,r,n;return i(this,function(i){switch(i.label){case 0:t=e||this.deps.activeProvider(),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null==t?void 0:t.request({method:"eth_accounts"})];case 2:return(r=i.sent())&&0!==r.length?[2,r.map(function(e){return(0,s.validateAndChecksumAddress)(e)}).filter(function(e){return void 0!==e})]:[2,null];case 3:return 4001!==(null==(n=i.sent())?void 0:n.code)&&o.logger.error("EvmProviderRegistry::accountsOf: eth_accounts threw an error",n),[2,null];case 4:return[2]}})})},e}();t.EvmProviderRegistry=l},7295(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.EvmRequestTracker=void 0;var s=r(3312),c=r(7392),u=r(4657),l=r(2657);function d(e){var t="string"==typeof e&&e.startsWith("0x")?e.slice(2):e;if("string"!=typeof t||0===t.length)return"";for(var r=Math.floor(t.length/2),n=new Uint8Array(r),i=0;i<r;i++){var a=Number.parseInt(t.substring(2*i,2*i+2),16);if(Number.isNaN(a))return(new TextDecoder).decode(n.subarray(0,i));n[i]=a}return(new TextDecoder).decode(n)}var h=function(){function e(e,t,r){this.wallet=e,this.registry=t,this.deps=r,this.polls=new Set,this.disposed=!1}return e.prototype.cleanup=function(){this.disposed=!0,this.polls.forEach(function(e){return clearTimeout(e)}),this.polls.clear()},e.prototype.schedulePoll=function(e,t){var r=this;if(!this.disposed){var n=setTimeout(function(){r.polls.delete(n),e()},t);this.polls.add(n)}},e.prototype.registerRequestListeners=function(e){var t=this;if(s.logger.info("registerRequestListeners"),!e)return s.logger.error("Provider not found for request (signature, transaction) tracking"),!1;var r=e.request;if(this.registry.isWrapped(e,r))return s.logger.info("Provider already wrapped with our SDK; skipping request wrapping."),!0;var o=e.request.bind(e),u=function(r){return i(t,[r],void 0,function(t){var r,u,d,h,f,p,v,g,y,m,b=this,A=t.method,S=t.params;return a(this,function(t){switch(t.label){case 0:if("eth_chainId"===A)return r=this.registry.chainGeneration(e),[2,o({method:A,params:S}).then(function(t){return r===b.registry.chainGeneration(e)&&"string"==typeof t&&b.registry.rememberChain(e,(0,c.parseChainId)(t)),t})];if(!Array.isArray(S)||!["eth_signTypedData_v4","personal_sign"].includes(A))return[3,4];if(!this.deps.isAutocaptureEnabled("signature"))return s.logger.debug("Signature event skipped (autocapture.signature: false)",{method:A}),[2,o({method:A,params:S})];(u=o({method:A,params:S})).catch(function(){}),d=this.registry.resolveChainId(e),i(b,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.deps.signature(n({status:l.SignatureStatus.REQUESTED},this.buildSignatureEventPayload(A,S,void 0,d,e)))];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),s.logger.error("Formo: Failed to track signature request",t),[3,3];case 3:return[2]}})}),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,u];case 2:return(h=t.sent())&&i(b,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.deps.signature(n({status:l.SignatureStatus.CONFIRMED},this.buildSignatureEventPayload(A,S,h,d,e)))];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),s.logger.error("Formo: Failed to track signature confirmation",t),[3,3];case 3:return[2]}})}),[2,h];case 3:throw f=t.sent(),4001===(null==(m=f)?void 0:m.code)&&i(b,void 0,void 0,function(){var t;return a(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.deps.signature(n({status:l.SignatureStatus.REJECTED},this.buildSignatureEventPayload(A,S,void 0,d,e)))];case 1:return r.sent(),[3,3];case 2:return t=r.sent(),s.logger.error("Formo: Failed to track signature rejection",t),[3,3];case 3:return[2]}})}),f;case 4:if("wallet_sendCalls"===A&&Array.isArray(S)&&S[0])return[2,this.trackBatchedCalls(e,o,S)];if(!Array.isArray(S)||"eth_sendTransaction"!==A||!S[0])return[3,8];if(!this.deps.isAutocaptureEnabled("transaction"))return s.logger.debug("Transaction event skipped (autocapture.transaction: false)",{method:A}),[2,o({method:A,params:S})];(p=o({method:A,params:S})).catch(function(){}),v=this.registry.resolveChainId(e),i(b,void 0,void 0,function(){var t,r;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.buildTransactionEventPayload(S,e,v)];case 1:return t=i.sent(),[4,this.deps.transaction(n({status:l.TransactionStatus.STARTED},t))];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),s.logger.error("Formo: Failed to track transaction start",r),[3,4];case 4:return[2]}})}),t.label=5;case 5:return t.trys.push([5,7,,8]),[4,p];case 6:return g=t.sent(),i(b,void 0,void 0,function(){var t,r;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.buildTransactionEventPayload(S,e,v)];case 1:return t=i.sent(),[4,this.deps.transaction(n(n({status:l.TransactionStatus.BROADCASTED},t),{transactionHash:g}))];case 2:return i.sent(),this.pollTransactionReceipt(e,g,t),[3,4];case 3:return r=i.sent(),s.logger.error("Formo: Failed to track transaction broadcast",r),[3,4];case 4:return[2]}})}),[2,g];case 7:throw y=t.sent(),4001===(null==(m=y)?void 0:m.code)&&i(b,void 0,void 0,function(){var t,r;return a(this,function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),[4,this.buildTransactionEventPayload(S,e,v)];case 1:return t=i.sent(),[4,this.deps.transaction(n({status:l.TransactionStatus.REJECTED},t))];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),s.logger.error("Formo: Failed to track transaction rejection",r),[3,4];case 4:return[2]}})}),y;case 8:return[2,o({method:A,params:S})]}})})};u[l.WRAPPED_REQUEST_SYMBOL]=!0;try{return e[l.WRAPPED_REQUEST_REF_SYMBOL]=u,e.request=u,!0}catch(e){return s.logger.warn("Failed to wrap provider.request; skipping",e),!1}},e.prototype.buildSignatureEventPayload=function(e,t,r,i,a){var o,s="personal_sign"===e?t[1]:t[0],c=(0,u.validateAndChecksumAddress)(s);if(!c)throw new Error("Invalid address in signature payload: ".concat(s));var l=null!==(o=null!=i?i:this.wallet.evmChainId)&&void 0!==o?o:void 0;return a&&a!==this.wallet.provider&&this.wallet.provider||this.wallet.backfill(c,l,a),n(n({},{chainId:l,address:c}),"personal_sign"===e?{message:d(t[0])}:{message:t[1]})},e.prototype.buildTransactionEventPayload=function(e,t,r){return i(this,void 0,void 0,function(){var n,i,o,s,c,l,d;return a(this,function(a){if(n=e[0],i=n.data,o=n.from,s=n.to,c=n.value,!(l=(0,u.validateAndChecksumAddress)(o)))throw new Error("Invalid address in transaction payload: ".concat(o));return d=null!=r?r:this.registry.resolveChainId(t),t&&t!==this.wallet.provider&&this.wallet.provider||this.wallet.backfill(l,d,t),[2,{chainId:d,data:i,address:l,to:s,value:c}]})})},e.prototype.pollTransactionReceipt=function(e,t,r){return i(this,arguments,void 0,function(e,t,r,o,c){var u,d,h=this;return void 0===o&&(o=10),void 0===c&&(c=3e3),a(this,function(f){return u=0,e?(d=function(){return i(h,void 0,void 0,function(){var i,h;return a(this,function(a){switch(a.label){case 0:if(this.disposed)return[2];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e.request({method:"eth_getTransactionReceipt",params:[t]})];case 2:if(i=a.sent()){if("0x1"===i.status||1===i.status)return this.deps.transaction(n(n({status:l.TransactionStatus.CONFIRMED},r),{transactionHash:t})).catch(function(e){return s.logger.error("Formo: Failed to track transaction confirmation",e)}),[2];if("0x0"===i.status||0===i.status)return this.deps.transaction(n(n({status:l.TransactionStatus.REVERTED},r),{transactionHash:t})).catch(function(e){return s.logger.error("Formo: Failed to track transaction revert",e)}),[2]}return[3,4];case 3:return h=a.sent(),s.logger.error("Error polling transaction receipt",h),[3,4];case 4:return++u<o&&this.schedulePoll(d,c),[2]}})})},d(),[2]):[2]})})},e.prototype.trackBatchedCalls=function(e,t,r){return i(this,void 0,void 0,function(){var i,d,h,f,p,v,g,y,m,b,A,S,w,E,_,C,I,k,O,P,T;return a(this,function(a){switch(a.label){case 0:if(!this.deps.isAutocaptureEnabled("transaction"))return s.logger.debug("Transaction event skipped (autocapture.transaction: false)",{method:"wallet_sendCalls"}),[2,t({method:"wallet_sendCalls",params:r})];if((i=t({method:"wallet_sendCalls",params:r})).catch(function(){}),d=r[0],h=Array.isArray(null==d?void 0:d.calls)?d.calls:[],f="string"==typeof(null==d?void 0:d.chainId)?(0,c.parseChainId)(d.chainId):void 0,p=f||this.registry.resolveChainId(e),!(v=(0,u.validateAndChecksumAddress)(null!==(T=null==d?void 0:d.from)&&void 0!==T?T:"")))return s.logger.warn("Formo: wallet_sendCalls has no valid `from`; not tracking",{from:null==d?void 0:d.from}),[2,i];if(0===h.length)return s.logger.debug("Formo: wallet_sendCalls carried no calls"),[2,i];for(e&&e!==this.wallet.provider&&this.wallet.provider||this.wallet.backfill(v,p,e),g=h.map(function(e,t){return{chainId:p,address:v,to:null==e?void 0:e.to,value:null==e?void 0:e.value,data:null==e?void 0:e.data,properties:{batch_size:h.length,batch_index:t}}}),y=0,m=g;y<m.length;y++)k=m[y],O=k.properties,P=o(k,["properties"]),this.deps.transaction(n({status:l.TransactionStatus.STARTED},P),O).catch(function(e){return s.logger.error("Formo: Failed to track batch call start",e)});a.label=1;case 1:return a.trys.push([1,3,,4]),[4,i];case 2:for(b=a.sent(),A=this.readBatchId(b),S=0,w=g;S<w.length;S++)k=w[S],O=k.properties,P=o(k,["properties"]),this.deps.transaction(n({status:l.TransactionStatus.BROADCASTED},P),n(n({},O),A?{batch_id:A}:{})).catch(function(e){return s.logger.error("Formo: Failed to track batch call broadcast",e)});return A&&this.pollBatchStatus(e,A,g),[2,b];case 3:if(E=a.sent(),4001===(null==(_=E)?void 0:_.code))for(C=0,I=g;C<I.length;C++)k=I[C],O=k.properties,P=o(k,["properties"]),this.deps.transaction(n({status:l.TransactionStatus.REJECTED},P),O).catch(function(e){return s.logger.error("Formo: Failed to track batch call rejection",e)});throw E;case 4:return[2]}})})},e.prototype.batchCallOutcome=function(e,t){var r=null==t?void 0:t.status;return void 0!==r?"0x0"===r||0===r?l.TransactionStatus.REVERTED:l.TransactionStatus.CONFIRMED:e>=600?void 0:e>=500?l.TransactionStatus.REVERTED:e>=400?l.TransactionStatus.REJECTED:l.TransactionStatus.CONFIRMED},e.prototype.readBatchId=function(e){if("string"==typeof e&&e.length>0)return e;if(e&&"object"==typeof e){var t=e.id;if("string"==typeof t&&t.length>0)return t}},e.prototype.pollBatchStatus=function(e,t,r){return i(this,arguments,void 0,function(e,t,r,c,u){var l,d,h=this;return void 0===c&&(c=10),void 0===u&&(u=3e3),a(this,function(f){return e?(l=0,d=function(){return i(h,void 0,void 0,function(){var i,h,f,p,v=this;return a(this,function(a){switch(a.label){case 0:if(this.disposed)return[2];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e.request({method:"wallet_getCallsStatus",params:[t]})];case 2:return i=a.sent(),void 0!==(h="number"==typeof(null==i?void 0:i.status)?i.status:void 0)&&h>=200?(f=Array.isArray(null==i?void 0:i.receipts)?i.receipts:[],r.forEach(function(e,r){var i=f[r],a=v.batchCallOutcome(h,i);if(void 0!==a){var c=e.properties,u=o(e,["properties"]);v.deps.transaction(n(n({status:a},u),(null==i?void 0:i.transactionHash)?{transactionHash:i.transactionHash}:{}),n(n({},c),{batch_id:t})).catch(function(e){return s.logger.error("Formo: Failed to track batch call outcome",e)})}}),[2]):[3,4];case 3:return p=a.sent(),s.logger.error("Error polling batch call status",p),[3,4];case 4:return++l<c&&this.schedulePoll(d,u),[2]}})})},d(),[2]):[2]})})},e}();t.EvmRequestTracker=h},7688(e,t){var r=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},n=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},i=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return r(this,void 0,void 0,function(){var r,a,o,s,c,u,l,d,h;return n(this,function(f){switch(f.label){case 0:a=(r=t||{}).retries,o=void 0===a?0:a,s=r.retryDelay,c=r.retryOn,u=i(r,["retries","retryDelay","retryOn"]),l=function(t){var r,i,a,l;return n(this,function(n){switch(n.label){case 0:r=t===o,n.label=1;case 1:return n.trys.push([1,6,,10]),[4,globalThis.fetch(e,u)];case 2:return(i=n.sent()).ok||r?[2,{value:i}]:((a=new Error(i.statusText)).response=i,(null==c?void 0:c(t,a,i))?s?[4,new Promise(function(e){return setTimeout(e,s(t))})]:[3,4]:[3,5]);case 3:n.sent(),n.label=4;case 4:return[2,"continue"];case 5:return[2,{value:i}];case 6:if(l=n.sent(),r)throw l;return(null==c?void 0:c(t,l,null))?s?[4,new Promise(function(e){return setTimeout(e,s(t))})]:[3,8]:[3,9];case 7:n.sent(),n.label=8;case 8:return[2,"continue"];case 9:throw l;case 10:return[2]}})},d=0,f.label=1;case 1:return d<=o?[5,l(d)]:[3,4];case 2:if("object"==typeof(h=f.sent()))return[2,h.value];f.label=3;case 3:return d++,[3,1];case 4:throw new Error("Unexpected: retry loop exited without returning or throwing")}})})}},5135(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0});var a=r(6271);i(r(5164),t),i(r(4245),t),"undefined"!=typeof window&&(window.formofy=a.formofy)},6271(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.formofy=function(e,t){e&&"undefined"!=typeof window?n.FormoAnalytics.init(e,t).then(function(e){if(window.formo=e,null==t?void 0:t.ready)try{t.ready(e)}catch(e){console.error("Error in FormoAnalytics ready callback:",e)}}).catch(function(e){return console.error("Error initializing FormoAnalytics:",e)}):console.warn("FormoAnalytics not found")};var n=r(8718)},7378(e,t){var r=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.logger=t.Logger=void 0;var n=function(){function e(e,t){void 0===e&&(e=!1),void 0===t&&(t=[]),this.enabled=e,this.enabledLevels=new Set(t)}return e.init=function(t){var r=e.getInstance();void 0!==t.enabled&&r.setEnabled(t.enabled),void 0!==t.enabledLevels&&r.setEnabledLevels(t.enabledLevels)},e.getInstance=function(t){var r,n;return e.instance||(e.instance=new e(null!==(r=null==t?void 0:t.enabled)&&void 0!==r&&r,null!==(n=null==t?void 0:t.enabledLevels)&&void 0!==n?n:[])),e.instance},e.prototype.setEnabled=function(e){this.enabled=e},e.prototype.isLoggingEnabled=function(){return this.enabled},e.prototype.setEnabledLevels=function(e){this.enabledLevels=new Set(e)},e.prototype.getEnabledLevels=function(){return Array.from(this.enabledLevels)},e.prototype.shouldLog=function(e){return!!this.enabled&&this.enabledLevels.has(e)},e.prototype.formatMessage=function(e){var t=(new Date).toLocaleString("en-US",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});return"[Formo SDK][".concat(t,"] ").concat(e)},e.prototype.debug=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("debug")&&console.debug.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.info=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("info")&&console.info.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.warn=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("warn")&&console.warn.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.error=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("error")&&console.error.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.trace=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.shouldLog("trace")&&console.trace.apply(console,r([this.formatMessage(e)],t,!1))},e.prototype.log=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];this.info.apply(this,r([e],t,!1))},e}();t.Logger=n,t.logger=n.getInstance()},3312(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(7378),t),i(r(9954),t)},9954(e,t){Object.defineProperty(t,"__esModule",{value:!0})},4328(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.parsePrivyProperties=void 0;var n=r(6053);Object.defineProperty(t,"parsePrivyProperties",{enumerable:!0,get:function(){return n.parsePrivyProperties}})},6053(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},s=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.parsePrivyProperties=f,t.identifyPrivyUser=function(e,t){return i(this,arguments,void 0,function(e,t,r){var i,o,s,u,l,d,p,v,g,y,m,b,A,S,w;return void 0===r&&(r={}),a(this,function(a){switch(a.label){case 0:if(!e||!t)return[2,void 0];if(null===(b=(i=e).isTrackingSuppressed)||void 0===b?void 0:b.call(i))return[2,void 0];if(o=f(t),s=o.properties,0===(u=o.wallets).length)return c.logger.info("identifyPrivyUser: user has no linked wallets; nothing to identify",t.id),[2,void 0];l=n(n({},s),r.properties),d=function(e,t,r){if(t)return e.find(function(e){return h(e.address,t)});if(r){var n=e.find(function(e){return h(e.address,r)});if(n)return n}var i=e.filter(function(e){return!e.isEmbedded});return i.length>0?i[i.length-1]:e[e.length-1]}(u,null!==(A=r.activeAddress)&&void 0!==A?A:i.currentAddress,null===(S=t.wallet)||void 0===S?void 0:S.address),null===(w=i.syncPrivyActiveChain)||void 0===w||w.call(i,null==d?void 0:d.chainType,null==d?void 0:d.address),p=i.identify.bind(e),v=0,g=u,a.label=1;case 1:return v<g.length?(y=g[v],m=n(n({},l),{is_embedded:y.isEmbedded}),y.walletClient&&(m.wallet_client=y.walletClient),y.chainType&&(m.chain_type=y.chainType),[4,p({address:y.address,userId:t.id,setActive:y===d},m)]):[3,4];case 2:a.sent(),a.label=3;case 3:return v++,[3,1];case 4:return[2,d?{address:d.address,chainType:d.chainType}:void 0]}})})};var c=r(3312);function u(e){return("wallet"===e.type||"smart_wallet"===e.type)&&!!e.address}function l(e){if(e instanceof Date){var t=e.getTime();return Number.isNaN(t)?void 0:t}if("number"==typeof e){if(!Number.isFinite(e))return;return e<1e11?1e3*e:e}if("string"==typeof e){var r=Date.parse(e);return Number.isNaN(r)?void 0:r}}var d=/^0x[0-9a-f]{40}$/i;function h(e,t){return d.test(e)&&d.test(t)?e.toLowerCase()===t.toLowerCase():e===t}function f(e){var t,r,n,i,a,c,h,f,p,v,g,y,m,b,A,S,w,E,_=e.linkedAccounts||[],C={privyDid:e.id,privyCreatedAt:l(e.createdAt)};if((null===(t=e.email)||void 0===t?void 0:t.address)&&(C.email=e.email.address),(null===(r=e.phone)||void 0===r?void 0:r.number)&&(C.phone=e.phone.number),(null===(n=e.apple)||void 0===n?void 0:n.email)&&(C.apple=e.apple.email),(null===(i=e.discord)||void 0===i?void 0:i.username)&&(C.discord=e.discord.username),(null===(a=e.farcaster)||void 0===a?void 0:a.username)&&(C.farcaster=e.farcaster.username),(null===(c=e.github)||void 0===c?void 0:c.username)&&(C.github=e.github.username),(null===(h=e.google)||void 0===h?void 0:h.email)&&(C.google=e.google.email),(null===(f=e.instagram)||void 0===f?void 0:f.username)&&(C.instagram=e.instagram.username),(null===(p=e.line)||void 0===p?void 0:p.email)&&(C.line=e.line.email),(null===(v=e.linkedin)||void 0===v?void 0:v.email)&&(C.linkedin=e.linkedin.email),(null===(g=e.spotify)||void 0===g?void 0:g.email)&&(C.spotify=e.spotify.email),(null===(y=e.telegram)||void 0===y?void 0:y.username)&&(C.telegram=e.telegram.username),(null===(m=e.tiktok)||void 0===m?void 0:m.username)&&(C.tiktok=e.tiktok.username),(null===(b=e.twitch)||void 0===b?void 0:b.username)&&(C.twitch=e.twitch.username),(null===(A=e.twitter)||void 0===A?void 0:A.username)&&(C.twitter=e.twitter.username),!C.email){var I=_.find(function(e){return"email"===e.type});(null==I?void 0:I.address)&&(C.email=I.address)}if(!C.phone){var k=_.find(function(e){return"phone"===e.type});(null==k?void 0:k.number)&&(C.phone=k.number)}if(!C.apple){var O=_.find(function(e){return"apple_oauth"===e.type});(null==O?void 0:O.email)&&(C.apple=O.email)}if(!C.discord){var P=_.find(function(e){return"discord_oauth"===e.type});(null==P?void 0:P.username)&&(C.discord=P.username)}if(!C.farcaster){var T=_.find(function(e){return"farcaster"===e.type});(null==T?void 0:T.username)?C.farcaster=T.username:(null==T?void 0:T.displayName)&&(C.farcaster=T.displayName)}if(!C.github){var x=_.find(function(e){return"github_oauth"===e.type});(null==x?void 0:x.username)&&(C.github=x.username)}if(!C.google){var L=_.find(function(e){return"google_oauth"===e.type});(null==L?void 0:L.email)&&(C.google=L.email)}if(!C.instagram){var H=_.find(function(e){return"instagram_oauth"===e.type});(null==H?void 0:H.username)&&(C.instagram=H.username)}if(!C.line){var M=_.find(function(e){return"line_oauth"===e.type});(null==M?void 0:M.email)&&(C.line=M.email)}if(!C.linkedin){var D=_.find(function(e){return"linkedin_oauth"===e.type});(null==D?void 0:D.email)&&(C.linkedin=D.email)}if(!C.spotify){var R=_.find(function(e){return"spotify_oauth"===e.type});(null==R?void 0:R.email)&&(C.spotify=R.email)}if(!C.telegram){var j=_.find(function(e){return"telegram"===e.type});(null==j?void 0:j.username)?C.telegram=j.username:(null==j?void 0:j.telegramUserId)&&(C.telegram=j.telegramUserId)}if(!C.tiktok){var U=_.find(function(e){return"tiktok_oauth"===e.type});(null==U?void 0:U.username)&&(C.tiktok=U.username)}if(!C.twitch){var N=_.find(function(e){return"twitch_oauth"===e.type});(null==N?void 0:N.username)?C.twitch=N.username:(null==N?void 0:N.email)&&(C.twitch=N.email)}if(!C.twitter){var F=_.find(function(e){return"twitter_oauth"===e.type});(null==F?void 0:F.username)&&(C.twitter=F.username)}var B=_.find(function(e){return"custom_auth"===e.type});(null==B?void 0:B.customUserId)&&(C.customUserId=B.customUserId),C.email||(C.google?C.email=C.google:C.apple?C.email=C.apple:C.linkedin&&(C.email=C.linkedin));for(var W=[],K=0,V=_;K<V.length;K++){var G=V[K];if(u(G))W.push({address:G.address,walletClient:null!==(S=G.walletClientType||G.walletClient)&&void 0!==S?S:void 0,chainType:null!==(w=G.chainType)&&void 0!==w?w:void 0,isEmbedded:"privy"===G.walletClientType||"privy"===G.walletClient});else if("cross_app"===G.type)for(var q=0,z=s(s([],G.embeddedWallets||[],!0),G.smartWallets||[],!0);q<z.length;q++){var Y=z[q];(null==Y?void 0:Y.address)&&W.push({address:Y.address,walletClient:"cross_app",chainType:null!==(E=Y.chainType)&&void 0!==E?E:void 0,isEmbedded:!0,fromCrossApp:!0})}}for(var Q=new Map,J=[],X=0,Z=W;X<Z.length;X++){var $=Z[X],ee=d.test($.address)?$.address.toLowerCase():$.address,te=Q.get(ee);void 0!==te?!$.fromCrossApp&&J[te].fromCrossApp&&(J[te]=$):(Q.set(ee,J.length),J.push($))}var re=J.map(function(e){return e.fromCrossApp,o(e,["fromCrossApp"])});return{properties:C,wallets:re}}},1794(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PROVIDER_ICON=void 0,t.detectInjectedProviderInfo=function(e){for(var n="Injected Provider",i="io.injected.provider",a=e,o=0,s=r;o<s.length;o++){var c=s[o];if(a[c.flag]){n=c.name,i=c.rdns;break}}return{name:n,rdns:i,uuid:"injected-".concat(i.replace(/[^a-zA-Z0-9]/g,"-")),icon:t.DEFAULT_PROVIDER_ICON}},t.isValidProvider=function(e){return!!e&&"function"==typeof e.request&&"function"==typeof e.on&&"function"==typeof e.removeListener},t.DEFAULT_PROVIDER_ICON="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9IjMyIiBoZWlnaHQ9IjMyIiBmaWxsPSIjRkZGIi8+CjxwYXRoIGQ9Ik0xNiA4TDggMjRoMTZMMTYgOHoiIGZpbGw9IiMzMzMiLz4KPC9zdmc+Cg==";var r=[{flag:"isMetaMask",name:"MetaMask",rdns:"io.metamask"},{flag:"isCoinbaseWallet",name:"Coinbase Wallet",rdns:"com.coinbase.wallet"},{flag:"isWalletConnect",name:"WalletConnect",rdns:"com.walletconnect"},{flag:"isTrust",name:"Trust Wallet",rdns:"com.trustwallet"},{flag:"isBraveWallet",name:"Brave Wallet",rdns:"com.brave.wallet"},{flag:"isPhantom",name:"Phantom",rdns:"app.phantom"}]},6653(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PROVIDER_ICON=t.isValidProvider=t.detectInjectedProviderInfo=void 0;var n=r(1794);Object.defineProperty(t,"detectInjectedProviderInfo",{enumerable:!0,get:function(){return n.detectInjectedProviderInfo}}),Object.defineProperty(t,"isValidProvider",{enumerable:!0,get:function(){return n.isValidProvider}}),Object.defineProperty(t,"DEFAULT_PROVIDER_ICON",{enumerable:!0,get:function(){return n.DEFAULT_PROVIDER_ICON}})},5796(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.EventQueue=void 0;var s=r(9879),c=r(9629),u=r(3312),l=r(49),d=o(r(7688)),h=function(){},f=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];try{e.apply(void 0,t)}catch(e){}},p=65536,v=function(){function e(e,t){var r=this;this.queue=[],this.queueByteSize=0,this.payloadHashes=new Set,this.closed=!1,this.disposePageLeave=null,this.onPageLeave=function(e){var t=!1,r=!1,n=null;function i(){t||(t=!0,e(r),n=setTimeout(function(){n=null,t=!1},0))}var a=function(){r=!1,i()},o=function(){r=!0,i()},s=function(){t=!1},c=function(){r="hidden"!==document.visibilityState,i()},u=function(){r="hidden"!==document.visibilityState,"hidden"===document.visibilityState?i():t=!1},l=globalThis,d=document;return l.addEventListener("beforeunload",a),l.addEventListener("blur",o),l.addEventListener("focus",s),d.addEventListener("pagehide",c),d.addEventListener("visibilitychange",u),function(){n&&(clearTimeout(n),n=null),l.removeEventListener("beforeunload",a),l.removeEventListener("blur",o),l.removeEventListener("focus",s),d.removeEventListener("pagehide",c),d.removeEventListener("visibilitychange",u)}},t=t||{},this.queue=[],this.writeKey=e,this.apiHost=t.apiHost,this.canSend=t.canSend,this.retryCount=(0,c.clampNumber)(t.retryCount||3,5,1),this.flushAt=(0,c.clampNumber)(t.flushAt||20,20,1),this.maxQueueSize=(0,c.clampNumber)(t.maxQueueSize||512e3,512e3,200),this.flushIntervalMs=(0,c.clampNumber)(t.flushInterval||3e4,3e5,1e4),this.flushed=!1,this.errorHandler=t.errorHandler,this.pendingFlush=null,this.timer=null,this.disposePageLeave=this.onPageLeave(function(e){return i(r,void 0,void 0,function(){return a(this,function(t){switch(t.label){case 0:return!1!==e?[3,2]:[4,this.flush(void 0,!0)];case 1:t.sent(),t.label=2;case 2:return[2]}})})})}return e.prototype.generateMessageId=function(e){return i(this,void 0,void 0,function(){var t,r,i;return a(this,function(a){return t=(0,c.toDateHourMinute)(new Date(e.original_timestamp)),r=n(n({},e),{original_timestamp:t}),i=JSON.stringify(r),[2,(0,c.hash)(i)]})})},e.prototype.clear=function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this.queue=[],this.queueByteSize=0,this.payloadHashes.clear()},e.prototype.close=function(){this.closed=!0,this.clear(),this.disposePageLeave&&(f(this.disposePageLeave),this.disposePageLeave=null)},Object.defineProperty(e.prototype,"isClosed",{get:function(){return this.closed},enumerable:!1,configurable:!0}),e.prototype.enqueue=function(e,t){return i(this,void 0,void 0,function(){var r,i,o,s;return a(this,function(a){switch(a.label){case 0:return t=t||h,this.closed?[2]:this.canSend&&!this.canSend()?(this.clear(),[2]):[4,this.generateMessageId(e)];case 1:return r=a.sent(),this.closed?[2]:this.isDuplicate(r)?(u.logger.warn("Event already enqueued, try again after ".concat((0,c.millisecondsToSecond)(this.flushIntervalMs)," seconds.")),[2]):((i={message:n(n({},e),{message_id:r}),callback:t,byteSize:0}).byteSize=JSON.stringify({message:i.message}).length,this.queue.push(i),this.queueByteSize+=i.byteSize,u.logger.log("Event enqueued: ".concat((0,c.getActionDescriptor)(e.type,e.properties))),this.flushed?(o=this.queue.length>=this.flushAt,s=this.queueByteSize>=this.maxQueueSize,o||s?(this.flush(),[2]):(this.flushIntervalMs&&!this.timer&&(this.timer=setTimeout(this.flush.bind(this),this.flushIntervalMs)),[2])):(this.flushed=!0,this.flush(),[2]))}})})},e.prototype.flush=function(e){return i(this,arguments,void 0,function(e,t){var r,i,o,s,c,u,l,d=this;return void 0===t&&(t=!1),a(this,function(a){switch(a.label){case 0:return e=e||h,this.timer&&(clearTimeout(this.timer),this.timer=null),this.canSend&&!this.canSend()?(this.clear(),f(e),[2,Promise.resolve()]):this.queue.length?this.pendingFlush?t?[3,2]:[4,this.pendingFlush]:[3,2]:(f(e),[2,Promise.resolve()]);case 1:a.sent(),a.label=2;case 2:for(r=this.queue.splice(0,t?this.queue.length:this.flushAt),i=0,o=r;i<o.length;i++)s=o[i],this.payloadHashes.delete(s.message.message_id),this.queueByteSize-=s.byteSize;return 0===this.queue.length&&(this.queueByteSize=0),c=(new Date).toISOString(),u=r.map(function(e){return n(n({},e.message),{sent_at:c})}),l=this.splitIntoBatches(r,u),[2,this.pendingFlush=this.sendBatches(l,u).then(function(t){return t?(f(e,t,u),"function"==typeof d.errorHandler&&f(d.errorHandler,t)):f(e,void 0,u),Promise.resolve(u)}).catch(function(t){f(e,t,u),"function"==typeof d.errorHandler&&f(d.errorHandler,t)})]}})})},e.byteLength=function(e){return(new TextEncoder).encode(e).byteLength},e.prototype.splitIntoBatches=function(t,r){var n=JSON.stringify(r);if(e.byteLength(n)<=p)return[{data:r,items:t,keepalive:!0}];for(var i=[],a=[],o=[],s=2,c=0;c<r.length;c++){var u=r[c],l=e.byteLength(JSON.stringify(u)),d=s+(a.length>0?1:0)+l;d>p?(a.length>0&&i.push({data:a,items:o,keepalive:!0}),l+2>p?(i.push({data:[u],items:[t[c]],keepalive:!1}),a=[],o=[],s=2):(a=[u],o=[t[c]],s=2+l)):(a.push(u),o.push(t[c]),s=d)}return a.length>0&&i.push({data:a,items:o,keepalive:!0}),i},e.prototype.sendBatches=function(e,t){return i(this,void 0,void 0,function(){var r,n,i,o,s,c,u,h,p=this;return a(this,function(a){switch(a.label){case 0:n=0,i=e,a.label=1;case 1:if(!(n<i.length))return[3,6];if(o=i[n],this.canSend&&!this.canSend())return[3,6];a.label=2;case 2:return a.trys.push([2,4,,5]),s=JSON.stringify(o.data),[4,(0,d.default)("".concat(this.apiHost),{headers:(0,l.EVENTS_API_REQUEST_HEADER)(this.writeKey),method:"POST",body:s,keepalive:o.keepalive,retries:this.retryCount,retryDelay:function(e){return 1e3*Math.pow(2,e)},retryOn:function(e,t,r){return p.isErrorRetryable(t,r)}})];case 3:if(!(c=a.sent()).ok)throw(u=new Error(c.statusText||"HTTP ".concat(c.status))).response=c,u;return o.items.forEach(function(e){var r=e.message,n=e.callback;return f(n,void 0,r,t)}),[3,5];case 4:return h=a.sent(),r=r||h,o.items.forEach(function(e){var r=e.message,n=e.callback;return f(n,h,r,t)}),[3,5];case 5:return n++,[3,1];case 6:return[2,r]}})})},e.prototype.isErrorRetryable=function(e,t){var r,n;if(e&&(0,s.isNetworkError)(e))return!0;var i=null!==(r=null==t?void 0:t.status)&&void 0!==r?r:null===(n=null==e?void 0:e.response)||void 0===n?void 0:n.status;return!!i&&(i>=500&&i<=599||429===i)},e.prototype.isDuplicate=function(e){return!!this.payloadHashes.has(e)||(this.payloadHashes.add(e),!1)},e}();t.EventQueue=v},4203(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(5796),t),i(r(4407),t)},4407(e,t){Object.defineProperty(t,"__esModule",{value:!0})},5896(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.FormoAnalyticsSession=t.SESSION_WALLET_IDENTIFIED_KEY=t.SESSION_WALLET_DETECTED_KEY=void 0;var i=r(6517),a=r(2257),o=r(3312);function s(e,t){if(void 0===t&&(t=new Set),void 0!==e&&"function"!=typeof e&&"symbol"!=typeof e){if(null===e)return"null";if("bigint"==typeof e)return"bigint:".concat(e.toString());if("number"==typeof e)return Number.isFinite(e)?JSON.stringify(e):"null";if("object"!=typeof e)return JSON.stringify(e);if(t.has(e))return'"[circular]"';t.add(e);try{var r=e.toJSON;if("function"==typeof r)return s(r.call(e),t);if(Array.isArray(e))return"[".concat(e.map(function(e){var r;return null!==(r=s(e,t))&&void 0!==r?r:"null"}).join(","),"]");for(var n=e,i=[],a=0,o=Object.keys(n).sort();a<o.length;a++){var c=o[a],u=s(n[c],t);void 0!==u&&i.push("".concat(JSON.stringify(c),":").concat(u))}return"{".concat(i.join(","),"}")}finally{t.delete(e)}}}function c(e){var t;if(e){var r;try{var n=s(e);if(void 0===n||"{}"===n)return;r=n}catch(e){return null===(t=o.logger.warn)||void 0===t||t.call(o.logger,"Session: failed to fingerprint identify properties",e),"nohash"}for(var i=2166136261,a=16777619,c=0;c<r.length;c++){var u=r.charCodeAt(c);i^=u,i=Math.imul(i,16777619),a^=u+c,a=Math.imul(a,2246822507)}return"".concat((i>>>0).toString(36)).concat((a>>>0).toString(36))}}function u(e){return encodeURIComponent(e).length}t.SESSION_WALLET_DETECTED_KEY="wallet-detected",t.SESSION_WALLET_IDENTIFIED_KEY="wallet-identified";var l=function(){function e(){}return e.prototype.generateIdentificationKey=function(e,t,r,n){return this.buildIdentificationKey(e,t,r,n).key},e.prototype.buildIdentificationKey=function(e,t,r,n){var i=c(n),a=[encodeURIComponent(e)];if(r||i){a.push(encodeURIComponent(t||"")),a.push(encodeURIComponent(r||""));var o=a.join(":");return i&&a.push(i),{key:a.join(":"),identityPrefix:o}}return t&&a.push(encodeURIComponent(t)),{key:a.join(":")}},e.prototype.isWalletDetected=function(e){var r;return((null===(r=(0,i.cookie)().get(t.SESSION_WALLET_DETECTED_KEY))||void 0===r?void 0:r.split(","))||[]).includes(e)},e.prototype.markWalletDetected=function(e){var r,o=(null===(r=(0,i.cookie)().get(t.SESSION_WALLET_DETECTED_KEY))||void 0===r?void 0:r.split(","))||[];o.includes(e)||(o.push(e),o.length>20&&o.splice(0,o.length-20),(0,i.cookie)().set(t.SESSION_WALLET_DETECTED_KEY,o.join(","),n({expires:new Date(Date.now()+864e5).toUTCString(),path:"/"},(0,a.getIdentityCookieSecurity)())))},e.prototype.isWalletIdentified=function(e,r,n,a){var s=this.generateIdentificationKey(e,r,n,a),c=(0,i.cookie)().get(t.SESSION_WALLET_IDENTIFIED_KEY),u=((null==c?void 0:c.split(","))||[]).includes(s);return o.logger.debug("Session: Checking wallet identification",{identifiedKey:s,isIdentified:u,hasRdns:!!r}),u},e.prototype.markWalletIdentified=function(e,r,s,c){var l,d=this.buildIdentificationKey(e,r,s,c),h=d.key,f=d.identityPrefix,p=(null===(l=(0,i.cookie)().get(t.SESSION_WALLET_IDENTIFIED_KEY))||void 0===l?void 0:l.split(","))||[];if(p.includes(h))o.logger.info("Session: Wallet already marked as identified",{identifiedKey:h,existingWallets:p,hasRdns:!!r});else{f&&(p=p.filter(function(e){return e!==f&&!e.startsWith("".concat(f,":"))})),p.push(h);for(var v=p.join(",");p.length>1&&u(v)>3584;)p.shift(),v=p.join(",");(0,i.cookie)().set(t.SESSION_WALLET_IDENTIFIED_KEY,v,n({expires:new Date(Date.now()+864e5).toUTCString(),path:"/"},(0,a.getIdentityCookieSecurity)())),o.logger.debug("Session: Marked wallet as identified",{identifiedKey:h,hasRdns:!!r})}},e}();t.FormoAnalyticsSession=l},1951(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.SolanaManager=void 0;var n=r(3312),i=r(8898),a=function(){function e(e,t){this.formo=e,(null==t?void 0:t.store)?(n.logger.info("SolanaManager: Initializing store-based Solana tracking"),this.storeHandler=new i.SolanaStoreHandler(e,t.store,{cluster:t.cluster})):(null==t?void 0:t.cluster)&&(this.pendingCluster=t.cluster)}return e.prototype.setStore=function(e,t){var r;null===(r=this.storeHandler)||void 0===r||r.cleanup(),this.storeHandler=new i.SolanaStoreHandler(this.formo,e,{cluster:(null==t?void 0:t.cluster)||this.pendingCluster}),this.pendingCluster=void 0},e.prototype.setCluster=function(e){this.storeHandler?this.storeHandler.setCluster(e):this.pendingCluster=e},e.prototype.cleanup=function(){var e;null===(e=this.storeHandler)||void 0===e||e.cleanup(),this.storeHandler=void 0},e}();t.SolanaManager=a},8898(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.SolanaStoreHandler=void 0;var i=r(4164),a=r(3312),o=r(9485),s=r(3236);function c(e,t,r){if(void 0===t&&(t=1e3),void 0===r&&(r=500),e.size>t)for(var n=Array.from(e),i=0;i<r&&i<n.length;i++)e.delete(n[i])}var u=function(){function e(e,t,r){this.unsubscribers=[],this.lastWalletStatus="disconnected",this.processedTransactions=new Set,this.startedTransactions=new Set,this.transactionSenders=new Map,this.formo=e,this.store=t,this.explicitCluster=!!(null==r?void 0:r.cluster),this.cluster=(null==r?void 0:r.cluster)||this.detectClusterFromStore(t)||"mainnet-beta",this.chainId=o.SOLANA_CHAIN_IDS[this.cluster],a.logger.info("SolanaStoreHandler: Initializing framework-kit store integration",{cluster:this.cluster,chainId:this.chainId}),this.setupWalletSubscription(),this.setupTransactionSubscription(),this.setupClusterSubscription(),this.checkInitialWalletState()}return e.prototype.setCluster=function(e){this.explicitCluster=!0;var t=this.cluster;this.cluster=e,this.chainId=o.SOLANA_CHAIN_IDS[e],t!==e&&this.lastAddress&&(this.lastChainId=this.chainId,this.formo.isAutocaptureEnabled("chain")&&this.formo.chain({chainId:this.chainId,address:this.lastAddress}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting chain event",e)}))},e.prototype.getChainId=function(){return this.chainId},e.prototype.resolveCurrentChainId=function(){if(!this.explicitCluster){var e=this.detectClusterFromStore(this.store);e&&(this.cluster=e,this.chainId=o.SOLANA_CHAIN_IDS[e])}return this.chainId},e.prototype.setupWalletSubscription=function(){var e=this,t=this.store.getState().wallet,r=this.store.subscribe(function(r){var n=r.wallet;if(n!==t){var i=t;t=n,e.handleWalletChange(n,i)}});this.unsubscribers.push(r),a.logger.info("SolanaStoreHandler: Wallet subscription set up")},e.prototype.checkInitialWalletState=function(){var e,t=this.store.getState().wallet;if("connected"===t.status){var r=t.session.account.address;if(r&&!(0,s.isBlockedSolanaAddress)(r)&&(this.lastWalletStatus="connected",this.lastAddress=r,this.lastChainId=this.chainId,a.logger.info("SolanaStoreHandler: Already connected on initialization",{address:r,chainId:this.chainId}),this.formo.isAutocaptureEnabled("connect"))){var n=(null===(e=t.session.connector)||void 0===e?void 0:e.name)||t.connectorId;this.formo.connect({chainId:this.chainId,address:r},{providerName:n,rdns:"sol.wallet.".concat(n.toLowerCase().replace(/\s+/g,""))}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting initial connect",e)})}}this.lastWalletStatus=t.status},e.prototype.handleWalletChange=function(e,t){if("connected"===t.status&&"connected"!==e.status&&this.handleDisconnect(),"connected"===e.status&&"connected"!==t.status)this.handleConnect(e);else if("connected"===e.status&&"connected"===t.status){var r=e.session.account.address!==t.session.account.address,n=e.connectorId!==t.connectorId;(r||n)&&(this.handleDisconnect(),this.handleConnect(e))}this.lastWalletStatus=e.status},e.prototype.handleConnect=function(e){var t,r=e.session.account.address;if(r&&!(0,s.isBlockedSolanaAddress)(r)){var n=this.resolveCurrentChainId();if(this.lastAddress=r,this.lastChainId=n,a.logger.info("SolanaStoreHandler: Wallet connected",{address:r,chainId:n,connector:e.connectorId}),this.formo.isAutocaptureEnabled("connect")){var i=(null===(t=e.session.connector)||void 0===t?void 0:t.name)||e.connectorId;this.formo.connect({chainId:n,address:r},{providerName:i,rdns:"sol.wallet.".concat(i.toLowerCase().replace(/\s+/g,""))}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting connect",e)})}}},e.prototype.handleDisconnect=function(){this.lastAddress&&(a.logger.info("SolanaStoreHandler: Wallet disconnected",{address:this.lastAddress,chainId:this.lastChainId}),this.formo.isAutocaptureEnabled("disconnect")&&this.formo.disconnect({chainId:this.lastChainId,address:this.lastAddress}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting disconnect",e)}),this.lastAddress=void 0,this.lastChainId=void 0)},e.prototype.setupClusterSubscription=function(){var e=this,t=this.store.getState().cluster.endpoint,r=this.store.subscribe(function(r){var n=r.cluster.endpoint;n!==t&&(t=n,e.handleClusterChange(n))});this.unsubscribers.push(r),a.logger.info("SolanaStoreHandler: Cluster subscription set up")},e.prototype.handleClusterChange=function(e){if(!this.explicitCluster){var t=this.detectClusterFromEndpoint(e);if(t){var r=this.cluster;t!==r&&(this.cluster=t,this.chainId=o.SOLANA_CHAIN_IDS[t],a.logger.info("SolanaStoreHandler: Cluster changed",{from:r,to:t,chainId:this.chainId}),this.lastAddress&&(this.lastChainId=this.chainId,this.formo.isAutocaptureEnabled("chain")&&this.formo.chain({chainId:this.chainId,address:this.lastAddress}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting chain event",e)})))}}},e.prototype.setupTransactionSubscription=function(){var e=this,t=this.store.getState().transactions,r=this.store.subscribe(function(r){var n=r.transactions;if(n!==t){var i=t;t=n,e.handleTransactionChanges(n,i)}});this.unsubscribers.push(r),a.logger.info("SolanaStoreHandler: Transaction subscription set up")},e.prototype.handleTransactionChanges=function(e,t){for(var r,n=0,i=Object.entries(e);n<i.length;n++){var a=i[n],o=a[0],s=a[1],c=t[o];if(!c||c.status!==s.status){var u=this.lastAddress||(null===(r=this.transactionSenders.get(o))||void 0===r?void 0:r.address);u&&this.handleTransactionStatusChange(o,s,c,u)}}},e.prototype.handleTransactionStatusChange=function(e,t,r,o){var s=this.chainId,u="".concat(e,":").concat(t.status);if(!this.processedTransactions.has(u)&&(this.processedTransactions.add(u),c(this.processedTransactions),this.formo.isAutocaptureEnabled("transaction")))switch(t.status){case"sending":this.startedTransactions.has(e)||(this.startedTransactions.add(e),c(this.startedTransactions),this.transactionSenders.set(e,{address:o,chainId:s}),this.formo.transaction({status:i.TransactionStatus.STARTED,chainId:s,address:o}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting transaction STARTED",e)}));break;case"waiting":if(f=t.signature){this.transactionSenders.has(e)||this.transactionSenders.set(e,{address:o,chainId:s});var l=this.transactionSenders.get(e);this.formo.transaction({status:i.TransactionStatus.BROADCASTED,chainId:l.chainId,address:l.address,transactionHash:f}).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting transaction BROADCASTED",e)})}break;case"confirmed":var d=(null==(l=this.transactionSenders.get(e))?void 0:l.address)||o,h=(null==l?void 0:l.chainId)||s,f=t.signature;a.logger.info("SolanaStoreHandler: Transaction confirmed",{key:e,signature:f}),this.formo.transaction(n({status:i.TransactionStatus.CONFIRMED,chainId:h,address:d},f&&{transactionHash:f})).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting transaction CONFIRMED",e)}),this.transactionSenders.delete(e);break;case"failed":d=(null==(l=this.transactionSenders.get(e))?void 0:l.address)||o,h=(null==l?void 0:l.chainId)||s,f=t.signature;var p=null==r?void 0:r.status,v="waiting"===p?i.TransactionStatus.REVERTED:i.TransactionStatus.REJECTED;a.logger.info("SolanaStoreHandler: Transaction failed",{key:e,signature:f,status:v,prevStatus:p}),this.formo.transaction(n({status:v,chainId:h,address:d},f&&{transactionHash:f})).catch(function(e){a.logger.error("SolanaStoreHandler: Error emitting transaction event",e)}),this.transactionSenders.delete(e)}},e.prototype.detectClusterFromStore=function(e){try{var t=e.getState().cluster.endpoint;return this.detectClusterFromEndpoint(t)}catch(e){return null}},e.prototype.detectClusterFromEndpoint=function(e){if(!e)return null;var t=e.toLowerCase();return t.includes("devnet")?"devnet":t.includes("testnet")?"testnet":t.includes("localhost")||t.includes("127.0.0.1")?"localnet":t.includes("mainnet")?"mainnet-beta":null},e.prototype.cleanup=function(){a.logger.debug("SolanaStoreHandler: Cleaning up");for(var e=0,t=this.unsubscribers;e<t.length;e++){var r=t[e];try{r()}catch(e){a.logger.error("SolanaStoreHandler: Error during cleanup",e)}}this.unsubscribers=[],this.processedTransactions.clear(),this.startedTransactions.clear(),this.transactionSenders.clear(),this.lastAddress=void 0,this.lastChainId=void 0,a.logger.debug("SolanaStoreHandler: Cleanup complete")},e}();t.SolanaStoreHandler=u},3236(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.SOLANA_SYSTEM_ADDRESSES=void 0,t.isSolanaAddress=n,t.getValidSolanaAddress=i,t.isSolanaSystemAddress=a,t.isBlockedSolanaAddress=function(e){var t=i(e);return!!t&&!!a(t)},t.publicKeyToAddress=function(e){if(!e)return null;try{var t=e.toBase58();return n(t)?t:null}catch(e){return null}},t.areSolanaAddressesEqual=function(e,t){var r=i(e),n=i(t);return!(!r||!n)&&r===n};var r=new Set("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function n(e){if("string"!=typeof e)return!1;var t=e.trim();return!(t.length<32||t.length>44)&&function(e){for(var t=0;t<e.length;t++)if(!r.has(e[t]))return!1;return!0}(t)}function i(e){if(!e)return null;if("object"==typeof e&&"toBase58"in e)try{var t=e.toBase58();return n(t)?t:null}catch(e){return null}if("string"==typeof e){var r=e.trim();return n(r)?r:null}return null}function a(e){var r=i(e);return!!r&&Object.values(t.SOLANA_SYSTEM_ADDRESSES).includes(r)}t.SOLANA_SYSTEM_ADDRESSES={SYSTEM_PROGRAM:"11111111111111111111111111111111",TOKEN_PROGRAM:"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",TOKEN_2022_PROGRAM:"TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb",ASSOCIATED_TOKEN_PROGRAM:"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",RENT_SYSVAR:"SysvarRent111111111111111111111111111111111",CLOCK_SYSVAR:"SysvarC1ock11111111111111111111111111111111"}},9308(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.SolanaManager=t.SolanaStoreHandler=void 0;var a=r(8898);Object.defineProperty(t,"SolanaStoreHandler",{enumerable:!0,get:function(){return a.SolanaStoreHandler}});var o=r(1951);Object.defineProperty(t,"SolanaManager",{enumerable:!0,get:function(){return o.SolanaManager}}),i(r(9485),t),i(r(6720),t),i(r(3236),t)},6720(e,t){Object.defineProperty(t,"__esModule",{value:!0})},9485(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_SOLANA_CHAIN_ID=t.SOLANA_CLUSTERS_BY_ID=t.SOLANA_CHAIN_IDS=void 0,t.isSolanaChainId=function(e){return null!=e&&Object.values(t.SOLANA_CHAIN_IDS).includes(e)},t.SOLANA_CHAIN_IDS={"mainnet-beta":900001,testnet:900002,devnet:900003,localnet:900004},t.SOLANA_CLUSTERS_BY_ID={900001:"mainnet-beta",900002:"testnet",900003:"devnet",900004:"localnet"},t.DEFAULT_SOLANA_CHAIN_ID=t.SOLANA_CHAIN_IDS["mainnet-beta"]},2073(e,t,r){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.StorageManager=void 0;var i=r(3312),a=n(r(8410)),o=n(r(7363)),s=n(r(7772)),c=["cookieStorage","localStorage","sessionStorage","memoryStorage"],u=function(){function e(e){this.writeKey=e,this.storages=new Map}return e.prototype.getStorage=function(e){if(!this.storages.has(e)){for(var t=this.createStorage(e),r=e;!t.isAvailable();){var n=c.indexOf(r);if(-1===n||n+1>=c.length){t=this.createStorage("memoryStorage");break}var a=r;r=c[n+1],i.logger.warn("Storage ".concat(a," is not available, trying ").concat(r)),t=this.createStorage(r)}this.storages.set(e,t)}return this.storages.get(e)},e.prototype.createStorage=function(e){switch(e){case"cookieStorage":return new a.default(this.writeKey);case"localStorage":case"sessionStorage":return new s.default(this.writeKey,this.getWebStorage(e));default:return new o.default(this.writeKey)}},e.prototype.getWebStorage=function(e){try{var t="localStorage"===e?localStorage:sessionStorage;return null!=t?t:null}catch(e){return null}},e}();t.StorageManager=u},701(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(9693),i=r(625),a=function(){function e(e){this.writeKey=e}return e.prototype.getKey=function(e){return"".concat(n.KEY_PREFIX,"_").concat((0,i.secureHash)(this.writeKey),"_").concat(e)},e}();t.default=a},8410(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=a(r(701)),s=r(9037),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.prototype.isAvailable=function(){return"undefined"!=typeof document&&"string"==typeof document.cookie},t.prototype.set=function(e,t,r){var n=null==r?void 0:r.expires,i=null==r?void 0:r.maxAge,a=(null==r?void 0:r.path)||"/",o=(null==r?void 0:r.domain)||"",c=null==r?void 0:r.sameSite,u=(null==r?void 0:r.secure)||!1,l=encodeURIComponent(this.getKey(e));if(o)document.cookie="".concat(l,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=").concat(a,";");else{var d=(0,s.getApexDomain)();d&&(document.cookie="".concat(l,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=").concat(a,"; domain=.").concat(d))}var h="".concat(l,"=").concat(encodeURIComponent(t));i?h+="; max-age="+i:n&&(h+="; expires="+n),a&&(h+="; path="+a),o&&(h+="; domain="+o),c&&(h+="; samesite="+c),u&&(h+="; secure"),document.cookie=h},t.prototype.get=function(e){var t=document.cookie.match(new RegExp("(?:^|; )".concat(encodeURIComponent(this.getKey(e)),"=([^;]*)")));return t?decodeURIComponent(t[1]):null},t.prototype.remove=function(e){var t=encodeURIComponent(this.getKey(e));document.cookie="".concat(t,"=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT");var r=(0,s.getApexDomain)();r&&(document.cookie="".concat(t,"=; path=/; domain=.").concat(r,"; expires=Thu, 01 Jan 1970 00:00:00 GMT"))},t}(o.default);t.default=c},7363(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.memoryStorage={},t}return i(t,e),t.prototype.isAvailable=function(){return!0},t.prototype.set=function(e,t){this.memoryStorage[this.getKey(e)]=t},t.prototype.get=function(e){return this.memoryStorage[this.getKey(e)]||null},t.prototype.remove=function(e){delete this.memoryStorage[this.getKey(e)]},t}(a(r(701)).default);t.default=o},7772(e,t,r){var n,i=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=r(3312),s=r(9693),c=function(e){function t(t,r){var n=e.call(this,t)||this;return n.backend=r,n}return i(t,e),t.prototype.isAvailable=function(){try{var e="__storage_test__";return this.backend.setItem(e,"1"),this.backend.removeItem(e),!0}catch(e){return!1}},t.prototype.set=function(e,t){"boolean"==typeof t&&(t=!0===t?"true":"false"),"object"==typeof t&&(t=s.JSON_PREFIX+JSON.stringify(t)),this.backend.setItem(this.getKey(e),t)},t.prototype.get=function(e){var t=this.backend.getItem(this.getKey(e));if(!t||"string"!=typeof t)return null;if(["null","undefined"].some(function(e){return e==t}))return null;if(t.startsWith(s.JSON_PREFIX))try{return JSON.parse(t.slice(s.JSON_PREFIX.length))}catch(e){return o.logger.error("[FORMO_ERROR] ".concat(this.backend.constructor.name," failed to parse JSON"),e),null}return["true","false"].some(function(e){return e==t})?JSON.parse(t):t},t.prototype.remove=function(e){this.backend.removeItem(this.getKey(e))},t}(a(r(701)).default);t.default=c},9693(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.KEY_PREFIX=t.JSON_PREFIX=void 0,t.JSON_PREFIX="__json=",t.KEY_PREFIX="formo"},2257(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getIdentityCookieDomain=function(e){if(void 0===e&&(e=!0),!e)return"";var t=(0,n.getApexDomain)();return t?".".concat(t):""},t.getIdentityCookieSecurity=function(){var e;return{sameSite:"lax",secure:"undefined"!=typeof window&&"https:"===(null===(e=window.location)||void 0===e?void 0:e.protocol)}};var n=r(9037)},6517(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.memory=t.session=t.local=t.cookie=void 0,t.initStorageManager=function(e){o||(o=new a.StorageManager(e))};var a=r(2073);i(r(2305),t);var o=null;function s(e){if(!o)throw new Error("StorageManager not initialized. Call initStorageManager(writeKey) first.");return o.getStorage(e)}t.cookie=function(){return s("cookieStorage")},t.local=function(){return s("localStorage")},t.session=function(){return s("sessionStorage")},t.memory=function(){return s("memoryStorage")}},2305(e,t){Object.defineProperty(t,"__esModule",{value:!0})},8834(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.TrackingPolicy=void 0;var n=r(4586),i=r(9879),a=function(){function e(e){this.deps=e}return e.prototype.trackingOptions=function(){var e=this.deps.options().tracking;return null===e||"object"!=typeof e||Array.isArray(e)?null:e},e.prototype.isTrackingSuppressed=function(){return this.deps.hasOptedOut()||this.isEnvironmentExcluded()},e.prototype.isEnvironmentExcluded=function(){return this.isTimezoneExcluded()||this.isHostExcluded()||this.isPathExcluded()},e.prototype.isHostExcluded=function(){var e=this.trackingOptions();if(!e)return!1;if("undefined"==typeof window)return!1;var t=e.excludeHosts;return(void 0===t?[]:t).includes(window.location.hostname)},e.prototype.isPathExcluded=function(){var e=this.trackingOptions();if(!e)return!1;if("undefined"==typeof window)return!1;var t=e.excludePaths;return(void 0===t?[]:t).includes(window.location.pathname)},e.prototype.isTimezoneExcluded=function(){var e=this.trackingOptions();if(!e)return!1;var t=e.excludeTimezones,r=void 0===t?[]:t;if(0===r.length)return!1;var i=(0,n.getTimezone)();if(!i)return!1;var a=i.toLowerCase();return r.some(function(e){return"string"==typeof e&&e.toLowerCase()===a})},e.prototype.isPageExcluded=function(){return this.isHostExcluded()||this.isPathExcluded()},e.prototype.isPersistedIdentityPurgeRequired=function(){return this.deps.hasOptedOut()||this.isTimezoneExcluded()},e.prototype.isChainExcluded=function(e){var t=this.trackingOptions();if(!t)return!1;var r=t.excludeChains,n=void 0===r?[]:r;return 0!==n.length&&this.isChainRefused(n,e)},e.prototype.isChainRefused=function(e,t){var r,n=null!==(r=null==t?void 0:t.chainId)&&void 0!==r?r:this.deps.currentChainId();return 0===n||void 0!==n&&e.includes(n)},e.prototype.shouldTrack=function(e){if(this.deps.hasOptedOut())return!1;var t=this.deps.options().tracking;if("boolean"==typeof t)return t;var r=this.trackingOptions();if(r){if(this.isEnvironmentExcluded())return!1;var n=r.excludeChains,a=void 0===n?[]:n;return!(a.length>0&&this.isChainRefused(a,e))}return!(0,i.isLocalhost)()},e.prototype.isAutocaptureEnabled=function(e){var t=this.deps.options().autocapture;return void 0===t||("boolean"==typeof t?t:null===t||"object"!=typeof t||!1!==t[e])},e}();t.TrackingPolicy=a},4312(e,t){Object.defineProperty(t,"__esModule",{value:!0})},4164(e,t){var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionStatus=t.SignatureStatus=void 0,function(e){e.REQUESTED="requested",e.REJECTED="rejected",e.CONFIRMED="confirmed"}(r||(t.SignatureStatus=r={})),function(e){e.STARTED="started",e.REJECTED="rejected",e.BROADCASTED="broadcasted",e.CONFIRMED="confirmed",e.REVERTED="reverted"}(n||(t.TransactionStatus=n={}))},2657(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4312),t),i(r(4164),t),i(r(7896),t)},7896(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.WRAPPED_REQUEST_REF_SYMBOL=t.WRAPPED_REQUEST_SYMBOL=void 0,t.WRAPPED_REQUEST_SYMBOL=Symbol("formoWrappedRequest"),t.WRAPPED_REQUEST_REF_SYMBOL=Symbol("formoWrappedRequestRef")},4657(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.validateAddress=t.validateAndChecksumAddress=t.toChecksumAddress=t.isBlockedAddress=t.getValidAddress=t.isValidAddress=void 0;var n=r(5628),i=r(7393),a=r(9879),o=r(1592),s=r(49),c=r(3236),u=r(9485),l=function(e){return"string"==typeof e&&""!==e.trim()&&(0,a.isAddress)(e.trim())?e.trim():null};t.isValidAddress=function(e){return null!==l(e)},t.getValidAddress=function(e){return l(e)},t.isBlockedAddress=function(e){if(!e||"string"!=typeof e)return!1;var t=e.trim().toLowerCase();return!(!t||!t.startsWith("0x")||42!==t.length)&&s.BLOCKED_ADDRESSES.some(function(e){return e.toLowerCase()===t})},t.toChecksumAddress=function(e){if(!(0,a.isAddress)(e,!1))throw new Error("Invalid address "+e);var t=e.toLowerCase().replace(/^0x/i,""),r=(0,a.uint8ArrayToHexString)((0,n.keccak256)((0,a.ensureIfUint8Array)((0,i.utf8ToBytes)(t))));if((0,o.isNullish)(r)||"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"===r)return"";for(var s="0x",c=r.replace(/^0x/i,""),u=0;u<t.length;u+=1)parseInt(c[u],16)>7?s+=t[u].toUpperCase():s+=t[u];return s},t.validateAndChecksumAddress=function(e){var r=(0,t.getValidAddress)(e);return r?(0,t.toChecksumAddress)(r):void 0},t.validateAddress=function(e,r){var n=Object.values(u.SOLANA_CHAIN_IDS);return null!=r&&n.includes(r)?(0,c.getValidSolanaAddress)(e)||void 0:null!=r?(0,t.validateAndChecksumAddress)(e):(0,t.validateAndChecksumAddress)(e)||(0,c.isSolanaAddress)(e)&&(0,c.getValidSolanaAddress)(e)||void 0}},7916(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getActionDescriptor=void 0,t.getActionDescriptor=function(e,t){var r=e;return(null==t?void 0:t.status)&&(r+=" ".concat(t.status)),"connect"!==e&&"disconnect"!==e||!(null==t?void 0:t.rdns)||(r+=" (".concat(t.rdns,")")),r}},7392(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.parseChainId=function(e){return"string"!=typeof e?0:e.startsWith("0x")||e.startsWith("0X")?parseInt(e,16):parseInt(e,10)}},1349(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.clampNumber=t.toDateHourMinute=t.millisecondsToSecond=void 0,t.toSnakeCase=function(e,t){void 0===t&&(t=[]);var r=function(e){return Array.isArray(e)?e.map(r):null!==e&&"object"==typeof e?Object.keys(e).reduce(function(n,i){return n[t.includes(i)?i:i.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toLowerCase()]=t.includes(i)?e[i]:r(e[i]),n},{}):e};return r(e)},t.millisecondsToSecond=function(e){return Math.ceil(e/1e3)},t.toDateHourMinute=function(e){return e.getUTCFullYear()+"-"+("0"+(e.getUTCMonth()+1)).slice(-2)+"-"+("0"+e.getUTCDate()).slice(-2)+" "+("0"+e.getUTCHours()).slice(-2)+":"+("0"+e.getUTCMinutes()).slice(-2)},t.clampNumber=function(e,t,r){return Math.min(Math.max(e,r),t)}},9037(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getApexDomain=function(){if("undefined"==typeof window)return null;if(void 0!==r)return r;var e=window.location.hostname;if("localhost"===e||/^\d+\.\d+\.\d+\.\d+$/.test(e))return r=null,null;var t=e.split(".");if(t.length<2)return r=null,null;for(var n=2;n<=t.length;n++){var a=t.slice(-n).join(".");if(i(a))return r=a,a}return r=null,null},t._resetApexDomainCache=function(){r=void 0};var r,n="__formo_domain_probe";function i(e){var t="probe";document.cookie="".concat(n,"=").concat(t,"; domain=.").concat(e,"; path=/; max-age=10");var r=-1!==document.cookie.indexOf("".concat(n,"=").concat(t));return document.cookie="".concat(n,"=; domain=.").concat(e,"; path=/; max-age=0"),r}},6262(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.hash=function(e){return n(this,void 0,void 0,function(){var t,r;return i(this,function(n){return t=(0,o.utf8ToBytes)(e),r=(0,a.sha256)(t),[2,(0,o.bytesToHex)(r)]})})},t.generateNativeUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues){var e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;var t=Array.from(e).map(function(e){return e.toString(16).padStart(2,"0")}).join("");return"".concat(t.slice(0,8),"-").concat(t.slice(8,12),"-").concat(t.slice(12,16),"-").concat(t.slice(16,20),"-").concat(t.slice(20))}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})};var a=r(6997),o=r(7393)},625(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.secureHash=function(e){var t=(0,i.utf8ToBytes)(e),r=(0,n.sha256)(t);return(0,i.bytesToHex)(r).slice(0,8)};var n=r(6997),i=r(7393)},9629(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(4657),t),i(r(7916),t),i(r(1349),t),i(r(6262),t),i(r(625),t),i(r(4586),t)},2817(e,t){function r(e,t){var r=null!=e?e:{},i=null!=t?t:{},a={};for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(a[o]=Object.prototype.hasOwnProperty.call(i,o)?n(r[o],i[o]):r[o]);for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(Object.prototype.hasOwnProperty.call(a,o)||(a[o]=i[o]));return a}function n(e,t){return i(e)&&i(t)?r(e,t):t}function i(e){return"[object Object]"===Object.prototype.toString.call(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.mergeDeepRight=r,t.default=r},8081(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getFormattedTimestamp=t.getCurrentTimeFormatted=void 0;var r=function(e){return e.toISOString()};t.getFormattedTimestamp=r,t.getCurrentTimeFormatted=function(){return r(new Date)}},4586(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getTimezone=void 0;var n=r(3312);t.getTimezone=function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||""}catch(e){return n.logger.error("Error resolving timezone:",e),""}}},8939(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.checkAddressChecksum=t.isAddress=void 0,t.ensureIfUint8Array=s;var n=r(9874),i=r(5628),a=r(7393),o=r(8090);function s(e){var t;return e instanceof Uint8Array||"Uint8Array"!==(null===(t=null==e?void 0:e.constructor)||void 0===t?void 0:t.name)?e:Uint8Array.from(e)}t.isAddress=function(e,r){return void 0===r&&(r=!0),!("string"!=typeof e&&!(0,n.isUint8Array)(e))&&(i=(0,n.isUint8Array)(e)?(0,n.uint8ArrayToHexString)(e):"string"!=typeof e||(0,o.isHexStrict)(e)||e.toLowerCase().startsWith("0x")?e:"0x".concat(e),!!/^(0x)?[0-9a-f]{40}$/i.test(i)&&(!(!/^(0x|0X)?[0-9a-f]{40}$/.test(i)&&!/^(0x|0X)?[0-9A-F]{40}$/.test(i))||!r||(0,t.checkAddressChecksum)(i)));var i},t.checkAddressChecksum=function(e){if(!/^(0x)?[0-9a-f]{40}$/i.test(e))return!1;for(var t=e.slice(2),r=(0,a.utf8ToBytes)(t.toLowerCase()),o=(0,n.uint8ArrayToHexString)((0,i.keccak256)(s(r))).slice(2),c=0;c<40;c+=1)if(parseInt(o[c],16)>7&&t[c].toUpperCase()!==t[c]||parseInt(o[c],16)<=7&&t[c].toLowerCase()!==t[c])return!1;return!0}},2886(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isLocalhost=void 0,t.isLocalhost=function(){return/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*:)*?:?0*1$/.test(window.location.hostname)||"file:"===window.location.protocol}},9090(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.objectToString=t.isPrimitive=t.isError=t.isDate=t.isRegExp=t.isObjectAndNotNull=t.isObject=t.isNumber=t.isBoolean=t.isArray=t.isBigInt=t.isDefinedNotNullAndNotEmptyString=t.isDefinedAndNotNull=t.isDefined=t.isTypeOfError=t.isNullOrUndefined=t.isUndefined=t.isNull=t.isString=t.isFunction=void 0,t.isFunction=function(e){return"function"==typeof e&&Boolean(e.constructor&&e.call&&e.apply)},t.isString=function(e){return"string"==typeof e};var r=function(e){return null===e};t.isNull=r;var n=function(e){return void 0===e};t.isUndefined=n;var i=function(e){return r(e)||n(e)};t.isNullOrUndefined=i,t.isBigInt=function(e){return"bigint"==typeof e},t.isDefined=function(e){return!n(e)};var a=function(e){return!i(e)};t.isDefinedAndNotNull=a,t.isDefinedNotNullAndNotEmptyString=function(e){return a(e)&&""!==e},t.isTypeOfError=function(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":return!0;default:return e instanceof Error}};var o=function(e){return Array.isArray(e)};t.isArray=o,t.isBoolean=function(e){return"boolean"==typeof e},t.isNumber=function(e){return"number"==typeof e};var s=function(e){return"object"==typeof e};t.isObject=s,t.isObjectAndNotNull=function(e){return!r(e)&&s(e)&&!o(e)},t.isRegExp=function(e){return s(e)&&"[object RegExp]"===c(e)},t.isDate=function(e){return s(e)&&"[object Date]"===c(e)},t.isError=function(e){return s(e)&&("[object Error]"===c(e)||e instanceof Error)},t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e};var c=function(e){return Object.prototype.toString.call(e)};t.objectToString=c},9879(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),i(r(8939),t),i(r(2886),t),i(r(9090),t),i(r(2921),t),i(r(1592),t),i(r(8090),t),i(r(9874),t)},2921(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNetworkError=function(e){return!(!e||(t=e,a=r.call(t),"[object Error]"!==a&&"[object DOMException]"!==a)||!n.has(e.name)||"string"!=typeof e.message)&&("Load failed"===e.message?void 0===e.stack:i.has(e.message));var t,a};var r=Object.prototype.toString,n=new Set(["TypeError","TimeoutError","NetworkError"]),i=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated","The operation was aborted due to timeout"])},1592(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isNullish=void 0,t.isNullish=function(e){return null==e}},8090(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isHexStrict=void 0,t.isHexStrict=function(e){return"string"==typeof e&&/^((-)?0x[0-9a-f]+|(0x))$/i.test(e)}},9874(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.isUint8Array=function(e){var t,r;return e instanceof Uint8Array||"Uint8Array"===(null===(t=null==e?void 0:e.constructor)||void 0===t?void 0:t.name)||"Buffer"===(null===(r=null==e?void 0:e.constructor)||void 0===r?void 0:r.name)},t.uint8ArrayToHexString=function(e){for(var t="0x",r=0,n=e;r<n.length;r++){var i=n[r].toString(16);t+=1===i.length?"0".concat(i):i}return t}},5479(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.version=void 0,t.version="1.36.0"},8788(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,a){function o(e){try{c(n.next(e))}catch(e){a(e)}}function s(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,s)}c((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(c){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,n=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){a.label=s[1];break}if(6===s[0]&&a.label<i[1]){a.label=i[1],i=s;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(s);break}i[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WagmiEventHandler=t.MARKER_GRACE_MS=void 0,t.__resetSeededWallet=function(){v.clear(),b.forEach(function(e){return clearTimeout(e)}),b.clear(),m.clear(),l.clear(),f.clear(),p.forEach(function(e){return clearTimeout(e)}),p.clear()};var o=r(4164),s=r(3312),c=r(5170),u=new Set(["status","chainId","address","data","to","value","transactionHash","function_name","function_args"]),l=new Set,d=new WeakMap,h=function(e,t){return"".concat(e,":").concat(t.toLowerCase())};t.MARKER_GRACE_MS=3e3;var f=new Map,p=new Map,v=new Map,g=new WeakMap,y=0,m=new Map,b=new Map;function A(e,t){var r;return t&&(null===(r=d.get(t))||void 0===r?void 0:r.has(e))?"exact":l.has(e)?"recent":"none"}function S(e,t){var r;l.delete(e),t&&(null===(r=d.get(t))||void 0===r||r.delete(e))}function w(e,t){var r;if(t){var n=null!==(r=d.get(t))&&void 0!==r?r:new Set;n.add(e),d.set(t,n)}l.add(e)}function E(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("bigint"==typeof e)return Number(e);if("string"==typeof e&&""!==e.trim()){var t=(e.startsWith("0x"),Number(e));return Number.isFinite(t)?t:void 0}}function _(e){if("string"==typeof e)return e;if(e&&"object"==typeof e){var t=e.address;if("string"==typeof t)return t}}function C(e,t,r){if(void 0===t&&(t=1e3),void 0===r&&(r=500),e.size>t)for(var n=Array.from(e),i=0;i<r&&i<n.length;i++)e.delete(n[i])}var I=function(){function e(e,t,r){this.unsubscribers=[],this.trackingState={isProcessing:!1},this.disposed=!1,this.reconciling=!1,this.transitionGeneration=0,this.missedDisconnect=!1,this.processedMutations=new Set,this.processedQueries=new Set,this.formo=e,this.wagmiConfig=t,this.queryClient=r,s.logger.info("WagmiEventHandler: Initializing Wagmi integration");var n,i,a,o,c,u=this.pruneMarkersForLostWallets();!function(e,t){var r;if(f.set(e,(null!==(r=f.get(e))&&void 0!==r?r:0)+1),t){var n=p.get(e);n&&(clearTimeout(n),p.delete(e))}}(this.formo.writeKey,u),this.ownerKey=(n=this.formo.writeKey,i=t,(a=g.get(i))||(a="cfg".concat(y+=1),g.set(i,a)),"".concat(n,":").concat(a)),v.set(this.ownerKey,this),o=this.ownerKey,(c=b.get(o))&&(clearTimeout(c),b.delete(o)),this.setupConnectionListeners(),this.seedFromCurrentState(),this.queryClient?(this.setupMutationTracking(),this.setupQueryTracking()):s.logger.warn("WagmiEventHandler: QueryClient not provided, signature and transaction events will not be tracked")}return e.prototype.pruneMarkersForLostWallets=function(){var e,t=this;try{e=this.getState()}catch(e){return!1}var r="".concat(this.formo.writeKey,":"),n=new Set;e.connections.forEach(function(e){e.accounts.forEach(function(e){return n.add(h(t.formo.writeKey,e))})});var i=!1;return l.forEach(function(e){e.startsWith(r)&&(n.has(e)?i=!0:l.delete(e))}),i},Object.defineProperty(e.prototype,"isEmittingOwner",{get:function(){if(!this.ownerKey)return!0;var e=v.get(this.ownerKey);return e?e===this:(v.set(this.ownerKey,this),!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pendingTransactions",{get:function(){var e,t=null!==(e=this.ownerKey)&&void 0!==e?e:"",r=m.get(t);return r||(r=new Map,m.set(t,r)),r},enumerable:!1,configurable:!0}),e.prototype.setupConnectionListeners=function(){var e=this;s.logger.info("WagmiEventHandler: Setting up connection listeners");var t=this.wagmiConfig.subscribe(function(e){return e.status},function(t,r){e.handleStatusChange(t,r)});this.unsubscribers.push(t);var r=this.wagmiConfig.subscribe(function(t){var r;return null!==(r=e.getActiveConnectionChainId(t))&&void 0!==r?r:t.chainId},function(t,r){e.handleChainChange(t,r)});this.unsubscribers.push(r);var n=this.wagmiConfig.subscribe(function(t){var r,n;return"".concat(null!==(r=t.current)&&void 0!==r?r:"","|").concat(null!==(n=e.getConnectedAddress(t))&&void 0!==n?n:"")},function(t,r){var n=t.split("|")[1],i=(null!=r?r:"|").split("|")[1];e.handleActiveAddressChange(n||void 0,i||void 0)});this.unsubscribers.push(n),s.logger.info("WagmiEventHandler: Connection listeners set up successfully")},e.prototype.seedFromCurrentState=function(){var e,t;try{var r=this.getState();if("connected"!==r.status)return;var i=this.getConnectedAddress(r),a=null!==(e=this.getActiveConnectionChainId(r))&&void 0!==e?e:r.chainId;if(!i||void 0===a)return void s.logger.debug("WagmiEventHandler: Connected at init but address or chainId is missing, nothing to seed",{address:i,chainId:a});if(s.logger.info("WagmiEventHandler: Adopting connection that predates this handler",{address:i,chainId:a}),this.formo.syncWalletState({chainId:a,address:i}),(null===(t=this.formo.currentAddress)||void 0===t?void 0:t.toLowerCase())!==i.toLowerCase())return void s.logger.debug("WagmiEventHandler: Central state declined the connection, not seeding",{address:i,chainId:a});if(this.trackingState.lastAddress=i,this.trackingState.lastChainId=a,this.trackingState.lastStatus=r.status,this.trackingState.lastConnectionId=r.current,!this.formo.isAutocaptureEnabled("connect")||!this.isEmittingOwner)return void s.logger.debug("WagmiEventHandler: Connect autocapture disabled, adopted without emitting",{address:i,chainId:a});if(!this.formo.willTrackEvent(a))return void s.logger.debug("WagmiEventHandler: Connect would not be tracked, adopted without emitting",{address:i,chainId:a});var o=h(this.formo.writeKey,i),c=r.current?r.connections.get(r.current):void 0;if("none"!==A(o,c))return void s.logger.debug("WagmiEventHandler: Wallet already adopted this page load, not re-emitting connect",{address:i});w(o,c);var u=this.getConnectorName(r);Promise.resolve(this.formo.connect({chainId:a,address:i},n({},u&&{providerName:u}))).catch(function(e){S(o,c),s.logger.error("WagmiEventHandler: Error emitting seeded connect event:",e)})}catch(e){s.logger.error("WagmiEventHandler: Error seeding from current state:",e)}},e.prototype.restoreCentralStateFromTracking=function(){var e,t=this.trackingState,r=t.lastAddress,n=t.lastChainId;r&&void 0!==n&&((null===(e=this.formo.currentAddress)||void 0===e?void 0:e.toLowerCase())===r.toLowerCase()&&this.formo.currentChainId===n||(s.logger.info("WagmiEventHandler: Restoring central state a stale disconnect cleared",{address:r,chainId:n}),this.formo.syncWalletState({chainId:n,address:r})))},e.prototype.releaseTrackedWallet=function(){var e=this.trackingState.lastAddress;this.trackingState.lastAddress=void 0,this.trackingState.lastChainId=void 0,this.trackingState.lastConnectionId=void 0,e&&l.delete(h(this.formo.writeKey,e))},e.prototype.retryAdoption=function(){this.disposed||(this.trackingState.lastAddress&&!this.tracksLiveWallet()&&(s.logger.debug("WagmiEventHandler: Tracked wallet is no longer the live one, releasing before retry",{tracked:this.trackingState.lastAddress}),this.releaseTrackedWallet()),this.resyncCentralState(),this.trackingState.lastAddress&&this.isCurrentWalletAnnounced()||this.seedFromCurrentState())},e.prototype.tracksLiveWallet=function(){var e=this.trackingState.lastAddress;if(!e)return!1;try{var t=this.getState();if("connected"!==t.status)return!1;var r=this.getConnectedAddress(t);return!!r&&r.toLowerCase()===e.toLowerCase()}catch(e){return s.logger.error("WagmiEventHandler: Error reading state to compare wallets:",e),!1}},e.prototype.resyncCentralState=function(){var e,t=this.trackingState,r=t.lastAddress,n=t.lastChainId;r&&void 0!==n&&((null===(e=this.formo.currentAddress)||void 0===e?void 0:e.toLowerCase())===r.toLowerCase()&&this.formo.currentChainId===n||(s.logger.info("WagmiEventHandler: Re-syncing central state for a tracked wallet",{address:r,chainId:n}),this.formo.syncWalletState({chainId:n,address:r})))},e.prototype.isCurrentWalletAnnounced=function(){var e,t=this.trackingState.lastAddress;if(!t)return!1;try{var r=this.getState();e=r.current?r.connections.get(r.current):void 0}catch(e){}return"none"!==A(h(this.formo.writeKey,t),e)},e.prototype.handleStatusChange=function(e,t){return i(this,void 0,void 0,function(){var r,i,o,c,u,d,f,p,v,g,y,m,b,E;return a(this,function(a){switch(a.label){case 0:if(this.trackingState.isProcessing)return"disconnected"===e&&(this.missedDisconnect=!0),s.logger.debug("WagmiEventHandler: Already processing status change, skipping"),[2];this.trackingState.isProcessing=!0,this.transitionGeneration+=1,a.label=1;case 1:return a.trys.push([1,14,15,16]),r=this.getState(),i=this.getConnectedAddress(r),o=null!==(y=this.getActiveConnectionChainId(r))&&void 0!==y?y:r.chainId,s.logger.info("WagmiEventHandler: Status changed",{status:e,prevStatus:t,address:i,chainId:o}),"disconnected"===e&&this.trackingState.lastAddress?(c=this.trackingState.lastAddress,u=this.trackingState.lastChainId,this.trackingState.lastConnectionId=void 0,this.trackingState.lastAddress=void 0,this.trackingState.lastChainId=void 0,this.pendingChainId=void 0,this.missedDisconnect=!1,l.delete(h(this.formo.writeKey,c)),this.formo.isAutocaptureEnabled("disconnect")&&this.isEmittingOwner?[4,this.formo.disconnect({chainId:u,address:c})]:[3,3]):[3,4];case 2:return a.sent(),[3,4];case 3:this.formo.syncWalletState({chainId:u}),a.label=4;case 4:return"connected"!==e||"connected"===t?[3,13]:i&&void 0!==o?(null===(m=this.trackingState.lastAddress)||void 0===m?void 0:m.toLowerCase())!==i.toLowerCase()?[3,9]:this.trackingState.lastChainId===o?[3,7]:this.pendingChainId!==o?[3,6]:(this.pendingChainId=void 0,s.logger.info("WagmiEventHandler: Re-entry carries a chain the subscription dropped, emitting it",{address:i,from:this.trackingState.lastChainId,to:o}),[4,this.handleChainChange(o,this.trackingState.lastChainId)]):[3,13];case 5:return a.sent(),this.trackingState.lastStatus=e,[2];case 6:return s.logger.info("WagmiEventHandler: Tracked wallet re-entered connected on a different chain",{address:i,from:this.trackingState.lastChainId,to:o}),this.formo.syncWalletState({chainId:o,address:i}),(null===(b=this.formo.currentAddress)||void 0===b?void 0:b.toLowerCase())===i.toLowerCase()?this.trackingState.lastChainId=o:(s.logger.debug("WagmiEventHandler: Central state declined the re-entry chain, dropping the wallet",{address:i,chainId:o}),this.releaseTrackedWallet()),[3,8];case 7:s.logger.debug("WagmiEventHandler: Ignoring re-entry to connected for an already tracked wallet",{address:i,chainId:o}),a.label=8;case 8:return this.trackingState.lastStatus=e,[2];case 9:if(this.formo.syncWalletState({chainId:o,address:i}),(null===(E=this.formo.currentAddress)||void 0===E?void 0:E.toLowerCase())!==i.toLowerCase())return s.logger.debug("WagmiEventHandler: Central state declined the connection, not adopting",{address:i,chainId:o}),this.trackingState.lastStatus=e,[2];if(this.trackingState.lastAddress=i,this.trackingState.lastChainId=o,this.trackingState.lastConnectionId=r.current,!(this.formo.isAutocaptureEnabled("connect")&&this.isEmittingOwner&&this.formo.willTrackEvent(o)))return[3,13];if(d=h(this.formo.writeKey,i),f=r.current?r.connections.get(r.current):void 0,"none"!==A(d,f))return s.logger.debug("WagmiEventHandler: Connect already announced for this wallet, not emitting again",{address:i}),this.trackingState.lastStatus=e,[2];w(d,f),p=this.getConnectorName(r),a.label=10;case 10:return a.trys.push([10,12,,13]),[4,this.formo.connect({chainId:o,address:i},n({},p&&{providerName:p}))];case 11:return a.sent(),[3,13];case 12:throw v=a.sent(),S(d,f),v;case 13:return this.trackingState.lastStatus=e,[3,16];case 14:return g=a.sent(),s.logger.error("WagmiEventHandler: Error handling status change:",g),[3,16];case 15:return this.trackingState.isProcessing=!1,this.reconcileWithLiveState(),[7];case 16:return[2]}})})},e.prototype.reconcileWithLiveState=function(){var e=this;if(!this.disposed&&!this.trackingState.isProcessing&&!this.reconciling){var t;try{t=this.getState()}catch(e){return void s.logger.error("WagmiEventHandler: Error reading state to reconcile:",e)}if("connected"===t.status||"disconnected"===t.status){var r="connected"===t.status?this.getConnectedAddress(t):void 0,n=this.trackingState.lastAddress;if(r||n)if(r&&n){if(r.toLowerCase()===n.toLowerCase()){if(this.missedDisconnect){this.missedDisconnect=!1,s.logger.info("WagmiEventHandler: A disconnect/reconnect cycle completed while the lock was held",{address:r}),this.reconciling=!0;try{this.handleStatusChange("disconnected","connected").then(function(){return e.retryAdoption()})}finally{this.reconciling=!1}return}this.resyncCentralState();var i=this.pendingChainId;return void(void 0!==i&&(this.pendingChainId=void 0,i!==this.trackingState.lastChainId&&(s.logger.info("WagmiEventHandler: Replaying a chain change dropped while reconnecting",{address:r,from:this.trackingState.lastChainId,to:i}),this.handleChainChange(i,this.trackingState.lastChainId))))}s.logger.info("WagmiEventHandler: Wallet changed while the lock was held, re-adopting",{from:n,to:r}),this.reconciling=!0;try{this.releaseTrackedWallet(),this.seedFromCurrentState()}finally{this.reconciling=!1}}else{this.reconciling=!0;try{r?(s.logger.info("WagmiEventHandler: Reconnect landed while the lock was held, adopting it",{address:r}),this.retryAdoption()):(s.logger.info("WagmiEventHandler: Disconnect landed while the lock was held, applying it",{address:n}),this.handleStatusChange("disconnected","connected"))}finally{this.reconciling=!1}}}}},e.prototype.handleActiveAddressChange=function(e,t){return i(this,void 0,void 0,function(){var r,i,o,c,u,d,f,p,v,g,y,m,b,E,_,C,I,k,O,P,T,x;return a(this,function(a){switch(a.label){case 0:if("connected"!==(r=this.getState()).status)return[2];if(i=this.trackingState.lastConnectionId,o=!!i&&!r.connections.has(i),c=void 0!==this.trackingState.lastConnectionId&&void 0!==r.current&&r.current!==this.trackingState.lastConnectionId,!o&&!c){if(!e||e===t)return[2];if((null===(I=this.trackingState.lastAddress)||void 0===I?void 0:I.toLowerCase())===e.toLowerCase())return[2]}return c&&!o&&e&&(null===(k=this.trackingState.lastAddress)||void 0===k?void 0:k.toLowerCase())===e.toLowerCase()?(u=null!==(O=this.getActiveConnectionChainId(r))&&void 0!==O?O:r.chainId,s.logger.info("WagmiEventHandler: Active connection changed for the same account",{address:e,from:this.trackingState.lastConnectionId,to:r.current}),this.trackingState.lastConnectionId=r.current,void 0===u||u===this.trackingState.lastChainId?[3,2]:[4,this.applyChainForTrackedWallet(e,u)]):[3,3];case 1:a.sent(),a.label=2;case 2:return[2];case 3:return e?(d=++this.transitionGeneration,void 0===(f=null!==(P=this.getActiveConnectionChainId(r))&&void 0!==P?P:r.chainId)?[2]:o?t&&this.isAddressConnected(r,t)?(s.logger.info("WagmiEventHandler: Tracked connector fell away, account still connected elsewhere",{address:t,connection:r.current}),this.trackingState.lastConnectionId=r.current,(null===(T=this.trackingState.lastAddress)||void 0===T?void 0:T.toLowerCase())!==e.toLowerCase()?[3,6]:this.trackingState.lastChainId===f?[3,5]:[4,this.applyChainForTrackedWallet(e,f)]):[3,7]:[3,14]):[2];case 4:a.sent(),a.label=5;case 5:return[2];case 6:return[3,14];case 7:if(!t)return[3,14];if(s.logger.info("WagmiEventHandler: Tracked connector disconnected, wagmi fell back to another connection",{disconnected:t,fallback:e}),p=this.trackingState.lastChainId,this.releaseTrackedWallet(),!this.formo.isAutocaptureEnabled("disconnect")||!this.isEmittingOwner)return[3,12];a.label=8;case 8:return a.trys.push([8,10,,11]),[4,this.formo.disconnect({chainId:p,address:t})];case 9:return a.sent(),[3,11];case 10:return v=a.sent(),s.logger.error("WagmiEventHandler: Error tracking connector fallback disconnect:",v),[3,11];case 11:return[3,13];case 12:this.formo.syncWalletState({chainId:p}),a.label=13;case 13:g=void 0;try{g=this.getState()}catch(e){}if(y=!this.disposed&&"connected"===(null==g?void 0:g.status)&&g.current===r.current,d!==this.transitionGeneration||!y)return s.logger.debug("WagmiEventHandler: A newer transition superseded this one, stopping",{address:e}),this.restoreCentralStateFromTracking(),[2];a.label=14;case 14:if(s.logger.info("WagmiEventHandler: Active account switched",{from:t,to:e,chainId:f}),this.formo.syncWalletState({chainId:f,address:e}),(null===(x=this.formo.currentAddress)||void 0===x?void 0:x.toLowerCase())!==e.toLowerCase())return s.logger.debug("WagmiEventHandler: Central state declined the switched account, not adopting",{address:e,chainId:f}),this.releaseTrackedWallet(),[2];if(this.trackingState.lastAddress=e,this.trackingState.lastChainId=f,this.trackingState.lastConnectionId=r.current,!(this.formo.isAutocaptureEnabled("connect")&&this.isEmittingOwner&&this.formo.willTrackEvent(f)))return[3,18];if(t&&!this.isAddressConnected(r,t)&&l.delete(h(this.formo.writeKey,t)),m=h(this.formo.writeKey,e),b=r.current?r.connections.get(r.current):void 0,E="none"!==A(m,b),w(m,b),E)return s.logger.debug("WagmiEventHandler: Fallback connection was already announced, not re-emitting connect",{address:e}),[2];a.label=15;case 15:return a.trys.push([15,17,,18]),_=this.getConnectorName(r),[4,this.formo.connect({chainId:f,address:e},n({},_&&{providerName:_}))];case 16:return a.sent(),[3,18];case 17:return C=a.sent(),S(m,b),s.logger.error("WagmiEventHandler: Error tracking account switch:",C),[3,18];case 18:return[2]}})})},e.prototype.applyChainForTrackedWallet=function(e,t){return i(this,void 0,void 0,function(){var r,n;return a(this,function(i){switch(i.label){case 0:if(this.formo.syncWalletState({chainId:t,address:e}),(null===(n=this.formo.currentAddress)||void 0===n?void 0:n.toLowerCase())!==e.toLowerCase())return s.logger.debug("WagmiEventHandler: Central state declined the new chain, dropping the wallet",{address:e,chainId:t}),this.releaseTrackedWallet(),[2];if(this.trackingState.lastChainId=t,!this.formo.isAutocaptureEnabled("chain")||!this.isEmittingOwner)return[3,4];i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.formo.chain({chainId:t,address:e})];case 2:return i.sent(),[3,4];case 3:return r=i.sent(),s.logger.error("WagmiEventHandler: Error tracking chain change:",r),[3,4];case 4:return[2]}})})},e.prototype.handleChainChange=function(e,t){return i(this,void 0,void 0,function(){var r,n,i,o;return a(this,function(a){switch(a.label){case 0:return e===t||void 0===e?[2]:"connected"!==(r=this.getState()).status?(this.pendingChainId=e,[2]):(this.pendingChainId=void 0,(n=this.getConnectedAddress(r))?void 0!==this.trackingState.lastConnectionId&&void 0!==r.current&&r.current!==this.trackingState.lastConnectionId?(s.logger.debug("WagmiEventHandler: Chain change belongs to a connection not adopted yet, deferring",{chainId:e,from:this.trackingState.lastConnectionId,to:r.current}),[2]):(i=!!this.trackingState.lastAddress,o=this.isCurrentWalletAnnounced(),i&&o||(this.retryAdoption(),o||!this.isCurrentWalletAnnounced())?(s.logger.info("WagmiEventHandler: Chain changed",{chainId:e,prevChainId:t,address:n}),[4,this.applyChainForTrackedWallet(n,e)]):[2]):(s.logger.warn("WagmiEventHandler: Chain changed but no address found"),[2]));case 1:return a.sent(),[2]}})})},e.prototype.setupMutationTracking=function(){var e=this;if(this.queryClient){s.logger.info("WagmiEventHandler: Setting up mutation tracking");var t=this.queryClient.getMutationCache().subscribe(function(t){e.handleMutationEvent(t)});this.unsubscribers.push(t),s.logger.info("WagmiEventHandler: Mutation tracking set up successfully")}},e.prototype.setupQueryTracking=function(){var e=this;if(this.queryClient){s.logger.info("WagmiEventHandler: Setting up query tracking");var t=this.queryClient.getQueryCache().subscribe(function(t){e.handleQueryEvent(t)});this.unsubscribers.push(t),s.logger.info("WagmiEventHandler: Query tracking set up successfully")}},e.prototype.handleQueryEvent=function(e){if("updated"===e.type&&this.isEmittingOwner){var t=e.query,r=t.queryKey;if(r&&0!==r.length){var n=r[0];if("waitForTransactionReceipt"===n){var i=t.state,a=i.data,o=null==a?void 0:a.status,c="".concat(t.queryHash,":").concat(i.status,":").concat(o||"");this.processedQueries.has(c)?s.logger.debug("WagmiEventHandler: Skipping duplicate query event",{queryType:n,queryHash:t.queryHash,status:i.status,receiptStatus:o}):(this.processedQueries.add(c),s.logger.debug("WagmiEventHandler: Query event",{queryType:n,queryHash:t.queryHash,status:i.status}),this.handleTransactionReceiptQuery(t),C(this.processedQueries))}}}},e.prototype.handleTransactionReceiptQuery=function(e){var t,r;if(this.formo.isAutocaptureEnabled("transaction")){var i=e.state,a=e.queryKey;if("success"===i.status){var c=a[1],u=null==c?void 0:c.hash,l=null==c?void 0:c.chainId;if(u){var d=u.toLowerCase(),h=this.pendingTransactions.get(d);if(h){var f=h.address,p=h.chainIdWasExplicit?h.chainId:null!==(t=null!=l?l:h.chainId)&&void 0!==t?t:this.trackingState.lastChainId;if(f)try{var v=i.data;if("success"!==(null==v?void 0:v.status)&&"reverted"!==(null==v?void 0:v.status))return void s.logger.debug("WagmiEventHandler: Receipt without explicit success/reverted status; ignoring",{transactionHash:u,status:null==v?void 0:v.status});var g="reverted"===v.status?o.TransactionStatus.REVERTED:o.TransactionStatus.CONFIRMED;s.logger.info("WagmiEventHandler: Tracking transaction confirmation",{status:g,transactionHash:u,address:f,chainId:p,blockNumber:null===(r=null==v?void 0:v.blockNumber)||void 0===r?void 0:r.toString()}),this.formo.transaction(n(n(n(n(n({status:g,chainId:p||0,address:f,transactionHash:u},(null==h?void 0:h.data)&&{data:h.data}),(null==h?void 0:h.to)&&{to:h.to}),(null==h?void 0:h.value)&&{value:h.value}),(null==h?void 0:h.function_name)&&{function_name:h.function_name}),(null==h?void 0:h.function_args)&&{function_args:h.function_args}),null==h?void 0:h.safeFunctionArgs),this.pendingTransactions.delete(d)}catch(e){s.logger.error("WagmiEventHandler: Error handling transaction receipt query:",e)}else s.logger.warn("WagmiEventHandler: Transaction receipt query but no address available")}else s.logger.debug("WagmiEventHandler: Receipt for unobserved tx hash; ignoring",{transactionHash:u})}else s.logger.warn("WagmiEventHandler: Transaction receipt query but no hash found")}}},e.prototype.handleMutationEvent=function(e){if("updated"===e.type&&this.isEmittingOwner){var t=e.mutation,r=t.options.mutationKey;if(r&&0!==r.length){var n=r[0],i=t.state,a="".concat(t.mutationId,":").concat(i.status);this.processedMutations.has(a)?s.logger.debug("WagmiEventHandler: Skipping duplicate mutation event",{mutationType:n,mutationId:t.mutationId,status:i.status}):(this.processedMutations.add(a),s.logger.debug("WagmiEventHandler: Mutation event",{mutationType:n,mutationId:t.mutationId,status:i.status}),"signMessage"!==n&&"signTypedData"!==n||this.handleSignatureMutation(n,t),"sendTransaction"!==n&&"writeContract"!==n||this.handleTransactionMutation(n,t),C(this.processedMutations))}}},e.prototype.handleSignatureMutation=function(e,t){var r,n,i,a;if(this.formo.isAutocaptureEnabled("signature")){var c=t.state,u=c.variables||{},l=null!==(a=null!==(i=null!==(n=E(null===(r=u.domain)||void 0===r?void 0:r.chainId))&&void 0!==n?n:E(u.chainId))&&void 0!==i?i:this.trackingState.lastChainId)&&void 0!==a?a:0,d=_(u.account)||this.trackingState.lastAddress;if(d)try{var h;if("pending"===c.status)h=o.SignatureStatus.REQUESTED;else if("success"===c.status)h=o.SignatureStatus.CONFIRMED;else{if("error"!==c.status)return;h=o.SignatureStatus.REJECTED}var f;f="signMessage"===e?u.message||"":JSON.stringify(u.message||u.types||{}),s.logger.info("WagmiEventHandler: Tracking signature event",{status:h,mutationType:e,address:d,chainId:l}),this.formo.signature({status:h,chainId:l,address:d,message:f})}catch(e){s.logger.error("WagmiEventHandler: Error handling signature mutation:",e)}else s.logger.warn("WagmiEventHandler: Signature event but no address available")}},e.prototype.handleTransactionMutation=function(e,t){var r;if(this.formo.isAutocaptureEnabled("transaction")){var i=t.state,a=i.variables||{},l=E(a.chainId),d=null!=l?l:this.trackingState.lastChainId,h=_(a.account)||a.from||this.trackingState.lastAddress;if(h)try{var f,p=void 0;if("pending"===i.status)f=o.TransactionStatus.STARTED;else if("success"===i.status)f=o.TransactionStatus.BROADCASTED,p=i.data;else{if("error"!==i.status)return;f=o.TransactionStatus.REJECTED}var v=void 0,g=void 0,y=void 0,m=void 0,b=null===(r=a.value)||void 0===r?void 0:r.toString();if("writeContract"===e){var A=a.abi,S=a.functionName,w=a.args,C=a.address,I=a.dataSuffix;if(g=C,y=S,A&&S){m=(0,c.extractFunctionArgs)(A,S,w);var k=(0,c.encodeWriteContractData)(A,S,w);k&&(v=(0,c.concatCalldataWithSuffix)(k,I),s.logger.debug("WagmiEventHandler: Encoded writeContract data",v.substring(0,10)))}}else v=a.data,g=a.to;s.logger.info("WagmiEventHandler: Tracking transaction event",{status:f,mutationType:e,address:h,chainId:d,transactionHash:p,function_name:y});var O=(0,c.buildSafeFunctionArgs)(m,u);if(f===o.TransactionStatus.BROADCASTED&&p){var P=p.toLowerCase(),T=n(n(n(n(n(n(n(n({address:h},void 0!==d&&{chainId:d}),{chainIdWasExplicit:void 0!==l}),v&&{data:v}),g&&{to:g}),b&&{value:b}),y&&{function_name:y}),m&&{function_args:m}),O&&{safeFunctionArgs:O});if(this.pendingTransactions.set(P,T),s.logger.debug("WagmiEventHandler: Stored pending transaction for confirmation",{transactionHash:P}),this.pendingTransactions.size>100)for(var x=Array.from(this.pendingTransactions.keys()),L=0;L<50&&L<x.length;L++)this.pendingTransactions.delete(x[L])}this.formo.transaction(n(n(n(n(n(n({status:f,chainId:d||0,address:h},v&&{data:v}),g&&{to:g}),b&&{value:b}),p&&{transactionHash:p}),y&&{function_name:y}),m&&{function_args:m}),O)}catch(e){s.logger.error("WagmiEventHandler: Error handling transaction mutation:",e)}else s.logger.warn("WagmiEventHandler: Transaction event but no address available")}},e.prototype.getState=function(){return"function"==typeof this.wagmiConfig.getState?this.wagmiConfig.getState():this.wagmiConfig.state?this.wagmiConfig.state:(s.logger.warn("WagmiEventHandler: Unable to get state from config, returning default state"),{status:"disconnected",connections:new Map,current:void 0,chainId:void 0})},e.prototype.getActiveConnectionChainId=function(e){var t;if(e.current)return null===(t=e.connections.get(e.current))||void 0===t?void 0:t.chainId},e.prototype.getConnectedAddress=function(e){if(e.current){var t=e.connections.get(e.current);if(t&&0!==t.accounts.length)return t.accounts[0]}},e.prototype.isAddressConnected=function(e,t){var r=t.toLowerCase(),n=!1;return e.connections.forEach(function(e){!n&&e.accounts.some(function(e){return e.toLowerCase()===r})&&(n=!0)}),n},e.prototype.getConnectorName=function(e){if(e.current){var t=e.connections.get(e.current);return null==t?void 0:t.connector.name}},e.prototype.cleanup=function(){if(s.logger.debug("WagmiEventHandler: Cleaning up subscriptions"),!this.disposed){this.disposed=!0,this.transitionGeneration+=1,this.ownerKey&&v.get(this.ownerKey)===this&&v.delete(this.ownerKey);var e=function(e){var r,n,i,a=Math.max(0,(null!==(r=f.get(e))&&void 0!==r?r:0)-1);f.set(e,a);var o=0===a;if(a>0||p.has(e))return o;var s=setTimeout(function(){p.delete(e);var t="".concat(e,":");l.forEach(function(e){e.startsWith(t)&&l.delete(e)})},t.MARKER_GRACE_MS);return null===(i=(n=s).unref)||void 0===i||i.call(n),p.set(e,s),o}(this.formo.writeKey);e&&this.ownerKey&&function(e){var r,n;if(!b.has(e)){var i=setTimeout(function(){b.delete(e),m.delete(e)},t.MARKER_GRACE_MS);null===(n=(r=i).unref)||void 0===n||n.call(r),b.set(e,i)}}(this.ownerKey)}for(var r=0,n=this.unsubscribers;r<n.length;r++){var i=n[r];try{i()}catch(e){s.logger.error("WagmiEventHandler: Error during cleanup:",e)}}this.unsubscribers=[],this.processedMutations.clear(),this.processedQueries.clear(),s.logger.debug("WagmiEventHandler: Cleanup complete")},e}();t.WagmiEventHandler=I},5707(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.WagmiEventHandler=void 0;var n=r(8788);Object.defineProperty(t,"WagmiEventHandler",{enumerable:!0,get:function(){return n.WagmiEventHandler}})},5170(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.flattenObject=a,t.concatCalldataWithSuffix=function(e,t){if(!t||"0x"===t)return e;var r=s();if(null==r?void 0:r.concatHex)return r.concatHex([e,t]);var n=t.replace(/^0x/i,"");return"".concat(e).concat(n)},t.encodeWriteContractData=function(e,t,r){try{var n=s();return n?n.encodeFunctionData({abi:e,functionName:t,args:r||[]}):void i.logger.debug("WagmiEventHandler: viem not available, cannot encode function data")}catch(e){return void i.logger.warn("WagmiEventHandler: Failed to encode function data",e)}},t.extractFunctionArgs=function(e,t,r){if(e&&t&&r&&Array.isArray(r))try{var n=e.find(function(e){return"function"===e.type&&e.name===t});if(!(null==n?void 0:n.inputs)||!Array.isArray(n.inputs))return;var a={};return n.inputs.forEach(function(e,t){if(t<r.length){var n=r[t],i=e.name||"arg".concat(t);a[i]=o(n)}}),a}catch(e){return void i.logger.warn("WagmiEventHandler: Failed to extract function args",e)}},t.buildSafeFunctionArgs=function(e,t){if(e){for(var r={},n=0,o=Object.entries(e);n<o.length;n++){var s=o[n],c=s[0],u=s[1],l=t.has(c)?"arg_".concat(c):c;if(r[l]=u,null!==u&&"object"==typeof u&&!Array.isArray(u))for(var d=a(u,l),h=0,f=Object.entries(d);h<f.length;h++){var p=f[h],v=p[0],g=p[1];v in r?i.logger.debug("WagmiEventHandler: Skipping flattened key collision",{flatKey:v,existingValue:r[v]}):r[v]=g}}return r}};var n,i=r(3312);function a(e,t){void 0===t&&(t="");for(var r={},n=0,i=Object.entries(e);n<i.length;n++){var o=i[n],s=o[0],c=o[1],u=t?"".concat(t,"_").concat(s):s;if(null===c||"object"!=typeof c||Array.isArray(c))r[u]=c;else{var l=a(c,u);Object.assign(r,l)}}return r}function o(e){if("bigint"==typeof e)return e.toString();if(Array.isArray(e))return e.map(o);if(null!==e&&"object"==typeof e){for(var t={},r=0,n=Object.entries(e);r<n.length;r++){var i=n[r],a=i[0],s=i[1];t[a]=o(s)}return t}return e}function s(){if(void 0!==n)return n;try{var e=r(Object(function(){var e=new Error("Cannot find module 'viem'");throw e.code="MODULE_NOT_FOUND",e}()));if(null==e?void 0:e.encodeFunctionData)return n={encodeFunctionData:e.encodeFunctionData,concatHex:e.concatHex}}catch(e){}return n=null,null}},2690(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.WalletStateStore=void 0;var i=r(49),a=r(6517),o=r(2257),s=r(3312),c=r(4657),u=r(9308),l=function(){function e(e){this.deps=e,this.state={evm:{},solana:{}},this.observationSeq=0,this.newestObservation={evm:0,solana:0},this.disconnectCount={evm:0,solana:0}}return Object.defineProperty(e.prototype,"activeNamespace",{get:function(){return this._activeNamespace},enumerable:!1,configurable:!0}),e.prototype.namespaceOf=function(e){return(0,u.isSolanaChainId)(e)?"solana":"evm"},Object.defineProperty(e.prototype,"evmAddress",{get:function(){return this.state.evm.address},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"evmChainId",{get:function(){return this.state.evm.chainId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"provider",{get:function(){return this.state.evm.provider},set:function(e){this.displaceProvider(this.state.evm.provider,e),this.state.evm.provider=e},enumerable:!1,configurable:!0}),e.prototype.observe=function(e){var t=++this.observationSeq;return this.newestObservation[e]=t,{id:t,namespace:e}},e.prototype.beginDisconnect=function(e){this.disconnectCount[e]++},e.prototype.disconnectsSoFar=function(e){return this.disconnectCount[e]},e.prototype.snapshot=function(e){return this.newestObservation[e]},e.prototype.isUnchangedSince=function(e,t){return this.newestObservation[e]===t},e.prototype.currentObservation=function(e){return{id:this.newestObservation[e],namespace:e}},e.prototype.isCurrent=function(e){return this.newestObservation[e.namespace]===e.id},e.prototype.set=function(e,t){var r="string"==typeof e?e:this.namespaceOf(e),n=this.state[r];"address"in t&&(n.address=t.address),"chainId"in t?n.chainId=t.chainId:"number"==typeof e&&(n.chainId=e),"evm"===r&&"provider"in t&&(this.displaceProvider(n.provider,t.provider),n.provider=t.provider),this._activeNamespace=r,this.syncDerived()},e.prototype.clear=function(e){"evm"===("string"==typeof e?e:this.namespaceOf(e))?(this.displaceProvider(this.state.evm.provider,void 0),this.state.evm={}):this.state.solana={},this.syncDerived()},e.prototype.reset=function(){var e=this.state.evm.provider;this.state={evm:{provider:e},solana:{}},this._activeNamespace=void 0,this.address=void 0,this.chainId=void 0},e.prototype.clearProvider=function(){this.provider=void 0},e.prototype.setActiveAddress=function(e){this.address=e,this.persist()},e.prototype.setActiveChainId=function(e){this.chainId=e,this.persist()},e.prototype.clearActiveChainId=function(){this.setActiveChainId(void 0)},e.prototype.syncWalletState=function(e){var t=e.chainId,r=e.address;if(this.observe(this.namespaceOf(t)),this.deps.isTrackingSuppressed()){if(!r)return void this.clearForChain(t);if(null==t)return;var n=this.namespaceOf(t),i=this.state[n].address,a=(0,c.validateAddress)(r,t);i&&a&&a!==i&&this.clear(t)}else if(r){if(null!=t){var o=(0,c.validateAddress)(r,t);o?this.set(t,{address:o}):s.logger.warn('syncWalletState: invalid address ("'.concat(r,'") for chain ').concat(t))}}else this.clearForChain(t)},e.prototype.backfill=function(e,t,r){if(r&&void 0!==t&&0!==t){var n=this.deps.providerChainId(r);void 0!==n&&n!==t&&(t=n)}if(!this.deps.isTrackingSuppressed()){var i=this.evmAddress;i?void 0!==t&&(0!==t||!this.evmChainId)&&i.toLowerCase()===e.toLowerCase()&&this.evmChainId!==t&&this.set("evm",{address:i,chainId:t}):this.set("evm",{address:e,chainId:t})}},e.prototype.clearStaleEvmWalletOnSwitchWhileSuppressed=function(e){var t=this.state.evm.address,r=(0,c.validateAndChecksumAddress)(e);t&&r&&r!==t&&this.clear("evm")},e.prototype.persist=function(){try{if(this.deps.isPersistedIdentityPurgeRequired())return void(0,a.cookie)().remove(i.ACTIVE_WALLET_KEY);if(this.address){if(this.deps.isPageExcluded())return;var e=JSON.stringify(n({address:this.address},void 0!==this.chainId&&{chainId:this.chainId})),t=(0,o.getIdentityCookieDomain)(this.deps.crossSubdomainCookies());(0,a.cookie)().set(i.ACTIVE_WALLET_KEY,e,n(n({path:"/",expires:new Date(Date.now()+i.ACTIVE_WALLET_TTL_MS).toUTCString()},(0,o.getIdentityCookieSecurity)()),t?{domain:t}:{}))}else(0,a.cookie)().remove(i.ACTIVE_WALLET_KEY)}catch(e){s.logger.warn("Failed to persist current wallet snapshot",e)}},e.prototype.load=function(){try{if(this.deps.isPersistedIdentityPurgeRequired())return void(0,a.cookie)().remove(i.ACTIVE_WALLET_KEY);if(this.deps.isPageExcluded())return;var e=(0,a.cookie)().get(i.ACTIVE_WALLET_KEY);if(!e)return;var t=JSON.parse(e);if(!(null==t?void 0:t.address))return;var r=t.chainId,n=null==r;if(!(n||"number"==typeof r&&Number.isFinite(r)))return void(0,a.cookie)().remove(i.ACTIVE_WALLET_KEY);var o=n?void 0:r,u=void 0===o?(0,c.validateAndChecksumAddress)(t.address)?"evm":"solana":this.namespaceOf(o),l=(0,c.validateAddress)(t.address,o);if(!l)return void(0,a.cookie)().remove(i.ACTIVE_WALLET_KEY);var d=this.state[u];d.address=l,void 0!==o&&(d.chainId=o),this._activeNamespace=u,this.address=l,this.chainId=o}catch(e){s.logger.warn("Failed to restore persisted wallet snapshot",e),(0,a.cookie)().remove(i.ACTIVE_WALLET_KEY)}},e.prototype.clearForChain=function(e){null!=e?this.clear(e):(this.clear("evm"),this.clear("solana"))},e.prototype.displaceProvider=function(e,t){e&&e!==t&&this.deps.onProviderDisplaced(e)},e.prototype.syncDerived=function(){var e=this._activeNamespace;if(e){var t=this.state[e];if(t.address||t.chainId)return this.address=t.address,this.chainId=t.chainId,void this.persist()}var r="evm"===e?"solana":"evm",n=this.state[r];if(n.address||n.chainId)return this.address=n.address,this.chainId=n.chainId,this._activeNamespace=r,void this.persist();this.address=void 0,this.chainId=void 0,this.persist()},e}();t.WalletStateStore=l},9478(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.requestProviders=t.announceProvider=t.createStore=void 0;var n=r(4887);Object.defineProperty(t,"createStore",{enumerable:!0,get:function(){return n.createStore}});var i=r(8919);Object.defineProperty(t,"announceProvider",{enumerable:!0,get:function(){return i.announceProvider}}),Object.defineProperty(t,"requestProviders",{enumerable:!0,get:function(){return i.requestProviders}})},4887(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.createStore=void 0;const n=r(8919);t.createStore=function(){const e=new Set;let t=[];const r=()=>(0,n.requestProviders)(r=>{t.some(({info:e})=>e.uuid===r.info.uuid)||(t=[...t,r],e.forEach(e=>e(t,{added:[r]})))});let i=r();return{_listeners:()=>e,clear(){e.forEach(e=>e([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),i?.()},findProvider:({rdns:e})=>t.find(t=>t.info.rdns===e),getProviders:()=>t,reset(){this.clear(),i?.(),i=r()},subscribe:(r,{emitImmediately:n}={})=>(e.add(r),n&&r(t,{added:t}),()=>e.delete(r))}}},8919(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.requestProviders=t.announceProvider=void 0,t.announceProvider=function(e){const t=new CustomEvent("eip6963:announceProvider",{detail:Object.freeze(e)});window.dispatchEvent(t);const r=()=>window.dispatchEvent(t);return window.addEventListener("eip6963:requestProvider",r),()=>window.removeEventListener("eip6963:requestProvider",r)},t.requestProviders=function(e){if("undefined"==typeof window)return;const t=t=>e(t.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)}}},t={},r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}(5135);return r.FormoAnalytics})());
|
|
3
3
|
//# sourceMappingURL=index.umd.min.js.map
|