superstack-wallet-sdk 0.5.9 → 0.5.10

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/index.cjs CHANGED
@@ -9,7 +9,7 @@ const Iu=BigInt(0),Nu=BigInt(1);function Su(e,t){const n=t.negate();return e?n:t
9
9
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Mu(e){void 0!==e.lowS&&as("lowS",e.lowS),void 0!==e.prehash&&as("prehash",e.prehash)}class Lu extends Error{constructor(e=""){super(e)}}const Fu={Err:Lu,_tlv:{encode:(e,t)=>{const{Err:n}=Fu;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(1&t.length)throw new n("tlv.encode: unpadded data");const r=t.length/2,o=ss(r);if(o.length/2&128)throw new n("tlv.encode: long form length too big");const a=r>127?ss(o.length/2|128):"";return ss(e)+a+o+t},decode(e,t){const{Err:n}=Fu;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const o=t[r++];let a=0;if(!!(128&o)){const e=127&o;if(!e)throw new n("tlv.decode(long): indefinite length not supported");if(e>4)throw new n("tlv.decode(long): byte length is too big");const s=t.subarray(r,r+e);if(s.length!==e)throw new n("tlv.decode: length bytes not complete");if(0===s[0])throw new n("tlv.decode(long): zero leftmost byte");for(const e of s)a=a<<8|e;if(r+=e,a<128)throw new n("tlv.decode(long): not minimal encoding")}else a=o;const s=t.subarray(r,r+a);if(s.length!==a)throw new n("tlv.decode: wrong value length");return{v:s,l:t.subarray(r+a)}}},_int:{encode(e){const{Err:t}=Fu;if(e<ju)throw new t("integer: negative integers are not allowed");let n=ss(e);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Fu;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return ws(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Fu,o=Ps("signature",e),{v:a,l:s}=r.decode(48,o);if(s.length)throw new t("invalid signature: left bytes after parsing");const{v:i,l:c}=r.decode(2,a),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(i),s:n.decode(l)}},hexFromSig(e){const{_tlv:t,_int:n}=Fu,r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}};function Uu(e,t){return us(xs(e,t))}const ju=BigInt(0),Du=BigInt(1);BigInt(2);const Gu=BigInt(3),Wu=BigInt(4);function qu(e){const t=function(e){const t=zu(e);$s(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:o}=t;if(n){if(!r.eql(o,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}(e),{Fp:n}=t,r=Pu(t.n,t.nBitLength),o=t.toBytes||((e,t,r)=>{const o=t.toAffine();return ks(Uint8Array.from([4]),n.toBytes(o.x),n.toBytes(o.y))}),a=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function s(e){const{a:r,b:o}=t,a=n.sqr(e),s=n.mul(a,e);return n.add(n.add(s,n.mul(e,r)),o)}function i(e,t){const r=n.sqr(t),o=s(e);return n.eql(r,o)}if(!i(t.Gx,t.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(t.a,Gu),Wu),l=n.mul(n.sqr(t.b),BigInt(27));if(n.is0(n.add(c,l)))throw new Error("bad curve params: a or b");function u(e){const{allowedPrivateKeyLengths:n,nByteLength:r,wrapPrivateKey:o,n:a}=t;if(n&&"bigint"!=typeof e){if(rs(e)&&(e=us(e)),"string"!=typeof e||!n.includes(e.length))throw new Error("invalid private key");e=e.padStart(2*r,"0")}let s;try{s="bigint"==typeof e?e:ws(Ps("private key",e,r))}catch(t){throw new Error("invalid private key, expected hex or "+r+" bytes, got "+typeof e)}return o&&(s=hu(s,a)),Ns("private key",s,Du,a),s}function d(e){if(!(e instanceof p))throw new Error("ProjectivePoint expected")}const f=Os((e,t)=>{const{px:r,py:o,pz:a}=e;if(n.eql(a,n.ONE))return{x:r,y:o};const s=e.is0();null==t&&(t=s?n.ONE:n.inv(a));const i=n.mul(r,t),c=n.mul(o,t),l=n.mul(a,t);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(l,n.ONE))throw new Error("invZ was invalid");return{x:i,y:c}}),h=Os(e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.py))return;throw new Error("bad point: ZERO")}const{x:r,y:o}=e.toAffine();if(!n.isValid(r)||!n.isValid(o))throw new Error("bad point: x or y not FE");if(!i(r,o))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class p{constructor(e,t,r){if(null==e||!n.isValid(e))throw new Error("x required");if(null==t||!n.isValid(t)||n.is0(t))throw new Error("y required");if(null==r||!n.isValid(r))throw new Error("z required");this.px=e,this.py=t,this.pz=r,Object.freeze(this)}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof p)throw new Error("projective point not allowed");const o=e=>n.eql(e,n.ZERO);return o(t)&&o(r)?p.ZERO:new p(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=vu(n,e.map(e=>e.pz));return e.map((e,n)=>e.toAffine(t[n])).map(p.fromAffine)}static fromHex(e){const t=p.fromAffine(a(Ps("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return p.BASE.multiply(u(e))}static msm(e,t){return Ru(p,r,e,t)}_setWindowSize(e){b.setWindowSize(this,e)}assertValidity(){h(this)}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){d(e);const{px:t,py:r,pz:o}=this,{px:a,py:s,pz:i}=e,c=n.eql(n.mul(t,i),n.mul(a,o)),l=n.eql(n.mul(r,i),n.mul(s,o));return c&&l}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,o=n.mul(r,Gu),{px:a,py:s,pz:i}=this;let c=n.ZERO,l=n.ZERO,u=n.ZERO,d=n.mul(a,a),f=n.mul(s,s),h=n.mul(i,i),m=n.mul(a,s);return m=n.add(m,m),u=n.mul(a,i),u=n.add(u,u),c=n.mul(e,u),l=n.mul(o,h),l=n.add(c,l),c=n.sub(f,l),l=n.add(f,l),l=n.mul(c,l),c=n.mul(m,c),u=n.mul(o,u),h=n.mul(e,h),m=n.sub(d,h),m=n.mul(e,m),m=n.add(m,u),u=n.add(d,d),d=n.add(u,d),d=n.add(d,h),d=n.mul(d,m),l=n.add(l,d),h=n.mul(s,i),h=n.add(h,h),d=n.mul(h,m),c=n.sub(c,d),u=n.mul(h,f),u=n.add(u,u),u=n.add(u,u),new p(c,l,u)}add(e){d(e);const{px:r,py:o,pz:a}=this,{px:s,py:i,pz:c}=e;let l=n.ZERO,u=n.ZERO,f=n.ZERO;const h=t.a,m=n.mul(t.b,Gu);let g=n.mul(r,s),b=n.mul(o,i),y=n.mul(a,c),w=n.add(r,o),v=n.add(s,i);w=n.mul(w,v),v=n.add(g,b),w=n.sub(w,v),v=n.add(r,a);let x=n.add(s,c);return v=n.mul(v,x),x=n.add(g,y),v=n.sub(v,x),x=n.add(o,a),l=n.add(i,c),x=n.mul(x,l),l=n.add(b,y),x=n.sub(x,l),f=n.mul(h,v),l=n.mul(m,y),f=n.add(l,f),l=n.sub(b,f),f=n.add(b,f),u=n.mul(l,f),b=n.add(g,g),b=n.add(b,g),y=n.mul(h,y),v=n.mul(m,v),b=n.add(b,y),y=n.sub(g,y),y=n.mul(h,y),v=n.add(v,y),g=n.mul(b,v),u=n.add(u,g),g=n.mul(x,v),l=n.mul(w,l),l=n.sub(l,g),g=n.mul(w,b),f=n.mul(x,f),f=n.add(f,g),new p(l,u,f)}subtract(e){return this.add(e.negate())}is0(){return this.equals(p.ZERO)}wNAF(e){return b.wNAFCached(this,e,p.normalizeZ)}multiplyUnsafe(e){const{endo:r,n:o}=t;Ns("scalar",e,ju,o);const a=p.ZERO;if(e===ju)return a;if(this.is0()||e===Du)return this;if(!r||b.hasPrecomputes(this))return b.wNAFCachedUnsafe(this,e,p.normalizeZ);let{k1neg:s,k1:i,k2neg:c,k2:l}=r.splitScalar(e),u=a,d=a,f=this;for(;i>ju||l>ju;)i&Du&&(u=u.add(f)),l&Du&&(d=d.add(f)),f=f.double(),i>>=Du,l>>=Du;return s&&(u=u.negate()),c&&(d=d.negate()),d=new p(n.mul(d.px,r.beta),d.py,d.pz),u.add(d)}multiply(e){const{endo:r,n:o}=t;let a,s;if(Ns("scalar",e,Du,o),r){const{k1neg:t,k1:o,k2neg:i,k2:c}=r.splitScalar(e);let{p:l,f:u}=this.wNAF(o),{p:d,f:f}=this.wNAF(c);l=b.constTimeNegate(t,l),d=b.constTimeNegate(i,d),d=new p(n.mul(d.px,r.beta),d.py,d.pz),a=l.add(d),s=u.add(f)}else{const{p:t,f:n}=this.wNAF(e);a=t,s=n}return p.normalizeZ([a,s])[0]}multiplyAndAddUnsafe(e,t,n){const r=p.BASE,o=(e,t)=>t!==ju&&t!==Du&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),a=o(this,t).add(o(e,n));return a.is0()?void 0:a}toAffine(e){return f(this,e)}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===Du)return!0;if(n)return n(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===Du?this:n?n(p,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return as("isCompressed",e),this.assertValidity(),o(p,this,e)}toHex(e=!0){return as("isCompressed",e),us(this.toRawBytes(e))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const{endo:m,nBitLength:g}=t,b=(y=p,w=m?Math.ceil(g/2):g,{constTimeNegate:Su,hasPrecomputes:e=>1!==_u(e),unsafeLadder(e,t,n=y.ZERO){let r=e;for(;t>Iu;)t&Nu&&(n=n.add(r)),r=r.double(),t>>=Nu;return n},precomputeWindow(e,t){const{windows:n,windowSize:r}=Bu(t,w),o=[];let a=e,s=a;for(let e=0;e<n;e++){s=a,o.push(s);for(let e=1;e<r;e++)s=s.add(a),o.push(s);a=s.double()}return o},wNAF(e,t,n){let r=y.ZERO,o=y.BASE;const a=Bu(e,w);for(let e=0;e<a.windows;e++){const{nextN:s,offset:i,isZero:c,isNeg:l,isNegF:u,offsetF:d}=Cu(n,e,a);n=s,c?o=o.add(Su(u,t[d])):r=r.add(Su(l,t[i]))}return{p:r,f:o}},wNAFUnsafe(e,t,n,r=y.ZERO){const o=Bu(e,w);for(let e=0;e<o.windows&&n!==Iu;e++){const{nextN:a,offset:s,isZero:i,isNeg:c}=Cu(n,e,o);if(n=a,!i){const e=t[s];r=r.add(c?e.negate():e)}}return r},getPrecomputes(e,t,n){let r=$u.get(t);return r||(r=this.precomputeWindow(t,e),1!==e&&$u.set(t,n(r))),r},wNAFCached(e,t,n){const r=_u(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)},wNAFCachedUnsafe(e,t,n,r){const o=_u(e);return 1===o?this.unsafeLadder(e,t,r):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),t,r)},setWindowSize(e,t){Tu(t,w),Ou.set(e,t),$u.delete(e)}});var y,w;return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:function(e){return Is(e,Du,t.n)}}}function Vu(e){const t=function(e){const t=zu(e);return $s(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:r,nByteLength:o,nBitLength:a}=t,s=n.BYTES+1,i=2*n.BYTES+1;function c(e){return hu(e,r)}function l(e){return mu(e,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:d,weierstrassEquation:f,isWithinCurveOrder:h}=qu({...t,toBytes(e,t,r){const o=t.toAffine(),a=n.toBytes(o.x),s=ks;return as("isCompressed",r),r?s(Uint8Array.from([t.hasEvenY()?2:3]),a):s(Uint8Array.from([4]),a,n.toBytes(o.y))},fromBytes(e){const t=e.length,r=e[0],o=e.subarray(1);if(t!==s||2!==r&&3!==r){if(t===i&&4===r){return{x:n.fromBytes(o.subarray(0,n.BYTES)),y:n.fromBytes(o.subarray(n.BYTES,2*n.BYTES))}}throw new Error("invalid Point, expected length of "+s+", or uncompressed "+i+", got "+t)}{const e=ws(o);if(!Is(e,Du,n.ORDER))throw new Error("Point is not on curve");const t=f(e);let a;try{a=n.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("Point is not on curve"+t)}return!(1&~r)!==((a&Du)===Du)&&(a=n.neg(a)),{x:e,y:a}}}});function p(e){return e>r>>Du}const m=(e,t,n)=>ws(e.slice(t,n));class g{constructor(e,t,n){Ns("r",e,Du,r),Ns("s",t,Du,r),this.r=e,this.s=t,null!=n&&(this.recovery=n),Object.freeze(this)}static fromCompact(e){const t=o;return e=Ps("compactSignature",e,2*t),new g(m(e,0,t),m(e,t,2*t))}static fromDER(e){const{r:t,s:n}=Fu.toSig(Ps("DER",e));return new g(t,n)}assertValidity(){}addRecoveryBit(e){return new g(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:o,recovery:a}=this,s=v(Ps("msgHash",e));if(null==a||![0,1,2,3].includes(a))throw new Error("recovery id invalid");const i=2===a||3===a?r+t.n:r;if(i>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=1&a?"03":"02",f=u.fromHex(d+Uu(i,n.BYTES)),h=l(i),p=c(-s*h),m=c(o*h),g=u.BASE.multiplyAndAddUnsafe(f,p,m);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new g(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return ys(this.toDERHex())}toDERHex(){return Fu.hexFromSig(this)}toCompactRawBytes(){return ys(this.toCompactHex())}toCompactHex(){const e=o;return Uu(this.r,e)+Uu(this.s,e)}}const b={isValidPrivateKey(e){try{return d(e),!0}catch(e){return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const e=Au(t.n);return function(e,t,n=!1){const r=e.length,o=ku(t),a=Au(t);if(r<16||r<a||r>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+r);const s=hu(n?vs(e):ws(e),t-iu)+iu;return n?Es(s,o):xs(s,o)}(t.randomBytes(e),t.n)},precompute:(e=8,t=u.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function y(e){if("bigint"==typeof e)return!1;if(e instanceof u)return!0;const r=Ps("key",e).length,a=n.BYTES,s=a+1,i=2*a+1;return t.allowedPrivateKeyLengths||o===s?void 0:r===s||r===i}const w=t.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const t=ws(e),n=8*e.length-a;return n>0?t>>BigInt(n):t},v=t.bits2int_modN||function(e){return c(w(e))},x=Ss(a);function E(e){return Ns("num < 2^"+a,e,ju,x),xs(e,o)}function P(e,r,o=k){if(["recovered","canonical"].some(e=>e in o))throw new Error("sign() legacy options not supported");const{hash:a,randomBytes:s}=t;let{lowS:i,prehash:f,extraEntropy:m}=o;null==i&&(i=!0),e=Ps("msgHash",e),Mu(o),f&&(e=Ps("prehashed msgHash",a(e)));const b=v(e),y=d(r),x=[E(y),E(b)];if(null!=m&&!1!==m){const e=!0===m?s(n.BYTES):m;x.push(Ps("extraEntropy",e))}const P=ks(...x),A=b;return{seed:P,k2sig:function(e){const t=w(e);if(!h(t))return;const n=l(t),r=u.BASE.multiply(t).toAffine(),o=c(r.x);if(o===ju)return;const a=c(n*c(A+o*y));if(a===ju)return;let s=(r.x===o?0:2)|Number(r.y&Du),d=a;return i&&p(a)&&(d=function(e){return p(e)?c(-e):e}(a),s^=1),new g(o,d,s)}}}const k={lowS:t.lowS,prehash:!1},A={lowS:t.lowS,prehash:!1};return u.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return u.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(!0===y(e))throw new Error("first arg must be private key");if(!1===y(t))throw new Error("second arg must be public key");return u.fromHex(t).multiply(d(e)).toRawBytes(n)},sign:function(e,n,r=k){const{seed:o,k2sig:a}=P(e,n,r),s=t,i=function(e,t,n){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 n)throw new Error("hmacFn must be a function");let r=Ts(e),o=Ts(e),a=0;const s=()=>{r.fill(1),o.fill(0),a=0},i=(...e)=>n(o,r,...e),c=(e=Ts(0))=>{o=i(Bs([0]),e),r=i(),0!==e.length&&(o=i(Bs([1]),e),r=i())},l=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e<t;){r=i();const t=r.slice();n.push(t),e+=r.length}return ks(...n)};return(e,t)=>{let n;for(s(),c(e);!(n=t(l()));)c();return s(),n}}(s.hash.outputLen,s.nByteLength,s.hmac);return i(o,a)},verify:function(e,n,r,o=A){const a=e;n=Ps("msgHash",n),r=Ps("publicKey",r);const{lowS:s,prehash:i,format:d}=o;if(Mu(o),"strict"in o)throw new Error("options.strict was renamed to lowS");if(void 0!==d&&"compact"!==d&&"der"!==d)throw new Error("format must be compact or der");const f="string"==typeof a||rs(a),h=!f&&!d&&"object"==typeof a&&null!==a&&"bigint"==typeof a.r&&"bigint"==typeof a.s;if(!f&&!h)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let p,m;try{if(h&&(p=new g(a.r,a.s)),f){try{"compact"!==d&&(p=g.fromDER(a))}catch(e){if(!(e instanceof Fu.Err))throw e}p||"der"===d||(p=g.fromCompact(a))}m=u.fromHex(r)}catch(e){return!1}if(!p)return!1;if(s&&p.hasHighS())return!1;i&&(n=t.hash(n));const{r:b,s:y}=p,w=v(n),x=l(y),E=c(w*x),P=c(b*x),k=u.BASE.multiplyAndAddUnsafe(m,E,P)?.toAffine();return!!k&&c(k.x)===b},ProjectivePoint:u,Signature:g,utils:b}}
10
10
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Hu(e){return{hash:e,hmac:(t,...n)=>au(e,t,function(...e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];on(r),t+=r.length}const n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){const o=e[t];n.set(o,r),r+=o.length}return n}(...n)),randomBytes:gn}}
11
11
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
12
- const Yu=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ku=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Zu=BigInt(0),Ju=BigInt(1),Qu=BigInt(2),Xu=(e,t)=>(e+t/Qu)/t;const ed=Pu(Yu,void 0,void 0,{sqrt:function(e){const t=Yu,n=BigInt(3),r=BigInt(6),o=BigInt(11),a=BigInt(22),s=BigInt(23),i=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=pu(u,n,t)*u%t,f=pu(d,n,t)*u%t,h=pu(f,Qu,t)*l%t,p=pu(h,o,t)*h%t,m=pu(p,a,t)*p%t,g=pu(m,i,t)*m%t,b=pu(g,c,t)*g%t,y=pu(b,i,t)*m%t,w=pu(y,n,t)*u%t,v=pu(w,s,t)*p%t,x=pu(v,r,t)*l%t,E=pu(x,Qu,t);if(!ed.eql(ed.sqr(E),e))throw new Error("Cannot find square root");return E}}),td=function(e,t){const n=t=>Vu({...e,...Hu(t)});return{...n(t),create:n}}({a:Zu,b:BigInt(7),Fp:ed,n:Ku,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Ku,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Ju*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,s=BigInt("0x100000000000000000000000000000000"),i=Xu(a*e,t),c=Xu(-r*e,t);let l=hu(e-i*n-c*o,t),u=hu(-i*r-c*a,t);const d=l>s,f=u>s;if(d&&(l=t-l),f&&(u=t-u),l>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:f,k2:u}}}},Ca);var nd=Object.freeze({__proto__:null,secp256k1:td});function rd(e,t={}){const{recovered:n}=t;if(void 0===e.r)throw new cd({signature:e});if(void 0===e.s)throw new cd({signature:e});if(n&&void 0===e.yParity)throw new cd({signature:e});if(e.r<0n||e.r>Rl)throw new ld({value:e.r});if(e.s<0n||e.s>Rl)throw new ud({value:e.s});if("number"==typeof e.yParity&&0!==e.yParity&&1!==e.yParity)throw new dd({value:e.yParity})}function od(e){if(130!==e.length&&132!==e.length)throw new id({signature:e});const t=BigInt(yi(e,0,32)),n=BigInt(yi(e,32,64)),r=(()=>{const t=Number(`0x${e.slice(130)}`);if(!Number.isNaN(t))try{return sd(t)}catch{throw new dd({value:t})}})();return void 0===r?{r:t,s:n}:{r:t,s:n,yParity:r}}function ad(e){if(void 0!==e.r&&void 0!==e.s)return function(e){const t="string"==typeof e?od(e):e instanceof Uint8Array?function(e){return od(hi(e))}(e):"string"==typeof e.r?function(e){const t=(()=>{const t=e.v?Number(e.v):void 0;let n=e.yParity?Number(e.yParity):void 0;if("number"==typeof t&&"number"!=typeof n&&(n=sd(t)),"number"!=typeof n)throw new dd({value:e.yParity});return n})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}(e):e.v?function(e){return{r:e.r,s:e.s,yParity:sd(e.v)}}(e):{r:e.r,s:e.s,...void 0!==e.yParity?{yParity:e.yParity}:{}};return rd(t),t}(e)}function sd(e){if(0===e||27===e)return 0;if(1===e||28===e)return 1;if(e>=35)return e%2==0?1:0;throw new fd({value:e})}class id extends _s{constructor({signature:e}){var t;super(`Value \`${e}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${wi((t=e,t instanceof Uint8Array?hi(t):Array.isArray(t)?hi(new Uint8Array(t)):t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class cd extends _s{constructor({signature:e}){super(`Signature \`${Hs(e)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class ld extends _s{constructor({value:e}){super(`Value \`${e}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class ud extends _s{constructor({value:e}){super(`Value \`${e}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class dd extends _s{constructor({value:e}){super(`Value \`${e}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class fd extends _s{constructor({value:e}){super(`Value \`${e}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function hd(e,t={}){return"string"==typeof e.chainId?function(e){const{address:t,chainId:n,nonce:r}=e,o=ad(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}(e):{...e,...t.signature}}const pd=Zl("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function md(e){if("string"==typeof e){if("0x8010801080108010801080108010801080108010801080108010801080108010"!==yi(e,-32))throw new gd(e)}else rd(e.authorization)}let gd=class extends _s{constructor(e){super(`Value \`${e}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};async function bd(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const a=r??"latest",s=void 0!==n?Wt(n):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Ft(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map(e=>({...e,value:BigInt(e.value)}))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,o,s||a]}))}async function yd(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:a}){const s=r||"latest",i=void 0!==n?Wt(n):void 0;let c=null;if(c=o?await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Wt(a)]},{dedupe:!0}):await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[i||s,Wt(a)]},{dedupe:Boolean(i)}),!c)throw new Vr({blockHash:t,blockNumber:n,blockTag:s,hash:o,index:a});return(e.chain?.formatters?.transaction?.format||ma)(c)}async function wd(e,{hash:t}){const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Hr({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||bc)(n)}async function vd(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:a,traceTransfers:s,validation:i}=t;try{const t=[];for(const e of o){const n=e.blockOverrides?Bi(e.blockOverrides):void 0,r=e.calls.map(e=>{const t=e,n=t.account?hr(t.account):void 0,r=t.abi?mr(t):t.data,o={...t,data:t.dataSuffix?Vn([r||"0x",t.dataSuffix]):r,from:t.from??n?.address};return la(o),oa(o)}),o=e.stateOverrides?ia(e.stateOverrides):void 0;t.push({blockOverrides:n,calls:r,stateOverrides:o})}const c=("bigint"==typeof n?Wt(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:t,returnFullTransactions:a,traceTransfers:s,validation:i},c]})).map((e,t)=>({...ga(e),calls:e.calls.map((e,n)=>{const{abi:r,args:a,functionName:s,to:i}=o[t].calls[n],c=e.error?.data??e.returnData,l=BigInt(e.gasUsed),u=e.logs?.map(e=>Za(e)),d="0x1"===e.status?"success":"failure",f=r&&"success"===d&&"0x"!==c?es({abi:r,data:c,functionName:s}):null,h=(()=>{if("success"===d)return;let t;return"0x"===e.error?.data?t=new at:e.error&&(t=new eo(e.error)),t?_o(t,{abi:r??[],address:i??"0x",args:a,functionName:s??"<unknown>"}):void 0})();return{data:c,gasUsed:l,logs:u,status:d,..."success"===d?{result:f}:{error:h}}})}))}catch(e){const t=e,n=ta(t,{});if(n instanceof ea)throw t;throw n}}function xd(e){let t=!0,n="",r=0,o="",a=!1;for(let s=0;s<e.length;s++){const i=e[s];if(["(",")",","].includes(i)&&(t=!0),"("===i&&r++,")"===i&&r--,t)if(0!==r)" "!==i?(o+=i,n+=i):","!==e[s-1]&&","!==n&&",("!==n&&(n="",t=!1);else if(" "===i&&["event","function","error",""].includes(o))o="";else if(o+=i,")"===i){a=!0;break}}if(!a)throw new _s("Unable to normalize signature.");return o}function Ed(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Sl(e,{strict:!1});case"bool":return"boolean"===n;case"function":case"string":return"string"===n;default:return"tuple"===r&&"components"in t?Object.values(t.components).every((t,n)=>Ed(Object.values(e)[n],t)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?"number"===n||"bigint"===n:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?"string"===n||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)&&(Array.isArray(e)&&e.every(e=>Ed(e,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})))}}function Pd(e,t,n){for(const r in e){const o=e[r],a=t[r];if("tuple"===o.type&&"tuple"===a.type&&"components"in o&&"components"in a)return Pd(o.components,a.components,n[r]);const s=[o.type,a.type];if((()=>!(!s.includes("address")||!s.includes("bytes20"))||(s.includes("address")&&s.includes("string")||!(!s.includes("address")||!s.includes("bytes")))&&Sl(n[r],{strict:!1}))())return s}}function kd(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||"string"==typeof e?We(e):e;return{...r,...n?{hash:Nd(r)}:{}}}function Ad(e,t,n){const{args:r=[],prepare:o=!0}=n??{},a=Ei(t,{strict:!1}),s=e.filter(e=>a?"function"===e.type||"error"===e.type?Id(e)===yi(t,0,4):"event"===e.type&&Nd(e)===t:"name"in e&&e.name===t);if(0===s.length)throw new Td({name:t});if(1===s.length)return{...s[0],...o?{hash:Nd(s[0])}:{}};let i;for(const e of s){if(!("inputs"in e))continue;if(!r||0===r.length){if(!e.inputs||0===e.inputs.length)return{...e,...o?{hash:Nd(e)}:{}};continue}if(!e.inputs)continue;if(0===e.inputs.length)continue;if(e.inputs.length!==r.length)continue;const t=r.every((t,n)=>{const r="inputs"in e&&e.inputs[n];return!!r&&Ed(t,r)});if(t){if(i&&"inputs"in i&&i.inputs){const t=Pd(e.inputs,i.inputs,r);if(t)throw new Sd({abiItem:e,type:t[0]},{abiItem:i,type:t[1]})}i=e}}const c=(()=>{if(i)return i;const[e,...t]=s;return{...e,overloads:t}})();if(!c)throw new Td({name:t});return{...c,...o?{hash:Nd(c)}:{}}}function Id(...e){const t=(()=>{if(Array.isArray(e[0])){const[t,n]=e;return Ad(t,n)}return e[0]})();return yi(Nd(t),0,4)}function Nd(...e){const t=(()=>{if(Array.isArray(e[0])){const[t,n]=e;return Ad(t,n)}return e[0]})();return"string"!=typeof t&&"hash"in t&&t.hash?t.hash:kl(mi(function(...e){const t=(()=>{if(Array.isArray(e[0])){const[t,n]=e;return Ad(t,n)}return e[0]})();return xd("string"==typeof t?t:oe(t))}(t)))}class Sd extends _s{constructor(e,t){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${e.type}\` in \`${xd(oe(e.abiItem))}\`, and`,`\`${t.type}\` in \`${xd(oe(t.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class Td extends _s{constructor({name:e,data:t,type:n="item"}){super(`ABI ${n}${e?` with name "${e}"`:t?` with data "${t}"`:""} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function Bd(e){const t=e.find(e=>"constructor"===e.type);if(!t)throw new Td({name:"constructor"});return t}function Cd(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[t,n,r]=e;return[Od(t,n,{args:r}),r]}const[t,n]=e;return[t,n]})(),{overloads:r}=t,o=r?Od([t,...r],t.name,{args:n}):t,a=Id(o);const s=n.length>0?Yl(o.inputs,n):void 0;return s?di(a,s):a}function $d(e,t={}){return kd(e,t)}function Od(e,t,n){const r=Ad(e,t,n);if("function"!==r.type)throw new Td({name:t,type:"function"});return r}const _d="0x0000000000000000000000000000000000000000";async function Rd(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:a,traceAssetChanges:s,traceTransfers:i,validation:c}=t,l=t.account?hr(t.account):void 0;if(s&&!l)throw new et("`account` is required when `traceAssetChanges` is true");const u=l?function(...e){const[t,n]=(()=>{if(Array.isArray(e[0])){const[t,n]=e;return[Bd(t),n]}return e})(),{bytecode:r,args:o}=n;return di(r,t.inputs?.length&&o?.length?Yl(t.inputs,o):"0x")}(kd("constructor(bytes, bytes)"),{bytecode:ji,args:["0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033",Cd($d("function getBalance(address)"),[l.address])]}):void 0;const d=s?await Promise.all(t.calls.map(async t=>{if(!t.data&&!t.abi)return;const{accessList:n}=await Vc(e,{account:l.address,...t,data:t.abi?mr(t):t.data});return n.map(({address:e,storageKeys:t})=>t.length>0?e:null)})).then(e=>e.flat().filter(Boolean)):[],f=await vd(e,{blockNumber:n,blockTag:r,blocks:[...s?[{calls:[{data:u}],stateOverrides:a},{calls:d.map((e,t)=>({abi:[$d("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:e,from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]}]:[],{calls:[...o,{}].map(e=>({...e,from:l?.address})),stateOverrides:a},...s?[{calls:[{data:u}]},{calls:d.map((e,t)=>({abi:[$d("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:e,from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]},{calls:d.map((e,t)=>({to:e,abi:[$d("function decimals() returns (uint256)")],functionName:"decimals",from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]},{calls:d.map((e,t)=>({to:e,abi:[$d("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]},{calls:d.map((e,t)=>({to:e,abi:[$d("function symbol() returns (string)")],functionName:"symbol",from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]}]:[]],traceTransfers:i,validation:c}),h=s?f[2]:f[0],[p,m,,g,b,y,w,v]=s?f:[],{calls:x,...E}=h,P=x.slice(0,-1)??[],k=[...p?.calls??[],...m?.calls??[]].map(e=>"success"===e.status?Lt(e.data):null),A=[...g?.calls??[],...b?.calls??[]].map(e=>"success"===e.status?Lt(e.data):null),I=(y?.calls??[]).map(e=>"success"===e.status?e.result:null),N=(v?.calls??[]).map(e=>"success"===e.status?e.result:null),S=(w?.calls??[]).map(e=>"success"===e.status?e.result:null),T=[];for(const[e,t]of A.entries()){const n=k[e];if("bigint"!=typeof t)continue;if("bigint"!=typeof n)continue;const r=I[e-1],o=N[e-1],a=S[e-1],s=(()=>0===e?{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18,symbol:"ETH"}:{address:d[e-1],decimals:a||r?Number(r??1):void 0,symbol:o??void 0})();T.some(e=>e.token.address===s.address)||T.push({token:s,value:{pre:n,post:t,diff:t-n}})}return{assetChanges:T,block:E,results:P}}const zd="0x6492649264926492649264926492649264926492649264926492649264926492";function Md(e){try{return function(e){if(yi(e,-32)!==zd)throw new Ld(e)}(e),!0}catch{return!1}}class Ld extends _s{constructor(e){super(`Value \`${e}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function Fd({r:e,s:t,to:n="hex",v:r,yParity:o}){const a=(()=>{if(0===o||1===o)return o;if(r&&(27n===r||28n===r||r>=35n))return r%2n==0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),s=`0x${new td.Signature(Lt(e),Lt(t)).toCompactHex()}${0===a?"1b":"1c"}`;return"hex"===n?s:Jt(s)}async function Ud(e,t){const{address:n,hash:r,erc6492VerifierAddress:o=t.universalSignatureVerifierAddress??e.chain?.contracts?.erc6492Verifier?.address,multicallAddress:a=t.multicallAddress??e.chain?.contracts?.multicall3?.address}=t,s=(()=>{const e=t.signature;return Ke(e)?e:"object"==typeof e&&"r"in e&&"s"in e?Fd(e):Gt(e)})();try{return function(e){try{return md(e),!0}catch{return!1}}(s)?await async function(e,t){const{address:n,blockNumber:r,blockTag:o,hash:a,multicallAddress:s}=t,{authorization:i,data:c,signature:l,to:u}=function(e){md(e);const t=xi(yi(e,-64,-32)),n=yi(e,-t-64,-64),r=yi(e,0,-t-64),[o,a,s]=Hl(pd,n);return{authorization:hd({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:r,...s&&"0x"!==s?{data:s,to:a}:{}}}(t.signature),d=await Kc(e,{address:n,blockNumber:r,blockTag:o});if(d===Hn(["0xef0100",i.address]))return await async function(e,t){const{address:n,blockNumber:r,blockTag:o,hash:a,signature:s}=t,i=await Ve(e,nc,"readContract")({address:n,abi:Li,args:[a,s],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(e=>{if(e instanceof Zr)throw new jd;throw e});if(i.startsWith("0x1626ba7e"))return!0;throw new jd}(e,{address:n,blockNumber:r,blockTag:o,hash:a,signature:l});const f={address:i.address,chainId:Number(i.chainId),nonce:Number(i.nonce),r:Wt(i.r,{size:32}),s:Wt(i.s,{size:32}),yParity:i.yParity},h=await async function({address:e,authorization:t,signature:n}){return qa(Dn(e),await jo({authorization:t,signature:n}))}({address:n,authorization:f});if(!h)throw new jd;const p=await Ve(e,nc,"readContract")({...s?{address:s}:{code:Wi},authorizationList:[f],abi:Ci,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:u??n,callData:c}]:[],{allowFailure:!0,target:n,callData:mr({abi:Li,functionName:"isValidSignature",args:[a,l]})}]]}),m=p[p.length-1]?.returnData;if(m?.startsWith("0x1626ba7e"))return!0;throw new jd}(e,{...t,multicallAddress:a,signature:s}):await async function(e,t){const{address:n,factory:r,factoryData:o,hash:a,signature:s,verifierAddress:i,...c}=t,l=await(async()=>r||o?Md(s)?s:function(e){const{data:t,signature:n,to:r}=e;return di(Yl(Zl("address, bytes, bytes"),[r,t,n]),zd)}({data:o,signature:s,to:r}):s)(),u=i?{to:i,data:mr({abi:Fi,functionName:"isValidSig",args:[n,a,l]}),...c}:{data:Yi({abi:Fi,args:[n,a,l],bytecode:Gi}),...c},{data:d}=await Ve(e,ec,"call")(u).catch(e=>{if(e instanceof Kr)throw new jd;throw e});if(function(e,t={}){let n=e;if(t.size&&(Mt(n,{size:t.size}),n=zt(n)),"0x00"===zt(n))return!1;if("0x01"===zt(n))return!0;throw new _t(n)}(d??"0x0"))return!0;throw new jd}(e,{...t,verifierAddress:o,signature:s})}catch(e){try{if(qa(Dn(n),await zo({hash:r,signature:s})))return!0}catch{}if(e instanceof jd)return!1;throw e}}class jd extends Error{}function Dd(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:a,pollingInterval:s=e.pollingInterval}){let i;return(void 0!==a?a:"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type&&"ipc"!==e.transport.transports[0].config.type))?sc(Or(["watchBlockNumber",e.uid,t,n,s]),{onBlockNumber:r,onError:o},r=>cc(async()=>{try{const t=await Ve(e,fc,"getBlockNumber")({cacheTime:0});if(void 0!==i){if(t===i)return;if(t-i>1&&n)for(let e=i+1n;e<t;e++)r.onBlockNumber(e,i),i=e}(void 0===i||t>i)&&(r.onBlockNumber(t,i),i=t)}catch(e){r.onError?.(e)}},{emitOnBegin:t,interval:s})):sc(Or(["watchBlockNumber",e.uid,t,n]),{onBlockNumber:r,onError:o},t=>{let n=!0,r=()=>n=!1;return(async()=>{try{const o=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),{unsubscribe:a}=await o.subscribe({params:["newHeads"],onData(e){if(!n)return;const r=Lt(e.result?.number);t.onBlockNumber(r,i),i=r},onError(e){t.onError?.(e)}});r=a,n||r()}catch(e){o?.(e)}})(),()=>r()})}const Gd=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,Wd=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;async function qd(e,t){const{address:n,domain:r,message:o,nonce:a,scheme:s,signature:i,time:c=new Date,...l}=t,u=function(e){const{scheme:t,statement:n,...r}=e.match(Gd)?.groups??{},{chainId:o,expirationTime:a,issuedAt:s,notBefore:i,requestId:c,...l}=e.match(Wd)?.groups??{},u=e.split("Resources:")[1]?.split("\n- ").slice(1);return{...r,...l,...o?{chainId:Number(o)}:{},...a?{expirationTime:new Date(a)}:{},...s?{issuedAt:new Date(s)}:{},...i?{notBefore:new Date(i)}:{},...c?{requestId:c}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}(o);if(!u.address)return!1;const d=function(e){const{address:t,domain:n,message:r,nonce:o,scheme:a,time:s=new Date}=e;if(n&&r.domain!==n)return!1;if(o&&r.nonce!==o)return!1;if(a&&r.scheme!==a)return!1;if(r.expirationTime&&s>=r.expirationTime)return!1;if(r.notBefore&&s<r.notBefore)return!1;try{if(!r.address)return!1;if(!qn(r.address,{strict:!1}))return!1;if(t&&!qa(r.address,t))return!1}catch{return!1}return!0}({address:n,domain:r,message:u,nonce:a,scheme:s,time:c});if(!d)return!1;const f=ul(o);return Ud(e,{address:u.address,hash:f,signature:i,...l})}function Vd(e){return{call:t=>ec(e,t),createAccessList:t=>Vc(e,t),createBlockFilter:()=>async function(e){const t=dr(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}(e),createContractEventFilter:t=>fr(e,t),createEventFilter:t=>Hc(e,t),createPendingTransactionFilter:()=>Yc(e),estimateContractGas:t=>async function(e,t){const{abi:n,address:r,args:o,functionName:a,dataSuffix:s,...i}=t,c=mr({abi:n,args:o,functionName:a});try{return await Ve(e,Wa,"estimateGas")({data:`${c}${s?s.replace("0x",""):""}`,to:r,...i})}catch(e){const t=i.account?hr(i.account):void 0;throw _o(e,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:a,sender:t?.address})}}(e,t),estimateGas:t=>Wa(e,t),getBalance:t=>async function(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o="bigint"==typeof n?Wt(n):void 0,a=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(a)}(e,t),getBlobBaseFee:()=>async function(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}(e),getBlock:t=>ba(e,t),getBlockNumber:t=>fc(e,t),getBlockTransactionCount:t=>async function(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=void 0!==n?Wt(n):void 0;let a;return a=t?await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:Boolean(o)}),Ft(a)}(e,t),getBytecode:t=>Kc(e,t),getChainId:()=>Ua(e),getCode:t=>Kc(e,t),getContractEvents:t=>Qa(e,t),getEip712Domain:t=>async function(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[t,a,s,i,c,l,u]=await Ve(e,nc,"readContract")({abi:Jc,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:a,version:s,chainId:Number(i),verifyingContract:c,salt:l},extensions:u,fields:t}}catch(e){const t=e;if("ContractFunctionExecutionError"===t.name&&"ContractFunctionZeroDataError"===t.cause.name)throw new Zc({address:n});throw t}}(e,t),getEnsAddress:t=>async function(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:a,gatewayUrls:s,strict:i}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ki({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),u=c?.ensTlds;if(u&&!u.some(e=>a.endsWith(e)))return null;const d=null!=o?[Sc(a),BigInt(o)]:[Sc(a)];try{const t=mr({abi:Mi,functionName:"addr",args:d}),o={address:l,abi:_i,functionName:"resolveWithGateways",args:[jt(Cc(a)),t,s??[Ac]],blockNumber:n,blockTag:r},i=Ve(e,nc,"readContract"),c=await i(o);if("0x"===c[0])return null;const u=es({abi:Mi,args:d,functionName:"addr",data:c[0]});return"0x"===u||"0x00"===zt(u)?null:u}catch(e){if(i)throw e;if(xc(e))return null;throw e}}(e,t),getEnsAvatar:t=>async function(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:a,strict:s,universalResolverAddress:i}){const c=await Ve(e,qc,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:i,gatewayUrls:a,strict:s});if(!c)return null;try{return await Wc(e,{record:c,gatewayUrls:r})}catch{return null}}(e,t),getEnsName:t=>async function(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:a=60n,gatewayUrls:s,strict:i}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ki({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const t={address:l,abi:Ri,args:[n,a,s??[Ac]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},i=Ve(e,nc,"readContract"),[c]=await i(t);return c||null}catch(e){if(i)throw e;if(xc(e))return null;throw e}}(e,t),getEnsResolver:t=>async function(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:a}=e,s=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Ki({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),i=a?.ensTlds;if(i&&!i.some(e=>o.endsWith(e)))throw new Error(`${o} is not a valid ENS TLD (${i?.join(", ")}) for chain "${a.name}" (id: ${a.id}).`);const[c]=await Ve(e,nc,"readContract")({address:s,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[jt(Cc(o))],blockNumber:n,blockTag:r});return c}(e,t),getEnsText:t=>qc(e,t),getFeeHistory:t=>Qc(e,t),estimateFeesPerGas:t=>async function(e,t){return va(e,t)}(e,t),getFilterChanges:e=>hc(0,e),getFilterLogs:e=>async function(e,{filter:t}){const n=t.strict??!1,r=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(e=>Za(e));return t.abi?Ka({abi:t.abi,logs:r,strict:n}):r}(0,e),getGasPrice:()=>ya(e),getLogs:t=>Ja(e,t),getProof:t=>bd(e,t),estimateMaxPriorityFeePerGas:t=>async function(e,t){return wa(e,t)}(e,t),getStorageAt:t=>async function(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const a=void 0!==n?Wt(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,a||r]})}(e,t),getTransaction:t=>yd(e,t),getTransactionConfirmations:t=>async function(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([Ve(e,fc,"getBlockNumber")({}),t?Ve(e,yd,"getTransaction")({hash:t}):void 0]),a=n?.blockNumber||o?.blockNumber;return a?r-a+1n:0n}(e,t),getTransactionCount:t=>xa(e,t),getTransactionReceipt:t=>wd(e,t),multicall:t=>async function(e,t){const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:a,blockOverrides:s,blockTag:i,stateOverride:c}=t,l=t.contracts,{batchSize:u=t.batchSize??1024,deployless:d=t.deployless??!1}="object"==typeof e.batch?.multicall?e.batch.multicall:{},f=(()=>{if(t.multicallAddress)return t.multicallAddress;if(d)return null;if(e.chain)return Ki({blockNumber:a,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),h=[[]];let p=0,m=0;for(let e=0;e<l.length;e++){const{abi:t,address:r,args:a,functionName:s}=l[e];try{const e=mr({abi:t,args:a,functionName:s});m+=(e.length-2)/2,u>0&&m>u&&h[p].length>0&&(p++,m=(e.length-2)/2,h[p]=[]),h[p]=[...h[p],{allowFailure:!0,callData:e,target:r}]}catch(e){const i=_o(e,{abi:t,address:r,args:a,docsPath:"/docs/contract/multicall",functionName:s,sender:n});if(!o)throw i;h[p]=[...h[p],{allowFailure:!0,callData:"0x",target:r}]}}const g=await Promise.allSettled(h.map(t=>Ve(e,nc,"readContract")({...null===f?{code:Wi}:{address:f},abi:Ci,account:n,args:[t],authorizationList:r,blockNumber:a,blockOverrides:s,blockTag:i,functionName:"aggregate3",stateOverride:c}))),b=[];for(let e=0;e<g.length;e++){const t=g[e];if("rejected"===t.status){if(!o)throw t.reason;for(let n=0;n<h[e].length;n++)b.push({status:"failure",error:t.reason,result:void 0});continue}const n=t.value;for(let t=0;t<n.length;t++){const{returnData:r,success:a}=n[t],{callData:s}=h[e][t],{abi:i,address:c,functionName:u,args:d}=l[b.length];try{if("0x"===s)throw new at;if(!a)throw new eo({data:r});const e=es({abi:i,args:d,data:r,functionName:u});b.push(o?{result:e,status:"success"}:e)}catch(e){const t=_o(e,{abi:i,address:c,args:d,docsPath:"/docs/contract/multicall",functionName:u});if(!o)throw t;b.push({error:t,result:void 0,status:"failure"})}}}if(b.length!==l.length)throw new et("multicall results mismatch");return b}(e,t),prepareTransactionRequest:t=>Ga(e,t),readContract:t=>nc(e,t),sendRawTransaction:t=>async function(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}(e,t),simulate:t=>vd(e,t),simulateBlocks:t=>vd(e,t),simulateCalls:t=>Rd(e,t),simulateContract:t=>async function(e,t){const{abi:n,address:r,args:o,dataSuffix:a,functionName:s,...i}=t,c=i.account?hr(i.account):e.account,l=mr({abi:n,args:o,functionName:s});try{const{data:u}=await Ve(e,ec,"call")({batch:!1,data:`${l}${a?a.replace("0x",""):""}`,to:r,...i,account:c});return{result:es({abi:n,args:o,functionName:s,data:u||"0x"}),request:{abi:n.filter(e=>"name"in e&&e.name===t.functionName),address:r,args:o,dataSuffix:a,functionName:s,...i,account:c}}}catch(e){throw _o(e,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:c?.address})}}(e,t),verifyHash:t=>Ud(e,t),verifyMessage:t=>async function(e,{address:t,message:n,factory:r,factoryData:o,signature:a,...s}){return Ud(e,{address:t,factory:r,factoryData:o,hash:ul(n),signature:a,...s})}(e,t),verifySiweMessage:t=>qd(e,t),verifyTypedData:t=>async function(e,t){const{address:n,factory:r,factoryData:o,signature:a,message:s,primaryType:i,types:c,domain:l,...u}=t;return Ud(e,{address:n,factory:r,factoryData:o,hash:gl({message:s,primaryType:i,types:c,domain:l}),signature:a,...u})}(e,t),uninstallFilter:e=>pc(0,e),waitForTransactionReceipt:t=>async function(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:a,retryCount:s=6,retryDelay:i=({count:e})=>200*(1<<e),timeout:c=18e4}=t,l=Or(["waitForTransactionReceipt",e.uid,o]),u=t.pollingInterval?t.pollingInterval:e.chain?.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval;let d,f,h,p,m,g=!1;const{promise:b,resolve:y,reject:w}=Ji(),v=c?setTimeout(()=>{m?.(),p?.(),w(new Yr({hash:o}))},c):void 0;return p=sc(l,{onReplaced:a,resolve:y,reject:w},async t=>{if(h=await Ve(e,wd,"getTransactionReceipt")({hash:o}).catch(()=>{}),h&&r<=1)return clearTimeout(v),t.resolve(h),void p?.();m=Ve(e,Dd,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(a){const c=e=>{clearTimeout(v),m?.(),e(),p?.()};let l=a;if(!g)try{if(h){if(r>1&&(!h.blockNumber||l-h.blockNumber+1n<r))return;return void c(()=>t.resolve(h))}if(n&&!d&&(g=!0,await mc(async()=>{d=await Ve(e,yd,"getTransaction")({hash:o}),d.blockNumber&&(l=d.blockNumber)},{delay:i,retryCount:s}),g=!1),h=await Ve(e,wd,"getTransactionReceipt")({hash:o}),r>1&&(!h.blockNumber||l-h.blockNumber+1n<r))return;c(()=>t.resolve(h))}catch(n){if(n instanceof Vr||n instanceof Hr){if(!d)return void(g=!1);try{f=d,g=!0;const n=await mc(()=>Ve(e,ba,"getBlock")({blockNumber:l,includeTransactions:!0}),{delay:i,retryCount:s,shouldRetry:({error:e})=>e instanceof ha});g=!1;const o=n.transactions.find(({from:e,nonce:t})=>e===f.from&&t===f.nonce);if(!o)return;if(h=await Ve(e,wd,"getTransactionReceipt")({hash:o.hash}),r>1&&(!h.blockNumber||l-h.blockNumber+1n<r))return;let a="replaced";o.to===f.to&&o.value===f.value&&o.input===f.input?a="repriced":o.from===o.to&&0n===o.value&&(a="cancelled"),c(()=>{t.onReplaced?.({reason:a,replacedTransaction:f,transaction:o,transactionReceipt:h}),t.resolve(h)})}catch(e){c(()=>t.reject(e))}}else c(()=>t.reject(n))}}})}),b}(e,t),watchBlocks:t=>function(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:a,includeTransactions:s,poll:i,pollingInterval:c=e.pollingInterval}){const l=void 0!==i?i:"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type&&"ipc"!==e.transport.transports[0].config.type),u=s??!1;let d;return l?sc(Or(["watchBlocks",e.uid,t,n,r,u,c]),{onBlock:o,onError:a},o=>cc(async()=>{try{const r=await Ve(e,ba,"getBlock")({blockTag:t,includeTransactions:u});if(null!==r.number&&null!=d?.number){if(r.number===d.number)return;if(r.number-d.number>1&&n)for(let t=d?.number+1n;t<r.number;t++){const n=await Ve(e,ba,"getBlock")({blockNumber:t,includeTransactions:u});o.onBlock(n,d),d=n}}(null==d?.number||"pending"===t&&null==r?.number||null!==r.number&&r.number>d.number)&&(o.onBlock(r,d),d=r)}catch(e){o.onError?.(e)}},{emitOnBegin:r,interval:c})):(()=>{let n=!0,s=!0,i=()=>n=!1;return(async()=>{try{r&&Ve(e,ba,"getBlock")({blockTag:t,includeTransactions:u}).then(e=>{n&&s&&(o(e,void 0),s=!1)}).catch(a);const c=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),{unsubscribe:l}=await c.subscribe({params:["newHeads"],async onData(t){if(!n)return;const r=await Ve(e,ba,"getBlock")({blockNumber:t.result?.number,includeTransactions:u}).catch(()=>{});n&&(o(r,d),s=!1,d=r)},onError(e){a?.(e)}});i=l,n||i()}catch(e){a?.(e)}})(),()=>i()})()}(e,t),watchBlockNumber:t=>Dd(e,t),watchContractEvent:t=>function(e,t){const{abi:n,address:r,args:o,batch:a=!0,eventName:s,fromBlock:i,onError:c,onLogs:l,poll:u,pollingInterval:d=e.pollingInterval,strict:f}=t;return(void 0!==u?u:"bigint"==typeof i||"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type&&"ipc"!==e.transport.transports[0].config.type))?(()=>{const t=f??!1;return sc(Or(["watchContractEvent",r,o,a,e.uid,s,d,t,i]),{onLogs:l,onError:c},c=>{let l,u;void 0!==i&&(l=i-1n);let f=!1;const h=cc(async()=>{if(f)try{let i;if(u)i=await Ve(e,hc,"getFilterChanges")({filter:u});else{const a=await Ve(e,fc,"getBlockNumber")({});i=l&&l<a?await Ve(e,Qa,"getContractEvents")({abi:n,address:r,args:o,eventName:s,fromBlock:l+1n,toBlock:a,strict:t}):[],l=a}if(0===i.length)return;if(a)c.onLogs(i);else for(const e of i)c.onLogs([e])}catch(e){u&&e instanceof fo&&(f=!1),c.onError?.(e)}else{try{u=await Ve(e,fr,"createContractEventFilter")({abi:n,address:r,args:o,eventName:s,strict:t,fromBlock:i})}catch{}f=!0}},{emitOnBegin:!0,interval:d});return async()=>{u&&await Ve(e,pc,"uninstallFilter")({filter:u}),h()}})})():(()=>{const t=f??!1,i=Or(["watchContractEvent",r,o,a,e.uid,s,d,t]);let u=!0,h=()=>u=!1;return sc(i,{onLogs:l,onError:c},t=>((async()=>{try{const a=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),i=s?lr({abi:n,eventName:s,args:o}):[],{unsubscribe:c}=await a.subscribe({params:["logs",{address:r,topics:i}],onData(e){if(!u)return;const r=e.result;try{const{eventName:e,args:o}=Ha({abi:n,data:r.data,topics:r.topics,strict:f}),a=Za(r,{args:o,eventName:e});t.onLogs([a])}catch(e){let n,o;if(e instanceof vt||e instanceof xt){if(f)return;n=e.abiItem.name,o=e.abiItem.inputs?.some(e=>!("name"in e&&e.name))}const a=Za(r,{args:o?[]:{},eventName:n});t.onLogs([a])}},onError(e){t.onError?.(e)}});h=c,u||h()}catch(e){c?.(e)}})(),()=>h()))})()}(e,t),watchEvent:t=>function(e,{address:t,args:n,batch:r=!0,event:o,events:a,fromBlock:s,onError:i,onLogs:c,poll:l,pollingInterval:u=e.pollingInterval,strict:d}){const f=void 0!==l?l:"bigint"==typeof s||"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type&&"ipc"!==e.transport.transports[0].config.type),h=d??!1;return f?sc(Or(["watchEvent",t,n,r,e.uid,o,u,s]),{onLogs:c,onError:i},i=>{let c,l;void 0!==s&&(c=s-1n);let d=!1;const f=cc(async()=>{if(d)try{let s;if(l)s=await Ve(e,hc,"getFilterChanges")({filter:l});else{const r=await Ve(e,fc,"getBlockNumber")({});s=c&&c!==r?await Ve(e,Ja,"getLogs")({address:t,args:n,event:o,events:a,fromBlock:c+1n,toBlock:r}):[],c=r}if(0===s.length)return;if(r)i.onLogs(s);else for(const e of s)i.onLogs([e])}catch(e){l&&e instanceof fo&&(d=!1),i.onError?.(e)}else{try{l=await Ve(e,Hc,"createEventFilter")({address:t,args:n,event:o,events:a,strict:h,fromBlock:s})}catch{}d=!0}},{emitOnBegin:!0,interval:u});return async()=>{l&&await Ve(e,pc,"uninstallFilter")({filter:l}),f()}}):(()=>{let r=!0,s=()=>r=!1;return(async()=>{try{const l=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),u=a??(o?[o]:void 0);let f=[];if(u){const e=u.flatMap(e=>lr({abi:[e],eventName:e.name,args:n}));f=[e],o&&(f=f[0])}const{unsubscribe:p}=await l.subscribe({params:["logs",{address:t,topics:f}],onData(e){if(!r)return;const t=e.result;try{const{eventName:e,args:n}=Ha({abi:u??[],data:t.data,topics:t.topics,strict:h}),r=Za(t,{args:n,eventName:e});c([r])}catch(e){let n,r;if(e instanceof vt||e instanceof xt){if(d)return;n=e.abiItem.name,r=e.abiItem.inputs?.some(e=>!("name"in e&&e.name))}const o=Za(t,{args:r?[]:{},eventName:n});c([o])}},onError(e){i?.(e)}});s=p,r||s()}catch(e){i?.(e)}})(),()=>s()})()}(e,t),watchPendingTransactions:t=>function(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:a=e.pollingInterval}){return(void 0!==o?o:"webSocket"!==e.transport.type&&"ipc"!==e.transport.type)?sc(Or(["watchPendingTransactions",e.uid,t,a]),{onTransactions:r,onError:n},n=>{let r;const o=cc(async()=>{try{if(!r)try{return void(r=await Ve(e,Yc,"createPendingTransactionFilter")({}))}catch(e){throw o(),e}const a=await Ve(e,hc,"getFilterChanges")({filter:r});if(0===a.length)return;if(t)n.onTransactions(a);else for(const e of a)n.onTransactions([e])}catch(e){n.onError?.(e)}},{emitOnBegin:!0,interval:a});return async()=>{r&&await Ve(e,pc,"uninstallFilter")({filter:r}),o()}}):(()=>{let t=!0,o=()=>t=!1;return(async()=>{try{const{unsubscribe:a}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!t)return;const n=e.result;r([n])},onError(e){n?.(e)}});o=a,t||o()}catch(e){n?.(e)}})(),()=>o()})()}(e,t)}}function Hd(e){const{key:t="public",name:n="Public Client"}=e,r=function(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:a="Base Client",type:s="base"}=e,i=e.experimental_blockTag??("number"==typeof n?.experimental_preconfirmationTime?"pending":void 0),c=n?.blockTime??12e3,l=Math.min(Math.max(Math.floor(c/2),500),4e3),u=e.pollingInterval??l,d=e.cacheTime??u,f=e.account?hr(e.account):void 0,{config:h,request:p,value:m}=e.transport({chain:n,pollingInterval:u}),g={account:f,batch:t,cacheTime:d,ccipRead:r,chain:n,key:o,name:a,pollingInterval:u,request:p,transport:{...h,...m},type:s,uid:vc(),...i?{experimental_blockTag:i}:{}};return Object.assign(g,{extend:function e(t){return n=>{const r=n(t);for(const e in g)delete r[e];const o={...t,...r};return Object.assign(o,{extend:e(o)})}}(g)})}({...e,key:t,name:n,type:"publicClient"});return r.extend(Vd)}class Yd extends et{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function Kd(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:a="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:l,retryDelay:u,raw:d}=t;return({chain:f,retryCount:h,timeout:p})=>{const{batchSize:m=1e3,wait:g=0}="object"==typeof n?n:{},b=t.retryCount??h,y=p??t.timeout??1e4,w=e||f?.rpcUrls.default.http[0];if(!w)throw new Yd;const v=ll(w,{fetchFn:r,fetchOptions:o,onRequest:c,onResponse:l,timeout:y});return function({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:a=150,timeout:s,type:i},c){return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:a,timeout:s,type:i},request:el(r,{methods:t,retryCount:o,retryDelay:a,uid:vc()}),value:c}}({key:a,methods:s,name:i,async request({method:e,params:t}){const r={method:e,params:t},{schedule:o}=Xi({id:w,wait:g,shouldSplitBatch:e=>e.length>m,fn:e=>v.request({body:e}),sort:(e,t)=>e.id-t.id}),[{error:a,result:s}]=await(async e=>n?o(e):[await v.request({body:e})])(r);if(d)return{error:a,result:s};if(a)throw new no({body:r,error:a,url:w});return s},retryCount:b,retryDelay:u,timeout:y,type:"http"},{fetchOptions:o,url:w})}}function Zd(e,t,n){for(let n in t){let r=t[n];Object.defineProperty(e,n,{enumerable:!0,value:r,writable:!1})}}function Jd(e,t){if(null==e)return"null";if(null==t&&(t=new Set),"object"==typeof e){if(t.has(e))return"[Circular]";t.add(e)}if(Array.isArray(e))return"[ "+e.map(e=>Jd(e,t)).join(", ")+" ]";if(e instanceof Uint8Array){const t="0123456789abcdef";let n="0x";for(let r=0;r<e.length;r++)n+=t[e[r]>>4],n+=t[15&e[r]];return n}if("object"==typeof e&&"function"==typeof e.toJSON)return Jd(e.toJSON(),t);switch(typeof e){case"boolean":case"number":case"symbol":return e.toString();case"bigint":return BigInt(e).toString();case"string":return JSON.stringify(e);case"object":{const n=Object.keys(e);return n.sort(),"{ "+n.map(n=>`${Jd(n,t)}: ${Jd(e[n],t)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Qd(e,t,n,r){if(!e)throw function(e,t,n){let r,o=e;{const r=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${Jd(n)}`);for(const e in n){if("shortMessage"===e)continue;const t=n[e];r.push(e+"="+Jd(t))}}r.push(`code=${t}`),r.push("version=6.15.0"),r.length&&(e+=" ("+r.join(", ")+")")}switch(t){case"INVALID_ARGUMENT":r=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(e);break;default:r=new Error(e)}return Zd(r,{code:t}),n&&Object.assign(r,n),null==r.shortMessage&&Zd(r,{shortMessage:o}),r}(t,n,r)}function Xd(e,t,n,r){Qd(e,t,"INVALID_ARGUMENT",{argument:n,value:r})}function ef(e,t){return function(e,t){if(e instanceof Uint8Array)return e;if("string"==typeof e&&e.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const t=new Uint8Array((e.length-2)/2);let n=2;for(let r=0;r<t.length;r++)t[r]=parseInt(e.substring(n,n+2),16),n+=2;return t}Xd(!1,"invalid BytesLike value",t,e)}(e,t)}["NFD","NFC","NFKD","NFKC"].reduce((e,t)=>{try{if("test"!=="test".normalize(t))throw new Error("bad");if("NFD"===t){const e=String.fromCharCode(233).normalize("NFD");if(e!==String.fromCharCode(101,769))throw new Error("broken")}e.push(t)}catch(e){}return e},[]);const tf=BigInt(0),nf=BigInt(1),rf=9007199254740991;function of(e,t){const n=cf(e,"value"),r=BigInt(uf(t,"width"));if(Qd(n>>r===tf,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:e}),n>>r-nf){return-((~n&(nf<<r)-nf)+nf)}return n}function af(e,t){const n=cf(e,"value"),r=BigInt(uf(t,"bits"));return n&(nf<<r)-nf}function sf(e,t){switch(typeof e){case"bigint":return e;case"number":return Xd(Number.isInteger(e),"underflow",t||"value",e),Xd(e>=-rf&&e<=rf,"overflow",t||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(n){Xd(!1,`invalid BigNumberish string: ${n.message}`,t||"value",e)}}Xd(!1,"invalid BigNumberish value",t||"value",e)}function cf(e,t){const n=sf(e,t);return Qd(n>=tf,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),n}const lf="0123456789abcdef";function uf(e,t){switch(typeof e){case"bigint":return Xd(e>=-rf&&e<=rf,"overflow",t||"value",e),Number(e);case"number":return Xd(Number.isInteger(e),"underflow",t||"value",e),Xd(e>=-rf&&e<=rf,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return uf(BigInt(e),t)}catch(n){Xd(!1,`invalid numeric string: ${n.message}`,t||"value",e)}}Xd(!1,"invalid numeric value",t||"value",e)}const df=BigInt(-1),ff=BigInt(0),hf=BigInt(1),pf=BigInt(5),mf={};let gf="0000";for(;gf.length<80;)gf+=gf;function bf(e){let t=gf;for(;t.length<e;)t+=t;return BigInt("1"+t.substring(0,e))}function yf(e,t,n){const r=BigInt(t.width);if(t.signed){const t=hf<<r-hf;Qd(null==n||e>=-t&&e<t,"overflow","NUMERIC_FAULT",{operation:n,fault:"overflow",value:e}),e=e>ff?of(af(e,r),r):-of(af(-e,r),r)}else{const t=hf<<r;Qd(null==n||e>=0&&e<t,"overflow","NUMERIC_FAULT",{operation:n,fault:"overflow",value:e}),e=(e%t+t)%t&t-hf}return e}function wf(e){"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,n=128,r=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const o=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);Xd(o,"invalid fixed format","format",e),t="u"!==o[1],n=parseInt(o[2]),r=parseInt(o[3])}else if(e){const o=e,a=(e,t,n)=>null==o[e]?n:(Xd(typeof o[e]===t,"invalid fixed format ("+e+" not "+t+")","format."+e,o[e]),o[e]);t=a("signed","boolean",t),n=a("width","number",n),r=a("decimals","number",r)}Xd(n%8==0,"invalid FixedNumber width (not byte aligned)","format.width",n),Xd(r<=80,"invalid FixedNumber decimals (too large)","format.decimals",r);return{signed:t,width:n,decimals:r,name:(t?"":"u")+"fixed"+String(n)+"x"+String(r)}}class vf{format;#e;#t;#n;_value;constructor(e,t,n){!function(e,t,n){if(e!==t){let e=n,t="new";e+=".",t+=" "+n,Qd(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}(e,mf,"FixedNumber"),this.#t=t,this.#e=n;const r=function(e,t){let n="";e<ff&&(n="-",e*=df);let r=e.toString();if(0===t)return n+r;for(;r.length<=t;)r=gf+r;const o=r.length-t;for(r=r.substring(0,o)+"."+r.substring(o);"0"===r[0]&&"."!==r[1];)r=r.substring(1);for(;"0"===r[r.length-1]&&"."!==r[r.length-2];)r=r.substring(0,r.length-1);return n+r}(t,n.decimals);Zd(this,{format:n.name,_value:r}),this.#n=bf(n.decimals)}get signed(){return this.#e.signed}get width(){return this.#e.width}get decimals(){return this.#e.decimals}get value(){return this.#t}#r(e){Xd(this.format===e.format,"incompatible format; use fixedNumber.toFormat","other",e)}#o(e,t){return e=yf(e,this.#e,t),new vf(mf,e,this.#e)}#a(e,t){return this.#r(e),this.#o(this.#t+e.#t,t)}addUnsafe(e){return this.#a(e)}add(e){return this.#a(e,"add")}#s(e,t){return this.#r(e),this.#o(this.#t-e.#t,t)}subUnsafe(e){return this.#s(e)}sub(e){return this.#s(e,"sub")}#i(e,t){return this.#r(e),this.#o(this.#t*e.#t/this.#n,t)}mulUnsafe(e){return this.#i(e)}mul(e){return this.#i(e,"mul")}mulSignal(e){this.#r(e);const t=this.#t*e.#t;return Qd(t%this.#n===ff,"precision lost during signalling mul","NUMERIC_FAULT",{operation:"mulSignal",fault:"underflow",value:this}),this.#o(t/this.#n,"mulSignal")}#c(e,t){return Qd(e.#t!==ff,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#r(e),this.#o(this.#t*this.#n/e.#t,t)}divUnsafe(e){return this.#c(e)}div(e){return this.#c(e,"div")}divSignal(e){Qd(e.#t!==ff,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#r(e);const t=this.#t*this.#n;return Qd(t%e.#t===ff,"precision lost during signalling div","NUMERIC_FAULT",{operation:"divSignal",fault:"underflow",value:this}),this.#o(t/e.#t,"divSignal")}cmp(e){let t=this.value,n=e.value;const r=this.decimals-e.decimals;return r>0?n*=bf(r):r<0&&(t*=bf(-r)),t<n?-1:t>n?1:0}eq(e){return 0===this.cmp(e)}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=this.#t;return this.#t<ff&&(e-=this.#n-hf),e=this.#t/this.#n*this.#n,this.#o(e,"floor")}ceiling(){let e=this.#t;return this.#t>ff&&(e+=this.#n-hf),e=this.#t/this.#n*this.#n,this.#o(e,"ceiling")}round(e){if(null==e&&(e=0),e>=this.decimals)return this;const t=this.decimals-e,n=pf*bf(t-1);let r=this.value+n;const o=bf(t);return r=r/o*o,yf(r,this.#e,"round"),new vf(mf,r,this.#e)}isZero(){return this.#t===ff}isNegative(){return this.#t<ff}toString(){return this._value}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return vf.fromString(this.toString(),e)}static fromValue(e,t,n){const r=null==t?0:uf(t),o=wf(n);let a=sf(e,"value");const s=r-o.decimals;if(s>0){const t=bf(s);Qd(a%t===ff,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),a/=t}else s<0&&(a*=bf(-s));return yf(a,o,"fromValue"),new vf(mf,a,o)}static fromString(e,t){const n=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);Xd(n&&n[2].length+n[3].length>0,"invalid FixedNumber string value","value",e);const r=wf(t);let o=n[2]||"0",a=n[3]||"";for(;a.length<r.decimals;)a+=gf;Qd(a.substring(r.decimals).match(/^0*$/),"too many decimals for format","NUMERIC_FAULT",{operation:"fromString",fault:"underflow",value:e}),a=a.substring(0,r.decimals);const s=BigInt(n[1]+o+a);return yf(s,r,"fromString"),new vf(mf,s,r)}static fromBytes(e,t){let n=function(e){if(e instanceof Uint8Array){let t="0x0";for(const n of e)t+=lf[n>>4],t+=lf[15&n];return BigInt(t)}return sf(e)}(ef(e,"value"));const r=wf(t);return r.signed&&(n=of(n,r.width)),yf(n,r,"fromBytes"),new vf(mf,n,r)}}function xf(e){return function(e,t){let n=18;return n=uf(t,"unit"),vf.fromValue(e,n,{decimals:n,width:512}).toString()}(e,18)}const Ef="0.38.13";function Pf({projectId:e,originComponentName:t,...n}){const r=new URL("https://pay.coinbase.com/buy");void 0!==e&&r.searchParams.append("appId",e);for(const e of Object.keys(n)){const t=n[e];void 0!==t&&(["string","number","boolean"].includes(typeof t)?r.searchParams.append(e,t.toString()):r.searchParams.append(e,JSON.stringify(t)))}return t?r.searchParams.append("sdkVersion",`onchainkit@${Ef}:${t}`):r.searchParams.append("sdkVersion",`onchainkit@${Ef}`),r.searchParams.sort(),r.toString()}var kf=[],Af=[],If="undefined"!=typeof Uint8Array?Uint8Array:Array,Nf=!1;function Sf(){Nf=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)kf[t]=e[t],Af[e.charCodeAt(t)]=t;Af["-".charCodeAt(0)]=62,Af["_".charCodeAt(0)]=63}function Tf(e){return kf[e>>18&63]+kf[e>>12&63]+kf[e>>6&63]+kf[63&e]}function Bf(e,t,n){for(var r,o=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(Tf(r));return o.join("")}function Cf(e){var t;Nf||Sf();for(var n=e.length,r=n%3,o="",a=[],s=16383,i=0,c=n-r;i<c;i+=s)a.push(Bf(e,i,i+s>c?c:i+s));return 1===r?(t=e[n-1],o+=kf[t>>2],o+=kf[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=kf[t>>10],o+=kf[t>>4&63],o+=kf[t<<2&63],o+="="),a.push(o),a.join("")}function $f(e,t,n,r,o){var a,s,i=8*o-r-1,c=(1<<i)-1,l=c>>1,u=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,a=h&(1<<-u)-1,h>>=-u,u+=i;u>0;a=256*a+e[t+d],d+=f,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=r;u>0;s=256*s+e[t+d],d+=f,u-=8);if(0===a)a=1-l;else{if(a===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),a-=l}return(h?-1:1)*s*Math.pow(2,a-r)}function Of(e,t,n,r,o,a){var s,i,c,l=8*a-o-1,u=(1<<l)-1,d=u>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(i=0,s=u):s+d>=1?(i=(t*c-1)*Math.pow(2,o),s+=d):(i=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[n+h]=255&i,h+=p,i/=256,o-=8);for(s=s<<o|i,l+=o;l>0;e[n+h]=255&s,h+=p,s/=256,l-=8);e[n+h-p]|=128*m}var _f={}.toString,Rf=Array.isArray||function(e){return"[object Array]"==_f.call(e)};function zf(){return Lf.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Mf(e,t){if(zf()<t)throw new RangeError("Invalid typed array length");return Lf.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Lf.prototype:(null===e&&(e=new Lf(t)),e.length=t),e}function Lf(e,t,n){if(!(Lf.TYPED_ARRAY_SUPPORT||this instanceof Lf))return new Lf(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return jf(this,e)}return Ff(this,e,t,n)}function Ff(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);Lf.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Lf.prototype:e=Df(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!Lf.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|qf(t,n);e=Mf(e,r);var o=e.write(t,n);o!==r&&(e=e.slice(0,o));return e}(e,t,n):function(e,t){if(Wf(t)){var n=0|Gf(t.length);return 0===(e=Mf(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?Mf(e,0):Df(e,t);if("Buffer"===t.type&&Rf(t.data))return Df(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Uf(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function jf(e,t){if(Uf(t),e=Mf(e,t<0?0:0|Gf(t)),!Lf.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Df(e,t){var n=t.length<0?0:0|Gf(t.length);e=Mf(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function Gf(e){if(e>=zf())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+zf().toString(16)+" bytes");return 0|e}function Wf(e){return!(null==e||!e._isBuffer)}function qf(e,t){if(Wf(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return yh(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return wh(e).length;default:if(r)return yh(e).length;t=(""+t).toLowerCase(),r=!0}}function Vf(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return ih(this,t,n);case"utf8":case"utf-8":return rh(this,t,n);case"ascii":return ah(this,t,n);case"latin1":case"binary":return sh(this,t,n);case"base64":return nh(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ch(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function Hf(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function Yf(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=Lf.from(t,r)),Wf(t))return 0===t.length?-1:Kf(e,t,n,r,o);if("number"==typeof t)return t&=255,Lf.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Kf(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function Kf(e,t,n,r,o){var a,s=1,i=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,i/=2,c/=2,n/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var u=-1;for(a=n;a<i;a++)if(l(e,a)===l(t,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===c)return u*s}else-1!==u&&(a-=a-u),u=-1}else for(n+c>i&&(n=i-c),a=n;a>=0;a--){for(var d=!0,f=0;f<c;f++)if(l(e,a+f)!==l(t,f)){d=!1;break}if(d)return a}return-1}function Zf(e,t,n,r){n=Number(n)||0;var o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var s=0;s<r;++s){var i=parseInt(t.substr(2*s,2),16);if(isNaN(i))return s;e[n+s]=i}return s}function Jf(e,t,n,r){return vh(yh(t,e.length-n),e,n,r)}function Qf(e,t,n,r){return vh(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function Xf(e,t,n,r){return Qf(e,t,n,r)}function eh(e,t,n,r){return vh(wh(t),e,n,r)}function th(e,t,n,r){return vh(function(e,t){for(var n,r,o,a=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,o=n%256,a.push(o),a.push(r);return a}(t,e.length-n),e,n,r)}function nh(e,t,n){return 0===t&&n===e.length?Cf(e):Cf(e.slice(t,n))}function rh(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o<n;){var a,s,i,c,l=e[o],u=null,d=l>239?4:l>223?3:l>191?2:1;if(o+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(a=e[o+1]))&&(c=(31&l)<<6|63&a)>127&&(u=c);break;case 3:a=e[o+1],s=e[o+2],128==(192&a)&&128==(192&s)&&(c=(15&l)<<12|(63&a)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:a=e[o+1],s=e[o+2],i=e[o+3],128==(192&a)&&128==(192&s)&&128==(192&i)&&(c=(15&l)<<18|(63&a)<<12|(63&s)<<6|63&i)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),o+=d}return function(e){var t=e.length;if(t<=oh)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=oh));return n}(r)}Lf.TYPED_ARRAY_SUPPORT=void 0===globalThis.TYPED_ARRAY_SUPPORT||globalThis.TYPED_ARRAY_SUPPORT,zf(),Lf.poolSize=8192,Lf._augment=function(e){return e.__proto__=Lf.prototype,e},Lf.from=function(e,t,n){return Ff(null,e,t,n)},Lf.TYPED_ARRAY_SUPPORT&&(Lf.prototype.__proto__=Uint8Array.prototype,Lf.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Lf[Symbol.species]),Lf.alloc=function(e,t,n){return function(e,t,n,r){return Uf(t),t<=0?Mf(e,t):void 0!==n?"string"==typeof r?Mf(e,t).fill(n,r):Mf(e,t).fill(n):Mf(e,t)}(null,e,t,n)},Lf.allocUnsafe=function(e){return jf(null,e)},Lf.allocUnsafeSlow=function(e){return jf(null,e)},Lf.isBuffer=function(e){return null!=e&&(!!e._isBuffer||xh(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&xh(e.slice(0,0))}(e))},Lf.compare=function(e,t){if(!Wf(e)||!Wf(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,a=Math.min(n,r);o<a;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},Lf.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Lf.concat=function(e,t){if(!Rf(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Lf.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=Lf.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var a=e[n];if(!Wf(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,o),o+=a.length}return r},Lf.byteLength=qf,Lf.prototype._isBuffer=!0,Lf.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Hf(this,t,t+1);return this},Lf.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Hf(this,t,t+3),Hf(this,t+1,t+2);return this},Lf.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Hf(this,t,t+7),Hf(this,t+1,t+6),Hf(this,t+2,t+5),Hf(this,t+3,t+4);return this},Lf.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?rh(this,0,e):Vf.apply(this,arguments)},Lf.prototype.equals=function(e){if(!Wf(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Lf.compare(this,e)},Lf.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Lf.prototype.compare=function(e,t,n,r,o){if(!Wf(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),i=Math.min(a,s),c=this.slice(r,o),l=e.slice(t,n),u=0;u<i;++u)if(c[u]!==l[u]){a=c[u],s=l[u];break}return a<s?-1:s<a?1:0},Lf.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},Lf.prototype.indexOf=function(e,t,n){return Yf(this,e,t,n,!0)},Lf.prototype.lastIndexOf=function(e,t,n){return Yf(this,e,t,n,!1)},Lf.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return Zf(this,e,t,n);case"utf8":case"utf-8":return Jf(this,e,t,n);case"ascii":return Qf(this,e,t,n);case"latin1":case"binary":return Xf(this,e,t,n);case"base64":return eh(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return th(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},Lf.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var oh=4096;function ah(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function sh(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function ih(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var o="",a=t;a<n;++a)o+=bh(e[a]);return o}function ch(e,t,n){for(var r=e.slice(t,n),o="",a=0;a<r.length;a+=2)o+=String.fromCharCode(r[a]+256*r[a+1]);return o}function lh(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function uh(e,t,n,r,o,a){if(!Wf(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function dh(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,a=Math.min(e.length-n,2);o<a;++o)e[n+o]=(t&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function fh(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,a=Math.min(e.length-n,4);o<a;++o)e[n+o]=t>>>8*(r?o:3-o)&255}function hh(e,t,n,r,o,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ph(e,t,n,r,o){return o||hh(e,0,n,4),Of(e,t,n,r,23,4),n+4}function mh(e,t,n,r,o){return o||hh(e,0,n,8),Of(e,t,n,r,52,8),n+8}Lf.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),Lf.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=Lf.prototype;else{var o=t-e;n=new Lf(o,void 0);for(var a=0;a<o;++a)n[a]=this[a+e]}return n},Lf.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||lh(e,t,this.length);for(var r=this[e],o=1,a=0;++a<t&&(o*=256);)r+=this[e+a]*o;return r},Lf.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||lh(e,t,this.length);for(var r=this[e+--t],o=1;t>0&&(o*=256);)r+=this[e+--t]*o;return r},Lf.prototype.readUInt8=function(e,t){return t||lh(e,1,this.length),this[e]},Lf.prototype.readUInt16LE=function(e,t){return t||lh(e,2,this.length),this[e]|this[e+1]<<8},Lf.prototype.readUInt16BE=function(e,t){return t||lh(e,2,this.length),this[e]<<8|this[e+1]},Lf.prototype.readUInt32LE=function(e,t){return t||lh(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Lf.prototype.readUInt32BE=function(e,t){return t||lh(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Lf.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||lh(e,t,this.length);for(var r=this[e],o=1,a=0;++a<t&&(o*=256);)r+=this[e+a]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*t)),r},Lf.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||lh(e,t,this.length);for(var r=t,o=1,a=this[e+--r];r>0&&(o*=256);)a+=this[e+--r]*o;return a>=(o*=128)&&(a-=Math.pow(2,8*t)),a},Lf.prototype.readInt8=function(e,t){return t||lh(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Lf.prototype.readInt16LE=function(e,t){t||lh(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},Lf.prototype.readInt16BE=function(e,t){t||lh(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},Lf.prototype.readInt32LE=function(e,t){return t||lh(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Lf.prototype.readInt32BE=function(e,t){return t||lh(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Lf.prototype.readFloatLE=function(e,t){return t||lh(e,4,this.length),$f(this,e,!0,23,4)},Lf.prototype.readFloatBE=function(e,t){return t||lh(e,4,this.length),$f(this,e,!1,23,4)},Lf.prototype.readDoubleLE=function(e,t){return t||lh(e,8,this.length),$f(this,e,!0,52,8)},Lf.prototype.readDoubleBE=function(e,t){return t||lh(e,8,this.length),$f(this,e,!1,52,8)},Lf.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||uh(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,a=0;for(this[t]=255&e;++a<n&&(o*=256);)this[t+a]=e/o&255;return t+n},Lf.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||uh(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+n},Lf.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,1,255,0),Lf.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Lf.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,2,65535,0),Lf.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):dh(this,e,t,!0),t+2},Lf.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,2,65535,0),Lf.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):dh(this,e,t,!1),t+2},Lf.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,4,4294967295,0),Lf.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):fh(this,e,t,!0),t+4},Lf.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,4,4294967295,0),Lf.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):fh(this,e,t,!1),t+4},Lf.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);uh(this,e,t,n,o-1,-o)}var a=0,s=1,i=0;for(this[t]=255&e;++a<n&&(s*=256);)e<0&&0===i&&0!==this[t+a-1]&&(i=1),this[t+a]=(e/s|0)-i&255;return t+n},Lf.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);uh(this,e,t,n,o-1,-o)}var a=n-1,s=1,i=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===i&&0!==this[t+a+1]&&(i=1),this[t+a]=(e/s|0)-i&255;return t+n},Lf.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,1,127,-128),Lf.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Lf.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,2,32767,-32768),Lf.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):dh(this,e,t,!0),t+2},Lf.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,2,32767,-32768),Lf.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):dh(this,e,t,!1),t+2},Lf.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,4,2147483647,-2147483648),Lf.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):fh(this,e,t,!0),t+4},Lf.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Lf.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):fh(this,e,t,!1),t+4},Lf.prototype.writeFloatLE=function(e,t,n){return ph(this,e,t,!0,n)},Lf.prototype.writeFloatBE=function(e,t,n){return ph(this,e,t,!1,n)},Lf.prototype.writeDoubleLE=function(e,t,n){return mh(this,e,t,!0,n)},Lf.prototype.writeDoubleBE=function(e,t,n){return mh(this,e,t,!1,n)},Lf.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var o,a=r-n;if(this===e&&n<t&&t<r)for(o=a-1;o>=0;--o)e[o+t]=this[o+n];else if(a<1e3||!Lf.TYPED_ARRAY_SUPPORT)for(o=0;o<a;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},Lf.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Lf.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var s=Wf(e)?e:yh(new Lf(e,r).toString()),i=s.length;for(a=0;a<n-t;++a)this[a+t]=s[a%i]}return this};var gh=/[^+\/0-9A-Za-z-_]/g;function bh(e){return e<16?"0"+e.toString(16):e.toString(16)}function yh(e,t){var n;t=t||1/0;for(var r=e.length,o=null,a=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&a.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&a.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function wh(e){return function(e){var t,n,r,o,a,s;Nf||Sf();var i=e.length;if(i%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[i-2]?2:"="===e[i-1]?1:0,s=new If(3*i/4-a),r=a>0?i-4:i;var c=0;for(t=0,n=0;t<r;t+=4,n+=3)o=Af[e.charCodeAt(t)]<<18|Af[e.charCodeAt(t+1)]<<12|Af[e.charCodeAt(t+2)]<<6|Af[e.charCodeAt(t+3)],s[c++]=o>>16&255,s[c++]=o>>8&255,s[c++]=255&o;return 2===a?(o=Af[e.charCodeAt(t)]<<2|Af[e.charCodeAt(t+1)]>>4,s[c++]=255&o):1===a&&(o=Af[e.charCodeAt(t)]<<10|Af[e.charCodeAt(t+1)]<<4|Af[e.charCodeAt(t+2)]>>2,s[c++]=o>>8&255,s[c++]=255&o),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(gh,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function vh(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function xh(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function Eh(){const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}class Ph{constructor(e){this.selectedWalletId=null,this.solanaConnection=null,this.ethereumProvider=null,this.walletInfo=null,this.phantomAdapter=null,this.walletType="embedded",this.backupWalletType="embedded_backup",this.ethereumNetwork=null,this.defaultNetwork=exports.Network.Solana,this.api=y.default.create({baseURL:e.baseURL,headers:{"Content-Type":"application/json"}}),this.middleAccountApi=y.default.create({baseURL:e.middleAccountBaseURL||"https://yeezy-payment-service-sit-a0dchfccbufeh5bx.z03.azurefd.net",headers:{"Content-Type":"application/json"}}),this.solanaCluster=e.solanaCluster,this.solanaConnection=new t.Connection(e.solanaCluster.rpcUrl),e.ethereumNetwork&&(this.ethereumNetwork={...e.ethereumNetwork,chainId:Number(e.ethereumNetwork.chainId)},this.ethereumProvider=Hd({transport:Kd(e.ethereumNetwork.rpcUrl)})),this.defaultNetwork=e.defaultNetwork||exports.Network.Solana}setWallet(e){this.walletInfo=e}setWalletType(e){this.walletType=e,T.saveWalletType(e)}setBackupWalletType(e){this.backupWalletType=e,T.saveBackupWalletType(e),console.log(33)}getWallet(){return this.walletInfo}getPhantomAdapter(){return this.phantomAdapter}getWalletType(){return this.walletType}getBackupWalletType(){return this.backupWalletType}get wallet(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.network===this.defaultNetwork))||null}get address(){var e;return(null===(e=this.wallet)||void 0===e?void 0:e.address)||null}get network(){var e;return(null===(e=this.wallet)||void 0===e?void 0:e.network)||null}get ethereumWallet(){var e,t;return(null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.address===T.getSwitchedAccountAddress()))||(null===(t=this.walletInfo)||void 0===t?void 0:t.wallets.find(e=>e.network===exports.Network.Ethereum&&"Main"===e.wallet_set))||null}get ethereumAddress(){var e;return(null===(e=this.ethereumWallet)||void 0===e?void 0:e.address)||null}get solanaWallet(){var e,t,n,r;const o=null===(t=null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.address===T.getSwitchedAccountAddress()))||void 0===t?void 0:t.wallet_set;return o?(null===(n=this.walletInfo)||void 0===n?void 0:n.wallets.find(e=>e.network===exports.Network.Solana&&e.wallet_set===o))||null:(null===(r=this.walletInfo)||void 0===r?void 0:r.wallets.find(e=>e.network===exports.Network.Solana&&"Main"===e.wallet_set))||null}get forwardSolanaWallet(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.network===exports.Network.Solana&&"Forward-0"===e.wallet_set))||null}get forwardSolanaAddress(){var e;return(null===(e=this.forwardSolanaWallet)||void 0===e?void 0:e.address)||null}get forwardEthereumWallet(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.network===exports.Network.Ethereum&&"Forward-0"===e.wallet_set))||null}get forwardEthereumAddress(){var e;return(null===(e=this.forwardEthereumWallet)||void 0===e?void 0:e.address)||null}get solanaAddress(){var e;return(null===(e=this.solanaWallet)||void 0===e?void 0:e.address)||null}get id(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.id)||null}get social_links(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.social_links)||null}async reconnect(e){try{if(T.getWalletType()==="phantom"+(e?"_backup":"")){return await this.connectPhantom()}if(!e){const e=await this.getSession();return this.setWallet(e),e}const t=T.getBackupWalletInfo();return this.setWallet(t),t}catch(e){return null}}async connectPhantom(){try{if(this.phantomAdapter||(this.phantomAdapter=new K),await this.phantomAdapter.connect(),!this.phantomAdapter.publicKey)throw new Error("Failed to connect to Phantom wallet");const e=this.phantomAdapter.publicKey.toString(),t={id:r.v4(),wallets:[{id:e,address:e,network:exports.Network.Solana,wallet_type:exports.WalletType.Phantom,wallet_set:"Main",account_index:0,is_enabled:!0}],social_links:[],social_infos:[],account_info:{name:null,sub_accounts:[]},created_at:Date.now(),is_exported:!1};return this.setWallet(t),this.setWalletType("phantom"),t}catch(e){throw console.error("Phantom connect error:",e),new Error(e instanceof Error?e.message:"Failed to connect to Phantom wallet")}}async updateAccountName(e,t){if(!this.walletInfo)throw new Error("No wallet info");const n={name:e};void 0!==t&&(n.account_index=t);const r=(await this.api.post("/account/update",n,{withCredentials:!0})).data;return this.setWallet(r),r}async manageMultiAccount(e){if(!this.walletInfo)throw new Error("No wallet info");const t=(await this.api.post("/account/multi",e,{withCredentials:!0})).data;return this.setWallet(t),t}async createSubAccount(e){return this.manageMultiAccount({type:"Create",data:{name:null!=e?e:null}})}async enableSubAccount(e){return this.manageMultiAccount({type:"Enable",data:{index:e}})}async disableSubAccount(e){return this.manageMultiAccount({type:"Disable",data:{index:e}})}async signSolanaTransaction(e){try{if(!this.walletInfo)throw new Error("No wallet info");if(!this.solanaConnection)throw new Error("No rpc connection");const{blockhash:n}=await this.solanaConnection.getLatestBlockhash();if(E(e)?e.message.recentBlockhash=n:e.recentBlockhash=n,this.phantomAdapter&&this.phantomAdapter.publicKey)return await this.phantomAdapter.signTransaction(e);const r=this.solanaWallet;if(!r)throw new Error("No solana wallet available");const o=await this.signV3({network:exports.Network.Solana,address:r.address,tx:{Solana:w.default.encode(E(e)?e.message.serialize():e.serializeMessage())}});return e.addSignature(new t.PublicKey(r.address),Lf.from(w.default.decode(o))),e}catch(e){throw new Error(e instanceof Error?e.message:"Failed to sign transaction")}}async signEthereumEip712(e){if(!this.ethereumNetwork)throw new Error("No Ethereum network");if(!this.ethereumProvider)throw new Error("No Ethereum provider");if(!this.walletInfo)throw new Error("No wallet info");if(!this.ethereumAddress)throw new Error("No Ethereum address");return await this.signV2({network:exports.Network.Ethereum,address:this.ethereumAddress,tx:{EthereumEip712:e}})}async sendSolanaTransaction(e){if(!this.solanaConnection)throw new Error("No rpc connection");try{return await this.solanaConnection.sendRawTransaction(e,{maxRetries:3,skipPreflight:!1})}catch(e){throw e}}async sendEthereumTransaction(e){if(!this.ethereumProvider)throw new Error("No Ethereum provider");try{return await this.ethereumProvider.sendRawTransaction({serializedTransaction:e})}catch(e){throw e}}async sendEmailVerificationCode(e){await this.api.post("/send_verification",{email:e})}async sendPhoneVerificationCode(e){e.startsWith("+")||(e=`+${e}`),await this.api.post("/send_verification",{phone:e,type:"phone"})}async verifyEmailVerificationCode({email:e,code:t}){const n={type:"Email",data:{network:this.defaultNetwork,email:e,code:t}},r=(await this.api.post("/login",n,{withCredentials:!0})).data;return this.setWallet(r),this.setWalletType("embedded"),r}async verifyPhoneVerificationCode({phone:e,code:t}){const n={type:"Phone",data:{network:this.defaultNetwork,phone:e,code:t}},r=(await this.api.post("/login",n,{withCredentials:!0})).data;return this.setWallet(r),this.setWalletType("embedded"),r}async twitterLogin(e){const t={type:"TwitterOAuth",data:{network:this.defaultNetwork,...e}},n=(await this.api.post("/login",t,{withCredentials:!0})).data;return this.setWallet(n),this.setWalletType("embedded"),n}async googleLogin(e){const t={type:"GoogleOAuth",data:{network:this.defaultNetwork,...e}},n=(await this.api.post("/login",t,{withCredentials:!0})).data;return this.setWallet(n),this.setWalletType("embedded"),n}async oauthLogin(e,t){const n={type:e,data:{network:t.network||this.defaultNetwork,...t}},r=(await this.api.post("/login",n,{withCredentials:!0})).data;return this.setWallet(r),t.isBackup?this.setBackupWalletType("embedded_backup"):this.setWalletType("embedded"),r}async loginWithChallenge(e,t){const n={type:e,data:{network:t.network||this.defaultNetwork,...t}},r=(await this.api.post("/login",n,{withCredentials:!0})).data;return this.setWallet(r),console.log(11),t.isBackup?(console.log(22),this.setBackupWalletType("embedded_backup")):this.setWalletType("embedded"),r}async oauthInit(e){return(await this.api.post("/oauth/init",e)).data}async getSignChallenge(e){return(await this.api.get(`/challenge?method=${e.method}&id=${e.id}`)).data}async getSession(){const e=(await this.api.get("/session",{withCredentials:!0})).data,{access_token:t,...n}=e;return t&&T.saveAccessToken(t),e}async logout(e){this.phantomAdapter?(this.phantomAdapter.disconnect(),this.phantomAdapter=null):await this.api.post("/logout",{},{withCredentials:!0}),this.setWallet(null),e?T.clearBackup():T.clear()}async getOAuth2ClientId(e){return(await this.api.get(`/oauth_id/${e}`)).data.client_id}setSelectedWallet(e){this.selectedWalletId=e}getSelectedWallet(){return this.selectedWalletId}async getSolanaBalance(){if(!this.solanaConnection||!this.solanaAddress)throw new Error("Solana connection not available");return(await this.solanaConnection.getBalance(new t.PublicKey(this.solanaAddress))/t.LAMPORTS_PER_SOL).toString()}async getEthereumBalance(){if(!this.ethereumProvider||!this.ethereumAddress)throw new Error("Ethereum provider not available");return xf(await this.ethereumProvider.getBalance({address:this.ethereumAddress}))}async fetchCoinbaseToken(e,t="solana"){return(await this.api.post("/ramp/coinbase",{addresses:[{address:e,blockchains:[t]}],assets:["solana"===t?"SOL":"ETH"]})).data.token}viemSignerAdapter(){return{signTypedData:async e=>{if(!this.ethereumNetwork)throw new Error("No Ethereum network");if(!this.ethereumProvider)throw new Error("No Ethereum provider");if(!this.walletInfo)throw new Error("No wallet info");if(!this.ethereumAddress)throw new Error("No Ethereum address");const t=await this.signV2({network:exports.Network.Ethereum,address:this.ethereumAddress,tx:{EthereumEip712:e}}),n=w.default.decode(t),r=n[64];return Fd({r:`0x${Lf.from(n.slice(0,32)).toString("hex")}`,s:`0x${Lf.from(n.slice(32,64)).toString("hex")}`,v:BigInt(r+27)})}}}async createMiddleAccount(e){try{return(await this.middleAccountApi.post("/create",e)).data}catch(e){throw new Error(e instanceof Error?e.message:"Failed to create middle account")}}async getCoinbaseOnrampUrlForMiddleAccount(e){try{const t={sessionToken:await this.fetchCoinbaseToken(e.middleAccountAddress,e.network===exports.Network.Solana?"solana":"ethereum"),presetCryptoAmount:Number(e.amount),redirectUrl:e.redirectUrl||window.location.href};return Pf(t)}catch(e){throw new Error(e instanceof Error?e.message:"Failed to get Coinbase onramp URL")}}async getOrderState(e){try{return(await this.middleAccountApi.get(`/order/${e}`)).data}catch(e){throw new Error(e instanceof Error?e.message:"Failed to get order status")}}async transfer(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_id:this.walletInfo.id,from:e.from,to:e.to,amount:e.amount,decimals:e.decimals,token:e.token,network:e.network,chain_id:e.chain_id};try{return(await this.api.post("/transfer",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Transfer failed")}}async buildTransaction(e,t){var n,r;if(!this.walletInfo)throw new Error("No wallet info available");try{const n={...e,wallet_address:t||e.wallet_address||null};return(await this.api.post("/v3/build_transaction",n,{withCredentials:!0})).data}catch(e){if(null===(r=null===(n=e.response)||void 0===n?void 0:n.data)||void 0===r?void 0:r.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to build transaction")}}async exportInit(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_nonce:Eh(),account_index:e};try{return(await this.api.post("/export/init",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to initialize export")}}async exportFinal(e){var t,n,r;if(!this.walletInfo)throw new Error("No wallet info available");const o={user_nonce:e.userNonce,server_nonce:e.serverNonce,account_index:e.accountIndex,is_export:null===(t=e.isExport)||void 0===t||t};try{return(await this.api.post("/export/final",o,{withCredentials:!0})).data}catch(e){if(null===(r=null===(n=e.response)||void 0===n?void 0:n.data)||void 0===r?void 0:r.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to finalize export")}}async getExportedWallets(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={account_index:e,is_export:!1};try{return(await this.api.post("/export/final",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to retrieve exported wallets")}}async closeInit(){var e,t;if(!this.walletInfo)throw new Error("No wallet info available");const n={user_nonce:Eh()};try{return(await this.api.post("/close/init",n,{withCredentials:!0})).data}catch(n){if(null===(t=null===(e=n.response)||void 0===e?void 0:e.data)||void 0===t?void 0:t.error)throw new Error(n.response.data.error);throw new Error(n instanceof Error?n.message:"Failed to initialize account closure")}}async closeFinal(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_nonce:e.userNonce,server_nonce:e.serverNonce};try{const e=await this.api.post("/close/final",r,{withCredentials:!0});return this.setWallet(null),T.clear(),e.data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to close account")}}async signV1(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_id:this.walletInfo.id,network:e.network,address:e.address,message:e.message};try{return(await this.api.post("/v1/sign",r,{withCredentials:!0})).data.signature}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to sign message")}}async signV2(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_id:this.walletInfo.id,network:e.network,address:e.address,tx:e.tx};try{return(await this.api.post("/v2/sign",r,{withCredentials:!0})).data.signature}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to sign transaction")}}async signV3(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");if(e.network!==exports.Network.Solana)throw new Error("v3 sign API only supports Solana transactions");if(!e.tx.Solana)throw new Error("Solana transaction is required for v3 sign API");const r={user_id:this.walletInfo.id,network:e.network,address:e.address,tx:{Solana:e.tx.Solana}};try{return(await this.api.post("/v3/sign",r,{withCredentials:!0})).data.signature}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to sign transaction")}}async lighterBuildTransaction(e,t){var n,r;if(!this.walletInfo)throw new Error("No wallet info available");try{const n={...e,wallet_address:t||e.wallet_address||null};return(await this.api.post("/v3/lighter/build_transaction",n,{withCredentials:!0})).data}catch(e){if(null===(r=null===(n=e.response)||void 0===n?void 0:n.data)||void 0===r?void 0:r.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to build Lighter transaction")}}async lighterAuth(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={account_index:e.lighter_account_index,wallet_address:e.wallet_address||null,expires_in_ms:e.expires_in_ms||null};try{return(await this.api.post("/v3/lighter/auth",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to generate Lighter auth token")}}async lighterChangeKey(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");if(e.lighter_account_index<0)throw new Error("accountIndex must be non-negative");const r={account_index:e.lighter_account_index,wallet_address:e.wallet_address||null};try{return(await this.api.post("/v3/lighter/change_key",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to change Lighter key")}}async exchange(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");try{return(await this.api.post("/v3/sign/exchange",e,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to build exchange transaction")}}}var kh=function(){return kh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},kh.apply(this,arguments)};function Ah(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function Ih(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}"function"==typeof SuppressedError&&SuppressedError;var Nh=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Sh=Ih(function(e){return Nh.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),Th="-ms-",Bh="-moz-",Ch="-webkit-",$h="comm",Oh="rule",_h="decl",Rh="@keyframes",zh=Math.abs,Mh=String.fromCharCode,Lh=Object.assign;function Fh(e){return e.trim()}function Uh(e,t){return(e=t.exec(e))?e[0]:e}function jh(e,t,n){return e.replace(t,n)}function Dh(e,t,n){return e.indexOf(t,n)}function Gh(e,t){return 0|e.charCodeAt(t)}function Wh(e,t,n){return e.slice(t,n)}function qh(e){return e.length}function Vh(e){return e.length}function Hh(e,t){return t.push(e),e}function Yh(e,t){return e.filter(function(e){return!Uh(e,t)})}var Kh=1,Zh=1,Jh=0,Qh=0,Xh=0,ep="";function tp(e,t,n,r,o,a,s,i){return{value:e,root:t,parent:n,type:r,props:o,children:a,line:Kh,column:Zh,length:s,return:"",siblings:i}}function np(e,t){return Lh(tp("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function rp(e){for(;e.root;)e=np(e.root,{children:[e]});Hh(e,e.siblings)}function op(){return Xh=Qh>0?Gh(ep,--Qh):0,Zh--,10===Xh&&(Zh=1,Kh--),Xh}function ap(){return Xh=Qh<Jh?Gh(ep,Qh++):0,Zh++,10===Xh&&(Zh=1,Kh++),Xh}function sp(){return Gh(ep,Qh)}function ip(){return Qh}function cp(e,t){return Wh(ep,e,t)}function lp(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function up(e){return Fh(cp(Qh-1,hp(91===e?e+2:40===e?e+1:e)))}function dp(e){for(;(Xh=sp())&&Xh<33;)ap();return lp(e)>2||lp(Xh)>3?"":" "}function fp(e,t){for(;--t&&ap()&&!(Xh<48||Xh>102||Xh>57&&Xh<65||Xh>70&&Xh<97););return cp(e,ip()+(t<6&&32==sp()&&32==ap()))}function hp(e){for(;ap();)switch(Xh){case e:return Qh;case 34:case 39:34!==e&&39!==e&&hp(Xh);break;case 40:41===e&&hp(e);break;case 92:ap()}return Qh}function pp(e,t){for(;ap()&&e+Xh!==57&&(e+Xh!==84||47!==sp()););return"/*"+cp(t,Qh-1)+"*"+Mh(47===e?e:ap())}function mp(e){for(;!lp(sp());)ap();return cp(e,Qh)}function gp(e){return function(e){return ep="",e}(bp("",null,null,null,[""],e=function(e){return Kh=Zh=1,Jh=qh(ep=e),Qh=0,[]}(e),0,[0],e))}function bp(e,t,n,r,o,a,s,i,c){for(var l=0,u=0,d=s,f=0,h=0,p=0,m=1,g=1,b=1,y=0,w="",v=o,x=a,E=r,P=w;g;)switch(p=y,y=ap()){case 40:if(108!=p&&58==Gh(P,d-1)){-1!=Dh(P+=jh(up(y),"&","&\f"),"&\f",zh(l?i[l-1]:0))&&(b=-1);break}case 34:case 39:case 91:P+=up(y);break;case 9:case 10:case 13:case 32:P+=dp(p);break;case 92:P+=fp(ip()-1,7);continue;case 47:switch(sp()){case 42:case 47:Hh(wp(pp(ap(),ip()),t,n,c),c);break;default:P+="/"}break;case 123*m:i[l++]=qh(P)*b;case 125*m:case 59:case 0:switch(y){case 0:case 125:g=0;case 59+u:-1==b&&(P=jh(P,/\f/g,"")),h>0&&qh(P)-d&&Hh(h>32?vp(P+";",r,n,d-1,c):vp(jh(P," ","")+";",r,n,d-2,c),c);break;case 59:P+=";";default:if(Hh(E=yp(P,t,n,l,u,o,i,w,v=[],x=[],d,a),a),123===y)if(0===u)bp(P,t,E,E,v,a,d,i,x);else switch(99===f&&110===Gh(P,3)?100:f){case 100:case 108:case 109:case 115:bp(e,E,E,r&&Hh(yp(e,E,E,0,0,o,i,w,o,v=[],d,x),x),o,x,d,i,r?v:x);break;default:bp(P,E,E,E,[""],x,0,i,x)}}l=u=h=0,m=b=1,w=P="",d=s;break;case 58:d=1+qh(P),h=p;default:if(m<1)if(123==y)--m;else if(125==y&&0==m++&&125==op())continue;switch(P+=Mh(y),y*m){case 38:b=u>0?1:(P+="\f",-1);break;case 44:i[l++]=(qh(P)-1)*b,b=1;break;case 64:45===sp()&&(P+=up(ap())),f=sp(),u=d=qh(w=P+=mp(ip())),y++;break;case 45:45===p&&2==qh(P)&&(m=0)}}return a}function yp(e,t,n,r,o,a,s,i,c,l,u,d){for(var f=o-1,h=0===o?a:[""],p=Vh(h),m=0,g=0,b=0;m<r;++m)for(var y=0,w=Wh(e,f+1,f=zh(g=s[m])),v=e;y<p;++y)(v=Fh(g>0?h[y]+" "+w:jh(w,/&\f/g,h[y])))&&(c[b++]=v);return tp(e,t,n,0===o?Oh:i,c,l,u,d)}function wp(e,t,n,r){return tp(e,t,n,$h,Mh(Xh),Wh(e,2,-2),0,r)}function vp(e,t,n,r,o){return tp(e,t,n,_h,Wh(e,0,r),Wh(e,r+1,-1),r,o)}function xp(e,t,n){switch(function(e,t){return 45^Gh(e,0)?(((t<<2^Gh(e,0))<<2^Gh(e,1))<<2^Gh(e,2))<<2^Gh(e,3):0}(e,t)){case 5103:return Ch+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ch+e+e;case 4789:return Bh+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Ch+e+Bh+e+Th+e+e;case 5936:switch(Gh(e,t+11)){case 114:return Ch+e+Th+jh(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ch+e+Th+jh(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ch+e+Th+jh(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Ch+e+Th+e+e;case 6165:return Ch+e+Th+"flex-"+e+e;case 5187:return Ch+e+jh(e,/(\w+).+(:[^]+)/,Ch+"box-$1$2"+Th+"flex-$1$2")+e;case 5443:return Ch+e+Th+"flex-item-"+jh(e,/flex-|-self/g,"")+(Uh(e,/flex-|baseline/)?"":Th+"grid-row-"+jh(e,/flex-|-self/g,""))+e;case 4675:return Ch+e+Th+"flex-line-pack"+jh(e,/align-content|flex-|-self/g,"")+e;case 5548:return Ch+e+Th+jh(e,"shrink","negative")+e;case 5292:return Ch+e+Th+jh(e,"basis","preferred-size")+e;case 6060:return Ch+"box-"+jh(e,"-grow","")+Ch+e+Th+jh(e,"grow","positive")+e;case 4554:return Ch+jh(e,/([^-])(transform)/g,"$1"+Ch+"$2")+e;case 6187:return jh(jh(jh(e,/(zoom-|grab)/,Ch+"$1"),/(image-set)/,Ch+"$1"),e,"")+e;case 5495:case 3959:return jh(e,/(image-set\([^]*)/,Ch+"$1$`$1");case 4968:return jh(jh(e,/(.+:)(flex-)?(.*)/,Ch+"box-pack:$3"+Th+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ch+e+e;case 4200:if(!Uh(e,/flex-|baseline/))return Th+"grid-column-align"+Wh(e,t)+e;break;case 2592:case 3360:return Th+jh(e,"template-","")+e;case 4384:case 3616:return n&&n.some(function(e,n){return t=n,Uh(e.props,/grid-\w+-end/)})?~Dh(e+(n=n[t].value),"span",0)?e:Th+jh(e,"-start","")+e+Th+"grid-row-span:"+(~Dh(n,"span",0)?Uh(n,/\d+/):+Uh(n,/\d+/)-+Uh(e,/\d+/))+";":Th+jh(e,"-start","")+e;case 4896:case 4128:return n&&n.some(function(e){return Uh(e.props,/grid-\w+-start/)})?e:Th+jh(jh(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return jh(e,/(.+)-inline(.+)/,Ch+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(qh(e)-1-t>6)switch(Gh(e,t+1)){case 109:if(45!==Gh(e,t+4))break;case 102:return jh(e,/(.+:)(.+)-([^]+)/,"$1"+Ch+"$2-$3$1"+Bh+(108==Gh(e,t+3)?"$3":"$2-$3"))+e;case 115:return~Dh(e,"stretch",0)?xp(jh(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return jh(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(t,n,r,o,a,s,i){return Th+n+":"+r+i+(o?Th+n+"-span:"+(a?s:+s-+r)+i:"")+e});case 4949:if(121===Gh(e,t+6))return jh(e,":",":"+Ch)+e;break;case 6444:switch(Gh(e,45===Gh(e,14)?18:11)){case 120:return jh(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Ch+(45===Gh(e,14)?"inline-":"")+"box$3$1"+Ch+"$2$3$1"+Th+"$2box$3")+e;case 100:return jh(e,":",":"+Th)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return jh(e,"scroll-","scroll-snap-")+e}return e}function Ep(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function Pp(e,t,n,r){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case _h:return e.return=e.return||e.value;case $h:return"";case Rh:return e.return=e.value+"{"+Ep(e.children,r)+"}";case Oh:if(!qh(e.value=e.props.join(",")))return""}return qh(n=Ep(e.children,r))?e.return=e.value+"{"+n+"}":""}function kp(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case _h:return void(e.return=xp(e.value,e.length,n));case Rh:return Ep([np(e,{value:jh(e.value,"@","@"+Ch)})],r);case Oh:if(e.length)return function(e,t){return e.map(t).join("")}(n=e.props,function(t){switch(Uh(t,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":rp(np(e,{props:[jh(t,/:(read-\w+)/,":-moz-$1")]})),rp(np(e,{props:[t]})),Lh(e,{props:Yh(n,r)});break;case"::placeholder":rp(np(e,{props:[jh(t,/:(plac\w+)/,":"+Ch+"input-$1")]})),rp(np(e,{props:[jh(t,/:(plac\w+)/,":-moz-$1")]})),rp(np(e,{props:[jh(t,/:(plac\w+)/,Th+"input-$1")]})),rp(np(e,{props:[t]})),Lh(e,{props:Yh(n,r)})}return""})}}var Ap={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Ip="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Np="active",Sp="data-styled-version",Tp="6.1.19",Bp="/*!sc*/\n",Cp="undefined"!=typeof window&&"undefined"!=typeof document,$p=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),Op=/invalid hook call/i,_p=new Set,Rp=function(e,t){if("production"!==process.env.NODE_ENV){var n=t?' with the id of "'.concat(t,'"'):"",r="The component ".concat(e).concat(n," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n",a=console.error;try{var s=!0;console.error=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];Op.test(e)?(s=!1,_p.delete(r)):a.apply(void 0,Ah([e],t,!1))},o.useRef(),s&&!_p.has(r)&&(console.warn(r),_p.add(r))}catch(e){Op.test(e.message)&&_p.delete(r)}finally{console.error=a}}},zp=Object.freeze([]),Mp=Object.freeze({});var Lp=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),Fp=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Up=/(^-|-$)/g;function jp(e){return e.replace(Fp,"-").replace(Up,"")}var Dp=/(a)(d)/gi,Gp=function(e){return String.fromCharCode(e+(e>25?39:97))};function Wp(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Gp(t%52)+n;return(Gp(t%52)+n).replace(Dp,"$1-$2")}var qp,Vp=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Hp=function(e){return Vp(5381,e)};function Yp(e){return Wp(Hp(e)>>>0)}function Kp(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function Zp(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var Jp="function"==typeof Symbol&&Symbol.for,Qp=Jp?Symbol.for("react.memo"):60115,Xp=Jp?Symbol.for("react.forward_ref"):60112,em={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},tm={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},nm={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},rm=((qp={})[Xp]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},qp[Qp]=nm,qp);function om(e){return("type"in(t=e)&&t.type.$$typeof)===Qp?nm:"$$typeof"in e?rm[e.$$typeof]:em;var t}var am=Object.defineProperty,sm=Object.getOwnPropertyNames,im=Object.getOwnPropertySymbols,cm=Object.getOwnPropertyDescriptor,lm=Object.getPrototypeOf,um=Object.prototype;function dm(e,t,n){if("string"!=typeof t){if(um){var r=lm(t);r&&r!==um&&dm(e,r,n)}var o=sm(t);im&&(o=o.concat(im(t)));for(var a=om(e),s=om(t),i=0;i<o.length;++i){var c=o[i];if(!(c in tm||n&&n[c]||s&&c in s||a&&c in a)){var l=cm(t,c);try{am(e,c,l)}catch(e){}}}}return e}function fm(e){return"function"==typeof e}function hm(e){return"object"==typeof e&&"styledComponentId"in e}function pm(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function mm(e,t){if(0===e.length)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function gm(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function bm(e,t,n){if(void 0===n&&(n=!1),!n&&!gm(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=bm(e[r],t[r]);else if(gm(t))for(var r in t)e[r]=bm(e[r],t[r]);return e}function ym(e,t){Object.defineProperty(e,"toString",{value:t})}var wm="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function vm(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],r=[],o=1,a=e.length;o<a;o+=1)r.push(e[o]);return r.forEach(function(e){n=n.replace(/%[a-z]/,e)}),n}function xm(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):"")):new Error(vm.apply(void 0,Ah([wm[e]],t,!1)).trim())}var Em=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)if((o<<=1)<0)throw xm(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var a=r;a<o;a++)this.groupSizes[a]=0}for(var s=this.indexOfGroup(e+1),i=(a=0,t.length);a<i;a++)this.tag.insertRule(s,t[a])&&(this.groupSizes[e]++,s++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,a=r;a<o;a++)t+="".concat(this.tag.getRule(a)).concat(Bp);return t},e}(),Pm=1<<30,km=new Map,Am=new Map,Im=1,Nm=function(e){if(km.has(e))return km.get(e);for(;Am.has(Im);)Im++;var t=Im++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>Pm))throw xm(16,"".concat(t));return km.set(e,t),Am.set(t,e),t},Sm=function(e,t){Im=t+1,km.set(e,t),Am.set(t,e)},Tm="style[".concat(Ip,"][").concat(Sp,'="').concat(Tp,'"]'),Bm=new RegExp("^".concat(Ip,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Cm=function(e,t,n){for(var r,o=n.split(","),a=0,s=o.length;a<s;a++)(r=o[a])&&e.registerName(t,r)},$m=function(e,t){for(var n,r=(null!==(n=t.textContent)&&void 0!==n?n:"").split(Bp),o=[],a=0,s=r.length;a<s;a++){var i=r[a].trim();if(i){var c=i.match(Bm);if(c){var l=0|parseInt(c[1],10),u=c[2];0!==l&&(Sm(u,l),Cm(e,u,c[3]),e.getTag().insertRules(l,o)),o.length=0}else o.push(i)}}},Om=function(e){for(var t=document.querySelectorAll(Tm),n=0,r=t.length;n<r;n++){var o=t[n];o&&o.getAttribute(Ip)!==Np&&($m(e,o),o.parentNode&&o.parentNode.removeChild(o))}};var _m=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){var t=Array.from(e.querySelectorAll("style[".concat(Ip,"]")));return t[t.length-1]}(n),a=void 0!==o?o.nextSibling:null;r.setAttribute(Ip,Np),r.setAttribute(Sp,Tp);var s="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null;return s&&r.setAttribute("nonce",s),n.insertBefore(r,a),r},Rm=function(){function e(e){this.element=_m(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}throw xm(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),zm=function(){function e(e){this.element=_m(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),Mm=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Lm=Cp,Fm={isServer:!Cp,useCSSOMInjection:!$p},Um=function(){function e(e,t,n){void 0===e&&(e=Mp),void 0===t&&(t={});var r=this;this.options=kh(kh({},Fm),e),this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&Cp&&Lm&&(Lm=!1,Om(this)),ym(this,function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=function(n){var o=function(e){return Am.get(e)}(n);if(void 0===o)return"continue";var a=e.names.get(o),s=t.getGroup(n);if(void 0===a||!a.size||0===s.length)return"continue";var i="".concat(Ip,".g").concat(n,'[id="').concat(o,'"]'),c="";void 0!==a&&a.forEach(function(e){e.length>0&&(c+="".concat(e,","))}),r+="".concat(s).concat(i,'{content:"').concat(c,'"}').concat(Bp)},a=0;a<n;a++)o(a);return r}(r)})}return e.registerId=function(e){return Nm(e)},e.prototype.rehydrate=function(){!this.server&&Cp&&Om(this)},e.prototype.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(kh(kh({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new Mm(n):t?new Rm(n):new zm(n)}(this.options),new Em(e)));var e},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(Nm(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(Nm(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(Nm(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),jm=/&/g,Dm=/^\s*\/\/.*$/gm;function Gm(e,t){return e.map(function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return"".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Gm(e.children,t)),e})}var Wm=new Um,qm=function(){var e,t,n,r=Mp,o=r.options,a=void 0===o?Mp:o,s=r.plugins,i=void 0===s?zp:s,c=function(n,r,o){return o.startsWith(t)&&o.endsWith(t)&&o.replaceAll(t,"").length>0?".".concat(e):n},l=i.slice();l.push(function(e){e.type===Oh&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(jm,t).replace(n,c))}),a.prefix&&l.push(kp),l.push(Pp);var u=function(r,o,s,i){void 0===o&&(o=""),void 0===s&&(s=""),void 0===i&&(i="&"),e=i,t=o,n=new RegExp("\\".concat(t,"\\b"),"g");var c=r.replace(Dm,""),u=gp(s||o?"".concat(s," ").concat(o," { ").concat(c," }"):c);a.namespace&&(u=Gm(u,a.namespace));var d,f=[];return Ep(u,function(e){var t=Vh(e);return function(n,r,o,a){for(var s="",i=0;i<t;i++)s+=e[i](n,r,o,a)||"";return s}}(l.concat((d=function(e){return f.push(e)},function(e){e.root||(e=e.return)&&d(e)})))),f};return u.hash=i.length?i.reduce(function(e,t){return t.name||xm(15),Vp(e,t.name)},5381).toString():"",u}(),Vm=v.default.createContext({shouldForwardProp:void 0,styleSheet:Wm,stylis:qm});function Hm(){return o.useContext(Vm)}Vm.Consumer,v.default.createContext(void 0);var Ym=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=qm);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,ym(this,function(){throw xm(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=qm),this.name+e.hash},e}(),Km=function(e){return e>="A"&&e<="Z"};function Zm(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(1===n&&"-"===r&&"-"===e[0])return e;Km(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var Jm=function(e){return null==e||!1===e||""===e},Qm=function(e){var t,n,r=[];for(var o in e){var a=e[o];e.hasOwnProperty(o)&&!Jm(a)&&(Array.isArray(a)&&a.isCss||fm(a)?r.push("".concat(Zm(o),":"),a,";"):gm(a)?r.push.apply(r,Ah(Ah(["".concat(o," {")],Qm(a),!1),["}"],!1)):r.push("".concat(Zm(o),": ").concat((t=o,null==(n=a)||"boolean"==typeof n||""===n?"":"number"!=typeof n||0===n||t in Ap||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function Xm(e,t,n,r){if(Jm(e))return[];if(hm(e))return[".".concat(e.styledComponentId)];if(fm(e)){if(!fm(a=e)||a.prototype&&a.prototype.isReactComponent||!t)return[e];var o=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof o||Array.isArray(o)||o instanceof Ym||gm(o)||null===o||console.error("".concat(Kp(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Xm(o,t,n,r)}var a;return e instanceof Ym?n?(e.inject(n,r),[e.getName(r)]):[e]:gm(e)?Qm(e):Array.isArray(e)?Array.prototype.concat.apply(zp,e.map(function(e){return Xm(e,t,n,r)})):[e.toString()]}var eg=Hp(Tp),tg=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&function(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(fm(n)&&!hm(n))return!1}return!0}(e),this.componentId=t,this.baseHash=Vp(eg,t),this.baseStyle=n,Um.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))r=pm(r,this.staticRulesId);else{var o=mm(Xm(this.rules,e,t,n)),a=Wp(Vp(this.baseHash,o)>>>0);if(!t.hasNameForId(this.componentId,a)){var s=n(o,".".concat(a),void 0,this.componentId);t.insertRules(this.componentId,a,s)}r=pm(r,a),this.staticRulesId=a}else{for(var i=Vp(this.baseHash,n.hash),c="",l=0;l<this.rules.length;l++){var u=this.rules[l];if("string"==typeof u)c+=u,"production"!==process.env.NODE_ENV&&(i=Vp(i,u));else if(u){var d=mm(Xm(u,e,t,n));i=Vp(i,d+l),c+=d}}if(c){var f=Wp(i>>>0);t.hasNameForId(this.componentId,f)||t.insertRules(this.componentId,f,n(c,".".concat(f),void 0,this.componentId)),r=pm(r,f)}}return r},e}(),ng=v.default.createContext(void 0);ng.Consumer;var rg={},og=new Set;function ag(e,t,n){var r=hm(e),a=e,s=!Zp(e),i=t.attrs,c=void 0===i?zp:i,l=t.componentId,u=void 0===l?function(e,t){var n="string"!=typeof e?"sc":jp(e);rg[n]=(rg[n]||0)+1;var r="".concat(n,"-").concat(Yp(Tp+n+rg[n]));return t?"".concat(t,"-").concat(r):r}(t.displayName,t.parentComponentId):l,d=t.displayName,f=void 0===d?function(e){return Zp(e)?"styled.".concat(e):"Styled(".concat(Kp(e),")")}(e):d,h=t.displayName&&t.componentId?"".concat(jp(t.displayName),"-").concat(t.componentId):t.componentId||u,p=r&&a.attrs?a.attrs.concat(c).filter(Boolean):c,m=t.shouldForwardProp;if(r&&a.shouldForwardProp){var g=a.shouldForwardProp;if(t.shouldForwardProp){var b=t.shouldForwardProp;m=function(e,t){return g(e,t)&&b(e,t)}}else m=g}var y=new tg(n,h,r?a.componentStyle:void 0);function w(e,t){return function(e,t,n){var r=e.attrs,a=e.componentStyle,s=e.defaultProps,i=e.foldedComponentIds,c=e.styledComponentId,l=e.target,u=v.default.useContext(ng),d=Hm(),f=e.shouldForwardProp||d.shouldForwardProp;"production"!==process.env.NODE_ENV&&o.useDebugValue(c);var h=function(e,t,n){return void 0===n&&(n=Mp),e.theme!==n.theme&&e.theme||t||n.theme}(t,u,s)||Mp,p=function(e,t,n){for(var r,o=kh(kh({},t),{className:void 0,theme:n}),a=0;a<e.length;a+=1){var s=fm(r=e[a])?r(o):r;for(var i in s)o[i]="className"===i?pm(o[i],s[i]):"style"===i?kh(kh({},o[i]),s[i]):s[i]}return t.className&&(o.className=pm(o.className,t.className)),o}(r,t,h),m=p.as||l,g={};for(var b in p)void 0===p[b]||"$"===b[0]||"as"===b||"theme"===b&&p.theme===h||("forwardedAs"===b?g.as=p.forwardedAs:f&&!f(b,m)||(g[b]=p[b],f||"development"!==process.env.NODE_ENV||Sh(b)||og.has(b)||!Lp.has(m)||(og.add(b),console.warn('styled-components: it looks like an unknown prop "'.concat(b,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var y=function(e,t){var n=Hm(),r=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return"production"!==process.env.NODE_ENV&&o.useDebugValue(r),r}(a,p);"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(y);var w=pm(i,c);return y&&(w+=" "+y),p.className&&(w+=" "+p.className),g[Zp(m)&&!Lp.has(m)?"class":"className"]=w,n&&(g.ref=n),o.createElement(m,g)}(x,e,t)}w.displayName=f;var x=v.default.forwardRef(w);return x.attrs=p,x.componentStyle=y,x.displayName=f,x.shouldForwardProp=m,x.foldedComponentIds=r?pm(a.foldedComponentIds,a.styledComponentId):"",x.styledComponentId=h,x.target=r?a.target:e,Object.defineProperty(x,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=r?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0,o=t;r<o.length;r++)bm(e,o[r],!0);return e}({},a.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(Rp(f,h),x.warnTooManyClasses=function(e,t){var n={},r=!1;return function(o){if(!r&&(n[o]=!0,Object.keys(n).length>=200)){var a=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(a,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),r=!0,n={}}}}(f,h)),ym(x,function(){return".".concat(x.styledComponentId)}),s&&dm(x,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),x}function sg(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n}var ig=function(e){return Object.assign(e,{isCss:!0})};function cg(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(fm(e)||gm(e))return ig(Xm(sg(zp,Ah([e],t,!0))));var r=e;return 0===t.length&&1===r.length&&"string"==typeof r[0]?Xm(r):ig(Xm(sg(r,t)))}function lg(e,t,n){if(void 0===n&&(n=Mp),!t)throw xm(1,t);var r=function(r){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return e(t,n,cg.apply(void 0,Ah([r],o,!1)))};return r.attrs=function(r){return lg(e,t,kh(kh({},n),{attrs:Array.prototype.concat(n.attrs,r).filter(Boolean)}))},r.withConfig=function(r){return lg(e,t,kh(kh({},n),r))},r}var ug=function(e){return lg(ag,e)},dg=ug;Lp.forEach(function(e){dg[e]=ug(e)}),"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");var fg="__sc-".concat(Ip,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[fg]||(window[fg]=0),1===window[fg]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window[fg]+=1);const hg={colors:{black:"#000000",white:"#FFFFFF",offWhite:"#F5F5F5",grey:{100:"#F7F7F7",200:"#E6E6E6",300:"#D1D1D1",400:"#B0B0B0",500:"#8C8C8C",600:"#696969",700:"#474747",800:"#2B2B2B",900:"#1A1A1A"},primary:"#000000",secondary:"#B0B0B0",error:"#FF4D4D",success:"#4CAF50",background:{main:"#FFFFFF",secondary:"#F5F5F5",overlay:"rgba(0, 0, 0, 0.7)"},text:{primary:"#000000",secondary:"#474747",tertiary:"#8C8C8C",inverse:"#FFFFFF"},button:{primary:{background:"#000000",text:"#FFFFFF",hover:"#2B2B2B",disabled:"#8C8C8C"},secondary:{background:"#F5F5F5",text:"#000000",hover:"#E6E6E6",disabled:"#D1D1D1"}},border:{light:"#E6E6E6",medium:"#D1D1D1",dark:"#8C8C8C"}},typography:{fontFamily:"'Montserrat', 'Arial', sans-serif",fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},fontWeights:{light:300,regular:400,medium:500,semibold:600,bold:700}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem",full:"9999px"},shadows:{none:"none",sm:"0 1px 2px rgba(0, 0, 0, 0.05)",md:"0 4px 6px rgba(0, 0, 0, 0.05)",lg:"0 10px 15px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px rgba(0, 0, 0, 0.05)"},transitions:{fast:"0.1s ease",normal:"0.2s ease",slow:"0.3s ease"}},pg=(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");var r=mm(cg.apply(void 0,Ah([e],t,!1))),o=Yp(r);return new Ym(o,r)})`
12
+ const Yu=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Ku=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Zu=BigInt(0),Ju=BigInt(1),Qu=BigInt(2),Xu=(e,t)=>(e+t/Qu)/t;const ed=Pu(Yu,void 0,void 0,{sqrt:function(e){const t=Yu,n=BigInt(3),r=BigInt(6),o=BigInt(11),a=BigInt(22),s=BigInt(23),i=BigInt(44),c=BigInt(88),l=e*e*e%t,u=l*l*e%t,d=pu(u,n,t)*u%t,f=pu(d,n,t)*u%t,h=pu(f,Qu,t)*l%t,p=pu(h,o,t)*h%t,m=pu(p,a,t)*p%t,g=pu(m,i,t)*m%t,b=pu(g,c,t)*g%t,y=pu(b,i,t)*m%t,w=pu(y,n,t)*u%t,v=pu(w,s,t)*p%t,x=pu(v,r,t)*l%t,E=pu(x,Qu,t);if(!ed.eql(ed.sqr(E),e))throw new Error("Cannot find square root");return E}}),td=function(e,t){const n=t=>Vu({...e,...Hu(t)});return{...n(t),create:n}}({a:Zu,b:BigInt(7),Fp:ed,n:Ku,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Ku,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Ju*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=n,s=BigInt("0x100000000000000000000000000000000"),i=Xu(a*e,t),c=Xu(-r*e,t);let l=hu(e-i*n-c*o,t),u=hu(-i*r-c*a,t);const d=l>s,f=u>s;if(d&&(l=t-l),f&&(u=t-u),l>s||u>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:l,k2neg:f,k2:u}}}},Ca);var nd=Object.freeze({__proto__:null,secp256k1:td});function rd(e,t={}){const{recovered:n}=t;if(void 0===e.r)throw new cd({signature:e});if(void 0===e.s)throw new cd({signature:e});if(n&&void 0===e.yParity)throw new cd({signature:e});if(e.r<0n||e.r>Rl)throw new ld({value:e.r});if(e.s<0n||e.s>Rl)throw new ud({value:e.s});if("number"==typeof e.yParity&&0!==e.yParity&&1!==e.yParity)throw new dd({value:e.yParity})}function od(e){if(130!==e.length&&132!==e.length)throw new id({signature:e});const t=BigInt(yi(e,0,32)),n=BigInt(yi(e,32,64)),r=(()=>{const t=Number(`0x${e.slice(130)}`);if(!Number.isNaN(t))try{return sd(t)}catch{throw new dd({value:t})}})();return void 0===r?{r:t,s:n}:{r:t,s:n,yParity:r}}function ad(e){if(void 0!==e.r&&void 0!==e.s)return function(e){const t="string"==typeof e?od(e):e instanceof Uint8Array?function(e){return od(hi(e))}(e):"string"==typeof e.r?function(e){const t=(()=>{const t=e.v?Number(e.v):void 0;let n=e.yParity?Number(e.yParity):void 0;if("number"==typeof t&&"number"!=typeof n&&(n=sd(t)),"number"!=typeof n)throw new dd({value:e.yParity});return n})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}(e):e.v?function(e){return{r:e.r,s:e.s,yParity:sd(e.v)}}(e):{r:e.r,s:e.s,...void 0!==e.yParity?{yParity:e.yParity}:{}};return rd(t),t}(e)}function sd(e){if(0===e||27===e)return 0;if(1===e||28===e)return 1;if(e>=35)return e%2==0?1:0;throw new fd({value:e})}class id extends _s{constructor({signature:e}){var t;super(`Value \`${e}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${wi((t=e,t instanceof Uint8Array?hi(t):Array.isArray(t)?hi(new Uint8Array(t)):t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class cd extends _s{constructor({signature:e}){super(`Signature \`${Hs(e)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class ld extends _s{constructor({value:e}){super(`Value \`${e}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class ud extends _s{constructor({value:e}){super(`Value \`${e}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class dd extends _s{constructor({value:e}){super(`Value \`${e}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class fd extends _s{constructor({value:e}){super(`Value \`${e}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function hd(e,t={}){return"string"==typeof e.chainId?function(e){const{address:t,chainId:n,nonce:r}=e,o=ad(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...o}}(e):{...e,...t.signature}}const pd=Zl("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function md(e){if("string"==typeof e){if("0x8010801080108010801080108010801080108010801080108010801080108010"!==yi(e,-32))throw new gd(e)}else rd(e.authorization)}let gd=class extends _s{constructor(e){super(`Value \`${e}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}};async function bd(e,{address:t,blockNumber:n,blockTag:r,storageKeys:o}){const a=r??"latest",s=void 0!==n?Wt(n):void 0;return function(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Ft(e.nonce):void 0,storageProof:e.storageProof?(t=e.storageProof,t.map(e=>({...e,value:BigInt(e.value)}))):void 0};var t}(await e.request({method:"eth_getProof",params:[t,o,s||a]}))}async function yd(e,{blockHash:t,blockNumber:n,blockTag:r,hash:o,index:a}){const s=r||"latest",i=void 0!==n?Wt(n):void 0;let c=null;if(c=o?await e.request({method:"eth_getTransactionByHash",params:[o]},{dedupe:!0}):t?await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,Wt(a)]},{dedupe:!0}):await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[i||s,Wt(a)]},{dedupe:Boolean(i)}),!c)throw new Vr({blockHash:t,blockNumber:n,blockTag:s,hash:o,index:a});return(e.chain?.formatters?.transaction?.format||ma)(c)}async function wd(e,{hash:t}){const n=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!n)throw new Hr({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||bc)(n)}async function vd(e,t){const{blockNumber:n,blockTag:r=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:a,traceTransfers:s,validation:i}=t;try{const t=[];for(const e of o){const n=e.blockOverrides?Bi(e.blockOverrides):void 0,r=e.calls.map(e=>{const t=e,n=t.account?hr(t.account):void 0,r=t.abi?mr(t):t.data,o={...t,data:t.dataSuffix?Vn([r||"0x",t.dataSuffix]):r,from:t.from??n?.address};return la(o),oa(o)}),o=e.stateOverrides?ia(e.stateOverrides):void 0;t.push({blockOverrides:n,calls:r,stateOverrides:o})}const c=("bigint"==typeof n?Wt(n):void 0)||r;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:t,returnFullTransactions:a,traceTransfers:s,validation:i},c]})).map((e,t)=>({...ga(e),calls:e.calls.map((e,n)=>{const{abi:r,args:a,functionName:s,to:i}=o[t].calls[n],c=e.error?.data??e.returnData,l=BigInt(e.gasUsed),u=e.logs?.map(e=>Za(e)),d="0x1"===e.status?"success":"failure",f=r&&"success"===d&&"0x"!==c?es({abi:r,data:c,functionName:s}):null,h=(()=>{if("success"===d)return;let t;return"0x"===e.error?.data?t=new at:e.error&&(t=new eo(e.error)),t?_o(t,{abi:r??[],address:i??"0x",args:a,functionName:s??"<unknown>"}):void 0})();return{data:c,gasUsed:l,logs:u,status:d,..."success"===d?{result:f}:{error:h}}})}))}catch(e){const t=e,n=ta(t,{});if(n instanceof ea)throw t;throw n}}function xd(e){let t=!0,n="",r=0,o="",a=!1;for(let s=0;s<e.length;s++){const i=e[s];if(["(",")",","].includes(i)&&(t=!0),"("===i&&r++,")"===i&&r--,t)if(0!==r)" "!==i?(o+=i,n+=i):","!==e[s-1]&&","!==n&&",("!==n&&(n="",t=!1);else if(" "===i&&["event","function","error",""].includes(o))o="";else if(o+=i,")"===i){a=!0;break}}if(!a)throw new _s("Unable to normalize signature.");return o}function Ed(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Sl(e,{strict:!1});case"bool":return"boolean"===n;case"function":case"string":return"string"===n;default:return"tuple"===r&&"components"in t?Object.values(t.components).every((t,n)=>Ed(Object.values(e)[n],t)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?"number"===n||"bigint"===n:/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?"string"===n||e instanceof Uint8Array:!!/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)&&(Array.isArray(e)&&e.every(e=>Ed(e,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})))}}function Pd(e,t,n){for(const r in e){const o=e[r],a=t[r];if("tuple"===o.type&&"tuple"===a.type&&"components"in o&&"components"in a)return Pd(o.components,a.components,n[r]);const s=[o.type,a.type];if((()=>!(!s.includes("address")||!s.includes("bytes20"))||(s.includes("address")&&s.includes("string")||!(!s.includes("address")||!s.includes("bytes")))&&Sl(n[r],{strict:!1}))())return s}}function kd(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||"string"==typeof e?We(e):e;return{...r,...n?{hash:Nd(r)}:{}}}function Ad(e,t,n){const{args:r=[],prepare:o=!0}=n??{},a=Ei(t,{strict:!1}),s=e.filter(e=>a?"function"===e.type||"error"===e.type?Id(e)===yi(t,0,4):"event"===e.type&&Nd(e)===t:"name"in e&&e.name===t);if(0===s.length)throw new Td({name:t});if(1===s.length)return{...s[0],...o?{hash:Nd(s[0])}:{}};let i;for(const e of s){if(!("inputs"in e))continue;if(!r||0===r.length){if(!e.inputs||0===e.inputs.length)return{...e,...o?{hash:Nd(e)}:{}};continue}if(!e.inputs)continue;if(0===e.inputs.length)continue;if(e.inputs.length!==r.length)continue;const t=r.every((t,n)=>{const r="inputs"in e&&e.inputs[n];return!!r&&Ed(t,r)});if(t){if(i&&"inputs"in i&&i.inputs){const t=Pd(e.inputs,i.inputs,r);if(t)throw new Sd({abiItem:e,type:t[0]},{abiItem:i,type:t[1]})}i=e}}const c=(()=>{if(i)return i;const[e,...t]=s;return{...e,overloads:t}})();if(!c)throw new Td({name:t});return{...c,...o?{hash:Nd(c)}:{}}}function Id(...e){const t=(()=>{if(Array.isArray(e[0])){const[t,n]=e;return Ad(t,n)}return e[0]})();return yi(Nd(t),0,4)}function Nd(...e){const t=(()=>{if(Array.isArray(e[0])){const[t,n]=e;return Ad(t,n)}return e[0]})();return"string"!=typeof t&&"hash"in t&&t.hash?t.hash:kl(mi(function(...e){const t=(()=>{if(Array.isArray(e[0])){const[t,n]=e;return Ad(t,n)}return e[0]})();return xd("string"==typeof t?t:oe(t))}(t)))}class Sd extends _s{constructor(e,t){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${e.type}\` in \`${xd(oe(e.abiItem))}\`, and`,`\`${t.type}\` in \`${xd(oe(t.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class Td extends _s{constructor({name:e,data:t,type:n="item"}){super(`ABI ${n}${e?` with name "${e}"`:t?` with data "${t}"`:""} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}function Bd(e){const t=e.find(e=>"constructor"===e.type);if(!t)throw new Td({name:"constructor"});return t}function Cd(...e){const[t,n=[]]=(()=>{if(Array.isArray(e[0])){const[t,n,r]=e;return[Od(t,n,{args:r}),r]}const[t,n]=e;return[t,n]})(),{overloads:r}=t,o=r?Od([t,...r],t.name,{args:n}):t,a=Id(o);const s=n.length>0?Yl(o.inputs,n):void 0;return s?di(a,s):a}function $d(e,t={}){return kd(e,t)}function Od(e,t,n){const r=Ad(e,t,n);if("function"!==r.type)throw new Td({name:t,type:"function"});return r}const _d="0x0000000000000000000000000000000000000000";async function Rd(e,t){const{blockNumber:n,blockTag:r,calls:o,stateOverrides:a,traceAssetChanges:s,traceTransfers:i,validation:c}=t,l=t.account?hr(t.account):void 0;if(s&&!l)throw new et("`account` is required when `traceAssetChanges` is true");const u=l?function(...e){const[t,n]=(()=>{if(Array.isArray(e[0])){const[t,n]=e;return[Bd(t),n]}return e})(),{bytecode:r,args:o}=n;return di(r,t.inputs?.length&&o?.length?Yl(t.inputs,o):"0x")}(kd("constructor(bytes, bytes)"),{bytecode:ji,args:["0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033",Cd($d("function getBalance(address)"),[l.address])]}):void 0;const d=s?await Promise.all(t.calls.map(async t=>{if(!t.data&&!t.abi)return;const{accessList:n}=await Vc(e,{account:l.address,...t,data:t.abi?mr(t):t.data});return n.map(({address:e,storageKeys:t})=>t.length>0?e:null)})).then(e=>e.flat().filter(Boolean)):[],f=await vd(e,{blockNumber:n,blockTag:r,blocks:[...s?[{calls:[{data:u}],stateOverrides:a},{calls:d.map((e,t)=>({abi:[$d("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:e,from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]}]:[],{calls:[...o,{}].map(e=>({...e,from:l?.address})),stateOverrides:a},...s?[{calls:[{data:u}]},{calls:d.map((e,t)=>({abi:[$d("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[l.address],to:e,from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]},{calls:d.map((e,t)=>({to:e,abi:[$d("function decimals() returns (uint256)")],functionName:"decimals",from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]},{calls:d.map((e,t)=>({to:e,abi:[$d("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]},{calls:d.map((e,t)=>({to:e,abi:[$d("function symbol() returns (string)")],functionName:"symbol",from:_d,nonce:t})),stateOverrides:[{address:_d,nonce:0}]}]:[]],traceTransfers:i,validation:c}),h=s?f[2]:f[0],[p,m,,g,b,y,w,v]=s?f:[],{calls:x,...E}=h,P=x.slice(0,-1)??[],k=[...p?.calls??[],...m?.calls??[]].map(e=>"success"===e.status?Lt(e.data):null),A=[...g?.calls??[],...b?.calls??[]].map(e=>"success"===e.status?Lt(e.data):null),I=(y?.calls??[]).map(e=>"success"===e.status?e.result:null),N=(v?.calls??[]).map(e=>"success"===e.status?e.result:null),S=(w?.calls??[]).map(e=>"success"===e.status?e.result:null),T=[];for(const[e,t]of A.entries()){const n=k[e];if("bigint"!=typeof t)continue;if("bigint"!=typeof n)continue;const r=I[e-1],o=N[e-1],a=S[e-1],s=(()=>0===e?{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18,symbol:"ETH"}:{address:d[e-1],decimals:a||r?Number(r??1):void 0,symbol:o??void 0})();T.some(e=>e.token.address===s.address)||T.push({token:s,value:{pre:n,post:t,diff:t-n}})}return{assetChanges:T,block:E,results:P}}const zd="0x6492649264926492649264926492649264926492649264926492649264926492";function Md(e){try{return function(e){if(yi(e,-32)!==zd)throw new Ld(e)}(e),!0}catch{return!1}}class Ld extends _s{constructor(e){super(`Value \`${e}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function Fd({r:e,s:t,to:n="hex",v:r,yParity:o}){const a=(()=>{if(0===o||1===o)return o;if(r&&(27n===r||28n===r||r>=35n))return r%2n==0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),s=`0x${new td.Signature(Lt(e),Lt(t)).toCompactHex()}${0===a?"1b":"1c"}`;return"hex"===n?s:Jt(s)}async function Ud(e,t){const{address:n,hash:r,erc6492VerifierAddress:o=t.universalSignatureVerifierAddress??e.chain?.contracts?.erc6492Verifier?.address,multicallAddress:a=t.multicallAddress??e.chain?.contracts?.multicall3?.address}=t,s=(()=>{const e=t.signature;return Ke(e)?e:"object"==typeof e&&"r"in e&&"s"in e?Fd(e):Gt(e)})();try{return function(e){try{return md(e),!0}catch{return!1}}(s)?await async function(e,t){const{address:n,blockNumber:r,blockTag:o,hash:a,multicallAddress:s}=t,{authorization:i,data:c,signature:l,to:u}=function(e){md(e);const t=xi(yi(e,-64,-32)),n=yi(e,-t-64,-64),r=yi(e,0,-t-64),[o,a,s]=Hl(pd,n);return{authorization:hd({address:o.delegation,chainId:Number(o.chainId),nonce:o.nonce,yParity:o.yParity,r:o.r,s:o.s}),signature:r,...s&&"0x"!==s?{data:s,to:a}:{}}}(t.signature),d=await Kc(e,{address:n,blockNumber:r,blockTag:o});if(d===Hn(["0xef0100",i.address]))return await async function(e,t){const{address:n,blockNumber:r,blockTag:o,hash:a,signature:s}=t,i=await Ve(e,nc,"readContract")({address:n,abi:Li,args:[a,s],blockNumber:r,blockTag:o,functionName:"isValidSignature"}).catch(e=>{if(e instanceof Zr)throw new jd;throw e});if(i.startsWith("0x1626ba7e"))return!0;throw new jd}(e,{address:n,blockNumber:r,blockTag:o,hash:a,signature:l});const f={address:i.address,chainId:Number(i.chainId),nonce:Number(i.nonce),r:Wt(i.r,{size:32}),s:Wt(i.s,{size:32}),yParity:i.yParity},h=await async function({address:e,authorization:t,signature:n}){return qa(Dn(e),await jo({authorization:t,signature:n}))}({address:n,authorization:f});if(!h)throw new jd;const p=await Ve(e,nc,"readContract")({...s?{address:s}:{code:Wi},authorizationList:[f],abi:Ci,blockNumber:r,blockTag:"pending",functionName:"aggregate3",args:[[...c?[{allowFailure:!0,target:u??n,callData:c}]:[],{allowFailure:!0,target:n,callData:mr({abi:Li,functionName:"isValidSignature",args:[a,l]})}]]}),m=p[p.length-1]?.returnData;if(m?.startsWith("0x1626ba7e"))return!0;throw new jd}(e,{...t,multicallAddress:a,signature:s}):await async function(e,t){const{address:n,factory:r,factoryData:o,hash:a,signature:s,verifierAddress:i,...c}=t,l=await(async()=>r||o?Md(s)?s:function(e){const{data:t,signature:n,to:r}=e;return di(Yl(Zl("address, bytes, bytes"),[r,t,n]),zd)}({data:o,signature:s,to:r}):s)(),u=i?{to:i,data:mr({abi:Fi,functionName:"isValidSig",args:[n,a,l]}),...c}:{data:Yi({abi:Fi,args:[n,a,l],bytecode:Gi}),...c},{data:d}=await Ve(e,ec,"call")(u).catch(e=>{if(e instanceof Kr)throw new jd;throw e});if(function(e,t={}){let n=e;if(t.size&&(Mt(n,{size:t.size}),n=zt(n)),"0x00"===zt(n))return!1;if("0x01"===zt(n))return!0;throw new _t(n)}(d??"0x0"))return!0;throw new jd}(e,{...t,verifierAddress:o,signature:s})}catch(e){try{if(qa(Dn(n),await zo({hash:r,signature:s})))return!0}catch{}if(e instanceof jd)return!1;throw e}}class jd extends Error{}function Dd(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:o,poll:a,pollingInterval:s=e.pollingInterval}){let i;return(void 0!==a?a:"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type&&"ipc"!==e.transport.transports[0].config.type))?sc(Or(["watchBlockNumber",e.uid,t,n,s]),{onBlockNumber:r,onError:o},r=>cc(async()=>{try{const t=await Ve(e,fc,"getBlockNumber")({cacheTime:0});if(void 0!==i){if(t===i)return;if(t-i>1&&n)for(let e=i+1n;e<t;e++)r.onBlockNumber(e,i),i=e}(void 0===i||t>i)&&(r.onBlockNumber(t,i),i=t)}catch(e){r.onError?.(e)}},{emitOnBegin:t,interval:s})):sc(Or(["watchBlockNumber",e.uid,t,n]),{onBlockNumber:r,onError:o},t=>{let n=!0,r=()=>n=!1;return(async()=>{try{const o=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),{unsubscribe:a}=await o.subscribe({params:["newHeads"],onData(e){if(!n)return;const r=Lt(e.result?.number);t.onBlockNumber(r,i),i=r},onError(e){t.onError?.(e)}});r=a,n||r()}catch(e){o?.(e)}})(),()=>r()})}const Gd=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,Wd=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;async function qd(e,t){const{address:n,domain:r,message:o,nonce:a,scheme:s,signature:i,time:c=new Date,...l}=t,u=function(e){const{scheme:t,statement:n,...r}=e.match(Gd)?.groups??{},{chainId:o,expirationTime:a,issuedAt:s,notBefore:i,requestId:c,...l}=e.match(Wd)?.groups??{},u=e.split("Resources:")[1]?.split("\n- ").slice(1);return{...r,...l,...o?{chainId:Number(o)}:{},...a?{expirationTime:new Date(a)}:{},...s?{issuedAt:new Date(s)}:{},...i?{notBefore:new Date(i)}:{},...c?{requestId:c}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}(o);if(!u.address)return!1;const d=function(e){const{address:t,domain:n,message:r,nonce:o,scheme:a,time:s=new Date}=e;if(n&&r.domain!==n)return!1;if(o&&r.nonce!==o)return!1;if(a&&r.scheme!==a)return!1;if(r.expirationTime&&s>=r.expirationTime)return!1;if(r.notBefore&&s<r.notBefore)return!1;try{if(!r.address)return!1;if(!qn(r.address,{strict:!1}))return!1;if(t&&!qa(r.address,t))return!1}catch{return!1}return!0}({address:n,domain:r,message:u,nonce:a,scheme:s,time:c});if(!d)return!1;const f=ul(o);return Ud(e,{address:u.address,hash:f,signature:i,...l})}function Vd(e){return{call:t=>ec(e,t),createAccessList:t=>Vc(e,t),createBlockFilter:()=>async function(e){const t=dr(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}(e),createContractEventFilter:t=>fr(e,t),createEventFilter:t=>Hc(e,t),createPendingTransactionFilter:()=>Yc(e),estimateContractGas:t=>async function(e,t){const{abi:n,address:r,args:o,functionName:a,dataSuffix:s,...i}=t,c=mr({abi:n,args:o,functionName:a});try{return await Ve(e,Wa,"estimateGas")({data:`${c}${s?s.replace("0x",""):""}`,to:r,...i})}catch(e){const t=i.account?hr(i.account):void 0;throw _o(e,{abi:n,address:r,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:a,sender:t?.address})}}(e,t),estimateGas:t=>Wa(e,t),getBalance:t=>async function(e,{address:t,blockNumber:n,blockTag:r=e.experimental_blockTag??"latest"}){const o="bigint"==typeof n?Wt(n):void 0,a=await e.request({method:"eth_getBalance",params:[t,o||r]});return BigInt(a)}(e,t),getBlobBaseFee:()=>async function(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}(e),getBlock:t=>ba(e,t),getBlockNumber:t=>fc(e,t),getBlockTransactionCount:t=>async function(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const o=void 0!==n?Wt(n):void 0;let a;return a=t?await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):await e.request({method:"eth_getBlockTransactionCountByNumber",params:[o||r]},{dedupe:Boolean(o)}),Ft(a)}(e,t),getBytecode:t=>Kc(e,t),getChainId:()=>Ua(e),getCode:t=>Kc(e,t),getContractEvents:t=>Qa(e,t),getEip712Domain:t=>async function(e,t){const{address:n,factory:r,factoryData:o}=t;try{const[t,a,s,i,c,l,u]=await Ve(e,nc,"readContract")({abi:Jc,address:n,functionName:"eip712Domain",factory:r,factoryData:o});return{domain:{name:a,version:s,chainId:Number(i),verifyingContract:c,salt:l},extensions:u,fields:t}}catch(e){const t=e;if("ContractFunctionExecutionError"===t.name&&"ContractFunctionZeroDataError"===t.cause.name)throw new Zc({address:n});throw t}}(e,t),getEnsAddress:t=>async function(e,t){const{blockNumber:n,blockTag:r,coinType:o,name:a,gatewayUrls:s,strict:i}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ki({blockNumber:n,chain:c,contract:"ensUniversalResolver"})})(),u=c?.ensTlds;if(u&&!u.some(e=>a.endsWith(e)))return null;const d=null!=o?[Sc(a),BigInt(o)]:[Sc(a)];try{const t=mr({abi:Mi,functionName:"addr",args:d}),o={address:l,abi:_i,functionName:"resolveWithGateways",args:[jt(Cc(a)),t,s??[Ac]],blockNumber:n,blockTag:r},i=Ve(e,nc,"readContract"),c=await i(o);if("0x"===c[0])return null;const u=es({abi:Mi,args:d,functionName:"addr",data:c[0]});return"0x"===u||"0x00"===zt(u)?null:u}catch(e){if(i)throw e;if(xc(e))return null;throw e}}(e,t),getEnsAvatar:t=>async function(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:o,gatewayUrls:a,strict:s,universalResolverAddress:i}){const c=await Ve(e,qc,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:o,universalResolverAddress:i,gatewayUrls:a,strict:s});if(!c)return null;try{return await Wc(e,{record:c,gatewayUrls:r})}catch{return null}}(e,t),getEnsName:t=>async function(e,t){const{address:n,blockNumber:r,blockTag:o,coinType:a=60n,gatewayUrls:s,strict:i}=t,{chain:c}=e,l=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!c)throw new Error("client chain not configured. universalResolverAddress is required.");return Ki({blockNumber:r,chain:c,contract:"ensUniversalResolver"})})();try{const t={address:l,abi:Ri,args:[n,a,s??[Ac]],functionName:"reverseWithGateways",blockNumber:r,blockTag:o},i=Ve(e,nc,"readContract"),[c]=await i(t);return c||null}catch(e){if(i)throw e;if(xc(e))return null;throw e}}(e,t),getEnsResolver:t=>async function(e,t){const{blockNumber:n,blockTag:r,name:o}=t,{chain:a}=e,s=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!a)throw new Error("client chain not configured. universalResolverAddress is required.");return Ki({blockNumber:n,chain:a,contract:"ensUniversalResolver"})})(),i=a?.ensTlds;if(i&&!i.some(e=>o.endsWith(e)))throw new Error(`${o} is not a valid ENS TLD (${i?.join(", ")}) for chain "${a.name}" (id: ${a.id}).`);const[c]=await Ve(e,nc,"readContract")({address:s,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[jt(Cc(o))],blockNumber:n,blockTag:r});return c}(e,t),getEnsText:t=>qc(e,t),getFeeHistory:t=>Qc(e,t),estimateFeesPerGas:t=>async function(e,t){return va(e,t)}(e,t),getFilterChanges:e=>hc(0,e),getFilterLogs:e=>async function(e,{filter:t}){const n=t.strict??!1,r=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(e=>Za(e));return t.abi?Ka({abi:t.abi,logs:r,strict:n}):r}(0,e),getGasPrice:()=>ya(e),getLogs:t=>Ja(e,t),getProof:t=>bd(e,t),estimateMaxPriorityFeePerGas:t=>async function(e,t){return wa(e,t)}(e,t),getStorageAt:t=>async function(e,{address:t,blockNumber:n,blockTag:r="latest",slot:o}){const a=void 0!==n?Wt(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,o,a||r]})}(e,t),getTransaction:t=>yd(e,t),getTransactionConfirmations:t=>async function(e,{hash:t,transactionReceipt:n}){const[r,o]=await Promise.all([Ve(e,fc,"getBlockNumber")({}),t?Ve(e,yd,"getTransaction")({hash:t}):void 0]),a=n?.blockNumber||o?.blockNumber;return a?r-a+1n:0n}(e,t),getTransactionCount:t=>xa(e,t),getTransactionReceipt:t=>wd(e,t),multicall:t=>async function(e,t){const{account:n,authorizationList:r,allowFailure:o=!0,blockNumber:a,blockOverrides:s,blockTag:i,stateOverride:c}=t,l=t.contracts,{batchSize:u=t.batchSize??1024,deployless:d=t.deployless??!1}="object"==typeof e.batch?.multicall?e.batch.multicall:{},f=(()=>{if(t.multicallAddress)return t.multicallAddress;if(d)return null;if(e.chain)return Ki({blockNumber:a,chain:e.chain,contract:"multicall3"});throw new Error("client chain not configured. multicallAddress is required.")})(),h=[[]];let p=0,m=0;for(let e=0;e<l.length;e++){const{abi:t,address:r,args:a,functionName:s}=l[e];try{const e=mr({abi:t,args:a,functionName:s});m+=(e.length-2)/2,u>0&&m>u&&h[p].length>0&&(p++,m=(e.length-2)/2,h[p]=[]),h[p]=[...h[p],{allowFailure:!0,callData:e,target:r}]}catch(e){const i=_o(e,{abi:t,address:r,args:a,docsPath:"/docs/contract/multicall",functionName:s,sender:n});if(!o)throw i;h[p]=[...h[p],{allowFailure:!0,callData:"0x",target:r}]}}const g=await Promise.allSettled(h.map(t=>Ve(e,nc,"readContract")({...null===f?{code:Wi}:{address:f},abi:Ci,account:n,args:[t],authorizationList:r,blockNumber:a,blockOverrides:s,blockTag:i,functionName:"aggregate3",stateOverride:c}))),b=[];for(let e=0;e<g.length;e++){const t=g[e];if("rejected"===t.status){if(!o)throw t.reason;for(let n=0;n<h[e].length;n++)b.push({status:"failure",error:t.reason,result:void 0});continue}const n=t.value;for(let t=0;t<n.length;t++){const{returnData:r,success:a}=n[t],{callData:s}=h[e][t],{abi:i,address:c,functionName:u,args:d}=l[b.length];try{if("0x"===s)throw new at;if(!a)throw new eo({data:r});const e=es({abi:i,args:d,data:r,functionName:u});b.push(o?{result:e,status:"success"}:e)}catch(e){const t=_o(e,{abi:i,address:c,args:d,docsPath:"/docs/contract/multicall",functionName:u});if(!o)throw t;b.push({error:t,result:void 0,status:"failure"})}}}if(b.length!==l.length)throw new et("multicall results mismatch");return b}(e,t),prepareTransactionRequest:t=>Ga(e,t),readContract:t=>nc(e,t),sendRawTransaction:t=>async function(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}(e,t),simulate:t=>vd(e,t),simulateBlocks:t=>vd(e,t),simulateCalls:t=>Rd(e,t),simulateContract:t=>async function(e,t){const{abi:n,address:r,args:o,dataSuffix:a,functionName:s,...i}=t,c=i.account?hr(i.account):e.account,l=mr({abi:n,args:o,functionName:s});try{const{data:u}=await Ve(e,ec,"call")({batch:!1,data:`${l}${a?a.replace("0x",""):""}`,to:r,...i,account:c});return{result:es({abi:n,args:o,functionName:s,data:u||"0x"}),request:{abi:n.filter(e=>"name"in e&&e.name===t.functionName),address:r,args:o,dataSuffix:a,functionName:s,...i,account:c}}}catch(e){throw _o(e,{abi:n,address:r,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:c?.address})}}(e,t),verifyHash:t=>Ud(e,t),verifyMessage:t=>async function(e,{address:t,message:n,factory:r,factoryData:o,signature:a,...s}){return Ud(e,{address:t,factory:r,factoryData:o,hash:ul(n),signature:a,...s})}(e,t),verifySiweMessage:t=>qd(e,t),verifyTypedData:t=>async function(e,t){const{address:n,factory:r,factoryData:o,signature:a,message:s,primaryType:i,types:c,domain:l,...u}=t;return Ud(e,{address:n,factory:r,factoryData:o,hash:gl({message:s,primaryType:i,types:c,domain:l}),signature:a,...u})}(e,t),uninstallFilter:e=>pc(0,e),waitForTransactionReceipt:t=>async function(e,t){const{checkReplacement:n=!0,confirmations:r=1,hash:o,onReplaced:a,retryCount:s=6,retryDelay:i=({count:e})=>200*(1<<e),timeout:c=18e4}=t,l=Or(["waitForTransactionReceipt",e.uid,o]),u=t.pollingInterval?t.pollingInterval:e.chain?.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval;let d,f,h,p,m,g=!1;const{promise:b,resolve:y,reject:w}=Ji(),v=c?setTimeout(()=>{m?.(),p?.(),w(new Yr({hash:o}))},c):void 0;return p=sc(l,{onReplaced:a,resolve:y,reject:w},async t=>{if(h=await Ve(e,wd,"getTransactionReceipt")({hash:o}).catch(()=>{}),h&&r<=1)return clearTimeout(v),t.resolve(h),void p?.();m=Ve(e,Dd,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:u,async onBlockNumber(a){const c=e=>{clearTimeout(v),m?.(),e(),p?.()};let l=a;if(!g)try{if(h){if(r>1&&(!h.blockNumber||l-h.blockNumber+1n<r))return;return void c(()=>t.resolve(h))}if(n&&!d&&(g=!0,await mc(async()=>{d=await Ve(e,yd,"getTransaction")({hash:o}),d.blockNumber&&(l=d.blockNumber)},{delay:i,retryCount:s}),g=!1),h=await Ve(e,wd,"getTransactionReceipt")({hash:o}),r>1&&(!h.blockNumber||l-h.blockNumber+1n<r))return;c(()=>t.resolve(h))}catch(n){if(n instanceof Vr||n instanceof Hr){if(!d)return void(g=!1);try{f=d,g=!0;const n=await mc(()=>Ve(e,ba,"getBlock")({blockNumber:l,includeTransactions:!0}),{delay:i,retryCount:s,shouldRetry:({error:e})=>e instanceof ha});g=!1;const o=n.transactions.find(({from:e,nonce:t})=>e===f.from&&t===f.nonce);if(!o)return;if(h=await Ve(e,wd,"getTransactionReceipt")({hash:o.hash}),r>1&&(!h.blockNumber||l-h.blockNumber+1n<r))return;let a="replaced";o.to===f.to&&o.value===f.value&&o.input===f.input?a="repriced":o.from===o.to&&0n===o.value&&(a="cancelled"),c(()=>{t.onReplaced?.({reason:a,replacedTransaction:f,transaction:o,transactionReceipt:h}),t.resolve(h)})}catch(e){c(()=>t.reject(e))}}else c(()=>t.reject(n))}}})}),b}(e,t),watchBlocks:t=>function(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:o,onError:a,includeTransactions:s,poll:i,pollingInterval:c=e.pollingInterval}){const l=void 0!==i?i:"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type&&"ipc"!==e.transport.transports[0].config.type),u=s??!1;let d;return l?sc(Or(["watchBlocks",e.uid,t,n,r,u,c]),{onBlock:o,onError:a},o=>cc(async()=>{try{const r=await Ve(e,ba,"getBlock")({blockTag:t,includeTransactions:u});if(null!==r.number&&null!=d?.number){if(r.number===d.number)return;if(r.number-d.number>1&&n)for(let t=d?.number+1n;t<r.number;t++){const n=await Ve(e,ba,"getBlock")({blockNumber:t,includeTransactions:u});o.onBlock(n,d),d=n}}(null==d?.number||"pending"===t&&null==r?.number||null!==r.number&&r.number>d.number)&&(o.onBlock(r,d),d=r)}catch(e){o.onError?.(e)}},{emitOnBegin:r,interval:c})):(()=>{let n=!0,s=!0,i=()=>n=!1;return(async()=>{try{r&&Ve(e,ba,"getBlock")({blockTag:t,includeTransactions:u}).then(e=>{n&&s&&(o(e,void 0),s=!1)}).catch(a);const c=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),{unsubscribe:l}=await c.subscribe({params:["newHeads"],async onData(t){if(!n)return;const r=await Ve(e,ba,"getBlock")({blockNumber:t.result?.number,includeTransactions:u}).catch(()=>{});n&&(o(r,d),s=!1,d=r)},onError(e){a?.(e)}});i=l,n||i()}catch(e){a?.(e)}})(),()=>i()})()}(e,t),watchBlockNumber:t=>Dd(e,t),watchContractEvent:t=>function(e,t){const{abi:n,address:r,args:o,batch:a=!0,eventName:s,fromBlock:i,onError:c,onLogs:l,poll:u,pollingInterval:d=e.pollingInterval,strict:f}=t;return(void 0!==u?u:"bigint"==typeof i||"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type&&"ipc"!==e.transport.transports[0].config.type))?(()=>{const t=f??!1;return sc(Or(["watchContractEvent",r,o,a,e.uid,s,d,t,i]),{onLogs:l,onError:c},c=>{let l,u;void 0!==i&&(l=i-1n);let f=!1;const h=cc(async()=>{if(f)try{let i;if(u)i=await Ve(e,hc,"getFilterChanges")({filter:u});else{const a=await Ve(e,fc,"getBlockNumber")({});i=l&&l<a?await Ve(e,Qa,"getContractEvents")({abi:n,address:r,args:o,eventName:s,fromBlock:l+1n,toBlock:a,strict:t}):[],l=a}if(0===i.length)return;if(a)c.onLogs(i);else for(const e of i)c.onLogs([e])}catch(e){u&&e instanceof fo&&(f=!1),c.onError?.(e)}else{try{u=await Ve(e,fr,"createContractEventFilter")({abi:n,address:r,args:o,eventName:s,strict:t,fromBlock:i})}catch{}f=!0}},{emitOnBegin:!0,interval:d});return async()=>{u&&await Ve(e,pc,"uninstallFilter")({filter:u}),h()}})})():(()=>{const t=f??!1,i=Or(["watchContractEvent",r,o,a,e.uid,s,d,t]);let u=!0,h=()=>u=!1;return sc(i,{onLogs:l,onError:c},t=>((async()=>{try{const a=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),i=s?lr({abi:n,eventName:s,args:o}):[],{unsubscribe:c}=await a.subscribe({params:["logs",{address:r,topics:i}],onData(e){if(!u)return;const r=e.result;try{const{eventName:e,args:o}=Ha({abi:n,data:r.data,topics:r.topics,strict:f}),a=Za(r,{args:o,eventName:e});t.onLogs([a])}catch(e){let n,o;if(e instanceof vt||e instanceof xt){if(f)return;n=e.abiItem.name,o=e.abiItem.inputs?.some(e=>!("name"in e&&e.name))}const a=Za(r,{args:o?[]:{},eventName:n});t.onLogs([a])}},onError(e){t.onError?.(e)}});h=c,u||h()}catch(e){c?.(e)}})(),()=>h()))})()}(e,t),watchEvent:t=>function(e,{address:t,args:n,batch:r=!0,event:o,events:a,fromBlock:s,onError:i,onLogs:c,poll:l,pollingInterval:u=e.pollingInterval,strict:d}){const f=void 0!==l?l:"bigint"==typeof s||"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].config.type&&"ipc"!==e.transport.transports[0].config.type),h=d??!1;return f?sc(Or(["watchEvent",t,n,r,e.uid,o,u,s]),{onLogs:c,onError:i},i=>{let c,l;void 0!==s&&(c=s-1n);let d=!1;const f=cc(async()=>{if(d)try{let s;if(l)s=await Ve(e,hc,"getFilterChanges")({filter:l});else{const r=await Ve(e,fc,"getBlockNumber")({});s=c&&c!==r?await Ve(e,Ja,"getLogs")({address:t,args:n,event:o,events:a,fromBlock:c+1n,toBlock:r}):[],c=r}if(0===s.length)return;if(r)i.onLogs(s);else for(const e of s)i.onLogs([e])}catch(e){l&&e instanceof fo&&(d=!1),i.onError?.(e)}else{try{l=await Ve(e,Hc,"createEventFilter")({address:t,args:n,event:o,events:a,strict:h,fromBlock:s})}catch{}d=!0}},{emitOnBegin:!0,interval:u});return async()=>{l&&await Ve(e,pc,"uninstallFilter")({filter:l}),f()}}):(()=>{let r=!0,s=()=>r=!1;return(async()=>{try{const l=(()=>{if("fallback"===e.transport.type){const t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),u=a??(o?[o]:void 0);let f=[];if(u){const e=u.flatMap(e=>lr({abi:[e],eventName:e.name,args:n}));f=[e],o&&(f=f[0])}const{unsubscribe:p}=await l.subscribe({params:["logs",{address:t,topics:f}],onData(e){if(!r)return;const t=e.result;try{const{eventName:e,args:n}=Ha({abi:u??[],data:t.data,topics:t.topics,strict:h}),r=Za(t,{args:n,eventName:e});c([r])}catch(e){let n,r;if(e instanceof vt||e instanceof xt){if(d)return;n=e.abiItem.name,r=e.abiItem.inputs?.some(e=>!("name"in e&&e.name))}const o=Za(t,{args:r?[]:{},eventName:n});c([o])}},onError(e){i?.(e)}});s=p,r||s()}catch(e){i?.(e)}})(),()=>s()})()}(e,t),watchPendingTransactions:t=>function(e,{batch:t=!0,onError:n,onTransactions:r,poll:o,pollingInterval:a=e.pollingInterval}){return(void 0!==o?o:"webSocket"!==e.transport.type&&"ipc"!==e.transport.type)?sc(Or(["watchPendingTransactions",e.uid,t,a]),{onTransactions:r,onError:n},n=>{let r;const o=cc(async()=>{try{if(!r)try{return void(r=await Ve(e,Yc,"createPendingTransactionFilter")({}))}catch(e){throw o(),e}const a=await Ve(e,hc,"getFilterChanges")({filter:r});if(0===a.length)return;if(t)n.onTransactions(a);else for(const e of a)n.onTransactions([e])}catch(e){n.onError?.(e)}},{emitOnBegin:!0,interval:a});return async()=>{r&&await Ve(e,pc,"uninstallFilter")({filter:r}),o()}}):(()=>{let t=!0,o=()=>t=!1;return(async()=>{try{const{unsubscribe:a}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!t)return;const n=e.result;r([n])},onError(e){n?.(e)}});o=a,t||o()}catch(e){n?.(e)}})(),()=>o()})()}(e,t)}}function Hd(e){const{key:t="public",name:n="Public Client"}=e,r=function(e){const{batch:t,chain:n,ccipRead:r,key:o="base",name:a="Base Client",type:s="base"}=e,i=e.experimental_blockTag??("number"==typeof n?.experimental_preconfirmationTime?"pending":void 0),c=n?.blockTime??12e3,l=Math.min(Math.max(Math.floor(c/2),500),4e3),u=e.pollingInterval??l,d=e.cacheTime??u,f=e.account?hr(e.account):void 0,{config:h,request:p,value:m}=e.transport({chain:n,pollingInterval:u}),g={account:f,batch:t,cacheTime:d,ccipRead:r,chain:n,key:o,name:a,pollingInterval:u,request:p,transport:{...h,...m},type:s,uid:vc(),...i?{experimental_blockTag:i}:{}};return Object.assign(g,{extend:function e(t){return n=>{const r=n(t);for(const e in g)delete r[e];const o={...t,...r};return Object.assign(o,{extend:e(o)})}}(g)})}({...e,key:t,name:n,type:"publicClient"});return r.extend(Vd)}class Yd extends et{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function Kd(e,t={}){const{batch:n,fetchFn:r,fetchOptions:o,key:a="http",methods:s,name:i="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:l,retryDelay:u,raw:d}=t;return({chain:f,retryCount:h,timeout:p})=>{const{batchSize:m=1e3,wait:g=0}="object"==typeof n?n:{},b=t.retryCount??h,y=p??t.timeout??1e4,w=e||f?.rpcUrls.default.http[0];if(!w)throw new Yd;const v=ll(w,{fetchFn:r,fetchOptions:o,onRequest:c,onResponse:l,timeout:y});return function({key:e,methods:t,name:n,request:r,retryCount:o=3,retryDelay:a=150,timeout:s,type:i},c){return{config:{key:e,methods:t,name:n,request:r,retryCount:o,retryDelay:a,timeout:s,type:i},request:el(r,{methods:t,retryCount:o,retryDelay:a,uid:vc()}),value:c}}({key:a,methods:s,name:i,async request({method:e,params:t}){const r={method:e,params:t},{schedule:o}=Xi({id:w,wait:g,shouldSplitBatch:e=>e.length>m,fn:e=>v.request({body:e}),sort:(e,t)=>e.id-t.id}),[{error:a,result:s}]=await(async e=>n?o(e):[await v.request({body:e})])(r);if(d)return{error:a,result:s};if(a)throw new no({body:r,error:a,url:w});return s},retryCount:b,retryDelay:u,timeout:y,type:"http"},{fetchOptions:o,url:w})}}function Zd(e,t,n){for(let n in t){let r=t[n];Object.defineProperty(e,n,{enumerable:!0,value:r,writable:!1})}}function Jd(e,t){if(null==e)return"null";if(null==t&&(t=new Set),"object"==typeof e){if(t.has(e))return"[Circular]";t.add(e)}if(Array.isArray(e))return"[ "+e.map(e=>Jd(e,t)).join(", ")+" ]";if(e instanceof Uint8Array){const t="0123456789abcdef";let n="0x";for(let r=0;r<e.length;r++)n+=t[e[r]>>4],n+=t[15&e[r]];return n}if("object"==typeof e&&"function"==typeof e.toJSON)return Jd(e.toJSON(),t);switch(typeof e){case"boolean":case"number":case"symbol":return e.toString();case"bigint":return BigInt(e).toString();case"string":return JSON.stringify(e);case"object":{const n=Object.keys(e);return n.sort(),"{ "+n.map(n=>`${Jd(n,t)}: ${Jd(e[n],t)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function Qd(e,t,n,r){if(!e)throw function(e,t,n){let r,o=e;{const r=[];if(n){if("message"in n||"code"in n||"name"in n)throw new Error(`value will overwrite populated values: ${Jd(n)}`);for(const e in n){if("shortMessage"===e)continue;const t=n[e];r.push(e+"="+Jd(t))}}r.push(`code=${t}`),r.push("version=6.15.0"),r.length&&(e+=" ("+r.join(", ")+")")}switch(t){case"INVALID_ARGUMENT":r=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(e);break;default:r=new Error(e)}return Zd(r,{code:t}),n&&Object.assign(r,n),null==r.shortMessage&&Zd(r,{shortMessage:o}),r}(t,n,r)}function Xd(e,t,n,r){Qd(e,t,"INVALID_ARGUMENT",{argument:n,value:r})}function ef(e,t){return function(e,t){if(e instanceof Uint8Array)return e;if("string"==typeof e&&e.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const t=new Uint8Array((e.length-2)/2);let n=2;for(let r=0;r<t.length;r++)t[r]=parseInt(e.substring(n,n+2),16),n+=2;return t}Xd(!1,"invalid BytesLike value",t,e)}(e,t)}["NFD","NFC","NFKD","NFKC"].reduce((e,t)=>{try{if("test"!=="test".normalize(t))throw new Error("bad");if("NFD"===t){const e=String.fromCharCode(233).normalize("NFD");if(e!==String.fromCharCode(101,769))throw new Error("broken")}e.push(t)}catch(e){}return e},[]);const tf=BigInt(0),nf=BigInt(1),rf=9007199254740991;function of(e,t){const n=cf(e,"value"),r=BigInt(uf(t,"width"));if(Qd(n>>r===tf,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:e}),n>>r-nf){return-((~n&(nf<<r)-nf)+nf)}return n}function af(e,t){const n=cf(e,"value"),r=BigInt(uf(t,"bits"));return n&(nf<<r)-nf}function sf(e,t){switch(typeof e){case"bigint":return e;case"number":return Xd(Number.isInteger(e),"underflow",t||"value",e),Xd(e>=-rf&&e<=rf,"overflow",t||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(n){Xd(!1,`invalid BigNumberish string: ${n.message}`,t||"value",e)}}Xd(!1,"invalid BigNumberish value",t||"value",e)}function cf(e,t){const n=sf(e,t);return Qd(n>=tf,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),n}const lf="0123456789abcdef";function uf(e,t){switch(typeof e){case"bigint":return Xd(e>=-rf&&e<=rf,"overflow",t||"value",e),Number(e);case"number":return Xd(Number.isInteger(e),"underflow",t||"value",e),Xd(e>=-rf&&e<=rf,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return uf(BigInt(e),t)}catch(n){Xd(!1,`invalid numeric string: ${n.message}`,t||"value",e)}}Xd(!1,"invalid numeric value",t||"value",e)}const df=BigInt(-1),ff=BigInt(0),hf=BigInt(1),pf=BigInt(5),mf={};let gf="0000";for(;gf.length<80;)gf+=gf;function bf(e){let t=gf;for(;t.length<e;)t+=t;return BigInt("1"+t.substring(0,e))}function yf(e,t,n){const r=BigInt(t.width);if(t.signed){const t=hf<<r-hf;Qd(null==n||e>=-t&&e<t,"overflow","NUMERIC_FAULT",{operation:n,fault:"overflow",value:e}),e=e>ff?of(af(e,r),r):-of(af(-e,r),r)}else{const t=hf<<r;Qd(null==n||e>=0&&e<t,"overflow","NUMERIC_FAULT",{operation:n,fault:"overflow",value:e}),e=(e%t+t)%t&t-hf}return e}function wf(e){"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,n=128,r=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const o=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);Xd(o,"invalid fixed format","format",e),t="u"!==o[1],n=parseInt(o[2]),r=parseInt(o[3])}else if(e){const o=e,a=(e,t,n)=>null==o[e]?n:(Xd(typeof o[e]===t,"invalid fixed format ("+e+" not "+t+")","format."+e,o[e]),o[e]);t=a("signed","boolean",t),n=a("width","number",n),r=a("decimals","number",r)}Xd(n%8==0,"invalid FixedNumber width (not byte aligned)","format.width",n),Xd(r<=80,"invalid FixedNumber decimals (too large)","format.decimals",r);return{signed:t,width:n,decimals:r,name:(t?"":"u")+"fixed"+String(n)+"x"+String(r)}}class vf{format;#e;#t;#n;_value;constructor(e,t,n){!function(e,t,n){if(e!==t){let e=n,t="new";e+=".",t+=" "+n,Qd(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}(e,mf,"FixedNumber"),this.#t=t,this.#e=n;const r=function(e,t){let n="";e<ff&&(n="-",e*=df);let r=e.toString();if(0===t)return n+r;for(;r.length<=t;)r=gf+r;const o=r.length-t;for(r=r.substring(0,o)+"."+r.substring(o);"0"===r[0]&&"."!==r[1];)r=r.substring(1);for(;"0"===r[r.length-1]&&"."!==r[r.length-2];)r=r.substring(0,r.length-1);return n+r}(t,n.decimals);Zd(this,{format:n.name,_value:r}),this.#n=bf(n.decimals)}get signed(){return this.#e.signed}get width(){return this.#e.width}get decimals(){return this.#e.decimals}get value(){return this.#t}#r(e){Xd(this.format===e.format,"incompatible format; use fixedNumber.toFormat","other",e)}#o(e,t){return e=yf(e,this.#e,t),new vf(mf,e,this.#e)}#a(e,t){return this.#r(e),this.#o(this.#t+e.#t,t)}addUnsafe(e){return this.#a(e)}add(e){return this.#a(e,"add")}#s(e,t){return this.#r(e),this.#o(this.#t-e.#t,t)}subUnsafe(e){return this.#s(e)}sub(e){return this.#s(e,"sub")}#i(e,t){return this.#r(e),this.#o(this.#t*e.#t/this.#n,t)}mulUnsafe(e){return this.#i(e)}mul(e){return this.#i(e,"mul")}mulSignal(e){this.#r(e);const t=this.#t*e.#t;return Qd(t%this.#n===ff,"precision lost during signalling mul","NUMERIC_FAULT",{operation:"mulSignal",fault:"underflow",value:this}),this.#o(t/this.#n,"mulSignal")}#c(e,t){return Qd(e.#t!==ff,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#r(e),this.#o(this.#t*this.#n/e.#t,t)}divUnsafe(e){return this.#c(e)}div(e){return this.#c(e,"div")}divSignal(e){Qd(e.#t!==ff,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#r(e);const t=this.#t*this.#n;return Qd(t%e.#t===ff,"precision lost during signalling div","NUMERIC_FAULT",{operation:"divSignal",fault:"underflow",value:this}),this.#o(t/e.#t,"divSignal")}cmp(e){let t=this.value,n=e.value;const r=this.decimals-e.decimals;return r>0?n*=bf(r):r<0&&(t*=bf(-r)),t<n?-1:t>n?1:0}eq(e){return 0===this.cmp(e)}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=this.#t;return this.#t<ff&&(e-=this.#n-hf),e=this.#t/this.#n*this.#n,this.#o(e,"floor")}ceiling(){let e=this.#t;return this.#t>ff&&(e+=this.#n-hf),e=this.#t/this.#n*this.#n,this.#o(e,"ceiling")}round(e){if(null==e&&(e=0),e>=this.decimals)return this;const t=this.decimals-e,n=pf*bf(t-1);let r=this.value+n;const o=bf(t);return r=r/o*o,yf(r,this.#e,"round"),new vf(mf,r,this.#e)}isZero(){return this.#t===ff}isNegative(){return this.#t<ff}toString(){return this._value}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return vf.fromString(this.toString(),e)}static fromValue(e,t,n){const r=null==t?0:uf(t),o=wf(n);let a=sf(e,"value");const s=r-o.decimals;if(s>0){const t=bf(s);Qd(a%t===ff,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),a/=t}else s<0&&(a*=bf(-s));return yf(a,o,"fromValue"),new vf(mf,a,o)}static fromString(e,t){const n=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);Xd(n&&n[2].length+n[3].length>0,"invalid FixedNumber string value","value",e);const r=wf(t);let o=n[2]||"0",a=n[3]||"";for(;a.length<r.decimals;)a+=gf;Qd(a.substring(r.decimals).match(/^0*$/),"too many decimals for format","NUMERIC_FAULT",{operation:"fromString",fault:"underflow",value:e}),a=a.substring(0,r.decimals);const s=BigInt(n[1]+o+a);return yf(s,r,"fromString"),new vf(mf,s,r)}static fromBytes(e,t){let n=function(e){if(e instanceof Uint8Array){let t="0x0";for(const n of e)t+=lf[n>>4],t+=lf[15&n];return BigInt(t)}return sf(e)}(ef(e,"value"));const r=wf(t);return r.signed&&(n=of(n,r.width)),yf(n,r,"fromBytes"),new vf(mf,n,r)}}function xf(e){return function(e,t){let n=18;return n=uf(t,"unit"),vf.fromValue(e,n,{decimals:n,width:512}).toString()}(e,18)}const Ef="0.38.13";function Pf({projectId:e,originComponentName:t,...n}){const r=new URL("https://pay.coinbase.com/buy");void 0!==e&&r.searchParams.append("appId",e);for(const e of Object.keys(n)){const t=n[e];void 0!==t&&(["string","number","boolean"].includes(typeof t)?r.searchParams.append(e,t.toString()):r.searchParams.append(e,JSON.stringify(t)))}return t?r.searchParams.append("sdkVersion",`onchainkit@${Ef}:${t}`):r.searchParams.append("sdkVersion",`onchainkit@${Ef}`),r.searchParams.sort(),r.toString()}var kf=[],Af=[],If="undefined"!=typeof Uint8Array?Uint8Array:Array,Nf=!1;function Sf(){Nf=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0;t<64;++t)kf[t]=e[t],Af[e.charCodeAt(t)]=t;Af["-".charCodeAt(0)]=62,Af["_".charCodeAt(0)]=63}function Tf(e){return kf[e>>18&63]+kf[e>>12&63]+kf[e>>6&63]+kf[63&e]}function Bf(e,t,n){for(var r,o=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(Tf(r));return o.join("")}function Cf(e){var t;Nf||Sf();for(var n=e.length,r=n%3,o="",a=[],s=16383,i=0,c=n-r;i<c;i+=s)a.push(Bf(e,i,i+s>c?c:i+s));return 1===r?(t=e[n-1],o+=kf[t>>2],o+=kf[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=kf[t>>10],o+=kf[t>>4&63],o+=kf[t<<2&63],o+="="),a.push(o),a.join("")}function $f(e,t,n,r,o){var a,s,i=8*o-r-1,c=(1<<i)-1,l=c>>1,u=-7,d=n?o-1:0,f=n?-1:1,h=e[t+d];for(d+=f,a=h&(1<<-u)-1,h>>=-u,u+=i;u>0;a=256*a+e[t+d],d+=f,u-=8);for(s=a&(1<<-u)-1,a>>=-u,u+=r;u>0;s=256*s+e[t+d],d+=f,u-=8);if(0===a)a=1-l;else{if(a===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,r),a-=l}return(h?-1:1)*s*Math.pow(2,a-r)}function Of(e,t,n,r,o,a){var s,i,c,l=8*a-o-1,u=(1<<l)-1,d=u>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,p=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(i=isNaN(t)?1:0,s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+d>=1?f/c:f*Math.pow(2,1-d))*c>=2&&(s++,c/=2),s+d>=u?(i=0,s=u):s+d>=1?(i=(t*c-1)*Math.pow(2,o),s+=d):(i=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[n+h]=255&i,h+=p,i/=256,o-=8);for(s=s<<o|i,l+=o;l>0;e[n+h]=255&s,h+=p,s/=256,l-=8);e[n+h-p]|=128*m}var _f={}.toString,Rf=Array.isArray||function(e){return"[object Array]"==_f.call(e)};function zf(){return Lf.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Mf(e,t){if(zf()<t)throw new RangeError("Invalid typed array length");return Lf.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Lf.prototype:(null===e&&(e=new Lf(t)),e.length=t),e}function Lf(e,t,n){if(!(Lf.TYPED_ARRAY_SUPPORT||this instanceof Lf))return new Lf(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return jf(this,e)}return Ff(this,e,t,n)}function Ff(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);Lf.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Lf.prototype:e=Df(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!Lf.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|qf(t,n);e=Mf(e,r);var o=e.write(t,n);o!==r&&(e=e.slice(0,o));return e}(e,t,n):function(e,t){if(Wf(t)){var n=0|Gf(t.length);return 0===(e=Mf(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?Mf(e,0):Df(e,t);if("Buffer"===t.type&&Rf(t.data))return Df(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function Uf(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function jf(e,t){if(Uf(t),e=Mf(e,t<0?0:0|Gf(t)),!Lf.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function Df(e,t){var n=t.length<0?0:0|Gf(t.length);e=Mf(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function Gf(e){if(e>=zf())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+zf().toString(16)+" bytes");return 0|e}function Wf(e){return!(null==e||!e._isBuffer)}function qf(e,t){if(Wf(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return yh(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return wh(e).length;default:if(r)return yh(e).length;t=(""+t).toLowerCase(),r=!0}}function Vf(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return ih(this,t,n);case"utf8":case"utf-8":return rh(this,t,n);case"ascii":return ah(this,t,n);case"latin1":case"binary":return sh(this,t,n);case"base64":return nh(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ch(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function Hf(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function Yf(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=Lf.from(t,r)),Wf(t))return 0===t.length?-1:Kf(e,t,n,r,o);if("number"==typeof t)return t&=255,Lf.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Kf(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function Kf(e,t,n,r,o){var a,s=1,i=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,i/=2,c/=2,n/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var u=-1;for(a=n;a<i;a++)if(l(e,a)===l(t,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===c)return u*s}else-1!==u&&(a-=a-u),u=-1}else for(n+c>i&&(n=i-c),a=n;a>=0;a--){for(var d=!0,f=0;f<c;f++)if(l(e,a+f)!==l(t,f)){d=!1;break}if(d)return a}return-1}function Zf(e,t,n,r){n=Number(n)||0;var o=e.length-n;r?(r=Number(r))>o&&(r=o):r=o;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var s=0;s<r;++s){var i=parseInt(t.substr(2*s,2),16);if(isNaN(i))return s;e[n+s]=i}return s}function Jf(e,t,n,r){return vh(yh(t,e.length-n),e,n,r)}function Qf(e,t,n,r){return vh(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function Xf(e,t,n,r){return Qf(e,t,n,r)}function eh(e,t,n,r){return vh(wh(t),e,n,r)}function th(e,t,n,r){return vh(function(e,t){for(var n,r,o,a=[],s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,o=n%256,a.push(o),a.push(r);return a}(t,e.length-n),e,n,r)}function nh(e,t,n){return 0===t&&n===e.length?Cf(e):Cf(e.slice(t,n))}function rh(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o<n;){var a,s,i,c,l=e[o],u=null,d=l>239?4:l>223?3:l>191?2:1;if(o+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(a=e[o+1]))&&(c=(31&l)<<6|63&a)>127&&(u=c);break;case 3:a=e[o+1],s=e[o+2],128==(192&a)&&128==(192&s)&&(c=(15&l)<<12|(63&a)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:a=e[o+1],s=e[o+2],i=e[o+3],128==(192&a)&&128==(192&s)&&128==(192&i)&&(c=(15&l)<<18|(63&a)<<12|(63&s)<<6|63&i)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),o+=d}return function(e){var t=e.length;if(t<=oh)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=oh));return n}(r)}Lf.TYPED_ARRAY_SUPPORT=void 0===globalThis.TYPED_ARRAY_SUPPORT||globalThis.TYPED_ARRAY_SUPPORT,zf(),Lf.poolSize=8192,Lf._augment=function(e){return e.__proto__=Lf.prototype,e},Lf.from=function(e,t,n){return Ff(null,e,t,n)},Lf.TYPED_ARRAY_SUPPORT&&(Lf.prototype.__proto__=Uint8Array.prototype,Lf.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Lf[Symbol.species]),Lf.alloc=function(e,t,n){return function(e,t,n,r){return Uf(t),t<=0?Mf(e,t):void 0!==n?"string"==typeof r?Mf(e,t).fill(n,r):Mf(e,t).fill(n):Mf(e,t)}(null,e,t,n)},Lf.allocUnsafe=function(e){return jf(null,e)},Lf.allocUnsafeSlow=function(e){return jf(null,e)},Lf.isBuffer=function(e){return null!=e&&(!!e._isBuffer||xh(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&xh(e.slice(0,0))}(e))},Lf.compare=function(e,t){if(!Wf(e)||!Wf(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,a=Math.min(n,r);o<a;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},Lf.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Lf.concat=function(e,t){if(!Rf(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Lf.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=Lf.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var a=e[n];if(!Wf(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,o),o+=a.length}return r},Lf.byteLength=qf,Lf.prototype._isBuffer=!0,Lf.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Hf(this,t,t+1);return this},Lf.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Hf(this,t,t+3),Hf(this,t+1,t+2);return this},Lf.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Hf(this,t,t+7),Hf(this,t+1,t+6),Hf(this,t+2,t+5),Hf(this,t+3,t+4);return this},Lf.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?rh(this,0,e):Vf.apply(this,arguments)},Lf.prototype.equals=function(e){if(!Wf(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Lf.compare(this,e)},Lf.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Lf.prototype.compare=function(e,t,n,r,o){if(!Wf(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),i=Math.min(a,s),c=this.slice(r,o),l=e.slice(t,n),u=0;u<i;++u)if(c[u]!==l[u]){a=c[u],s=l[u];break}return a<s?-1:s<a?1:0},Lf.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},Lf.prototype.indexOf=function(e,t,n){return Yf(this,e,t,n,!0)},Lf.prototype.lastIndexOf=function(e,t,n){return Yf(this,e,t,n,!1)},Lf.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return Zf(this,e,t,n);case"utf8":case"utf-8":return Jf(this,e,t,n);case"ascii":return Qf(this,e,t,n);case"latin1":case"binary":return Xf(this,e,t,n);case"base64":return eh(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return th(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},Lf.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var oh=4096;function ah(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function sh(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function ih(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var o="",a=t;a<n;++a)o+=bh(e[a]);return o}function ch(e,t,n){for(var r=e.slice(t,n),o="",a=0;a<r.length;a+=2)o+=String.fromCharCode(r[a]+256*r[a+1]);return o}function lh(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function uh(e,t,n,r,o,a){if(!Wf(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function dh(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,a=Math.min(e.length-n,2);o<a;++o)e[n+o]=(t&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function fh(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,a=Math.min(e.length-n,4);o<a;++o)e[n+o]=t>>>8*(r?o:3-o)&255}function hh(e,t,n,r,o,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function ph(e,t,n,r,o){return o||hh(e,0,n,4),Of(e,t,n,r,23,4),n+4}function mh(e,t,n,r,o){return o||hh(e,0,n,8),Of(e,t,n,r,52,8),n+8}Lf.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),Lf.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=Lf.prototype;else{var o=t-e;n=new Lf(o,void 0);for(var a=0;a<o;++a)n[a]=this[a+e]}return n},Lf.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||lh(e,t,this.length);for(var r=this[e],o=1,a=0;++a<t&&(o*=256);)r+=this[e+a]*o;return r},Lf.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||lh(e,t,this.length);for(var r=this[e+--t],o=1;t>0&&(o*=256);)r+=this[e+--t]*o;return r},Lf.prototype.readUInt8=function(e,t){return t||lh(e,1,this.length),this[e]},Lf.prototype.readUInt16LE=function(e,t){return t||lh(e,2,this.length),this[e]|this[e+1]<<8},Lf.prototype.readUInt16BE=function(e,t){return t||lh(e,2,this.length),this[e]<<8|this[e+1]},Lf.prototype.readUInt32LE=function(e,t){return t||lh(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Lf.prototype.readUInt32BE=function(e,t){return t||lh(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Lf.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||lh(e,t,this.length);for(var r=this[e],o=1,a=0;++a<t&&(o*=256);)r+=this[e+a]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*t)),r},Lf.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||lh(e,t,this.length);for(var r=t,o=1,a=this[e+--r];r>0&&(o*=256);)a+=this[e+--r]*o;return a>=(o*=128)&&(a-=Math.pow(2,8*t)),a},Lf.prototype.readInt8=function(e,t){return t||lh(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Lf.prototype.readInt16LE=function(e,t){t||lh(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},Lf.prototype.readInt16BE=function(e,t){t||lh(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},Lf.prototype.readInt32LE=function(e,t){return t||lh(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Lf.prototype.readInt32BE=function(e,t){return t||lh(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Lf.prototype.readFloatLE=function(e,t){return t||lh(e,4,this.length),$f(this,e,!0,23,4)},Lf.prototype.readFloatBE=function(e,t){return t||lh(e,4,this.length),$f(this,e,!1,23,4)},Lf.prototype.readDoubleLE=function(e,t){return t||lh(e,8,this.length),$f(this,e,!0,52,8)},Lf.prototype.readDoubleBE=function(e,t){return t||lh(e,8,this.length),$f(this,e,!1,52,8)},Lf.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||uh(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,a=0;for(this[t]=255&e;++a<n&&(o*=256);)this[t+a]=e/o&255;return t+n},Lf.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||uh(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,a=1;for(this[t+o]=255&e;--o>=0&&(a*=256);)this[t+o]=e/a&255;return t+n},Lf.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,1,255,0),Lf.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Lf.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,2,65535,0),Lf.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):dh(this,e,t,!0),t+2},Lf.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,2,65535,0),Lf.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):dh(this,e,t,!1),t+2},Lf.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,4,4294967295,0),Lf.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):fh(this,e,t,!0),t+4},Lf.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,4,4294967295,0),Lf.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):fh(this,e,t,!1),t+4},Lf.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);uh(this,e,t,n,o-1,-o)}var a=0,s=1,i=0;for(this[t]=255&e;++a<n&&(s*=256);)e<0&&0===i&&0!==this[t+a-1]&&(i=1),this[t+a]=(e/s|0)-i&255;return t+n},Lf.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);uh(this,e,t,n,o-1,-o)}var a=n-1,s=1,i=0;for(this[t+a]=255&e;--a>=0&&(s*=256);)e<0&&0===i&&0!==this[t+a+1]&&(i=1),this[t+a]=(e/s|0)-i&255;return t+n},Lf.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,1,127,-128),Lf.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Lf.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,2,32767,-32768),Lf.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):dh(this,e,t,!0),t+2},Lf.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,2,32767,-32768),Lf.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):dh(this,e,t,!1),t+2},Lf.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,4,2147483647,-2147483648),Lf.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):fh(this,e,t,!0),t+4},Lf.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||uh(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Lf.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):fh(this,e,t,!1),t+4},Lf.prototype.writeFloatLE=function(e,t,n){return ph(this,e,t,!0,n)},Lf.prototype.writeFloatBE=function(e,t,n){return ph(this,e,t,!1,n)},Lf.prototype.writeDoubleLE=function(e,t,n){return mh(this,e,t,!0,n)},Lf.prototype.writeDoubleBE=function(e,t,n){return mh(this,e,t,!1,n)},Lf.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var o,a=r-n;if(this===e&&n<t&&t<r)for(o=a-1;o>=0;--o)e[o+t]=this[o+n];else if(a<1e3||!Lf.TYPED_ARRAY_SUPPORT)for(o=0;o<a;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+a),t);return a},Lf.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!Lf.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var s=Wf(e)?e:yh(new Lf(e,r).toString()),i=s.length;for(a=0;a<n-t;++a)this[a+t]=s[a%i]}return this};var gh=/[^+\/0-9A-Za-z-_]/g;function bh(e){return e<16?"0"+e.toString(16):e.toString(16)}function yh(e,t){var n;t=t||1/0;for(var r=e.length,o=null,a=[],s=0;s<r;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&a.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&a.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function wh(e){return function(e){var t,n,r,o,a,s;Nf||Sf();var i=e.length;if(i%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[i-2]?2:"="===e[i-1]?1:0,s=new If(3*i/4-a),r=a>0?i-4:i;var c=0;for(t=0,n=0;t<r;t+=4,n+=3)o=Af[e.charCodeAt(t)]<<18|Af[e.charCodeAt(t+1)]<<12|Af[e.charCodeAt(t+2)]<<6|Af[e.charCodeAt(t+3)],s[c++]=o>>16&255,s[c++]=o>>8&255,s[c++]=255&o;return 2===a?(o=Af[e.charCodeAt(t)]<<2|Af[e.charCodeAt(t+1)]>>4,s[c++]=255&o):1===a&&(o=Af[e.charCodeAt(t)]<<10|Af[e.charCodeAt(t+1)]<<4|Af[e.charCodeAt(t+2)]>>2,s[c++]=o>>8&255,s[c++]=255&o),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(gh,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function vh(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function xh(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function Eh(){const e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,"0")).join("")}class Ph{constructor(e){this.selectedWalletId=null,this.solanaConnection=null,this.ethereumProvider=null,this.walletInfo=null,this.phantomAdapter=null,this.walletType="embedded",this.backupWalletType="embedded_backup",this.ethereumNetwork=null,this.defaultNetwork=exports.Network.Solana,this.api=y.default.create({baseURL:e.baseURL,headers:{"Content-Type":"application/json"}}),this.middleAccountApi=y.default.create({baseURL:e.middleAccountBaseURL||"https://yeezy-payment-service-sit-a0dchfccbufeh5bx.z03.azurefd.net",headers:{"Content-Type":"application/json"}}),this.solanaCluster=e.solanaCluster,this.solanaConnection=new t.Connection(e.solanaCluster.rpcUrl),e.ethereumNetwork&&(this.ethereumNetwork={...e.ethereumNetwork,chainId:Number(e.ethereumNetwork.chainId)},this.ethereumProvider=Hd({transport:Kd(e.ethereumNetwork.rpcUrl)})),this.defaultNetwork=e.defaultNetwork||exports.Network.Solana}setWallet(e){this.walletInfo=e}setWalletType(e){this.walletType=e,T.saveWalletType(e)}setBackupWalletType(e){this.backupWalletType=e,T.saveBackupWalletType(e),console.log(33)}getWallet(){return this.walletInfo}getPhantomAdapter(){return this.phantomAdapter}getWalletType(){return this.walletType}getBackupWalletType(){return this.backupWalletType}get wallet(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.network===this.defaultNetwork))||null}get address(){var e;return(null===(e=this.wallet)||void 0===e?void 0:e.address)||null}get network(){var e;return(null===(e=this.wallet)||void 0===e?void 0:e.network)||null}get ethereumWallet(){var e,t;return(null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.address===T.getSwitchedAccountAddress()))||(null===(t=this.walletInfo)||void 0===t?void 0:t.wallets.find(e=>e.network===exports.Network.Ethereum&&"Main"===e.wallet_set))||null}get ethereumAddress(){var e;return(null===(e=this.ethereumWallet)||void 0===e?void 0:e.address)||null}get solanaWallet(){var e,t,n,r;const o=null===(t=null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.address===T.getSwitchedAccountAddress()))||void 0===t?void 0:t.wallet_set;return o?(null===(n=this.walletInfo)||void 0===n?void 0:n.wallets.find(e=>e.network===exports.Network.Solana&&e.wallet_set===o))||null:(null===(r=this.walletInfo)||void 0===r?void 0:r.wallets.find(e=>e.network===exports.Network.Solana&&"Main"===e.wallet_set))||null}get forwardSolanaWallet(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.network===exports.Network.Solana&&"Forward-0"===e.wallet_set))||null}get forwardSolanaAddress(){var e;return(null===(e=this.forwardSolanaWallet)||void 0===e?void 0:e.address)||null}get forwardEthereumWallet(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.wallets.find(e=>e.network===exports.Network.Ethereum&&"Forward-0"===e.wallet_set))||null}get forwardEthereumAddress(){var e;return(null===(e=this.forwardEthereumWallet)||void 0===e?void 0:e.address)||null}get solanaAddress(){var e;return(null===(e=this.solanaWallet)||void 0===e?void 0:e.address)||null}get id(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.id)||null}get social_links(){var e;return(null===(e=this.walletInfo)||void 0===e?void 0:e.social_links)||null}async reconnect(e){try{if(T.getWalletType()==="phantom"+(e?"_backup":"")){return await this.connectPhantom()}if(!e){const e=await this.getSession();return this.setWallet(e),e}const t=T.getBackupWalletInfo();return this.setWallet(t),t}catch(e){return null}}async connectPhantom(){try{if(this.phantomAdapter||(this.phantomAdapter=new K),await this.phantomAdapter.connect(),!this.phantomAdapter.publicKey)throw new Error("Failed to connect to Phantom wallet");const e=this.phantomAdapter.publicKey.toString(),t={id:r.v4(),wallets:[{id:e,address:e,network:exports.Network.Solana,wallet_type:exports.WalletType.Phantom,wallet_set:"Main",account_index:0,is_enabled:!0}],social_links:[],social_infos:[],account_info:{name:null,sub_accounts:[]},created_at:Date.now(),is_exported:!1};return this.setWallet(t),this.setWalletType("phantom"),t}catch(e){throw console.error("Phantom connect error:",e),new Error(e instanceof Error?e.message:"Failed to connect to Phantom wallet")}}async updateAccountName(e,t){if(!this.walletInfo)throw new Error("No wallet info");const n={name:e};void 0!==t&&(n.account_index=t);const r=(await this.api.post("/account/update",n,{withCredentials:!0})).data;return this.setWallet(r),r}async manageMultiAccount(e){if(!this.walletInfo)throw new Error("No wallet info");const t=(await this.api.post("/account/multi",e,{withCredentials:!0})).data;return this.setWallet(t),t}async createSubAccount(e){return this.manageMultiAccount({type:"Create",data:{name:null!=e?e:null}})}async enableSubAccount(e){return this.manageMultiAccount({type:"Enable",data:{index:e}})}async disableSubAccount(e){return this.manageMultiAccount({type:"Disable",data:{index:e}})}async signSolanaTransaction(e){try{if(!this.walletInfo)throw new Error("No wallet info");if(!this.solanaConnection)throw new Error("No rpc connection");const{blockhash:n}=await this.solanaConnection.getLatestBlockhash();if(E(e)?e.message.recentBlockhash=n:e.recentBlockhash=n,this.phantomAdapter&&this.phantomAdapter.publicKey)return await this.phantomAdapter.signTransaction(e);const r=this.solanaWallet;if(!r)throw new Error("No solana wallet available");const o=await this.signV3({network:exports.Network.Solana,address:r.address,tx:{Solana:w.default.encode(E(e)?e.message.serialize():e.serializeMessage())}});return e.addSignature(new t.PublicKey(r.address),Lf.from(w.default.decode(o))),e}catch(e){throw new Error(e instanceof Error?e.message:"Failed to sign transaction")}}async signEthereumEip712(e){if(!this.ethereumNetwork)throw new Error("No Ethereum network");if(!this.ethereumProvider)throw new Error("No Ethereum provider");if(!this.walletInfo)throw new Error("No wallet info");if(!this.ethereumAddress)throw new Error("No Ethereum address");return await this.signV2({network:exports.Network.Ethereum,address:this.ethereumAddress,tx:{EthereumEip712:e}})}async sendSolanaTransaction(e){if(!this.solanaConnection)throw new Error("No rpc connection");try{return await this.solanaConnection.sendRawTransaction(e,{maxRetries:3,skipPreflight:!1})}catch(e){throw e}}async sendEthereumTransaction(e){if(!this.ethereumProvider)throw new Error("No Ethereum provider");try{return await this.ethereumProvider.sendRawTransaction({serializedTransaction:e})}catch(e){throw e}}async sendEmailVerificationCode(e){await this.api.post("/send_verification",{email:e})}async sendPhoneVerificationCode(e){e.startsWith("+")||(e=`+${e}`),await this.api.post("/send_verification",{phone:e,type:"phone"})}async verifyEmailVerificationCode({email:e,code:t}){const n={type:"Email",data:{network:this.defaultNetwork,email:e,code:t}},r=(await this.api.post("/login",n,{withCredentials:!0})).data;return this.setWallet(r),this.setWalletType("embedded"),r}async verifyPhoneVerificationCode({phone:e,code:t}){const n={type:"Phone",data:{network:this.defaultNetwork,phone:e,code:t}},r=(await this.api.post("/login",n,{withCredentials:!0})).data;return this.setWallet(r),this.setWalletType("embedded"),r}async twitterLogin(e){const t={type:"TwitterOAuth",data:{network:this.defaultNetwork,...e}},n=(await this.api.post("/login",t,{withCredentials:!0})).data;return this.setWallet(n),this.setWalletType("embedded"),n}async googleLogin(e){const t={type:"GoogleOAuth",data:{network:this.defaultNetwork,...e}},n=(await this.api.post("/login",t,{withCredentials:!0})).data;return this.setWallet(n),this.setWalletType("embedded"),n}async oauthLogin(e,t){const n={type:e,data:{network:t.network||this.defaultNetwork,...t}},r=(await this.api.post("/login",n,{withCredentials:!0})).data;return this.setWallet(r),t.isBackup?this.setBackupWalletType("embedded_backup"):this.setWalletType("embedded"),r}async loginWithChallenge(e,t){const n={type:e,data:{network:t.network||this.defaultNetwork,...t}},r=(await this.api.post("/login",n,{withCredentials:!0})).data;return this.setWallet(r),console.log(11),t.isBackup?(console.log(22),this.setBackupWalletType("embedded_backup")):this.setWalletType("embedded"),r}async oauthInit(e){return(await this.api.post("/oauth/init",e)).data}async getSignChallenge(e){return(await this.api.get(`/challenge?method=${e.method}&id=${e.id}`)).data}async getSession(){const e=(await this.api.get("/session",{withCredentials:!0})).data,{access_token:t,...n}=e;return t&&T.saveAccessToken(t),e}async logout(e){this.phantomAdapter?(this.phantomAdapter.disconnect(),this.phantomAdapter=null):await this.api.post("/logout",{},{withCredentials:!0}),this.setWallet(null),e?T.clearBackup():T.clear()}async getOAuth2ClientId(e){return(await this.api.get(`/oauth_id/${e}`)).data.client_id}setSelectedWallet(e){this.selectedWalletId=e}getSelectedWallet(){return this.selectedWalletId}async getSolanaBalance(){if(!this.solanaConnection||!this.solanaAddress)throw new Error("Solana connection not available");return(await this.solanaConnection.getBalance(new t.PublicKey(this.solanaAddress))/t.LAMPORTS_PER_SOL).toString()}async getEthereumBalance(){if(!this.ethereumProvider||!this.ethereumAddress)throw new Error("Ethereum provider not available");return xf(await this.ethereumProvider.getBalance({address:this.ethereumAddress}))}async fetchCoinbaseToken(e,t="solana"){return(await this.api.post("/ramp/coinbase",{addresses:[{address:e,blockchains:[t]}],assets:["solana"===t?"SOL":"ETH"]})).data.token}viemSignerAdapter(){return{signTypedData:async e=>{if(!this.ethereumNetwork)throw new Error("No Ethereum network");if(!this.ethereumProvider)throw new Error("No Ethereum provider");if(!this.walletInfo)throw new Error("No wallet info");if(!this.ethereumAddress)throw new Error("No Ethereum address");const t=await this.signV2({network:exports.Network.Ethereum,address:this.ethereumAddress,tx:{EthereumEip712:e}}),n=w.default.decode(t),r=n[64];return Fd({r:`0x${Lf.from(n.slice(0,32)).toString("hex")}`,s:`0x${Lf.from(n.slice(32,64)).toString("hex")}`,v:BigInt(r+27)})}}}async createMiddleAccount(e){try{return(await this.middleAccountApi.post("/create",e)).data}catch(e){throw new Error(e instanceof Error?e.message:"Failed to create middle account")}}async getCoinbaseOnrampUrlForMiddleAccount(e){try{const t={sessionToken:await this.fetchCoinbaseToken(e.middleAccountAddress,e.network===exports.Network.Solana?"solana":"ethereum"),presetCryptoAmount:Number(e.amount),redirectUrl:e.redirectUrl||window.location.href};return Pf(t)}catch(e){throw new Error(e instanceof Error?e.message:"Failed to get Coinbase onramp URL")}}async getOrderState(e){try{return(await this.middleAccountApi.get(`/order/${e}`)).data}catch(e){throw new Error(e instanceof Error?e.message:"Failed to get order status")}}async transfer(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_id:this.walletInfo.id,from:e.from,to:e.to,amount:e.amount,decimals:e.decimals,token:e.token,network:e.network,chain_id:e.chain_id};try{return(await this.api.post("/v3/sign/transfer",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Transfer failed")}}async buildTransaction(e,t){var n,r;if(!this.walletInfo)throw new Error("No wallet info available");try{const n={...e,wallet_address:t||e.wallet_address||null};return(await this.api.post("/v3/sign/build_transaction",n,{withCredentials:!0})).data}catch(e){if(null===(r=null===(n=e.response)||void 0===n?void 0:n.data)||void 0===r?void 0:r.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to build transaction")}}async exportInit(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_nonce:Eh(),account_index:e};try{return(await this.api.post("/export/init",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to initialize export")}}async exportFinal(e){var t,n,r;if(!this.walletInfo)throw new Error("No wallet info available");const o={user_nonce:e.userNonce,server_nonce:e.serverNonce,account_index:e.accountIndex,is_export:null===(t=e.isExport)||void 0===t||t};try{return(await this.api.post("/export/final",o,{withCredentials:!0})).data}catch(e){if(null===(r=null===(n=e.response)||void 0===n?void 0:n.data)||void 0===r?void 0:r.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to finalize export")}}async getExportedWallets(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={account_index:e,is_export:!1};try{return(await this.api.post("/export/final",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to retrieve exported wallets")}}async closeInit(){var e,t;if(!this.walletInfo)throw new Error("No wallet info available");const n={user_nonce:Eh()};try{return(await this.api.post("/close/init",n,{withCredentials:!0})).data}catch(n){if(null===(t=null===(e=n.response)||void 0===e?void 0:e.data)||void 0===t?void 0:t.error)throw new Error(n.response.data.error);throw new Error(n instanceof Error?n.message:"Failed to initialize account closure")}}async closeFinal(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_nonce:e.userNonce,server_nonce:e.serverNonce};try{const e=await this.api.post("/close/final",r,{withCredentials:!0});return this.setWallet(null),T.clear(),e.data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to close account")}}async signV1(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_id:this.walletInfo.id,network:e.network,address:e.address,message:e.message};try{return(await this.api.post("/v1/sign",r,{withCredentials:!0})).data.signature}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to sign message")}}async signV2(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={user_id:this.walletInfo.id,network:e.network,address:e.address,tx:e.tx};try{return(await this.api.post("/v2/sign",r,{withCredentials:!0})).data.signature}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to sign transaction")}}async signV3(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");if(e.network!==exports.Network.Solana)throw new Error("v3 sign API only supports Solana transactions");if(!e.tx.Solana)throw new Error("Solana transaction is required for v3 sign API");const r={user_id:this.walletInfo.id,network:e.network,address:e.address,tx:{Solana:e.tx.Solana}};try{return(await this.api.post("/v3/sign",r,{withCredentials:!0})).data.signature}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to sign transaction")}}async lighterBuildTransaction(e,t){var n,r;if(!this.walletInfo)throw new Error("No wallet info available");try{const n={...e,wallet_address:t||e.wallet_address||null};return(await this.api.post("/v3/lighter/build_transaction",n,{withCredentials:!0})).data}catch(e){if(null===(r=null===(n=e.response)||void 0===n?void 0:n.data)||void 0===r?void 0:r.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to build Lighter transaction")}}async lighterAuth(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");const r={account_index:e.lighter_account_index,wallet_address:e.wallet_address||null,expires_in_ms:e.expires_in_ms||null};try{return(await this.api.post("/v3/lighter/auth",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to generate Lighter auth token")}}async lighterChangeKey(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");if(e.lighter_account_index<0)throw new Error("accountIndex must be non-negative");const r={account_index:e.lighter_account_index,wallet_address:e.wallet_address||null};try{return(await this.api.post("/v3/lighter/change_key",r,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to change Lighter key")}}async exchange(e){var t,n;if(!this.walletInfo)throw new Error("No wallet info available");try{return(await this.api.post("/v3/sign/exchange",e,{withCredentials:!0})).data}catch(e){if(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.error)throw new Error(e.response.data.error);throw new Error(e instanceof Error?e.message:"Failed to build exchange transaction")}}}var kh=function(){return kh=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},kh.apply(this,arguments)};function Ah(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}function Ih(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}"function"==typeof SuppressedError&&SuppressedError;var Nh=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,Sh=Ih(function(e){return Nh.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),Th="-ms-",Bh="-moz-",Ch="-webkit-",$h="comm",Oh="rule",_h="decl",Rh="@keyframes",zh=Math.abs,Mh=String.fromCharCode,Lh=Object.assign;function Fh(e){return e.trim()}function Uh(e,t){return(e=t.exec(e))?e[0]:e}function jh(e,t,n){return e.replace(t,n)}function Dh(e,t,n){return e.indexOf(t,n)}function Gh(e,t){return 0|e.charCodeAt(t)}function Wh(e,t,n){return e.slice(t,n)}function qh(e){return e.length}function Vh(e){return e.length}function Hh(e,t){return t.push(e),e}function Yh(e,t){return e.filter(function(e){return!Uh(e,t)})}var Kh=1,Zh=1,Jh=0,Qh=0,Xh=0,ep="";function tp(e,t,n,r,o,a,s,i){return{value:e,root:t,parent:n,type:r,props:o,children:a,line:Kh,column:Zh,length:s,return:"",siblings:i}}function np(e,t){return Lh(tp("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function rp(e){for(;e.root;)e=np(e.root,{children:[e]});Hh(e,e.siblings)}function op(){return Xh=Qh>0?Gh(ep,--Qh):0,Zh--,10===Xh&&(Zh=1,Kh--),Xh}function ap(){return Xh=Qh<Jh?Gh(ep,Qh++):0,Zh++,10===Xh&&(Zh=1,Kh++),Xh}function sp(){return Gh(ep,Qh)}function ip(){return Qh}function cp(e,t){return Wh(ep,e,t)}function lp(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function up(e){return Fh(cp(Qh-1,hp(91===e?e+2:40===e?e+1:e)))}function dp(e){for(;(Xh=sp())&&Xh<33;)ap();return lp(e)>2||lp(Xh)>3?"":" "}function fp(e,t){for(;--t&&ap()&&!(Xh<48||Xh>102||Xh>57&&Xh<65||Xh>70&&Xh<97););return cp(e,ip()+(t<6&&32==sp()&&32==ap()))}function hp(e){for(;ap();)switch(Xh){case e:return Qh;case 34:case 39:34!==e&&39!==e&&hp(Xh);break;case 40:41===e&&hp(e);break;case 92:ap()}return Qh}function pp(e,t){for(;ap()&&e+Xh!==57&&(e+Xh!==84||47!==sp()););return"/*"+cp(t,Qh-1)+"*"+Mh(47===e?e:ap())}function mp(e){for(;!lp(sp());)ap();return cp(e,Qh)}function gp(e){return function(e){return ep="",e}(bp("",null,null,null,[""],e=function(e){return Kh=Zh=1,Jh=qh(ep=e),Qh=0,[]}(e),0,[0],e))}function bp(e,t,n,r,o,a,s,i,c){for(var l=0,u=0,d=s,f=0,h=0,p=0,m=1,g=1,b=1,y=0,w="",v=o,x=a,E=r,P=w;g;)switch(p=y,y=ap()){case 40:if(108!=p&&58==Gh(P,d-1)){-1!=Dh(P+=jh(up(y),"&","&\f"),"&\f",zh(l?i[l-1]:0))&&(b=-1);break}case 34:case 39:case 91:P+=up(y);break;case 9:case 10:case 13:case 32:P+=dp(p);break;case 92:P+=fp(ip()-1,7);continue;case 47:switch(sp()){case 42:case 47:Hh(wp(pp(ap(),ip()),t,n,c),c);break;default:P+="/"}break;case 123*m:i[l++]=qh(P)*b;case 125*m:case 59:case 0:switch(y){case 0:case 125:g=0;case 59+u:-1==b&&(P=jh(P,/\f/g,"")),h>0&&qh(P)-d&&Hh(h>32?vp(P+";",r,n,d-1,c):vp(jh(P," ","")+";",r,n,d-2,c),c);break;case 59:P+=";";default:if(Hh(E=yp(P,t,n,l,u,o,i,w,v=[],x=[],d,a),a),123===y)if(0===u)bp(P,t,E,E,v,a,d,i,x);else switch(99===f&&110===Gh(P,3)?100:f){case 100:case 108:case 109:case 115:bp(e,E,E,r&&Hh(yp(e,E,E,0,0,o,i,w,o,v=[],d,x),x),o,x,d,i,r?v:x);break;default:bp(P,E,E,E,[""],x,0,i,x)}}l=u=h=0,m=b=1,w=P="",d=s;break;case 58:d=1+qh(P),h=p;default:if(m<1)if(123==y)--m;else if(125==y&&0==m++&&125==op())continue;switch(P+=Mh(y),y*m){case 38:b=u>0?1:(P+="\f",-1);break;case 44:i[l++]=(qh(P)-1)*b,b=1;break;case 64:45===sp()&&(P+=up(ap())),f=sp(),u=d=qh(w=P+=mp(ip())),y++;break;case 45:45===p&&2==qh(P)&&(m=0)}}return a}function yp(e,t,n,r,o,a,s,i,c,l,u,d){for(var f=o-1,h=0===o?a:[""],p=Vh(h),m=0,g=0,b=0;m<r;++m)for(var y=0,w=Wh(e,f+1,f=zh(g=s[m])),v=e;y<p;++y)(v=Fh(g>0?h[y]+" "+w:jh(w,/&\f/g,h[y])))&&(c[b++]=v);return tp(e,t,n,0===o?Oh:i,c,l,u,d)}function wp(e,t,n,r){return tp(e,t,n,$h,Mh(Xh),Wh(e,2,-2),0,r)}function vp(e,t,n,r,o){return tp(e,t,n,_h,Wh(e,0,r),Wh(e,r+1,-1),r,o)}function xp(e,t,n){switch(function(e,t){return 45^Gh(e,0)?(((t<<2^Gh(e,0))<<2^Gh(e,1))<<2^Gh(e,2))<<2^Gh(e,3):0}(e,t)){case 5103:return Ch+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ch+e+e;case 4789:return Bh+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Ch+e+Bh+e+Th+e+e;case 5936:switch(Gh(e,t+11)){case 114:return Ch+e+Th+jh(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ch+e+Th+jh(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ch+e+Th+jh(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Ch+e+Th+e+e;case 6165:return Ch+e+Th+"flex-"+e+e;case 5187:return Ch+e+jh(e,/(\w+).+(:[^]+)/,Ch+"box-$1$2"+Th+"flex-$1$2")+e;case 5443:return Ch+e+Th+"flex-item-"+jh(e,/flex-|-self/g,"")+(Uh(e,/flex-|baseline/)?"":Th+"grid-row-"+jh(e,/flex-|-self/g,""))+e;case 4675:return Ch+e+Th+"flex-line-pack"+jh(e,/align-content|flex-|-self/g,"")+e;case 5548:return Ch+e+Th+jh(e,"shrink","negative")+e;case 5292:return Ch+e+Th+jh(e,"basis","preferred-size")+e;case 6060:return Ch+"box-"+jh(e,"-grow","")+Ch+e+Th+jh(e,"grow","positive")+e;case 4554:return Ch+jh(e,/([^-])(transform)/g,"$1"+Ch+"$2")+e;case 6187:return jh(jh(jh(e,/(zoom-|grab)/,Ch+"$1"),/(image-set)/,Ch+"$1"),e,"")+e;case 5495:case 3959:return jh(e,/(image-set\([^]*)/,Ch+"$1$`$1");case 4968:return jh(jh(e,/(.+:)(flex-)?(.*)/,Ch+"box-pack:$3"+Th+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ch+e+e;case 4200:if(!Uh(e,/flex-|baseline/))return Th+"grid-column-align"+Wh(e,t)+e;break;case 2592:case 3360:return Th+jh(e,"template-","")+e;case 4384:case 3616:return n&&n.some(function(e,n){return t=n,Uh(e.props,/grid-\w+-end/)})?~Dh(e+(n=n[t].value),"span",0)?e:Th+jh(e,"-start","")+e+Th+"grid-row-span:"+(~Dh(n,"span",0)?Uh(n,/\d+/):+Uh(n,/\d+/)-+Uh(e,/\d+/))+";":Th+jh(e,"-start","")+e;case 4896:case 4128:return n&&n.some(function(e){return Uh(e.props,/grid-\w+-start/)})?e:Th+jh(jh(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return jh(e,/(.+)-inline(.+)/,Ch+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(qh(e)-1-t>6)switch(Gh(e,t+1)){case 109:if(45!==Gh(e,t+4))break;case 102:return jh(e,/(.+:)(.+)-([^]+)/,"$1"+Ch+"$2-$3$1"+Bh+(108==Gh(e,t+3)?"$3":"$2-$3"))+e;case 115:return~Dh(e,"stretch",0)?xp(jh(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return jh(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(t,n,r,o,a,s,i){return Th+n+":"+r+i+(o?Th+n+"-span:"+(a?s:+s-+r)+i:"")+e});case 4949:if(121===Gh(e,t+6))return jh(e,":",":"+Ch)+e;break;case 6444:switch(Gh(e,45===Gh(e,14)?18:11)){case 120:return jh(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Ch+(45===Gh(e,14)?"inline-":"")+"box$3$1"+Ch+"$2$3$1"+Th+"$2box$3")+e;case 100:return jh(e,":",":"+Th)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return jh(e,"scroll-","scroll-snap-")+e}return e}function Ep(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function Pp(e,t,n,r){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case _h:return e.return=e.return||e.value;case $h:return"";case Rh:return e.return=e.value+"{"+Ep(e.children,r)+"}";case Oh:if(!qh(e.value=e.props.join(",")))return""}return qh(n=Ep(e.children,r))?e.return=e.value+"{"+n+"}":""}function kp(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case _h:return void(e.return=xp(e.value,e.length,n));case Rh:return Ep([np(e,{value:jh(e.value,"@","@"+Ch)})],r);case Oh:if(e.length)return function(e,t){return e.map(t).join("")}(n=e.props,function(t){switch(Uh(t,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":rp(np(e,{props:[jh(t,/:(read-\w+)/,":-moz-$1")]})),rp(np(e,{props:[t]})),Lh(e,{props:Yh(n,r)});break;case"::placeholder":rp(np(e,{props:[jh(t,/:(plac\w+)/,":"+Ch+"input-$1")]})),rp(np(e,{props:[jh(t,/:(plac\w+)/,":-moz-$1")]})),rp(np(e,{props:[jh(t,/:(plac\w+)/,Th+"input-$1")]})),rp(np(e,{props:[t]})),Lh(e,{props:Yh(n,r)})}return""})}}var Ap={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Ip="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",Np="active",Sp="data-styled-version",Tp="6.1.19",Bp="/*!sc*/\n",Cp="undefined"!=typeof window&&"undefined"!=typeof document,$p=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),Op=/invalid hook call/i,_p=new Set,Rp=function(e,t){if("production"!==process.env.NODE_ENV){var n=t?' with the id of "'.concat(t,'"'):"",r="The component ".concat(e).concat(n," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n",a=console.error;try{var s=!0;console.error=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];Op.test(e)?(s=!1,_p.delete(r)):a.apply(void 0,Ah([e],t,!1))},o.useRef(),s&&!_p.has(r)&&(console.warn(r),_p.add(r))}catch(e){Op.test(e.message)&&_p.delete(r)}finally{console.error=a}}},zp=Object.freeze([]),Mp=Object.freeze({});var Lp=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),Fp=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,Up=/(^-|-$)/g;function jp(e){return e.replace(Fp,"-").replace(Up,"")}var Dp=/(a)(d)/gi,Gp=function(e){return String.fromCharCode(e+(e>25?39:97))};function Wp(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=Gp(t%52)+n;return(Gp(t%52)+n).replace(Dp,"$1-$2")}var qp,Vp=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Hp=function(e){return Vp(5381,e)};function Yp(e){return Wp(Hp(e)>>>0)}function Kp(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function Zp(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var Jp="function"==typeof Symbol&&Symbol.for,Qp=Jp?Symbol.for("react.memo"):60115,Xp=Jp?Symbol.for("react.forward_ref"):60112,em={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},tm={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},nm={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},rm=((qp={})[Xp]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},qp[Qp]=nm,qp);function om(e){return("type"in(t=e)&&t.type.$$typeof)===Qp?nm:"$$typeof"in e?rm[e.$$typeof]:em;var t}var am=Object.defineProperty,sm=Object.getOwnPropertyNames,im=Object.getOwnPropertySymbols,cm=Object.getOwnPropertyDescriptor,lm=Object.getPrototypeOf,um=Object.prototype;function dm(e,t,n){if("string"!=typeof t){if(um){var r=lm(t);r&&r!==um&&dm(e,r,n)}var o=sm(t);im&&(o=o.concat(im(t)));for(var a=om(e),s=om(t),i=0;i<o.length;++i){var c=o[i];if(!(c in tm||n&&n[c]||s&&c in s||a&&c in a)){var l=cm(t,c);try{am(e,c,l)}catch(e){}}}}return e}function fm(e){return"function"==typeof e}function hm(e){return"object"==typeof e&&"styledComponentId"in e}function pm(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function mm(e,t){if(0===e.length)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function gm(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function bm(e,t,n){if(void 0===n&&(n=!1),!n&&!gm(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=bm(e[r],t[r]);else if(gm(t))for(var r in t)e[r]=bm(e[r],t[r]);return e}function ym(e,t){Object.defineProperty(e,"toString",{value:t})}var wm="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function vm(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=e[0],r=[],o=1,a=e.length;o<a;o+=1)r.push(e[o]);return r.forEach(function(e){n=n.replace(/%[a-z]/,e)}),n}function xm(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):"")):new Error(vm.apply(void 0,Ah([wm[e]],t,!1)).trim())}var Em=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,o=r;e>=o;)if((o<<=1)<0)throw xm(16,"".concat(e));this.groupSizes=new Uint32Array(o),this.groupSizes.set(n),this.length=o;for(var a=r;a<o;a++)this.groupSizes[a]=0}for(var s=this.indexOfGroup(e+1),i=(a=0,t.length);a<i;a++)this.tag.insertRule(s,t[a])&&(this.groupSizes[e]++,s++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var o=n;o<r;o++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),o=r+n,a=r;a<o;a++)t+="".concat(this.tag.getRule(a)).concat(Bp);return t},e}(),Pm=1<<30,km=new Map,Am=new Map,Im=1,Nm=function(e){if(km.has(e))return km.get(e);for(;Am.has(Im);)Im++;var t=Im++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>Pm))throw xm(16,"".concat(t));return km.set(e,t),Am.set(t,e),t},Sm=function(e,t){Im=t+1,km.set(e,t),Am.set(t,e)},Tm="style[".concat(Ip,"][").concat(Sp,'="').concat(Tp,'"]'),Bm=new RegExp("^".concat(Ip,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Cm=function(e,t,n){for(var r,o=n.split(","),a=0,s=o.length;a<s;a++)(r=o[a])&&e.registerName(t,r)},$m=function(e,t){for(var n,r=(null!==(n=t.textContent)&&void 0!==n?n:"").split(Bp),o=[],a=0,s=r.length;a<s;a++){var i=r[a].trim();if(i){var c=i.match(Bm);if(c){var l=0|parseInt(c[1],10),u=c[2];0!==l&&(Sm(u,l),Cm(e,u,c[3]),e.getTag().insertRules(l,o)),o.length=0}else o.push(i)}}},Om=function(e){for(var t=document.querySelectorAll(Tm),n=0,r=t.length;n<r;n++){var o=t[n];o&&o.getAttribute(Ip)!==Np&&($m(e,o),o.parentNode&&o.parentNode.removeChild(o))}};var _m=function(e){var t=document.head,n=e||t,r=document.createElement("style"),o=function(e){var t=Array.from(e.querySelectorAll("style[".concat(Ip,"]")));return t[t.length-1]}(n),a=void 0!==o?o.nextSibling:null;r.setAttribute(Ip,Np),r.setAttribute(Sp,Tp);var s="undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null;return s&&r.setAttribute("nonce",s),n.insertBefore(r,a),r},Rm=function(){function e(e){this.element=_m(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var o=t[n];if(o.ownerNode===e)return o}throw xm(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),zm=function(){function e(e){this.element=_m(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),Mm=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Lm=Cp,Fm={isServer:!Cp,useCSSOMInjection:!$p},Um=function(){function e(e,t,n){void 0===e&&(e=Mp),void 0===t&&(t={});var r=this;this.options=kh(kh({},Fm),e),this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&Cp&&Lm&&(Lm=!1,Om(this)),ym(this,function(){return function(e){for(var t=e.getTag(),n=t.length,r="",o=function(n){var o=function(e){return Am.get(e)}(n);if(void 0===o)return"continue";var a=e.names.get(o),s=t.getGroup(n);if(void 0===a||!a.size||0===s.length)return"continue";var i="".concat(Ip,".g").concat(n,'[id="').concat(o,'"]'),c="";void 0!==a&&a.forEach(function(e){e.length>0&&(c+="".concat(e,","))}),r+="".concat(s).concat(i,'{content:"').concat(c,'"}').concat(Bp)},a=0;a<n;a++)o(a);return r}(r)})}return e.registerId=function(e){return Nm(e)},e.prototype.rehydrate=function(){!this.server&&Cp&&Om(this)},e.prototype.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(kh(kh({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,n=e.target;return e.isServer?new Mm(n):t?new Rm(n):new zm(n)}(this.options),new Em(e)));var e},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(Nm(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(Nm(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(Nm(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),jm=/&/g,Dm=/^\s*\/\/.*$/gm;function Gm(e,t){return e.map(function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return"".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Gm(e.children,t)),e})}var Wm=new Um,qm=function(){var e,t,n,r=Mp,o=r.options,a=void 0===o?Mp:o,s=r.plugins,i=void 0===s?zp:s,c=function(n,r,o){return o.startsWith(t)&&o.endsWith(t)&&o.replaceAll(t,"").length>0?".".concat(e):n},l=i.slice();l.push(function(e){e.type===Oh&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(jm,t).replace(n,c))}),a.prefix&&l.push(kp),l.push(Pp);var u=function(r,o,s,i){void 0===o&&(o=""),void 0===s&&(s=""),void 0===i&&(i="&"),e=i,t=o,n=new RegExp("\\".concat(t,"\\b"),"g");var c=r.replace(Dm,""),u=gp(s||o?"".concat(s," ").concat(o," { ").concat(c," }"):c);a.namespace&&(u=Gm(u,a.namespace));var d,f=[];return Ep(u,function(e){var t=Vh(e);return function(n,r,o,a){for(var s="",i=0;i<t;i++)s+=e[i](n,r,o,a)||"";return s}}(l.concat((d=function(e){return f.push(e)},function(e){e.root||(e=e.return)&&d(e)})))),f};return u.hash=i.length?i.reduce(function(e,t){return t.name||xm(15),Vp(e,t.name)},5381).toString():"",u}(),Vm=v.default.createContext({shouldForwardProp:void 0,styleSheet:Wm,stylis:qm});function Hm(){return o.useContext(Vm)}Vm.Consumer,v.default.createContext(void 0);var Ym=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=qm);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,ym(this,function(){throw xm(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=qm),this.name+e.hash},e}(),Km=function(e){return e>="A"&&e<="Z"};function Zm(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(1===n&&"-"===r&&"-"===e[0])return e;Km(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var Jm=function(e){return null==e||!1===e||""===e},Qm=function(e){var t,n,r=[];for(var o in e){var a=e[o];e.hasOwnProperty(o)&&!Jm(a)&&(Array.isArray(a)&&a.isCss||fm(a)?r.push("".concat(Zm(o),":"),a,";"):gm(a)?r.push.apply(r,Ah(Ah(["".concat(o," {")],Qm(a),!1),["}"],!1)):r.push("".concat(Zm(o),": ").concat((t=o,null==(n=a)||"boolean"==typeof n||""===n?"":"number"!=typeof n||0===n||t in Ap||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function Xm(e,t,n,r){if(Jm(e))return[];if(hm(e))return[".".concat(e.styledComponentId)];if(fm(e)){if(!fm(a=e)||a.prototype&&a.prototype.isReactComponent||!t)return[e];var o=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof o||Array.isArray(o)||o instanceof Ym||gm(o)||null===o||console.error("".concat(Kp(e)," is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")),Xm(o,t,n,r)}var a;return e instanceof Ym?n?(e.inject(n,r),[e.getName(r)]):[e]:gm(e)?Qm(e):Array.isArray(e)?Array.prototype.concat.apply(zp,e.map(function(e){return Xm(e,t,n,r)})):[e.toString()]}var eg=Hp(Tp),tg=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===n||n.isStatic)&&function(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(fm(n)&&!hm(n))return!1}return!0}(e),this.componentId=t,this.baseHash=Vp(eg,t),this.baseStyle=n,Um.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))r=pm(r,this.staticRulesId);else{var o=mm(Xm(this.rules,e,t,n)),a=Wp(Vp(this.baseHash,o)>>>0);if(!t.hasNameForId(this.componentId,a)){var s=n(o,".".concat(a),void 0,this.componentId);t.insertRules(this.componentId,a,s)}r=pm(r,a),this.staticRulesId=a}else{for(var i=Vp(this.baseHash,n.hash),c="",l=0;l<this.rules.length;l++){var u=this.rules[l];if("string"==typeof u)c+=u,"production"!==process.env.NODE_ENV&&(i=Vp(i,u));else if(u){var d=mm(Xm(u,e,t,n));i=Vp(i,d+l),c+=d}}if(c){var f=Wp(i>>>0);t.hasNameForId(this.componentId,f)||t.insertRules(this.componentId,f,n(c,".".concat(f),void 0,this.componentId)),r=pm(r,f)}}return r},e}(),ng=v.default.createContext(void 0);ng.Consumer;var rg={},og=new Set;function ag(e,t,n){var r=hm(e),a=e,s=!Zp(e),i=t.attrs,c=void 0===i?zp:i,l=t.componentId,u=void 0===l?function(e,t){var n="string"!=typeof e?"sc":jp(e);rg[n]=(rg[n]||0)+1;var r="".concat(n,"-").concat(Yp(Tp+n+rg[n]));return t?"".concat(t,"-").concat(r):r}(t.displayName,t.parentComponentId):l,d=t.displayName,f=void 0===d?function(e){return Zp(e)?"styled.".concat(e):"Styled(".concat(Kp(e),")")}(e):d,h=t.displayName&&t.componentId?"".concat(jp(t.displayName),"-").concat(t.componentId):t.componentId||u,p=r&&a.attrs?a.attrs.concat(c).filter(Boolean):c,m=t.shouldForwardProp;if(r&&a.shouldForwardProp){var g=a.shouldForwardProp;if(t.shouldForwardProp){var b=t.shouldForwardProp;m=function(e,t){return g(e,t)&&b(e,t)}}else m=g}var y=new tg(n,h,r?a.componentStyle:void 0);function w(e,t){return function(e,t,n){var r=e.attrs,a=e.componentStyle,s=e.defaultProps,i=e.foldedComponentIds,c=e.styledComponentId,l=e.target,u=v.default.useContext(ng),d=Hm(),f=e.shouldForwardProp||d.shouldForwardProp;"production"!==process.env.NODE_ENV&&o.useDebugValue(c);var h=function(e,t,n){return void 0===n&&(n=Mp),e.theme!==n.theme&&e.theme||t||n.theme}(t,u,s)||Mp,p=function(e,t,n){for(var r,o=kh(kh({},t),{className:void 0,theme:n}),a=0;a<e.length;a+=1){var s=fm(r=e[a])?r(o):r;for(var i in s)o[i]="className"===i?pm(o[i],s[i]):"style"===i?kh(kh({},o[i]),s[i]):s[i]}return t.className&&(o.className=pm(o.className,t.className)),o}(r,t,h),m=p.as||l,g={};for(var b in p)void 0===p[b]||"$"===b[0]||"as"===b||"theme"===b&&p.theme===h||("forwardedAs"===b?g.as=p.forwardedAs:f&&!f(b,m)||(g[b]=p[b],f||"development"!==process.env.NODE_ENV||Sh(b)||og.has(b)||!Lp.has(m)||(og.add(b),console.warn('styled-components: it looks like an unknown prop "'.concat(b,'" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));var y=function(e,t){var n=Hm(),r=e.generateAndInjectStyles(t,n.styleSheet,n.stylis);return"production"!==process.env.NODE_ENV&&o.useDebugValue(r),r}(a,p);"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(y);var w=pm(i,c);return y&&(w+=" "+y),p.className&&(w+=" "+p.className),g[Zp(m)&&!Lp.has(m)?"class":"className"]=w,n&&(g.ref=n),o.createElement(m,g)}(x,e,t)}w.displayName=f;var x=v.default.forwardRef(w);return x.attrs=p,x.componentStyle=y,x.displayName=f,x.shouldForwardProp=m,x.foldedComponentIds=r?pm(a.foldedComponentIds,a.styledComponentId):"",x.styledComponentId=h,x.target=r?a.target:e,Object.defineProperty(x,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=r?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0,o=t;r<o.length;r++)bm(e,o[r],!0);return e}({},a.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(Rp(f,h),x.warnTooManyClasses=function(e,t){var n={},r=!1;return function(o){if(!r&&(n[o]=!0,Object.keys(n).length>=200)){var a=t?' with the id of "'.concat(t,'"'):"";console.warn("Over ".concat(200," classes were generated for component ").concat(e).concat(a,".\n")+"Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"),r=!0,n={}}}}(f,h)),ym(x,function(){return".".concat(x.styledComponentId)}),s&&dm(x,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),x}function sg(e,t){for(var n=[e[0]],r=0,o=t.length;r<o;r+=1)n.push(t[r],e[r+1]);return n}var ig=function(e){return Object.assign(e,{isCss:!0})};function cg(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(fm(e)||gm(e))return ig(Xm(sg(zp,Ah([e],t,!0))));var r=e;return 0===t.length&&1===r.length&&"string"==typeof r[0]?Xm(r):ig(Xm(sg(r,t)))}function lg(e,t,n){if(void 0===n&&(n=Mp),!t)throw xm(1,t);var r=function(r){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return e(t,n,cg.apply(void 0,Ah([r],o,!1)))};return r.attrs=function(r){return lg(e,t,kh(kh({},n),{attrs:Array.prototype.concat(n.attrs,r).filter(Boolean)}))},r.withConfig=function(r){return lg(e,t,kh(kh({},n),r))},r}var ug=function(e){return lg(ag,e)},dg=ug;Lp.forEach(function(e){dg[e]=ug(e)}),"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");var fg="__sc-".concat(Ip,"__");"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[fg]||(window[fg]=0),1===window[fg]&&console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."),window[fg]+=1);const hg={colors:{black:"#000000",white:"#FFFFFF",offWhite:"#F5F5F5",grey:{100:"#F7F7F7",200:"#E6E6E6",300:"#D1D1D1",400:"#B0B0B0",500:"#8C8C8C",600:"#696969",700:"#474747",800:"#2B2B2B",900:"#1A1A1A"},primary:"#000000",secondary:"#B0B0B0",error:"#FF4D4D",success:"#4CAF50",background:{main:"#FFFFFF",secondary:"#F5F5F5",overlay:"rgba(0, 0, 0, 0.7)"},text:{primary:"#000000",secondary:"#474747",tertiary:"#8C8C8C",inverse:"#FFFFFF"},button:{primary:{background:"#000000",text:"#FFFFFF",hover:"#2B2B2B",disabled:"#8C8C8C"},secondary:{background:"#F5F5F5",text:"#000000",hover:"#E6E6E6",disabled:"#D1D1D1"}},border:{light:"#E6E6E6",medium:"#D1D1D1",dark:"#8C8C8C"}},typography:{fontFamily:"'Montserrat', 'Arial', sans-serif",fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},fontWeights:{light:300,regular:400,medium:500,semibold:600,bold:700}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem",full:"9999px"},shadows:{none:"none",sm:"0 1px 2px rgba(0, 0, 0, 0.05)",md:"0 4px 6px rgba(0, 0, 0, 0.05)",lg:"0 10px 15px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px rgba(0, 0, 0, 0.05)"},transitions:{fast:"0.1s ease",normal:"0.2s ease",slow:"0.3s ease"}},pg=(function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product&&console.warn("`keyframes` cannot be used on ReactNative, only on the web. To do animation in ReactNative please use Animated.");var r=mm(cg.apply(void 0,Ah([e],t,!1))),o=Yp(r);return new Ym(o,r)})`
13
13
  from {
14
14
  transform: rotate(0deg);
15
15
  }