@ottocode/openclaw-setu 0.1.2 → 0.1.4

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.
@@ -0,0 +1,42 @@
1
+ // @bun
2
+ import{$c as zY,Vc as EY,Wc as _Y,Yc as OY,Zc as mQ,_c as lQ,cd as LY,fd as pQ,hd as cQ,id as nQ,kd as uQ,rd as oQ,sd as iQ,td as tQ,ud as sQ}from"./chunk-fc5rfx0b.js";import{Fd as f1}from"./chunk-zy3raqnk.js";var PZ="1.2.3";class q extends Error{constructor($,Y={}){let Z=Y.cause instanceof q?Y.cause.details:Y.cause?.message?Y.cause.message:Y.details,Q=Y.cause instanceof q?Y.cause.docsPath||Y.docsPath:Y.docsPath,J=[$||"An error occurred.","",...Y.metaMessages?[...Y.metaMessages,""]:[],...Q?[`Docs: https://abitype.dev${Q}`]:[],...Z?[`Details: ${Z}`]:[],`Version: abitype@${PZ}`].join(`
3
+ `);super(J);if(Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),Y.cause)this.cause=Y.cause;this.details=Z,this.docsPath=Q,this.metaMessages=Y.metaMessages,this.shortMessage=$}}function R($,Y){return $.exec(Y)?.groups}var q0=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,A0=/^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)?$/,p$=/^\(.+?\).*?$/;var xZ=/^tuple(?<array>(\[(\d*)\])*)$/;function c$($){let Y=$.type;if(xZ.test($.type)&&"components"in $){Y="(";let Z=$.components.length;for(let J=0;J<Z;J++){let X=$.components[J];if(Y+=c$(X),J<Z-1)Y+=", "}let Q=R(xZ,$.type);return Y+=`)${Q?.array||""}`,c$({...$,type:Y})}if("indexed"in $&&$.indexed)Y=`${Y} indexed`;if($.name)return`${Y} ${$.name}`;return Y}function $$($){let Y="",Z=$.length;for(let Q=0;Q<Z;Q++){let J=$[Q];if(Y+=c$(J),Q!==Z-1)Y+=", "}return Y}function T0($){if($.type==="function")return`function ${$.name}(${$$($.inputs)})${$.stateMutability&&$.stateMutability!=="nonpayable"?` ${$.stateMutability}`:""}${$.outputs?.length?` returns (${$$($.outputs)})`:""}`;if($.type==="event")return`event ${$.name}(${$$($.inputs)})`;if($.type==="error")return`error ${$.name}(${$$($.inputs)})`;if($.type==="constructor")return`constructor(${$$($.inputs)})${$.stateMutability==="payable"?" payable":""}`;if($.type==="fallback")return`fallback() external${$.stateMutability==="payable"?" payable":""}`;return"receive() external payable"}var yZ=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function bZ($){return yZ.test($)}function hZ($){return R(yZ,$)}var vZ=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function gZ($){return vZ.test($)}function dZ($){return R(vZ,$)}var mZ=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function lZ($){return mZ.test($)}function pZ($){return R(mZ,$)}var cZ=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function t($){return cZ.test($)}function nZ($){return R(cZ,$)}var uZ=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function oZ($){return uZ.test($)}function iZ($){return R(uZ,$)}var tZ=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function sZ($){return tZ.test($)}function rZ($){return R(tZ,$)}var pJ=/^receive\(\) external payable$/;function aZ($){return pJ.test($)}var E0=new Set(["memory","indexed","storage","calldata"]),eZ=new Set(["indexed"]),n$=new Set(["calldata","memory","storage"]);class _0 extends q{constructor({signature:$}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify($,null,2)})`,docsPath:"/api/human#parseabiitem-1"});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class O0 extends q{constructor({type:$}){super("Unknown type.",{metaMessages:[`Type "${$}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class L0 extends q{constructor({type:$}){super("Unknown type.",{metaMessages:[`Type "${$}" is not a valid ABI type.`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class z0 extends q{constructor({params:$}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify($,null,2)})`,docsPath:"/api/human#parseabiparameters-1"});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class R0 extends q{constructor({param:$}){super("Invalid ABI parameter.",{details:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class S0 extends q{constructor({param:$,name:Y}){super("Invalid ABI parameter.",{details:$,metaMessages:[`"${Y}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class k0 extends q{constructor({param:$,type:Y,modifier:Z}){super("Invalid ABI parameter.",{details:$,metaMessages:[`Modifier "${Z}" not allowed${Y?` in "${Y}" type`:""}.`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class I0 extends q{constructor({param:$,type:Y,modifier:Z}){super("Invalid ABI parameter.",{details:$,metaMessages:[`Modifier "${Z}" not allowed${Y?` in "${Y}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${Z}" was given.`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class B0 extends q{constructor({abiParameter:$}){super("Invalid ABI parameter.",{details:JSON.stringify($,null,2),metaMessages:["ABI parameter type is invalid."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class m extends q{constructor({signature:$,type:Y}){super(`Invalid ${Y} signature.`,{details:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class j0 extends q{constructor({signature:$}){super("Unknown signature.",{details:$});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class f0 extends q{constructor({signature:$}){super("Invalid struct signature.",{details:$,metaMessages:["No properties exist."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class P0 extends q{constructor({type:$}){super("Circular reference detected.",{metaMessages:[`Struct "${$}" is a circular reference.`]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class x0 extends q{constructor({current:$,depth:Y}){super("Unbalanced parentheses.",{metaMessages:[`"${$.trim()}" has too many ${Y>0?"opening":"closing"} parentheses.`],details:`Depth "${Y}"`});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function $Q($,Y,Z){let Q="";if(Z)for(let J of Object.entries(Z)){if(!J)continue;let X="";for(let W of J[1])X+=`[${W.type}${W.name?`:${W.name}`:""}]`;Q+=`(${J[0]}{${X}})`}if(Y)return`${Y}:${$}${Q}`;return`${$}${Q}`}var u$=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function E$($,Y={}){if(lZ($))return cJ($,Y);if(gZ($))return nJ($,Y);if(bZ($))return uJ($,Y);if(oZ($))return oJ($,Y);if(sZ($))return iJ($);if(aZ($))return{type:"receive",stateMutability:"payable"};throw new j0({signature:$})}function cJ($,Y={}){let Z=pZ($);if(!Z)throw new m({signature:$,type:"function"});let Q=L(Z.parameters),J=[],X=Q.length;for(let D=0;D<X;D++)J.push(f(Q[D],{modifiers:n$,structs:Y,type:"function"}));let W=[];if(Z.returns){let D=L(Z.returns),K=D.length;for(let w=0;w<K;w++)W.push(f(D[w],{modifiers:n$,structs:Y,type:"function"}))}return{name:Z.name,type:"function",stateMutability:Z.stateMutability??"nonpayable",inputs:J,outputs:W}}function nJ($,Y={}){let Z=dZ($);if(!Z)throw new m({signature:$,type:"event"});let Q=L(Z.parameters),J=[],X=Q.length;for(let W=0;W<X;W++)J.push(f(Q[W],{modifiers:eZ,structs:Y,type:"event"}));return{name:Z.name,type:"event",inputs:J}}function uJ($,Y={}){let Z=hZ($);if(!Z)throw new m({signature:$,type:"error"});let Q=L(Z.parameters),J=[],X=Q.length;for(let W=0;W<X;W++)J.push(f(Q[W],{structs:Y,type:"error"}));return{name:Z.name,type:"error",inputs:J}}function oJ($,Y={}){let Z=iZ($);if(!Z)throw new m({signature:$,type:"constructor"});let Q=L(Z.parameters),J=[],X=Q.length;for(let W=0;W<X;W++)J.push(f(Q[W],{structs:Y,type:"constructor"}));return{type:"constructor",stateMutability:Z.stateMutability??"nonpayable",inputs:J}}function iJ($){let Y=rZ($);if(!Y)throw new m({signature:$,type:"fallback"});return{type:"fallback",stateMutability:Y.stateMutability??"nonpayable"}}var tJ=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,sJ=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,rJ=/^u?int$/;function f($,Y){let Z=$Q($,Y?.type,Y?.structs);if(u$.has(Z))return u$.get(Z);let Q=p$.test($),J=R(Q?sJ:tJ,$);if(!J)throw new R0({param:$});if(J.name&&eJ(J.name))throw new S0({param:$,name:J.name});let X=J.name?{name:J.name}:{},W=J.modifier==="indexed"?{indexed:!0}:{},D=Y?.structs??{},K,w={};if(Q){K="tuple";let F=L(J.type),C=[],N=F.length;for(let U=0;U<N;U++)C.push(f(F[U],{structs:D}));w={components:C}}else if(J.type in D)K="tuple",w={components:D[J.type]};else if(rJ.test(J.type))K=`${J.type}256`;else if(J.type==="address payable")K="address";else if(K=J.type,Y?.type!=="struct"&&!y0(K))throw new L0({type:K});if(J.modifier){if(!Y?.modifiers?.has?.(J.modifier))throw new k0({param:$,type:Y?.type,modifier:J.modifier});if(n$.has(J.modifier)&&!$X(K,!!J.array))throw new I0({param:$,type:Y?.type,modifier:J.modifier})}let G={type:`${K}${J.array??""}`,...X,...W,...w};return u$.set(Z,G),G}function L($,Y=[],Z="",Q=0){let J=$.trim().length;for(let X=0;X<J;X++){let W=$[X],D=$.slice(X+1);switch(W){case",":return Q===0?L(D,[...Y,Z.trim()]):L(D,Y,`${Z}${W}`,Q);case"(":return L(D,Y,`${Z}${W}`,Q+1);case")":return L(D,Y,`${Z}${W}`,Q-1);default:return L(D,Y,`${Z}${W}`,Q)}}if(Z==="")return Y;if(Q!==0)throw new x0({current:Z,depth:Q});return Y.push(Z.trim()),Y}function y0($){return $==="address"||$==="bool"||$==="function"||$==="string"||q0.test($)||A0.test($)}var aJ=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function eJ($){return $==="address"||$==="bool"||$==="function"||$==="string"||$==="tuple"||q0.test($)||A0.test($)||aJ.test($)}function $X($,Y){return Y||$==="bytes"||$==="string"||$==="tuple"}function w$($){let Y={},Z=$.length;for(let W=0;W<Z;W++){let D=$[W];if(!t(D))continue;let K=nZ(D);if(!K)throw new m({signature:D,type:"struct"});let w=K.properties.split(";"),G=[],F=w.length;for(let C=0;C<F;C++){let U=w[C].trim();if(!U)continue;let P=f(U,{type:"struct"});G.push(P)}if(!G.length)throw new f0({signature:D});Y[K.name]=G}let Q={},J=Object.entries(Y),X=J.length;for(let W=0;W<X;W++){let[D,K]=J[W];Q[D]=YQ(K,Y)}return Q}var YX=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function YQ($=[],Y={},Z=new Set){let Q=[],J=$.length;for(let X=0;X<J;X++){let W=$[X];if(p$.test(W.type))Q.push(W);else{let K=R(YX,W.type);if(!K?.type)throw new B0({abiParameter:W});let{array:w,type:G}=K;if(G in Y){if(Z.has(G))throw new P0({type:G});Q.push({...W,type:`tuple${w??""}`,components:YQ(Y[G],Y,new Set([...Z,G]))})}else if(y0(G))Q.push(W);else throw new O0({type:G})}}return Q}function o$($){let Y=w$($),Z=[],Q=$.length;for(let J=0;J<Q;J++){let X=$[J];if(t(X))continue;Z.push(E$(X,Y))}return Z}function ZX($){let Y;if(typeof $==="string")Y=E$($);else{let Z=w$($),Q=$.length;for(let J=0;J<Q;J++){let X=$[J];if(t(X))continue;Y=E$(X,Z);break}}if(!Y)throw new _0({signature:$});return Y}function QX($){let Y=[];if(typeof $==="string"){let Z=L($),Q=Z.length;for(let J=0;J<Q;J++)Y.push(f(Z[J],{modifiers:E0}))}else{let Z=w$($),Q=$.length;for(let J=0;J<Q;J++){let X=$[J];if(t(X))continue;let W=L(X),D=W.length;for(let K=0;K<D;K++)Y.push(f(W[K],{modifiers:E0,structs:Z}))}}if(Y.length===0)throw new z0({params:$});return Y}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var g0=BigInt(0),v0=BigInt(1);function d0($){return $ instanceof Uint8Array||ArrayBuffer.isView($)&&$.constructor.name==="Uint8Array"}function m0($){if(!d0($))throw Error("Uint8Array expected")}function o5($,Y){if(typeof Y!=="boolean")throw Error($+" boolean expected, got "+Y)}function i5($){let Y=$.toString(16);return Y.length&1?"0"+Y:Y}function JQ($){if(typeof $!=="string")throw Error("hex string expected, got "+typeof $);return $===""?g0:BigInt("0x"+$)}var XQ=typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function",JX=Array.from({length:256},($,Y)=>Y.toString(16).padStart(2,"0"));function WQ($){if(m0($),XQ)return $.toHex();let Y="";for(let Z=0;Z<$.length;Z++)Y+=JX[$[Z]];return Y}var l={_0:48,_9:57,A:65,F:70,a:97,f:102};function ZQ($){if($>=l._0&&$<=l._9)return $-l._0;if($>=l.A&&$<=l.F)return $-(l.A-10);if($>=l.a&&$<=l.f)return $-(l.a-10);return}function DQ($){if(typeof $!=="string")throw Error("hex string expected, got "+typeof $);if(XQ)return Uint8Array.fromHex($);let Y=$.length,Z=Y/2;if(Y%2)throw Error("hex string expected, got unpadded hex of length "+Y);let Q=new Uint8Array(Z);for(let J=0,X=0;J<Z;J++,X+=2){let W=ZQ($.charCodeAt(X)),D=ZQ($.charCodeAt(X+1));if(W===void 0||D===void 0){let K=$[X]+$[X+1];throw Error('hex string expected, got non-hex character "'+K+'" at index '+X)}Q[J]=W*16+D}return Q}function t5($){return JQ(WQ($))}function s5($){return m0($),JQ(WQ(Uint8Array.from($).reverse()))}function XX($,Y){return DQ($.toString(16).padStart(Y*2,"0"))}function r5($,Y){return XX($,Y).reverse()}function a5($,Y,Z){let Q;if(typeof Y==="string")try{Q=DQ(Y)}catch(X){throw Error($+" must be hex string or Uint8Array, cause: "+X)}else if(d0(Y))Q=Uint8Array.from(Y);else throw Error($+" must be hex string or Uint8Array");let J=Q.length;if(typeof Z==="number"&&J!==Z)throw Error($+" of length "+Z+" expected, got "+J);return Q}function WX(...$){let Y=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];m0(J),Y+=J.length}let Z=new Uint8Array(Y);for(let Q=0,J=0;Q<$.length;Q++){let X=$[Q];Z.set(X,J),J+=X.length}return Z}var b0=($)=>typeof $==="bigint"&&g0<=$;function DX($,Y,Z){return b0($)&&b0(Y)&&b0(Z)&&Y<=$&&$<Z}function e5($,Y,Z,Q){if(!DX(Y,Z,Q))throw Error("expected valid "+$+": "+Z+" <= n < "+Q+", got "+Y)}function $9($){let Y;for(Y=0;$>g0;$>>=v0,Y+=1);return Y}var Y9=($)=>(v0<<BigInt($))-v0,h0=($)=>new Uint8Array($),QQ=($)=>Uint8Array.from($);function Z9($,Y,Z){if(typeof $!=="number"||$<2)throw Error("hashLen must be a number");if(typeof Y!=="number"||Y<2)throw Error("qByteLen must be a number");if(typeof Z!=="function")throw Error("hmacFn must be a function");let Q=h0($),J=h0($),X=0,W=()=>{Q.fill(1),J.fill(0),X=0},D=(...F)=>Z(J,Q,...F),K=(F=h0(0))=>{if(J=D(QQ([0]),F),Q=D(),F.length===0)return;J=D(QQ([1]),F),Q=D()},w=()=>{if(X++>=1000)throw Error("drbg: tried 1000 values");let F=0,C=[];while(F<Y){Q=D();let N=Q.slice();C.push(N),F+=Q.length}return WX(...C)};return(F,C)=>{W(),K(F);let N=void 0;while(!(N=C(w())))K();return W(),N}}var KX={bigint:($)=>typeof $==="bigint",function:($)=>typeof $==="function",boolean:($)=>typeof $==="boolean",string:($)=>typeof $==="string",stringOrUint8Array:($)=>typeof $==="string"||d0($),isSafeInteger:($)=>Number.isSafeInteger($),array:($)=>Array.isArray($),field:($,Y)=>Y.Fp.isValid($),hash:($)=>typeof $==="function"&&Number.isSafeInteger($.outputLen)};function Q9($,Y,Z={}){let Q=(J,X,W)=>{let D=KX[X];if(typeof D!=="function")throw Error("invalid validator function");let K=$[J];if(W&&K===void 0)return;if(!D(K,$))throw Error("param "+String(J)+" is invalid. Expected "+X+", got "+K)};for(let[J,X]of Object.entries(Y))Q(J,X,!1);for(let[J,X]of Object.entries(Z))Q(J,X,!0);return $}function J9($){let Y=new WeakMap;return(Z,...Q)=>{let J=Y.get(Z);if(J!==void 0)return J;let X=$(Z,...Q);return Y.set(Z,X),X}}var KQ="0.1.1";function VQ(){return KQ}class M extends Error{static setStaticOptions($){M.prototype.docsOrigin=$.docsOrigin,M.prototype.showVersion=$.showVersion,M.prototype.version=$.version}constructor($,Y={}){let Z=(()=>{if(Y.cause instanceof M){if(Y.cause.details)return Y.cause.details;if(Y.cause.shortMessage)return Y.cause.shortMessage}if(Y.cause&&"details"in Y.cause&&typeof Y.cause.details==="string")return Y.cause.details;if(Y.cause?.message)return Y.cause.message;return Y.details})(),Q=(()=>{if(Y.cause instanceof M)return Y.cause.docsPath||Y.docsPath;return Y.docsPath})(),J=Y.docsOrigin??M.prototype.docsOrigin,X=`${J}${Q??""}`,W=Boolean(Y.version??M.prototype.showVersion),D=Y.version??M.prototype.version,K=[$||"An error occurred.",...Y.metaMessages?["",...Y.metaMessages]:[],...Z||Q||W?["",Z?`Details: ${Z}`:void 0,Q?`See: ${X}`:void 0,W?`Version: ${D}`:void 0]:[]].filter((w)=>typeof w==="string").join(`
4
+ `);super(K,Y.cause?{cause:Y.cause}:void 0);Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=Y.cause,this.details=Z,this.docs=X,this.docsOrigin=J,this.docsPath=Q,this.shortMessage=$,this.showVersion=W,this.version=D}walk($){return wQ(this,$)}}Object.defineProperty(M,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${VQ()}`}});(()=>{M.setStaticOptions(M.defaultStaticOptions)})();function wQ($,Y){if(Y?.($))return $;if($&&typeof $==="object"&&"cause"in $&&$.cause)return wQ($.cause,Y);return Y?null:$}function G$($,Y){if(Y$($)>Y)throw new c0({givenSize:Y$($),maxSize:Y})}function FQ($,Y){if(typeof Y==="number"&&Y>0&&Y>Y$($)-1)throw new i$({offset:Y,position:"start",size:Y$($)})}function CQ($,Y,Z){if(typeof Y==="number"&&typeof Z==="number"&&Y$($)!==Z-Y)throw new i$({offset:Z,position:"end",size:Y$($)})}var p={zero:48,nine:57,A:65,F:70,a:97,f:102};function l0($){if($>=p.zero&&$<=p.nine)return $-p.zero;if($>=p.A&&$<=p.F)return $-(p.A-10);if($>=p.a&&$<=p.f)return $-(p.a-10);return}function NQ($,Y={}){let{dir:Z,size:Q=32}=Y;if(Q===0)return $;if($.length>Q)throw new n0({size:$.length,targetSize:Q,type:"Bytes"});let J=new Uint8Array(Q);for(let X=0;X<Q;X++){let W=Z==="right";J[W?X:Q-X-1]=$[W?X:$.length-X-1]}return J}function p0($,Y={}){let{dir:Z="left"}=Y,Q=$,J=0;for(let X=0;X<Q.length-1;X++)if(Q[Z==="left"?X:Q.length-X-1].toString()==="0")J++;else break;return Q=Z==="left"?Q.slice(J):Q.slice(0,Q.length-J),Q}function F$($,Y){if(Z$($)>Y)throw new o0({givenSize:Z$($),maxSize:Y})}function HQ($,Y){if(typeof Y==="number"&&Y>0&&Y>Z$($)-1)throw new t$({offset:Y,position:"start",size:Z$($)})}function MQ($,Y,Z){if(typeof Y==="number"&&typeof Z==="number"&&Z$($)!==Z-Y)throw new t$({offset:Z,position:"end",size:Z$($)})}function u0($,Y={}){let{dir:Z,size:Q=32}=Y;if(Q===0)return $;let J=$.replace("0x","");if(J.length>Q*2)throw new i0({size:Math.ceil(J.length/2),targetSize:Q,type:"Hex"});return`0x${J[Z==="right"?"padEnd":"padStart"](Q*2,"0")}`}function UQ($,Y={}){let{dir:Z="left"}=Y,Q=$.replace("0x",""),J=0;for(let X=0;X<Q.length-1;X++)if(Q[Z==="left"?X:Q.length-X-1].toString()==="0")J++;else break;if(Q=Z==="left"?Q.slice(J):Q.slice(0,Q.length-J),Q==="0")return"0x";if(Z==="right"&&Q.length%2===1)return`0x${Q}0`;return`0x${Q}`}function r$($,Y,Z){return JSON.stringify($,(Q,J)=>{if(typeof Y==="function")return Y(Q,J);if(typeof J==="bigint")return J.toString()+"#__bigint";return J},Z)}var GX=new TextDecoder,FX=new TextEncoder;function CX($){if($ instanceof Uint8Array)return;if(!$)throw new _$($);if(typeof $!=="object")throw new _$($);if(!("BYTES_PER_ELEMENT"in $))throw new _$($);if($.BYTES_PER_ELEMENT!==1||$.constructor.name!=="Uint8Array")throw new _$($)}function w9($){if($ instanceof Uint8Array)return $;if(typeof $==="string")return HX($);return NX($)}function NX($){return $ instanceof Uint8Array?$:new Uint8Array($)}function HX($,Y={}){let{size:Z}=Y,Q=$;if(Z)F$($,Z),Q=t0($,Z);let J=Q.slice(2);if(J.length%2)J=`0${J}`;let X=J.length/2,W=new Uint8Array(X);for(let D=0,K=0;D<X;D++){let w=l0(J.charCodeAt(K++)),G=l0(J.charCodeAt(K++));if(w===void 0||G===void 0)throw new M(`Invalid byte sequence ("${J[K-2]}${J[K-1]}" in "${J}").`);W[D]=w<<4|G}return W}function G9($,Y={}){let{size:Z}=Y,Q=FX.encode($);if(typeof Z==="number")return G$(Q,Z),MX(Q,Z);return Q}function MX($,Y){return NQ($,{dir:"right",size:Y})}function Y$($){return $.length}function F9($,Y,Z,Q={}){let{strict:J}=Q;FQ($,Y);let X=$.slice(Y,Z);if(J)CQ(X,Y,Z);return X}function C9($,Y={}){let{size:Z}=Y;if(typeof Z<"u")G$($,Z);let Q=C$($,Y);return s0(Q,Y)}function N9($,Y={}){let{size:Z}=Y,Q=$;if(typeof Z<"u")G$(Q,Z),Q=UX(Q);if(Q.length>1||Q[0]>1)throw new TQ(Q);return Boolean(Q[0])}function H9($,Y={}){let{size:Z}=Y;if(typeof Z<"u")G$($,Z);let Q=C$($,Y);return EQ(Q,Y)}function M9($,Y={}){let{size:Z}=Y,Q=$;if(typeof Z<"u")G$(Q,Z),Q=qX(Q);return GX.decode(Q)}function UX($){return p0($,{dir:"left"})}function qX($){return p0($,{dir:"right"})}function U9($){try{return CX($),!0}catch{return!1}}class TQ extends M{constructor($){super(`Bytes value \`${$}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}class _$ extends M{constructor($){super(`Value \`${typeof $==="object"?r$($):$}\` of type \`${typeof $}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class c0 extends M{constructor({givenSize:$,maxSize:Y}){super(`Size cannot exceed \`${Y}\` bytes. Given size: \`${$}\` bytes.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class i$ extends M{constructor({offset:$,position:Y,size:Z}){super(`Slice ${Y==="start"?"starting":"ending"} at offset \`${$}\` is out-of-bounds (size: \`${Z}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}}class n0 extends M{constructor({size:$,targetSize:Y,type:Z}){super(`${Z.charAt(0).toUpperCase()}${Z.slice(1).toLowerCase()} size (\`${$}\`) exceeds padding size (\`${Y}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}var AX=new TextEncoder,TX=Array.from({length:256},($,Y)=>Y.toString(16).padStart(2,"0"));function EX($,Y={}){let{strict:Z=!1}=Y;if(!$)throw new r0($);if(typeof $!=="string")throw new r0($);if(Z){if(!/^0x[0-9a-fA-F]*$/.test($))throw new a0($)}if(!$.startsWith("0x"))throw new a0($)}function q9(...$){return`0x${$.reduce((Y,Z)=>Y+Z.replace("0x",""),"")}`}function A9($){if($ instanceof Uint8Array)return C$($);if(Array.isArray($))return C$(new Uint8Array($));return $}function T9($,Y={}){let Z=`0x${Number($)}`;if(typeof Y.size==="number")return F$(Z,Y.size),_Q(Z,Y.size);return Z}function C$($,Y={}){let Z="";for(let J=0;J<$.length;J++)Z+=TX[$[J]];let Q=`0x${Z}`;if(typeof Y.size==="number")return F$(Q,Y.size),t0(Q,Y.size);return Q}function I($,Y={}){let{signed:Z,size:Q}=Y,J=BigInt($),X;if(Q)if(Z)X=(1n<<BigInt(Q)*8n-1n)-1n;else X=2n**(BigInt(Q)*8n)-1n;else if(typeof $==="number")X=BigInt(Number.MAX_SAFE_INTEGER);let W=typeof X==="bigint"&&Z?-X-1n:0;if(X&&J>X||J<W){let w=typeof $==="bigint"?"n":"";throw new OQ({max:X?`${X}${w}`:void 0,min:`${W}${w}`,signed:Z,size:Q,value:`${$}${w}`})}let K=`0x${(Z&&J<0?BigInt.asUintN(Q*8,BigInt(J)):J).toString(16)}`;if(Q)return _Q(K,Q);return K}function E9($,Y={}){return C$(AX.encode($),Y)}function _Q($,Y){return u0($,{dir:"left",size:Y})}function t0($,Y){return u0($,{dir:"right",size:Y})}function _9($,Y,Z,Q={}){let{strict:J}=Q;HQ($,Y);let X=`0x${$.replace("0x","").slice((Y??0)*2,(Z??$.length)*2)}`;if(J)MQ(X,Y,Z);return X}function Z$($){return Math.ceil(($.length-2)/2)}function O9($){return UQ($,{dir:"left"})}function s0($,Y={}){let{signed:Z}=Y;if(Y.size)F$($,Y.size);let Q=BigInt($);if(!Z)return Q;let J=($.length-2)/2,X=(1n<<BigInt(J)*8n)-1n,W=X>>1n;if(Q<=W)return Q;return Q-X-1n}function EQ($,Y={}){let{signed:Z,size:Q}=Y;if(!Z&&!Q)return Number($);return Number(s0($,Y))}function L9($,Y={}){let{strict:Z=!1}=Y;try{return EX($,{strict:Z}),!0}catch{return!1}}class OQ extends M{constructor({max:$,min:Y,signed:Z,size:Q,value:J}){super(`Number \`${J}\` is not in safe${Q?` ${Q*8}-bit`:""}${Z?" signed":" unsigned"} integer range ${$?`(\`${Y}\` to \`${$}\`)`:`(above \`${Y}\`)`}`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class r0 extends M{constructor($){super(`Value \`${typeof $==="object"?r$($):$}\` of type \`${typeof $}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class a0 extends M{constructor($){super(`Value \`${$}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class o0 extends M{constructor({givenSize:$,maxSize:Y}){super(`Size cannot exceed \`${Y}\` bytes. Given size: \`${$}\` bytes.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class t$ extends M{constructor({offset:$,position:Y,size:Z}){super(`Slice ${Y==="start"?"starting":"ending"} at offset \`${$}\` is out-of-bounds (size: \`${Z}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class i0 extends M{constructor({size:$,targetSize:Y,type:Z}){super(`${Z.charAt(0).toUpperCase()}${Z.slice(1).toLowerCase()} size (\`${$}\`) exceeds padding size (\`${Y}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function LQ($){return{address:$.address,amount:I($.amount),index:I($.index),validatorIndex:I($.validatorIndex)}}function zQ($){return{...typeof $.baseFeePerGas==="bigint"&&{baseFeePerGas:I($.baseFeePerGas)},...typeof $.blobBaseFee==="bigint"&&{blobBaseFee:I($.blobBaseFee)},...typeof $.feeRecipient==="string"&&{feeRecipient:$.feeRecipient},...typeof $.gasLimit==="bigint"&&{gasLimit:I($.gasLimit)},...typeof $.number==="bigint"&&{number:I($.number)},...typeof $.prevRandao==="bigint"&&{prevRandao:I($.prevRandao)},...typeof $.time==="bigint"&&{time:I($.time)},...$.withdrawals&&{withdrawals:$.withdrawals.map(LQ)}}}function N$($){if(typeof $==="string")return{address:$,type:"json-rpc"};return $}var e0=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],a$=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],RQ=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],S9=[...RQ,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],k9=[...RQ,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],I9=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],B9=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],j9=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],f9=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}];var SQ="0x82ad56cb";var kQ="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",IQ="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",y9="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",BQ="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";var $Y="2.46.1";var YY={getDocsUrl:({docsBaseUrl:$,docsPath:Y="",docsSlug:Z})=>Y?`${$??"https://viem.sh"}${Y}${Z?`#${Z}`:""}`:void 0,version:`viem@${$Y}`};class V extends Error{constructor($,Y={}){let Z=(()=>{if(Y.cause instanceof V)return Y.cause.details;if(Y.cause?.message)return Y.cause.message;return Y.details})(),Q=(()=>{if(Y.cause instanceof V)return Y.cause.docsPath||Y.docsPath;return Y.docsPath})(),J=YY.getDocsUrl?.({...Y,docsPath:Q}),X=[$||"An error occurred.","",...Y.metaMessages?[...Y.metaMessages,""]:[],...J?[`Docs: ${J}`]:[],...Z?[`Details: ${Z}`]:[],...YY.version?[`Version: ${YY.version}`]:[]].join(`
5
+ `);super(X,Y.cause?{cause:Y.cause}:void 0);Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=Z,this.docsPath=Q,this.metaMessages=Y.metaMessages,this.name=Y.name??this.name,this.shortMessage=$,this.version=$Y}walk($){return jQ(this,$)}}function jQ($,Y){if(Y?.($))return $;if($&&typeof $==="object"&&"cause"in $&&$.cause!==void 0)return jQ($.cause,Y);return Y?null:$}class H$ extends V{constructor({blockNumber:$,chain:Y,contract:Z}){super(`Chain "${Y.name}" does not support contract "${Z.name}".`,{metaMessages:["This could be due to any of the following:",...$&&Z.blockCreated&&Z.blockCreated>$?[`- The contract "${Z.name}" was not deployed until block ${Z.blockCreated} (current block ${$}).`]:[`- The chain does not have the contract "${Z.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class LX extends V{constructor({chain:$,currentChainId:Y}){super(`The current chain of the wallet (id: ${Y}) does not match the target chain for the transaction (id: ${$.id} \u2013 ${$.name}).`,{metaMessages:[`Current Chain ID: ${Y}`,`Expected Chain ID: ${$.id} \u2013 ${$.name}`],name:"ChainMismatchError"})}}class zX extends V{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
6
+ `),{name:"ChainNotFoundError"})}}class e$ extends V{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class RX extends V{constructor({chainId:$}){super(typeof $==="number"?`Chain ID "${$}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}var fQ={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},$0={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},PQ={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function E($,{includeName:Y=!1}={}){if($.type!=="function"&&$.type!=="event"&&$.type!=="error")throw new ZY($.type);return`${$.name}(${O$($.inputs,{includeName:Y})})`}function O$($,{includeName:Y=!1}={}){if(!$)return"";return $.map((Z)=>SX(Z,{includeName:Y})).join(Y?", ":",")}function SX($,{includeName:Y}){if($.type.startsWith("tuple"))return`(${O$($.components,{includeName:Y})})${$.type.slice(5)}`;return $.type+(Y&&$.name?` ${$.name}`:"")}function B($,{strict:Y=!0}={}){if(!$)return!1;if(typeof $!=="string")return!1;return Y?/^0x[0-9a-fA-F]*$/.test($):$.startsWith("0x")}function A($){if(B($,{strict:!1}))return Math.ceil(($.length-2)/2);return $.length}class QY extends V{constructor({docsPath:$}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
7
+ `),{docsPath:$,name:"AbiConstructorNotFoundError"})}}class Y0 extends V{constructor({docsPath:$}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
8
+ `),{docsPath:$,name:"AbiConstructorParamsNotFoundError"})}}class JY extends V{constructor({data:$,params:Y,size:Z}){super([`Data size of ${Z} bytes is too small for given parameters.`].join(`
9
+ `),{metaMessages:[`Params: (${O$(Y,{includeName:!0})})`,`Data: ${$} (${Z} bytes)`],name:"AbiDecodingDataSizeTooSmallError"});Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=$,this.params=Y,this.size=Z}}class L$ extends V{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class XY extends V{constructor({expectedLength:$,givenLength:Y,type:Z}){super([`ABI encoding array length mismatch for type ${Z}.`,`Expected length: ${$}`,`Given length: ${Y}`].join(`
10
+ `),{name:"AbiEncodingArrayLengthMismatchError"})}}class WY extends V{constructor({expectedSize:$,value:Y}){super(`Size of bytes "${Y}" (bytes${A(Y)}) does not match expected size (bytes${$}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class DY extends V{constructor({expectedLength:$,givenLength:Y}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${$}`,`Given length (values): ${Y}`].join(`
11
+ `),{name:"AbiEncodingLengthMismatchError"})}}class KY extends V{constructor($,{docsPath:Y}){super([`Arguments (\`args\`) were provided to "${$}", but "${$}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
12
+ `),{docsPath:Y,name:"AbiErrorInputsNotFoundError"})}}class Z0 extends V{constructor($,{docsPath:Y}={}){super([`Error ${$?`"${$}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
13
+ `),{docsPath:Y,name:"AbiErrorNotFoundError"})}}class z$ extends V{constructor($,{docsPath:Y}){super([`Encoded error signature "${$}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${$}.`].join(`
14
+ `),{docsPath:Y,name:"AbiErrorSignatureNotFoundError"});Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=$}}class kX extends V{constructor({docsPath:$}){super("Cannot extract event signature from empty topics.",{docsPath:$,name:"AbiEventSignatureEmptyTopicsError"})}}class IX extends V{constructor($,{docsPath:Y}){super([`Encoded event signature "${$}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${$}.`].join(`
15
+ `),{docsPath:Y,name:"AbiEventSignatureNotFoundError"})}}class BX extends V{constructor($,{docsPath:Y}={}){super([`Event ${$?`"${$}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
16
+ `),{docsPath:Y,name:"AbiEventNotFoundError"})}}class x extends V{constructor($,{docsPath:Y}={}){super([`Function ${$?`"${$}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
17
+ `),{docsPath:Y,name:"AbiFunctionNotFoundError"})}}class R$ extends V{constructor($,{docsPath:Y}){super([`Function "${$}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
18
+ `),{docsPath:Y,name:"AbiFunctionOutputsNotFoundError"})}}class VY extends V{constructor($,{docsPath:Y}){super([`Encoded function signature "${$}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://4byte.sourcify.dev/?q=${$}.`].join(`
19
+ `),{docsPath:Y,name:"AbiFunctionSignatureNotFoundError"})}}class wY extends V{constructor($,Y){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${$.type}\` in \`${E($.abiItem)}\`, and`,`\`${Y.type}\` in \`${E(Y.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class jX extends V{constructor({expectedSize:$,givenSize:Y}){super(`Expected bytes${$}, got bytes${Y}.`,{name:"BytesSizeMismatchError"})}}class fX extends V{constructor({abiItem:$,data:Y,params:Z,size:Q}){super([`Data size of ${Q} bytes is too small for non-indexed event parameters.`].join(`
20
+ `),{metaMessages:[`Params: (${O$(Z,{includeName:!0})})`,`Data: ${Y} (${Q} bytes)`],name:"DecodeLogDataMismatch"});Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=$,this.data=Y,this.params=Z,this.size=Q}}class PX extends V{constructor({abiItem:$,param:Y}){super([`Expected a topic for indexed event parameter${Y.name?` "${Y.name}"`:""} on event "${E($,{includeName:!0})}".`].join(`
21
+ `),{name:"DecodeLogTopicsMismatch"});Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=$}}class GY extends V{constructor($,{docsPath:Y}){super([`Type "${$}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
22
+ `),{docsPath:Y,name:"InvalidAbiEncodingType"})}}class FY extends V{constructor($,{docsPath:Y}){super([`Type "${$}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
23
+ `),{docsPath:Y,name:"InvalidAbiDecodingType"})}}class S$ extends V{constructor($){super([`Value "${$}" is not a valid array.`].join(`
24
+ `),{name:"InvalidArrayError"})}}class ZY extends V{constructor($){super([`"${$}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
25
+ `),{name:"InvalidDefinitionTypeError"})}}class Q0 extends V{constructor({offset:$,position:Y,size:Z}){super(`Slice ${Y==="start"?"starting":"ending"} at offset "${$}" is out-of-bounds (size: ${Z}).`,{name:"SliceOffsetOutOfBoundsError"})}}class J0 extends V{constructor({size:$,targetSize:Y,type:Z}){super(`${Z.charAt(0).toUpperCase()}${Z.slice(1).toLowerCase()} size (${$}) exceeds padding size (${Y}).`,{name:"SizeExceedsPaddingSizeError"})}}class X0 extends V{constructor({size:$,targetSize:Y,type:Z}){super(`${Z.charAt(0).toUpperCase()}${Z.slice(1).toLowerCase()} is expected to be ${Y} ${Z} long, but is ${$} ${Z} long.`,{name:"InvalidBytesLengthError"})}}function y($,Y,Z,{strict:Q}={}){if(B($,{strict:!1}))return xX($,Y,Z,{strict:Q});return CY($,Y,Z,{strict:Q})}function xQ($,Y){if(typeof Y==="number"&&Y>0&&Y>A($)-1)throw new Q0({offset:Y,position:"start",size:A($)})}function yQ($,Y,Z){if(typeof Y==="number"&&typeof Z==="number"&&A($)!==Z-Y)throw new Q0({offset:Z,position:"end",size:A($)})}function CY($,Y,Z,{strict:Q}={}){xQ($,Y);let J=$.slice(Y,Z);if(Q)yQ(J,Y,Z);return J}function xX($,Y,Z,{strict:Q}={}){xQ($,Y);let J=`0x${$.replace("0x","").slice((Y??0)*2,(Z??$.length)*2)}`;if(Q)yQ(J,Y,Z);return J}function s($,{dir:Y,size:Z=32}={}){if(typeof $==="string")return c($,{dir:Y,size:Z});return yX($,{dir:Y,size:Z})}function c($,{dir:Y,size:Z=32}={}){if(Z===null)return $;let Q=$.replace("0x","");if(Q.length>Z*2)throw new J0({size:Math.ceil(Q.length/2),targetSize:Z,type:"hex"});return`0x${Q[Y==="right"?"padEnd":"padStart"](Z*2,"0")}`}function yX($,{dir:Y,size:Z=32}={}){if(Z===null)return $;if($.length>Z)throw new J0({size:$.length,targetSize:Z,type:"bytes"});let Q=new Uint8Array(Z);for(let J=0;J<Z;J++){let X=Y==="right";Q[X?J:Z-J-1]=$[X?J:$.length-J-1]}return Q}class Q$ extends V{constructor({max:$,min:Y,signed:Z,size:Q,value:J}){super(`Number "${J}" is not in safe ${Q?`${Q*8}-bit ${Z?"signed":"unsigned"} `:""}integer range ${$?`(${Y} to ${$})`:`(above ${Y})`}`,{name:"IntegerOutOfRangeError"})}}class NY extends V{constructor($){super(`Bytes value "${$}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class HY extends V{constructor($){super(`Hex value "${$}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}class MY extends V{constructor({givenSize:$,maxSize:Y}){super(`Size cannot exceed ${Y} bytes. Given size: ${$} bytes.`,{name:"SizeOverflowError"})}}function n($,{dir:Y="left"}={}){let Z=typeof $==="string"?$.replace("0x",""):$,Q=0;for(let J=0;J<Z.length-1;J++)if(Z[Y==="left"?J:Z.length-J-1].toString()==="0")Q++;else break;if(Z=Y==="left"?Z.slice(Q):Z.slice(0,Z.length-Q),typeof $==="string"){if(Z.length===1&&Y==="right")Z=`${Z}0`;return`0x${Z.length%2===1?`0${Z}`:Z}`}return Z}function z($,{size:Y}){if(A($)>Y)throw new MY({givenSize:A($),maxSize:Y})}function UY($,Y={}){let{signed:Z}=Y;if(Y.size)z($,{size:Y.size});let Q=BigInt($);if(!Z)return Q;let J=($.length-2)/2,X=(1n<<BigInt(J)*8n-1n)-1n;if(Q<=X)return Q;return Q-BigInt(`0x${"f".padStart(J*2,"f")}`)-1n}function F4($,Y={}){let Z=$;if(Y.size)z(Z,{size:Y.size}),Z=n(Z);if(n(Z)==="0x00")return!1;if(n(Z)==="0x01")return!0;throw new HY(Z)}function bQ($,Y={}){let Z=UY($,Y),Q=Number(Z);if(!Number.isSafeInteger(Q))throw new Q$({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:Y.signed,size:Y.size,value:`${Z}n`});return Q}var bX=Array.from({length:256},($,Y)=>Y.toString(16).padStart(2,"0"));function hQ($,Y={}){if(typeof $==="number"||typeof $==="bigint")return H($,Y);if(typeof $==="string")return AY($,Y);if(typeof $==="boolean")return qY($,Y);return j($,Y)}function qY($,Y={}){let Z=`0x${Number($)}`;if(typeof Y.size==="number")return z(Z,{size:Y.size}),s(Z,{size:Y.size});return Z}function j($,Y={}){let Z="";for(let J=0;J<$.length;J++)Z+=bX[$[J]];let Q=`0x${Z}`;if(typeof Y.size==="number")return z(Q,{size:Y.size}),s(Q,{dir:"right",size:Y.size});return Q}function H($,Y={}){let{signed:Z,size:Q}=Y,J=BigInt($),X;if(Q)if(Z)X=(1n<<BigInt(Q)*8n-1n)-1n;else X=2n**(BigInt(Q)*8n)-1n;else if(typeof $==="number")X=BigInt(Number.MAX_SAFE_INTEGER);let W=typeof X==="bigint"&&Z?-X-1n:0;if(X&&J>X||J<W){let K=typeof $==="bigint"?"n":"";throw new Q$({max:X?`${X}${K}`:void 0,min:`${W}${K}`,signed:Z,size:Q,value:`${$}${K}`})}let D=`0x${(Z&&J<0?(1n<<BigInt(Q*8))+BigInt(J):J).toString(16)}`;if(Q)return s(D,{size:Q});return D}var hX=new TextEncoder;function AY($,Y={}){let Z=hX.encode($);return j(Z,Y)}var vX=new TextEncoder;function W0($,Y={}){if(typeof $==="number"||typeof $==="bigint")return dX($,Y);if(typeof $==="boolean")return gX($,Y);if(B($))return D0($,Y);return TY($,Y)}function gX($,Y={}){let Z=new Uint8Array(1);if(Z[0]=Number($),typeof Y.size==="number")return z(Z,{size:Y.size}),s(Z,{size:Y.size});return Z}var u={zero:48,nine:57,A:65,F:70,a:97,f:102};function vQ($){if($>=u.zero&&$<=u.nine)return $-u.zero;if($>=u.A&&$<=u.F)return $-(u.A-10);if($>=u.a&&$<=u.f)return $-(u.a-10);return}function D0($,Y={}){let Z=$;if(Y.size)z(Z,{size:Y.size}),Z=s(Z,{dir:"right",size:Y.size});let Q=Z.slice(2);if(Q.length%2)Q=`0${Q}`;let J=Q.length/2,X=new Uint8Array(J);for(let W=0,D=0;W<J;W++){let K=vQ(Q.charCodeAt(D++)),w=vQ(Q.charCodeAt(D++));if(K===void 0||w===void 0)throw new V(`Invalid byte sequence ("${Q[D-2]}${Q[D-1]}" in "${Q}").`);X[W]=K*16+w}return X}function dX($,Y){let Z=H($,Y);return D0(Z)}function TY($,Y={}){let Z=vX.encode($);if(typeof Y.size==="number")return z(Z,{size:Y.size}),s(Z,{dir:"right",size:Y.size});return Z}var mX=BigInt(0),k$=BigInt(1),lX=BigInt(2),pX=BigInt(7),cX=BigInt(256),nX=BigInt(113),rQ=[],aQ=[],eQ=[];for(let $=0,Y=k$,Z=1,Q=0;$<24;$++){[Z,Q]=[Q,(2*Z+3*Q)%5],rQ.push(2*(5*Q+Z)),aQ.push(($+1)*($+2)/2%64);let J=mX;for(let X=0;X<7;X++)if(Y=(Y<<k$^(Y>>pX)*nX)%cX,Y&lX)J^=k$<<(k$<<BigInt(X))-k$;eQ.push(J)}var $J=uQ(eQ,!0),uX=$J[0],oX=$J[1],gQ=($,Y,Z)=>Z>32?tQ($,Y,Z):oQ($,Y,Z),dQ=($,Y,Z)=>Z>32?sQ($,Y,Z):iQ($,Y,Z);function iX($,Y=24){let Z=new Uint32Array(10);for(let Q=24-Y;Q<24;Q++){for(let W=0;W<10;W++)Z[W]=$[W]^$[W+10]^$[W+20]^$[W+30]^$[W+40];for(let W=0;W<10;W+=2){let D=(W+8)%10,K=(W+2)%10,w=Z[K],G=Z[K+1],F=gQ(w,G,1)^Z[D],C=dQ(w,G,1)^Z[D+1];for(let N=0;N<50;N+=10)$[W+N]^=F,$[W+N+1]^=C}let J=$[2],X=$[3];for(let W=0;W<24;W++){let D=aQ[W],K=gQ(J,X,D),w=dQ(J,X,D),G=rQ[W];J=$[G],X=$[G+1],$[G]=K,$[G+1]=w}for(let W=0;W<50;W+=10){for(let D=0;D<10;D++)Z[D]=$[W+D];for(let D=0;D<10;D++)$[W+D]^=~Z[(D+2)%10]&Z[(D+4)%10]}$[0]^=uX[Q],$[1]^=oX[Q]}zY(Z)}class RY extends cQ{constructor($,Y,Z,Q=!1,J=24){super();if(this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=$,this.suffix=Y,this.outputLen=Z,this.enableXOF=Q,this.rounds=J,EY(Z),!(0<$&&$<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=lQ(this.state)}clone(){return this._cloneInto()}keccak(){LY(this.state32),iX(this.state32,this.rounds),LY(this.state32),this.posOut=0,this.pos=0}update($){OY(this),$=pQ($),_Y($);let{blockLen:Y,state:Z}=this,Q=$.length;for(let J=0;J<Q;){let X=Math.min(Y-this.pos,Q-J);for(let W=0;W<X;W++)Z[this.pos++]^=$[J++];if(this.pos===Y)this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:$,suffix:Y,pos:Z,blockLen:Q}=this;if($[Z]^=Y,(Y&128)!==0&&Z===Q-1)this.keccak();$[Q-1]^=128,this.keccak()}writeInto($){OY(this,!1),_Y($),this.finish();let Y=this.state,{blockLen:Z}=this;for(let Q=0,J=$.length;Q<J;){if(this.posOut>=Z)this.keccak();let X=Math.min(Z-this.posOut,J-Q);$.set(Y.subarray(this.posOut,this.posOut+X),Q),this.posOut+=X,Q+=X}return $}xofInto($){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto($)}xof($){return EY($),this.xofInto(new Uint8Array($))}digestInto($){if(mQ($,this),this.finished)throw Error("digest() was already called");return this.writeInto($),this.destroy(),$}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,zY(this.state)}_cloneInto($){let{blockLen:Y,suffix:Z,outputLen:Q,rounds:J,enableXOF:X}=this;return $||($=new RY(Y,Z,Q,X,J)),$.state32.set(this.state32),$.pos=this.pos,$.posOut=this.posOut,$.finished=this.finished,$.rounds=J,$.suffix=Z,$.outputLen=Q,$.enableXOF=X,$.destroyed=this.destroyed,$}}var tX=($,Y,Z)=>nQ(()=>new RY(Y,$,Z));var YJ=(()=>tX(1,136,32))();function K0($,Y){let Z=Y||"hex",Q=YJ(B($,{strict:!1})?W0($):$);if(Z==="bytes")return Q;return hQ(Q)}var sX=($)=>K0(W0($));function ZJ($){return sX($)}function QJ($){let Y=!0,Z="",Q=0,J="",X=!1;for(let W=0;W<$.length;W++){let D=$[W];if(["(",")",","].includes(D))Y=!0;if(D==="(")Q++;if(D===")")Q--;if(!Y)continue;if(Q===0){if(D===" "&&["event","function",""].includes(J))J="";else if(J+=D,D===")"){X=!0;break}continue}if(D===" "){if($[W-1]!==","&&Z!==","&&Z!==",(")Z="",Y=!1;continue}J+=D,Z+=D}if(!X)throw new V("Unable to normalize signature.");return J}var JJ=($)=>{let Y=(()=>{if(typeof $==="string")return $;return T0($)})();return QJ(Y)};function V0($){return ZJ(JJ($))}var b=($)=>y(V0($),0,4);class S extends V{constructor({address:$}){super(`Address "${$}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class I$ extends Map{constructor($){super();Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=$}get($){let Y=super.get($);if(super.has($)&&Y!==void 0)this.delete($),super.set($,Y);return Y}set($,Y){if(super.set($,Y),this.maxSize&&this.size>this.maxSize){let Z=this.keys().next().value;if(Z)this.delete(Z)}return this}}var rX=/^0x[a-fA-F0-9]{40}$/,SY=new I$(8192);function T($,Y){let{strict:Z=!0}=Y??{},Q=`${$}.${Z}`;if(SY.has(Q))return SY.get(Q);let J=(()=>{if(!rX.test($))return!1;if($.toLowerCase()===$)return!0;if(Z)return B$($)===$;return!0})();return SY.set(Q,J),J}var kY=new I$(8192);function B$($,Y){if(kY.has(`${$}.${Y}`))return kY.get(`${$}.${Y}`);let Z=Y?`${Y}${$.toLowerCase()}`:$.substring(2).toLowerCase(),Q=K0(TY(Z),"bytes"),J=(Y?Z.substring(`${Y}0x`.length):Z).split("");for(let W=0;W<40;W+=2){if(Q[W>>1]>>4>=8&&J[W])J[W]=J[W].toUpperCase();if((Q[W>>1]&15)>=8&&J[W+1])J[W+1]=J[W+1].toUpperCase()}let X=`0x${J.join("")}`;return kY.set(`${$}.${Y}`,X),X}function JW($,Y){if(!T($,{strict:!1}))throw new S({address:$});return B$($,Y)}class w0 extends V{constructor({offset:$}){super(`Offset \`${$}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class IY extends V{constructor({length:$,position:Y}){super(`Position \`${Y}\` is out of bounds (\`0 < position < ${$}\`).`,{name:"PositionOutOfBoundsError"})}}class BY extends V{constructor({count:$,limit:Y}){super(`Recursive read limit of \`${Y}\` exceeded (recursive read count: \`${$}\`).`,{name:"RecursiveReadLimitExceededError"})}}var aX={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new BY({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition($){if($<0||$>this.bytes.length-1)throw new IY({length:this.bytes.length,position:$})},decrementPosition($){if($<0)throw new w0({offset:$});let Y=this.position-$;this.assertPosition(Y),this.position=Y},getReadCount($){return this.positionReadCount.get($||this.position)||0},incrementPosition($){if($<0)throw new w0({offset:$});let Y=this.position+$;this.assertPosition(Y),this.position=Y},inspectByte($){let Y=$??this.position;return this.assertPosition(Y),this.bytes[Y]},inspectBytes($,Y){let Z=Y??this.position;return this.assertPosition(Z+$-1),this.bytes.subarray(Z,Z+$)},inspectUint8($){let Y=$??this.position;return this.assertPosition(Y),this.bytes[Y]},inspectUint16($){let Y=$??this.position;return this.assertPosition(Y+1),this.dataView.getUint16(Y)},inspectUint24($){let Y=$??this.position;return this.assertPosition(Y+2),(this.dataView.getUint16(Y)<<8)+this.dataView.getUint8(Y+2)},inspectUint32($){let Y=$??this.position;return this.assertPosition(Y+3),this.dataView.getUint32(Y)},pushByte($){this.assertPosition(this.position),this.bytes[this.position]=$,this.position++},pushBytes($){this.assertPosition(this.position+$.length-1),this.bytes.set($,this.position),this.position+=$.length},pushUint8($){this.assertPosition(this.position),this.bytes[this.position]=$,this.position++},pushUint16($){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,$),this.position+=2},pushUint24($){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,$>>8),this.dataView.setUint8(this.position+2,$&255),this.position+=3},pushUint32($){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,$),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let $=this.inspectByte();return this.position++,$},readBytes($,Y){this.assertReadLimit(),this._touch();let Z=this.inspectBytes($);return this.position+=Y??$,Z},readUint8(){this.assertReadLimit(),this._touch();let $=this.inspectUint8();return this.position+=1,$},readUint16(){this.assertReadLimit(),this._touch();let $=this.inspectUint16();return this.position+=2,$},readUint24(){this.assertReadLimit(),this._touch();let $=this.inspectUint24();return this.position+=3,$},readUint32(){this.assertReadLimit(),this._touch();let $=this.inspectUint32();return this.position+=4,$},get remaining(){return this.bytes.length-this.position},setPosition($){let Y=this.position;return this.assertPosition($),this.position=$,()=>this.position=Y},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let $=this.getReadCount();if(this.positionReadCount.set(this.position,$+1),$>0)this.recursiveReadCount++}};function XJ($,{recursiveReadLimit:Y=8192}={}){let Z=Object.create(aX);return Z.bytes=$,Z.dataView=new DataView($.buffer??$,$.byteOffset,$.byteLength),Z.positionReadCount=new Map,Z.recursiveReadLimit=Y,Z}function WJ($,Y={}){if(typeof Y.size<"u")z($,{size:Y.size});let Z=j($,Y);return UY(Z,Y)}function DJ($,Y={}){let Z=$;if(typeof Y.size<"u")z(Z,{size:Y.size}),Z=n(Z);if(Z.length>1||Z[0]>1)throw new NY(Z);return Boolean(Z[0])}function h($,Y={}){if(typeof Y.size<"u")z($,{size:Y.size});let Z=j($,Y);return bQ(Z,Y)}function KJ($,Y={}){let Z=$;if(typeof Y.size<"u")z(Z,{size:Y.size}),Z=n(Z,{dir:"right"});return new TextDecoder().decode(Z)}function o($){if(typeof $[0]==="string")return J$($);return eX($)}function eX($){let Y=0;for(let J of $)Y+=J.length;let Z=new Uint8Array(Y),Q=0;for(let J of $)Z.set(J,Q),Q+=J.length;return Z}function J$($){return`0x${$.reduce((Y,Z)=>Y+Z.replace("0x",""),"")}`}var MW=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,VJ=/^(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)?$/;function v($,Y){if($.length!==Y.length)throw new DY({expectedLength:$.length,givenLength:Y.length});let Z=$1({params:$,values:Y}),Q=fY(Z);if(Q.length===0)return"0x";return Q}function $1({params:$,values:Y}){let Z=[];for(let Q=0;Q<$.length;Q++)Z.push(jY({param:$[Q],value:Y[Q]}));return Z}function jY({param:$,value:Y}){let Z=G0($.type);if(Z){let[Q,J]=Z;return Z1(Y,{length:Q,param:{...$,type:J}})}if($.type==="tuple")return D1(Y,{param:$});if($.type==="address")return Y1(Y);if($.type==="bool")return J1(Y);if($.type.startsWith("uint")||$.type.startsWith("int")){let Q=$.type.startsWith("int"),[,,J="256"]=VJ.exec($.type)??[];return X1(Y,{signed:Q,size:Number(J)})}if($.type.startsWith("bytes"))return Q1(Y,{param:$});if($.type==="string")return W1(Y);throw new GY($.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function fY($){let Y=0;for(let X=0;X<$.length;X++){let{dynamic:W,encoded:D}=$[X];if(W)Y+=32;else Y+=A(D)}let Z=[],Q=[],J=0;for(let X=0;X<$.length;X++){let{dynamic:W,encoded:D}=$[X];if(W)Z.push(H(Y+J,{size:32})),Q.push(D),J+=A(D);else Z.push(D)}return o([...Z,...Q])}function Y1($){if(!T($))throw new S({address:$});return{dynamic:!1,encoded:c($.toLowerCase())}}function Z1($,{length:Y,param:Z}){let Q=Y===null;if(!Array.isArray($))throw new S$($);if(!Q&&$.length!==Y)throw new XY({expectedLength:Y,givenLength:$.length,type:`${Z.type}[${Y}]`});let J=!1,X=[];for(let W=0;W<$.length;W++){let D=jY({param:Z,value:$[W]});if(D.dynamic)J=!0;X.push(D)}if(Q||J){let W=fY(X);if(Q){let D=H(X.length,{size:32});return{dynamic:!0,encoded:X.length>0?o([D,W]):D}}if(J)return{dynamic:!0,encoded:W}}return{dynamic:!1,encoded:o(X.map(({encoded:W})=>W))}}function Q1($,{param:Y}){let[,Z]=Y.type.split("bytes"),Q=A($);if(!Z){let J=$;if(Q%32!==0)J=c(J,{dir:"right",size:Math.ceil(($.length-2)/2/32)*32});return{dynamic:!0,encoded:o([c(H(Q,{size:32})),J])}}if(Q!==Number.parseInt(Z,10))throw new WY({expectedSize:Number.parseInt(Z,10),value:$});return{dynamic:!1,encoded:c($,{dir:"right"})}}function J1($){if(typeof $!=="boolean")throw new V(`Invalid boolean value: "${$}" (type: ${typeof $}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:c(qY($))}}function X1($,{signed:Y,size:Z=256}){if(typeof Z==="number"){let Q=2n**(BigInt(Z)-(Y?1n:0n))-1n,J=Y?-Q-1n:0n;if($>Q||$<J)throw new Q$({max:Q.toString(),min:J.toString(),signed:Y,size:Z/8,value:$.toString()})}return{dynamic:!1,encoded:H($,{size:32,signed:Y})}}function W1($){let Y=AY($),Z=Math.ceil(A(Y)/32),Q=[];for(let J=0;J<Z;J++)Q.push(c(y(Y,J*32,(J+1)*32),{dir:"right"}));return{dynamic:!0,encoded:o([c(H(A(Y),{size:32})),...Q])}}function D1($,{param:Y}){let Z=!1,Q=[];for(let J=0;J<Y.components.length;J++){let X=Y.components[J],W=Array.isArray($)?J:X.name,D=jY({param:X,value:$[W]});if(Q.push(D),D.dynamic)Z=!0}return{dynamic:Z,encoded:Z?fY(Q):o(Q.map(({encoded:J})=>J))}}function G0($){let Y=$.match(/^(.*)\[(\d+)?\]$/);return Y?[Y[2]?Number(Y[2]):null,Y[1]]:void 0}function U$($,Y){let Z=typeof Y==="string"?D0(Y):Y,Q=XJ(Z);if(A(Z)===0&&$.length>0)throw new L$;if(A(Y)&&A(Y)<32)throw new JY({data:typeof Y==="string"?Y:j(Y),params:$,size:A(Y)});let J=0,X=[];for(let W=0;W<$.length;++W){let D=$[W];Q.setPosition(J);let[K,w]=M$(Q,D,{staticPosition:0});J+=w,X.push(K)}return X}function M$($,Y,{staticPosition:Z}){let Q=G0(Y.type);if(Q){let[J,X]=Q;return V1($,{...Y,type:X},{length:J,staticPosition:Z})}if(Y.type==="tuple")return C1($,Y,{staticPosition:Z});if(Y.type==="address")return K1($);if(Y.type==="bool")return w1($);if(Y.type.startsWith("bytes"))return G1($,Y,{staticPosition:Z});if(Y.type.startsWith("uint")||Y.type.startsWith("int"))return F1($,Y);if(Y.type==="string")return N1($,{staticPosition:Z});throw new FY(Y.type,{docsPath:"/docs/contract/decodeAbiParameters"})}var wJ=32,PY=32;function K1($){let Y=$.readBytes(32);return[B$(j(CY(Y,-20))),32]}function V1($,Y,{length:Z,staticPosition:Q}){if(!Z){let W=h($.readBytes(PY)),D=Q+W,K=D+wJ;$.setPosition(D);let w=h($.readBytes(wJ)),G=j$(Y),F=0,C=[];for(let N=0;N<w;++N){$.setPosition(K+(G?N*32:F));let[U,P]=M$($,Y,{staticPosition:K});F+=P,C.push(U)}return $.setPosition(Q+32),[C,32]}if(j$(Y)){let W=h($.readBytes(PY)),D=Q+W,K=[];for(let w=0;w<Z;++w){$.setPosition(D+w*32);let[G]=M$($,Y,{staticPosition:D});K.push(G)}return $.setPosition(Q+32),[K,32]}let J=0,X=[];for(let W=0;W<Z;++W){let[D,K]=M$($,Y,{staticPosition:Q+J});J+=K,X.push(D)}return[X,J]}function w1($){return[DJ($.readBytes(32),{size:32}),32]}function G1($,Y,{staticPosition:Z}){let[Q,J]=Y.type.split("bytes");if(!J){let W=h($.readBytes(32));$.setPosition(Z+W);let D=h($.readBytes(32));if(D===0)return $.setPosition(Z+32),["0x",32];let K=$.readBytes(D);return $.setPosition(Z+32),[j(K),32]}return[j($.readBytes(Number.parseInt(J,10),32)),32]}function F1($,Y){let Z=Y.type.startsWith("int"),Q=Number.parseInt(Y.type.split("int")[1]||"256",10),J=$.readBytes(32);return[Q>48?WJ(J,{signed:Z}):h(J,{signed:Z}),32]}function C1($,Y,{staticPosition:Z}){let Q=Y.components.length===0||Y.components.some(({name:W})=>!W),J=Q?[]:{},X=0;if(j$(Y)){let W=h($.readBytes(PY)),D=Z+W;for(let K=0;K<Y.components.length;++K){let w=Y.components[K];$.setPosition(D+X);let[G,F]=M$($,w,{staticPosition:D});X+=F,J[Q?K:w?.name]=G}return $.setPosition(Z+32),[J,32]}for(let W=0;W<Y.components.length;++W){let D=Y.components[W],[K,w]=M$($,D,{staticPosition:Z});J[Q?W:D?.name]=K,X+=w}return[J,X]}function N1($,{staticPosition:Y}){let Z=h($.readBytes(32)),Q=Y+Z;$.setPosition(Q);let J=h($.readBytes(32));if(J===0)return $.setPosition(Y+32),["",32];let X=$.readBytes(J,32),W=KJ(n(X));return $.setPosition(Y+32),[W,32]}function j$($){let{type:Y}=$;if(Y==="string")return!0;if(Y==="bytes")return!0;if(Y.endsWith("[]"))return!0;if(Y==="tuple")return $.components?.some(j$);let Z=G0($.type);if(Z&&j$({...$,type:Z[1]}))return!0;return!1}function F0($){let{abi:Y,data:Z}=$,Q=y(Z,0,4);if(Q==="0x")throw new L$;let X=[...Y||[],$0,PQ].find((W)=>W.type==="error"&&Q===b(E(W)));if(!X)throw new z$(Q,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:X,args:"inputs"in X&&X.inputs&&X.inputs.length>0?U$(X.inputs,y(Z,4)):void 0,errorName:X.name}}var g=($,Y,Z)=>JSON.stringify($,(Q,J)=>{let X=typeof J==="bigint"?J.toString():J;return typeof Y==="function"?Y(Q,X):X},Z);function xY({abiItem:$,args:Y,includeFunctionName:Z=!0,includeName:Q=!1}){if(!("name"in $))return;if(!("inputs"in $))return;if(!$.inputs)return;return`${Z?$.name:""}(${$.inputs.map((J,X)=>`${Q&&J.name?`${J.name}: `:""}${typeof Y[X]==="object"?g(Y[X]):Y[X]}`).join(", ")})`}var GJ=V0;function d($){let{abi:Y,args:Z=[],name:Q}=$,J=B(Q,{strict:!1}),X=Y.filter((D)=>{if(J){if(D.type==="function")return b(D)===Q;if(D.type==="event")return GJ(D)===Q;return!1}return"name"in D&&D.name===Q});if(X.length===0)return;if(X.length===1)return X[0];let W;for(let D of X){if(!("inputs"in D))continue;if(!Z||Z.length===0){if(!D.inputs||D.inputs.length===0)return D;continue}if(!D.inputs)continue;if(D.inputs.length===0)continue;if(D.inputs.length!==Z.length)continue;if(Z.every((w,G)=>{let F="inputs"in D&&D.inputs[G];if(!F)return!1;return yY(w,F)})){if(W&&"inputs"in W&&W.inputs){let w=FJ(D.inputs,W.inputs,Z);if(w)throw new wY({abiItem:D,type:w[0]},{abiItem:W,type:w[1]})}W=D}}if(W)return W;return X[0]}function yY($,Y){let Z=typeof $,Q=Y.type;switch(Q){case"address":return T($,{strict:!1});case"bool":return Z==="boolean";case"function":return Z==="string";case"string":return Z==="string";default:{if(Q==="tuple"&&"components"in Y)return Object.values(Y.components).every((J,X)=>{return Z==="object"&&yY(Object.values($)[X],J)});if(/^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(Q))return Z==="number"||Z==="bigint";if(/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(Q))return Z==="string"||$ instanceof Uint8Array;if(/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(Q))return Array.isArray($)&&$.every((J)=>yY(J,{...Y,type:Q.replace(/(\[[0-9]{0,}\])$/,"")}));return!1}}}function FJ($,Y,Z){for(let Q in $){let J=$[Q],X=Y[Q];if(J.type==="tuple"&&X.type==="tuple"&&"components"in J&&"components"in X)return FJ(J.components,X.components,Z[Q]);let W=[J.type,X.type];if((()=>{if(W.includes("address")&&W.includes("bytes20"))return!0;if(W.includes("address")&&W.includes("string"))return T(Z[Q],{strict:!1});if(W.includes("address")&&W.includes("bytes"))return T(Z[Q],{strict:!1});return!1})())return W}return}var CJ={gwei:9,wei:18},NJ={ether:-9,wei:9};function C0($,Y){let Z=$.toString(),Q=Z.startsWith("-");if(Q)Z=Z.slice(1);Z=Z.padStart(Y,"0");let[J,X]=[Z.slice(0,Z.length-Y),Z.slice(Z.length-Y)];return X=X.replace(/(0+)$/,""),`${Q?"-":""}${J||"0"}${X?`.${X}`:""}`}function N0($,Y="wei"){return C0($,CJ[Y])}function k($,Y="wei"){return C0($,NJ[Y])}class bY extends V{constructor({address:$}){super(`State for account "${$}" is set multiple times.`,{name:"AccountStateConflictError"})}}class hY extends V{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function HJ($){return $.reduce((Y,{slot:Z,value:Q})=>{return`${Y} ${Z}: ${Q}
26
+ `},"")}function MJ($){return $.reduce((Y,{address:Z,...Q})=>{let J=`${Y} ${Z}:
27
+ `;if(Q.nonce)J+=` nonce: ${Q.nonce}
28
+ `;if(Q.balance)J+=` balance: ${Q.balance}
29
+ `;if(Q.code)J+=` code: ${Q.code}
30
+ `;if(Q.state)J+=` state:
31
+ `,J+=HJ(Q.state);if(Q.stateDiff)J+=` stateDiff:
32
+ `,J+=HJ(Q.stateDiff);return J},` State Override:
33
+ `).slice(0,-1)}function f$($){let Y=Object.entries($).map(([Q,J])=>{if(J===void 0||J===!1)return null;return[Q,J]}).filter(Boolean),Z=Y.reduce((Q,[J])=>Math.max(Q,J.length),0);return Y.map(([Q,J])=>` ${`${Q}:`.padEnd(Z+1)} ${J}`).join(`
34
+ `)}class H1 extends V{constructor({v:$}){super(`Invalid \`v\` value "${$}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class M1 extends V{constructor({transaction:$}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",f$($),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class U1 extends V{constructor({storageKey:$}){super(`Size for storage key "${$}" is invalid. Expected 32 bytes. Got ${Math.floor(($.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}class q1 extends V{constructor($,{account:Y,docsPath:Z,chain:Q,data:J,gas:X,gasPrice:W,maxFeePerGas:D,maxPriorityFeePerGas:K,nonce:w,to:G,value:F}){let C=f$({chain:Q&&`${Q?.name} (id: ${Q?.id})`,from:Y?.address,to:G,value:typeof F<"u"&&`${N0(F)} ${Q?.nativeCurrency?.symbol||"ETH"}`,data:J,gas:X,gasPrice:typeof W<"u"&&`${k(W)} gwei`,maxFeePerGas:typeof D<"u"&&`${k(D)} gwei`,maxPriorityFeePerGas:typeof K<"u"&&`${k(K)} gwei`,nonce:w});super($.shortMessage,{cause:$,docsPath:Z,metaMessages:[...$.metaMessages?[...$.metaMessages," "]:[],"Request Arguments:",C].filter(Boolean),name:"TransactionExecutionError"});Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=$}}class A1 extends V{constructor({blockHash:$,blockNumber:Y,blockTag:Z,hash:Q,index:J}){let X="Transaction";if(Z&&J!==void 0)X=`Transaction at block time "${Z}" at index "${J}"`;if($&&J!==void 0)X=`Transaction at block hash "${$}" at index "${J}"`;if(Y&&J!==void 0)X=`Transaction at block number "${Y}" at index "${J}"`;if(Q)X=`Transaction with hash "${Q}"`;super(`${X} could not be found.`,{name:"TransactionNotFoundError"})}}class T1 extends V{constructor({hash:$}){super(`Transaction receipt with hash "${$}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class E1 extends V{constructor({receipt:$}){super(`Transaction with hash "${$.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"});Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=$}}class _1 extends V{constructor({hash:$}){super(`Timed out while waiting for transaction with hash "${$}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}var UJ=($)=>$,X$=($)=>$;class vY extends V{constructor($,{account:Y,docsPath:Z,chain:Q,data:J,gas:X,gasPrice:W,maxFeePerGas:D,maxPriorityFeePerGas:K,nonce:w,to:G,value:F,stateOverride:C}){let N=Y?N$(Y):void 0,U=f$({from:N?.address,to:G,value:typeof F<"u"&&`${N0(F)} ${Q?.nativeCurrency?.symbol||"ETH"}`,data:J,gas:X,gasPrice:typeof W<"u"&&`${k(W)} gwei`,maxFeePerGas:typeof D<"u"&&`${k(D)} gwei`,maxPriorityFeePerGas:typeof K<"u"&&`${k(K)} gwei`,nonce:w});if(C)U+=`
35
+ ${MJ(C)}`;super($.shortMessage,{cause:$,docsPath:Z,metaMessages:[...$.metaMessages?[...$.metaMessages," "]:[],"Raw Call Arguments:",U].filter(Boolean),name:"CallExecutionError"});Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=$}}class O1 extends V{constructor($,{abi:Y,args:Z,contractAddress:Q,docsPath:J,functionName:X,sender:W}){let D=d({abi:Y,args:Z,name:X}),K=D?xY({abiItem:D,args:Z,includeFunctionName:!1,includeName:!1}):void 0,w=D?E(D,{includeName:!0}):void 0,G=f$({address:Q&&UJ(Q),function:w,args:K&&K!=="()"&&`${[...Array(X?.length??0).keys()].map(()=>" ").join("")}${K}`,sender:W});super($.shortMessage||`An unknown error occurred while executing the contract function "${X}".`,{cause:$,docsPath:J,metaMessages:[...$.metaMessages?[...$.metaMessages," "]:[],G&&"Contract Call:",G].filter(Boolean),name:"ContractFunctionExecutionError"});Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=Y,this.args=Z,this.cause=$,this.contractAddress=Q,this.functionName=X,this.sender=W}}class L1 extends V{constructor({abi:$,data:Y,functionName:Z,message:Q}){let J,X,W,D;if(Y&&Y!=="0x")try{X=F0({abi:$,data:Y});let{abiItem:w,errorName:G,args:F}=X;if(G==="Error")D=F[0];else if(G==="Panic"){let[C]=F;D=fQ[C]}else{let C=w?E(w,{includeName:!0}):void 0,N=w&&F?xY({abiItem:w,args:F,includeFunctionName:!1,includeName:!1}):void 0;W=[C?`Error: ${C}`:"",N&&N!=="()"?` ${[...Array(G?.length??0).keys()].map(()=>" ").join("")}${N}`:""]}}catch(w){J=w}else if(Q)D=Q;let K;if(J instanceof z$)K=J.signature,W=[`Unable to decode signature "${K}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${K}.`];super(D&&D!=="execution reverted"||K?[`The contract function "${Z}" reverted with the following ${K?"signature":"reason"}:`,D||K].join(`
36
+ `):`The contract function "${Z}" reverted.`,{cause:J,metaMessages:W,name:"ContractFunctionRevertedError"});Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=X,this.raw=Y,this.reason=D,this.signature=K}}class z1 extends V{constructor({functionName:$}){super(`The contract function "${$}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${$}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class gY extends V{constructor({factory:$}){super(`Deployment for counterfactual contract call failed${$?` for factory "${$}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class dY extends V{constructor({data:$,message:Y}){super(Y||"",{name:"RawContractError"});Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=$}}var mY="/docs/contract/decodeFunctionResult";function qJ($){let{abi:Y,args:Z,functionName:Q,data:J}=$,X=Y[0];if(Q){let D=d({abi:Y,args:Z,name:Q});if(!D)throw new x(Q,{docsPath:mY});X=D}if(X.type!=="function")throw new x(void 0,{docsPath:mY});if(!X.outputs)throw new R$(X.name,{docsPath:mY});let W=U$(X.outputs,J);if(W&&W.length>1)return W;if(W&&W.length===1)return W[0];return}var lY="/docs/contract/encodeDeployData";function pY($){let{abi:Y,args:Z,bytecode:Q}=$;if(!Z||Z.length===0)return Q;let J=Y.find((W)=>("type"in W)&&W.type==="constructor");if(!J)throw new QY({docsPath:lY});if(!("inputs"in J))throw new Y0({docsPath:lY});if(!J.inputs||J.inputs.length===0)throw new Y0({docsPath:lY});let X=v(J.inputs,Z);return J$([Q,X])}var AJ="/docs/contract/encodeFunctionData";function TJ($){let{abi:Y,args:Z,functionName:Q}=$,J=Y[0];if(Q){let X=d({abi:Y,args:Z,name:Q});if(!X)throw new x(Q,{docsPath:AJ});J=X}if(J.type!=="function")throw new x(void 0,{docsPath:AJ});return{abi:[J],functionName:b(E(J))}}function EJ($){let{args:Y}=$,{abi:Z,functionName:Q}=(()=>{if($.abi.length===1&&$.functionName?.startsWith("0x"))return $;return TJ($)})(),J=Z[0],X=Q,W="inputs"in J&&J.inputs?v(J.inputs,Y??[]):void 0;return J$([X,W??"0x"])}function _J({blockNumber:$,chain:Y,contract:Z}){let Q=Y?.contracts?.[Z];if(!Q)throw new H$({chain:Y,contract:{name:Z}});if($&&Q.blockCreated&&Q.blockCreated>$)throw new H$({blockNumber:$,chain:Y,contract:{name:Z,blockCreated:Q.blockCreated}});return Q.address}class r extends V{constructor({cause:$,message:Y}={}){let Z=Y?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${Z?`with reason: ${Z}`:"for an unknown reason"}.`,{cause:$,name:"ExecutionRevertedError"})}}Object.defineProperty(r,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(r,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class W$ extends V{constructor({cause:$,maxFeePerGas:Y}={}){super(`The fee cap (\`maxFeePerGas\`${Y?` = ${k(Y)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:$,name:"FeeCapTooHighError"})}}Object.defineProperty(W$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class P$ extends V{constructor({cause:$,maxFeePerGas:Y}={}){super(`The fee cap (\`maxFeePerGas\`${Y?` = ${k(Y)}`:""} gwei) cannot be lower than the block base fee.`,{cause:$,name:"FeeCapTooLowError"})}}Object.defineProperty(P$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class x$ extends V{constructor({cause:$,nonce:Y}={}){super(`Nonce provided for the transaction ${Y?`(${Y}) `:""}is higher than the next one expected.`,{cause:$,name:"NonceTooHighError"})}}Object.defineProperty(x$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class y$ extends V{constructor({cause:$,nonce:Y}={}){super([`Nonce provided for the transaction ${Y?`(${Y}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
37
+ `),{cause:$,name:"NonceTooLowError"})}}Object.defineProperty(y$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class b$ extends V{constructor({cause:$,nonce:Y}={}){super(`Nonce provided for the transaction ${Y?`(${Y}) `:""}exceeds the maximum allowed nonce.`,{cause:$,name:"NonceMaxValueError"})}}Object.defineProperty(b$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class h$ extends V{constructor({cause:$}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
38
+ `),{cause:$,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(h$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class v$ extends V{constructor({cause:$,gas:Y}={}){super(`The amount of gas ${Y?`(${Y}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:$,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(v$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class g$ extends V{constructor({cause:$,gas:Y}={}){super(`The amount of gas ${Y?`(${Y}) `:""}provided for the transaction is too low.`,{cause:$,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(g$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class d$ extends V{constructor({cause:$}){super("The transaction type is not supported for this chain.",{cause:$,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(d$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class D$ extends V{constructor({cause:$,maxPriorityFeePerGas:Y,maxFeePerGas:Z}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${Y?` = ${k(Y)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${Z?` = ${k(Z)} gwei`:""}).`].join(`
39
+ `),{cause:$,name:"TipAboveFeeCapError"})}}Object.defineProperty(D$,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class m$ extends V{constructor({cause:$}){super(`An error occurred while executing: ${$?.shortMessage}`,{cause:$,name:"UnknownNodeError"})}}class H0 extends V{constructor({body:$,cause:Y,details:Z,headers:Q,status:J,url:X}){super("HTTP request failed.",{cause:Y,details:Z,metaMessages:[J&&`Status: ${J}`,`URL: ${X$(X)}`,$&&`Request body: ${g($)}`].filter(Boolean),name:"HttpRequestError"});Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=$,this.headers=Q,this.status=J,this.url=X}}class cY extends V{constructor({body:$,error:Y,url:Z}){super("RPC Request failed.",{cause:Y,details:Y.message,metaMessages:[`URL: ${X$(Z)}`,`Request body: ${g($)}`],name:"RpcRequestError"});Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=Y.code,this.data=Y.data,this.url=Z}}class R1 extends V{constructor({body:$,url:Y}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${X$(Y)}`,`Request body: ${g($)}`],name:"TimeoutError"});Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=Y}}var S1=-1;class _ extends V{constructor($,{code:Y,docsPath:Z,metaMessages:Q,name:J,shortMessage:X}){super(X,{cause:$,docsPath:Z,metaMessages:Q||$?.metaMessages,name:J||"RpcError"});Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=J||$.name,this.code=$ instanceof cY?$.code:Y??S1}}class O extends _{constructor($,Y){super($,Y);Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=Y.data}}class nY extends _{constructor($){super($,{code:nY.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(nY,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class uY extends _{constructor($){super($,{code:uY.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(uY,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class oY extends _{constructor($,{method:Y}={}){super($,{code:oY.code,name:"MethodNotFoundRpcError",shortMessage:`The method${Y?` "${Y}"`:""} does not exist / is not available.`})}}Object.defineProperty(oY,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class iY extends _{constructor($){super($,{code:iY.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
40
+ `)})}}Object.defineProperty(iY,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class tY extends _{constructor($){super($,{code:tY.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(tY,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class sY extends _{constructor($){super($,{code:sY.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
41
+ `)})}}Object.defineProperty(sY,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32000});class rY extends _{constructor($){super($,{code:rY.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(rY,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class aY extends _{constructor($){super($,{code:aY.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(aY,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class eY extends _{constructor($){super($,{code:eY.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(eY,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class $Z extends _{constructor($,{method:Y}={}){super($,{code:$Z.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${Y?` "${Y}"`:""} is not supported.`})}}Object.defineProperty($Z,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class YZ extends _{constructor($){super($,{code:YZ.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(YZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class ZZ extends _{constructor($){super($,{code:ZZ.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(ZZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class QZ extends O{constructor($){super($,{code:QZ.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(QZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class JZ extends O{constructor($){super($,{code:JZ.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(JZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class XZ extends O{constructor($,{method:Y}={}){super($,{code:XZ.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${Y?` " ${Y}"`:""}.`})}}Object.defineProperty(XZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class WZ extends O{constructor($){super($,{code:WZ.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(WZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class DZ extends O{constructor($){super($,{code:DZ.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(DZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class KZ extends O{constructor($){super($,{code:KZ.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(KZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class VZ extends O{constructor($){super($,{code:VZ.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(VZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class wZ extends O{constructor($){super($,{code:wZ.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(wZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class GZ extends O{constructor($){super($,{code:GZ.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(GZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class FZ extends O{constructor($){super($,{code:FZ.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(FZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class CZ extends O{constructor($){super($,{code:CZ.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(CZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class NZ extends O{constructor($){super($,{code:NZ.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(NZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class HZ extends O{constructor($){super($,{code:HZ.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(HZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class MZ extends O{constructor($){super($,{code:MZ.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(MZ,"code",{enumerable:!0,configurable:!0,writable:!0,value:7000});class k1 extends _{constructor($){super($,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function OJ($,Y){let Z=($.details||"").toLowerCase(),Q=$ instanceof V?$.walk((J)=>J?.code===r.code):$;if(Q instanceof V)return new r({cause:$,message:Q.details});if(r.nodeMessage.test(Z))return new r({cause:$,message:$.details});if(W$.nodeMessage.test(Z))return new W$({cause:$,maxFeePerGas:Y?.maxFeePerGas});if(P$.nodeMessage.test(Z))return new P$({cause:$,maxFeePerGas:Y?.maxFeePerGas});if(x$.nodeMessage.test(Z))return new x$({cause:$,nonce:Y?.nonce});if(y$.nodeMessage.test(Z))return new y$({cause:$,nonce:Y?.nonce});if(b$.nodeMessage.test(Z))return new b$({cause:$,nonce:Y?.nonce});if(h$.nodeMessage.test(Z))return new h$({cause:$});if(v$.nodeMessage.test(Z))return new v$({cause:$,gas:Y?.gas});if(g$.nodeMessage.test(Z))return new g$({cause:$,gas:Y?.gas});if(d$.nodeMessage.test(Z))return new d$({cause:$});if(D$.nodeMessage.test(Z))return new D$({cause:$,maxFeePerGas:Y?.maxFeePerGas,maxPriorityFeePerGas:Y?.maxPriorityFeePerGas});return new m$({cause:$})}function LJ($,{docsPath:Y,...Z}){let Q=(()=>{let J=OJ($,Z);if(J instanceof m$)return $;return J})();return new vY(Q,{docsPath:Y,...Z})}function zJ($,{format:Y}){if(!Y)return{};let Z={};function Q(X){let W=Object.keys(X);for(let D of W){if(D in $)Z[D]=$[D];if(X[D]&&typeof X[D]==="object"&&!Array.isArray(X[D]))Q(X[D])}}let J=Y($||{});return Q(J),Z}function RJ($,Y){return({exclude:Z,format:Q})=>{return{exclude:Z,format:(J,X)=>{let W=Y(J,X);if(Z)for(let D of Z)delete W[D];return{...W,...Q(J,X)}},type:$}}}var I1={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function UZ($,Y){let Z={};if(typeof $.authorizationList<"u")Z.authorizationList=B1($.authorizationList);if(typeof $.accessList<"u")Z.accessList=$.accessList;if(typeof $.blobVersionedHashes<"u")Z.blobVersionedHashes=$.blobVersionedHashes;if(typeof $.blobs<"u")if(typeof $.blobs[0]!=="string")Z.blobs=$.blobs.map((Q)=>j(Q));else Z.blobs=$.blobs;if(typeof $.data<"u")Z.data=$.data;if($.account)Z.from=$.account.address;if(typeof $.from<"u")Z.from=$.from;if(typeof $.gas<"u")Z.gas=H($.gas);if(typeof $.gasPrice<"u")Z.gasPrice=H($.gasPrice);if(typeof $.maxFeePerBlobGas<"u")Z.maxFeePerBlobGas=H($.maxFeePerBlobGas);if(typeof $.maxFeePerGas<"u")Z.maxFeePerGas=H($.maxFeePerGas);if(typeof $.maxPriorityFeePerGas<"u")Z.maxPriorityFeePerGas=H($.maxPriorityFeePerGas);if(typeof $.nonce<"u")Z.nonce=H($.nonce);if(typeof $.to<"u")Z.to=$.to;if(typeof $.type<"u")Z.type=I1[$.type];if(typeof $.value<"u")Z.value=H($.value);return Z}var T8=RJ("transactionRequest",UZ);function B1($){return $.map((Y)=>({address:Y.address,r:Y.r?H(BigInt(Y.r)):Y.r,s:Y.s?H(BigInt(Y.s)):Y.s,chainId:H(Y.chainId),nonce:H(Y.nonce),...typeof Y.yParity<"u"?{yParity:H(Y.yParity)}:{},...typeof Y.v<"u"&&typeof Y.yParity>"u"?{v:H(Y.v)}:{}}))}function SJ(){let $=()=>{return},Y=()=>{return};return{promise:new Promise((Q,J)=>{$=Q,Y=J}),resolve:$,reject:Y}}var qZ=new Map;function kJ({fn:$,id:Y,shouldSplitBatch:Z,wait:Q=0,sort:J}){let X=async()=>{let G=K();W();let F=G.map(({args:C})=>C);if(F.length===0)return;$(F).then((C)=>{if(J&&Array.isArray(C))C.sort(J);for(let N=0;N<G.length;N++){let{resolve:U}=G[N];U?.([C[N],C])}}).catch((C)=>{for(let N=0;N<G.length;N++){let{reject:U}=G[N];U?.(C)}})},W=()=>qZ.delete(Y),D=()=>K().map(({args:G})=>G),K=()=>qZ.get(Y)||[],w=(G)=>qZ.set(Y,[...K(),G]);return{flush:W,async schedule(G){let{promise:F,resolve:C,reject:N}=SJ();if(Z?.([...D(),G]))X();if(K().length>0)return w({args:G,resolve:C,reject:N}),F;return w({args:G,resolve:C,reject:N}),setTimeout(X,Q),F}}}function IJ($){if(!$||$.length===0)return;return $.reduce((Y,{slot:Z,value:Q})=>{if(Z.length!==66)throw new X0({size:Z.length,targetSize:66,type:"hex"});if(Q.length!==66)throw new X0({size:Q.length,targetSize:66,type:"hex"});return Y[Z]=Q,Y},{})}function j1($){let{balance:Y,nonce:Z,state:Q,stateDiff:J,code:X}=$,W={};if(X!==void 0)W.code=X;if(Y!==void 0)W.balance=H(Y);if(Z!==void 0)W.nonce=H(Z);if(Q!==void 0)W.state=IJ(Q);if(J!==void 0){if(W.state)throw new hY;W.stateDiff=IJ(J)}return W}function BJ($){if(!$)return;let Y={};for(let{address:Z,...Q}of $){if(!T(Z,{strict:!1}))throw new S({address:Z});if(Y[Z])throw new bY({address:Z});Y[Z]=j1(Q)}return Y}var j8=2n**(8n-1n)-1n,f8=2n**(16n-1n)-1n,P8=2n**(24n-1n)-1n,x8=2n**(32n-1n)-1n,y8=2n**(40n-1n)-1n,b8=2n**(48n-1n)-1n,h8=2n**(56n-1n)-1n,v8=2n**(64n-1n)-1n,g8=2n**(72n-1n)-1n,d8=2n**(80n-1n)-1n,m8=2n**(88n-1n)-1n,l8=2n**(96n-1n)-1n,p8=2n**(104n-1n)-1n,c8=2n**(112n-1n)-1n,n8=2n**(120n-1n)-1n,u8=2n**(128n-1n)-1n,o8=2n**(136n-1n)-1n,i8=2n**(144n-1n)-1n,t8=2n**(152n-1n)-1n,s8=2n**(160n-1n)-1n,r8=2n**(168n-1n)-1n,a8=2n**(176n-1n)-1n,e8=2n**(184n-1n)-1n,$2=2n**(192n-1n)-1n,Y2=2n**(200n-1n)-1n,Z2=2n**(208n-1n)-1n,Q2=2n**(216n-1n)-1n,J2=2n**(224n-1n)-1n,X2=2n**(232n-1n)-1n,W2=2n**(240n-1n)-1n,D2=2n**(248n-1n)-1n,K2=2n**(256n-1n)-1n,V2=-(2n**(8n-1n)),w2=-(2n**(16n-1n)),G2=-(2n**(24n-1n)),F2=-(2n**(32n-1n)),C2=-(2n**(40n-1n)),N2=-(2n**(48n-1n)),H2=-(2n**(56n-1n)),M2=-(2n**(64n-1n)),U2=-(2n**(72n-1n)),q2=-(2n**(80n-1n)),A2=-(2n**(88n-1n)),T2=-(2n**(96n-1n)),E2=-(2n**(104n-1n)),_2=-(2n**(112n-1n)),O2=-(2n**(120n-1n)),L2=-(2n**(128n-1n)),z2=-(2n**(136n-1n)),R2=-(2n**(144n-1n)),S2=-(2n**(152n-1n)),k2=-(2n**(160n-1n)),I2=-(2n**(168n-1n)),B2=-(2n**(176n-1n)),j2=-(2n**(184n-1n)),f2=-(2n**(192n-1n)),P2=-(2n**(200n-1n)),x2=-(2n**(208n-1n)),y2=-(2n**(216n-1n)),b2=-(2n**(224n-1n)),h2=-(2n**(232n-1n)),v2=-(2n**(240n-1n)),g2=-(2n**(248n-1n)),d2=-(2n**(256n-1n)),m2=2n**8n-1n,l2=2n**16n-1n,p2=2n**24n-1n,c2=2n**32n-1n,n2=2n**40n-1n,u2=2n**48n-1n,o2=2n**56n-1n,i2=2n**64n-1n,t2=2n**72n-1n,s2=2n**80n-1n,r2=2n**88n-1n,a2=2n**96n-1n,e2=2n**104n-1n,$D=2n**112n-1n,YD=2n**120n-1n,ZD=2n**128n-1n,QD=2n**136n-1n,JD=2n**144n-1n,XD=2n**152n-1n,WD=2n**160n-1n,DD=2n**168n-1n,KD=2n**176n-1n,VD=2n**184n-1n,wD=2n**192n-1n,GD=2n**200n-1n,FD=2n**208n-1n,CD=2n**216n-1n,ND=2n**224n-1n,HD=2n**232n-1n,MD=2n**240n-1n,UD=2n**248n-1n,jJ=2n**256n-1n;function fJ($){let{account:Y,maxFeePerGas:Z,maxPriorityFeePerGas:Q,to:J}=$,X=Y?N$(Y):void 0;if(X&&!T(X.address))throw new S({address:X.address});if(J&&!T(J))throw new S({address:J});if(Z&&Z>jJ)throw new W$({maxFeePerGas:Z});if(Q&&Z&&Q>Z)throw new D$({maxFeePerGas:Z,maxPriorityFeePerGas:Q})}async function PJ($,Y){let{account:Z=$.account,authorizationList:Q,batch:J=Boolean($.batch?.multicall),blockNumber:X,blockTag:W=$.experimental_blockTag??"latest",accessList:D,blobs:K,blockOverrides:w,code:G,data:F,factory:C,factoryData:N,gas:U,gasPrice:P,maxFeePerBlobGas:q$,maxFeePerGas:K$,maxPriorityFeePerGas:A$,nonce:l$,to:V$,value:vJ,stateOverride:gJ,...dJ}=Y,SZ=Z?N$(Z):void 0;if(G&&(C||N))throw new V("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(G&&V$)throw new V("Cannot provide both `code` & `to` as parameters.");let kZ=G&&F,IZ=C&&N&&V$&&F,BZ=kZ||IZ,mJ=(()=>{if(kZ)return xJ({code:G,data:F});if(IZ)return y1({data:F,factory:C,factoryData:N,to:V$});return F})();try{fJ(Y);let T$=(typeof X==="bigint"?H(X):void 0)||W,a=w?zQ(w):void 0,e=BJ(gJ),jZ=$.chain?.formatters?.transactionRequest?.format,U0=(jZ||UZ)({...zJ(dJ,{format:jZ}),accessList:D,account:SZ,authorizationList:Q,blobs:K,data:mJ,gas:U,gasPrice:P,maxFeePerBlobGas:q$,maxFeePerGas:K$,maxPriorityFeePerGas:A$,nonce:l$,to:BZ?void 0:V$,value:vJ},"call");if(J&&P1({request:U0})&&!e&&!a)try{return await x1($,{...U0,blockNumber:X,blockTag:W})}catch(i){if(!(i instanceof e$)&&!(i instanceof H$))throw i}let lJ=(()=>{let i=[U0,T$];if(e&&a)return[...i,e,a];if(e)return[...i,e];if(a)return[...i,{},a];return i})(),fZ=await $.request({method:"eth_call",params:lJ});if(fZ==="0x")return{data:void 0};return{data:fZ}}catch(M0){let T$=b1(M0),{offchainLookup:a,offchainLookupSignature:e}=await import("./chunk-g3ma3sec.js");if($.ccipRead!==!1&&T$?.slice(0,10)===e&&V$)return{data:await a($,{data:T$,to:V$})};if(BZ&&T$?.slice(0,10)==="0x101bb98d")throw new gY({factory:C});throw LJ(M0,{...Y,account:SZ,chain:$.chain})}}function P1({request:$}){let{data:Y,to:Z,...Q}=$;if(!Y)return!1;if(Y.startsWith(SQ))return!1;if(!Z)return!1;if(Object.values(Q).filter((J)=>typeof J<"u").length>0)return!1;return!0}async function x1($,Y){let{batchSize:Z=1024,deployless:Q=!1,wait:J=0}=typeof $.batch?.multicall==="object"?$.batch.multicall:{},{blockNumber:X,blockTag:W=$.experimental_blockTag??"latest",data:D,to:K}=Y,w=(()=>{if(Q)return null;if(Y.multicallAddress)return Y.multicallAddress;if($.chain)return _J({blockNumber:X,chain:$.chain,contract:"multicall3"});throw new e$})(),F=(typeof X==="bigint"?H(X):void 0)||W,{schedule:C}=kJ({id:`${$.uid}.${F}`,wait:J,shouldSplitBatch(P){return P.reduce((K$,{data:A$})=>K$+(A$.length-2),0)>Z*2},fn:async(P)=>{let q$=P.map((l$)=>({allowFailure:!0,callData:l$.data,target:l$.to})),K$=EJ({abi:e0,args:[q$],functionName:"aggregate3"}),A$=await $.request({method:"eth_call",params:[{...w===null?{data:xJ({code:BQ,data:K$})}:{to:w,data:K$}},F]});return qJ({abi:e0,args:[q$],functionName:"aggregate3",data:A$||"0x"})}}),[{returnData:N,success:U}]=await C({data:D,to:K});if(!U)throw new dY({data:N});if(N==="0x")return{data:void 0};return{data:N}}function xJ($){let{code:Y,data:Z}=$;return pY({abi:o$(["constructor(bytes, bytes)"]),bytecode:kQ,args:[Y,Z]})}function y1($){let{data:Y,factory:Z,factoryData:Q,to:J}=$;return pY({abi:o$(["constructor(address, bytes, address, bytes)"]),bytecode:IQ,args:[J,Y,Z,Q]})}function b1($){if(!($ instanceof V))return;let Y=$.walk();return typeof Y?.data==="object"?Y.data?.data:Y.data}class AZ extends V{constructor({callbackSelector:$,cause:Y,data:Z,extraData:Q,sender:J,urls:X}){super(Y.shortMessage||"An error occurred while fetching for an offchain result.",{cause:Y,metaMessages:[...Y.metaMessages||[],Y.metaMessages?.length?"":[],"Offchain Gateway Call:",X&&[" Gateway URL(s):",...X.map((W)=>` ${X$(W)}`)],` Sender: ${J}`,` Data: ${Z}`,` Callback selector: ${$}`,` Extra data: ${Q}`].flat(),name:"OffchainLookupError"})}}class TZ extends V{constructor({result:$,url:Y}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${X$(Y)}`,`Response: ${g($)}`],name:"OffchainLookupResponseMalformedError"})}}class EZ extends V{constructor({sender:$,to:Y}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${Y}`,`OffchainLookup sender address: ${$}`],name:"OffchainLookupSenderMismatchError"})}}function yJ($,Y){if(!T($,{strict:!1}))throw new S({address:$});if(!T(Y,{strict:!1}))throw new S({address:Y});return $.toLowerCase()===Y.toLowerCase()}function bJ($){let{abi:Y,data:Z}=$,Q=y(Z,0,4),J=Y.find((X)=>X.type==="function"&&Q===b(E(X)));if(!J)throw new VY(Q,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:J.name,args:"inputs"in J&&J.inputs&&J.inputs.length>0?U$(J.inputs,y(Z,4)):void 0}}var _Z="/docs/contract/encodeErrorResult";function OZ($){let{abi:Y,errorName:Z,args:Q}=$,J=Y[0];if(Z){let K=d({abi:Y,args:Q,name:Z});if(!K)throw new Z0(Z,{docsPath:_Z});J=K}if(J.type!=="error")throw new Z0(void 0,{docsPath:_Z});let X=E(J),W=b(X),D="0x";if(Q&&Q.length>0){if(!J.inputs)throw new KY(J.name,{docsPath:_Z});D=v(J.inputs,Q)}return J$([W,D])}var LZ="/docs/contract/encodeFunctionResult";function hJ($){let{abi:Y,functionName:Z,result:Q}=$,J=Y[0];if(Z){let W=d({abi:Y,name:Z});if(!W)throw new x(Z,{docsPath:LZ});J=W}if(J.type!=="function")throw new x(void 0,{docsPath:LZ});if(!J.outputs)throw new R$(J.name,{docsPath:LZ});let X=(()=>{if(J.outputs.length===0)return[];if(J.outputs.length===1)return[Q];if(Array.isArray(Q))return Q;throw new S$(Q)})();return v(J.outputs,X)}var zZ="x-batch-gateway:true";async function RZ($){let{data:Y,ccipRequest:Z}=$,{args:[Q]}=bJ({abi:a$,data:Y}),J=[],X=[];return await Promise.all(Q.map(async(W,D)=>{try{X[D]=W.urls.includes(zZ)?await RZ({data:W.data,ccipRequest:Z}):await Z(W),J[D]=!1}catch(K){J[D]=!0,X[D]=h1(K)}})),hJ({abi:a$,functionName:"query",result:[J,X]})}function h1($){if($.name==="HttpRequestError"&&$.status)return OZ({abi:a$,errorName:"HttpError",args:[$.status,$.shortMessage]});return OZ({abi:[$0],errorName:"Error",args:["shortMessage"in $?$.shortMessage:$.message]})}var j6="0x556f1830",v1={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function f6($,{blockNumber:Y,blockTag:Z,data:Q,to:J}){let{args:X}=F0({data:Q,abi:[v1]}),[W,D,K,w,G]=X,{ccipRead:F}=$,C=F&&typeof F?.request==="function"?F.request:g1;try{if(!yJ(J,W))throw new EZ({sender:W,to:J});let N=D.includes(zZ)?await RZ({data:K,ccipRequest:C}):await C({data:K,sender:W,urls:D}),{data:U}=await PJ($,{blockNumber:Y,blockTag:Z,data:o([w,v([{type:"bytes"},{type:"bytes"}],[N,G])]),to:J});return U}catch(N){throw new AZ({callbackSelector:w,cause:N,data:Q,extraData:G,sender:W,urls:D})}}async function g1({data:$,sender:Y,urls:Z}){let Q=Error("An unknown error occurred.");for(let J=0;J<Z.length;J++){let X=Z[J],W=X.includes("{data}")?"GET":"POST",D=W==="POST"?{data:$,sender:Y}:void 0,K=W==="POST"?{"Content-Type":"application/json"}:{};try{let w=await fetch(X.replace("{sender}",Y.toLowerCase()).replace("{data}",$),{body:JSON.stringify(D),headers:K,method:W}),G;if(w.headers.get("Content-Type")?.startsWith("application/json"))G=(await w.json()).data;else G=await w.text();if(!w.ok){Q=new H0({body:D,details:G?.error?g(G.error):w.statusText,headers:w.headers,status:w.status,url:X});continue}if(!B(G)){Q=new TZ({result:G,url:X});continue}return G}catch(w){Q=new H0({body:D,details:w.message,url:X})}}throw Q}
42
+ export{YJ as A,$$ as B,T0 as C,ZX as D,QX as E,E as F,B as G,A as H,V as I,QY as J,Y0 as K,JY as L,L$ as M,kX as N,IX as O,BX as P,jX as Q,fX as R,PX as S,s as T,n as U,UY as V,F4 as W,bQ as X,hQ as Y,j as Z,H as _,AY as $,W0 as aa,D0 as ba,TY as ca,K0 as da,GJ as ea,S as fa,I$ as ga,B$ as ha,JW as ia,T as ja,o as ka,J$ as la,y as ma,xX as na,MW as oa,VJ as pa,v as qa,d as ra,N$ as sa,EJ as ta,IY as ua,XJ as va,U$ as wa,g as xa,N0 as ya,k as za,f$ as Aa,H1 as Ba,M1 as Ca,U1 as Da,q1 as Ea,A1 as Fa,T1 as Ga,E1 as Ha,_1 as Ia,vY as Ja,O1 as Ka,L1 as La,z1 as Ma,dY as Na,H0 as Oa,cY as Pa,R1 as Qa,nY as Ra,uY as Sa,oY as Ta,iY as Ua,tY as Va,sY as Wa,rY as Xa,aY as Ya,eY as Za,$Z as _a,YZ as $a,ZZ as ab,QZ as bb,JZ as cb,XZ as db,WZ as eb,DZ as fb,KZ as gb,VZ as hb,wZ as ib,GZ as jb,FZ as kb,CZ as lb,NZ as mb,HZ as nb,MZ as ob,k1 as pb,W$ as qb,D$ as rb,m$ as sb,OJ as tb,zJ as ub,RJ as vb,UZ as wb,T8 as xb,BJ as yb,l2 as zb,jJ as Ab,fJ as Bb,yJ as Cb,qJ as Db,d0 as Eb,o5 as Fb,i5 as Gb,WQ as Hb,DQ as Ib,t5 as Jb,s5 as Kb,XX as Lb,r5 as Mb,a5 as Nb,WX as Ob,DX as Pb,e5 as Qb,$9 as Rb,Y9 as Sb,Z9 as Tb,Q9 as Ub,J9 as Vb,M as Wb,r$ as Xb,w9 as Yb,HX as Zb,G9 as _b,Y$ as $b,F9 as ac,C9 as bc,N9 as cc,H9 as dc,M9 as ec,UX as fc,U9 as gc,q9 as hc,A9 as ic,T9 as jc,C$ as kc,I as lc,E9 as mc,_Q as nc,t0 as oc,_9 as pc,Z$ as qc,O9 as rc,EQ as sc,L9 as tc,OQ as uc,zQ as vc,e0 as wc,S9 as xc,k9 as yc,I9 as zc,B9 as Ac,j9 as Bc,f9 as Cc,kQ as Dc,y9 as Ec,BQ as Fc,LX as Gc,zX as Hc,RX as Ic,pY as Jc,_J as Kc,LJ as Lc,SJ as Mc,kJ as Nc,zZ as Oc,j6 as Pc,v1 as Qc,f6 as Rc,g1 as Sc,PJ as Tc};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{$c as J$,Ad as F0,Bd as h0,Vc as JJ,Wc as r$,Xc as i0,Yc as k$,Zc as b0,ad as l$,bd as p,fd as o$,gd as IJ,hd as i$,id as K0,jd as t$,kd as _0,ld as G0,md as X0,nd as D$,od as I$,pd as S$,qd as g$,vd as e,wd as d0,xd as u0,yd as c0,zd as m0}from"./chunk-fc5rfx0b.js";function HJ($,Q,J,q){if(typeof $.setBigUint64==="function")return $.setBigUint64(Q,J,q);let G=BigInt(32),Y=BigInt(4294967295),K=Number(J>>G&Y),M=Number(J&Y),X=q?4:0,j=q?0:4;$.setUint32(Q+X,K,q),$.setUint32(Q+j,M,q)}function v0($,Q,J){return $&Q^~$&J}function y0($,Q,J){return $&Q^$&J^Q&J}class a$ extends i${constructor($,Q,J,q){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=$,this.outputLen=Q,this.padOffset=J,this.isLE=q,this.buffer=new Uint8Array($),this.view=l$(this.buffer)}update($){k$(this),$=o$($),r$($);let{view:Q,buffer:J,blockLen:q}=this,G=$.length;for(let Y=0;Y<G;){let K=Math.min(q-this.pos,G-Y);if(K===q){let M=l$($);for(;q<=G-Y;Y+=q)this.process(M,Y);continue}if(J.set($.subarray(Y,Y+K),this.pos),this.pos+=K,Y+=K,this.pos===q)this.process(Q,0),this.pos=0}return this.length+=$.length,this.roundClean(),this}digestInto($){k$(this),b0($,this),this.finished=!0;let{buffer:Q,view:J,blockLen:q,isLE:G}=this,{pos:Y}=this;if(Q[Y++]=128,J$(this.buffer.subarray(Y)),this.padOffset>q-Y)this.process(J,0),Y=0;for(let Z=Y;Z<q;Z++)Q[Z]=0;HJ(J,q-8,BigInt(this.length*8),G),this.process(J,0);let K=l$($),M=this.outputLen;if(M%4)throw Error("_sha2: outputLen should be aligned to 32bit");let X=M/4,j=this.get();if(X>j.length)throw Error("_sha2: outputLen bigger than state");for(let Z=0;Z<X;Z++)K.setUint32(4*Z,j[Z],G)}digest(){let{buffer:$,outputLen:Q}=this;this.digestInto($);let J=$.slice(0,Q);return this.destroy(),J}_cloneInto($){$||($=new this.constructor),$.set(...this.get());let{blockLen:Q,buffer:J,length:q,finished:G,destroyed:Y,pos:K}=this;if($.destroyed=Y,$.finished=G,$.length=q,$.pos=K,q%Q)$.buffer.set(J);return $}clone(){return this._cloneInto()}}var Q$=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var c=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var EJ=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Z$=new Uint32Array(64);class l0 extends a${constructor($=32){super(64,$,8,!1);this.A=Q$[0]|0,this.B=Q$[1]|0,this.C=Q$[2]|0,this.D=Q$[3]|0,this.E=Q$[4]|0,this.F=Q$[5]|0,this.G=Q$[6]|0,this.H=Q$[7]|0}get(){let{A:$,B:Q,C:J,D:q,E:G,F:Y,G:K,H:M}=this;return[$,Q,J,q,G,Y,K,M]}set($,Q,J,q,G,Y,K,M){this.A=$|0,this.B=Q|0,this.C=J|0,this.D=q|0,this.E=G|0,this.F=Y|0,this.G=K|0,this.H=M|0}process($,Q){for(let Z=0;Z<16;Z++,Q+=4)Z$[Z]=$.getUint32(Q,!1);for(let Z=16;Z<64;Z++){let O=Z$[Z-15],W=Z$[Z-2],D=p(O,7)^p(O,18)^O>>>3,L=p(W,17)^p(W,19)^W>>>10;Z$[Z]=L+Z$[Z-7]+D+Z$[Z-16]|0}let{A:J,B:q,C:G,D:Y,E:K,F:M,G:X,H:j}=this;for(let Z=0;Z<64;Z++){let O=p(K,6)^p(K,11)^p(K,25),W=j+O+v0(K,M,X)+EJ[Z]+Z$[Z]|0,L=(p(J,2)^p(J,13)^p(J,22))+y0(J,q,G)|0;j=X,X=M,M=K,K=Y+W|0,Y=G,G=q,q=J,J=W+L|0}J=J+this.A|0,q=q+this.B|0,G=G+this.C|0,Y=Y+this.D|0,K=K+this.E|0,M=M+this.F|0,X=X+this.G|0,j=j+this.H|0,this.set(J,q,G,Y,K,M,X,j)}roundClean(){J$(Z$)}destroy(){this.set(0,0,0,0,0,0,0,0),J$(this.buffer)}}var r0=(()=>_0(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(($)=>BigInt($))))(),SJ=(()=>r0[0])(),gJ=(()=>r0[1])(),U$=new Uint32Array(80),j$=new Uint32Array(80);class o0 extends a${constructor($=64){super(128,$,16,!1);this.Ah=c[0]|0,this.Al=c[1]|0,this.Bh=c[2]|0,this.Bl=c[3]|0,this.Ch=c[4]|0,this.Cl=c[5]|0,this.Dh=c[6]|0,this.Dl=c[7]|0,this.Eh=c[8]|0,this.El=c[9]|0,this.Fh=c[10]|0,this.Fl=c[11]|0,this.Gh=c[12]|0,this.Gl=c[13]|0,this.Hh=c[14]|0,this.Hl=c[15]|0}get(){let{Ah:$,Al:Q,Bh:J,Bl:q,Ch:G,Cl:Y,Dh:K,Dl:M,Eh:X,El:j,Fh:Z,Fl:O,Gh:W,Gl:D,Hh:L,Hl:C}=this;return[$,Q,J,q,G,Y,K,M,X,j,Z,O,W,D,L,C]}set($,Q,J,q,G,Y,K,M,X,j,Z,O,W,D,L,C){this.Ah=$|0,this.Al=Q|0,this.Bh=J|0,this.Bl=q|0,this.Ch=G|0,this.Cl=Y|0,this.Dh=K|0,this.Dl=M|0,this.Eh=X|0,this.El=j|0,this.Fh=Z|0,this.Fl=O|0,this.Gh=W|0,this.Gl=D|0,this.Hh=L|0,this.Hl=C|0}process($,Q){for(let A=0;A<16;A++,Q+=4)U$[A]=$.getUint32(Q),j$[A]=$.getUint32(Q+=4);for(let A=16;A<80;A++){let U=U$[A-15]|0,N=j$[A-15]|0,V=D$(U,N,1)^D$(U,N,8)^G0(U,N,7),T=I$(U,N,1)^I$(U,N,8)^X0(U,N,7),R=U$[A-2]|0,k=j$[A-2]|0,E=D$(R,k,19)^S$(R,k,61)^G0(R,k,6),w=I$(R,k,19)^g$(R,k,61)^X0(R,k,6),H=c0(T,w,j$[A-7],j$[A-16]),f=m0(H,V,E,U$[A-7],U$[A-16]);U$[A]=f|0,j$[A]=H|0}let{Ah:J,Al:q,Bh:G,Bl:Y,Ch:K,Cl:M,Dh:X,Dl:j,Eh:Z,El:O,Fh:W,Fl:D,Gh:L,Gl:C,Hh:g,Hl:B}=this;for(let A=0;A<80;A++){let U=D$(Z,O,14)^D$(Z,O,18)^S$(Z,O,41),N=I$(Z,O,14)^I$(Z,O,18)^g$(Z,O,41),V=Z&W^~Z&L,T=O&D^~O&C,R=F0(B,N,T,gJ[A],j$[A]),k=h0(R,g,U,V,SJ[A],U$[A]),E=R|0,w=D$(J,q,28)^S$(J,q,34)^S$(J,q,39),H=I$(J,q,28)^g$(J,q,34)^g$(J,q,39),f=J&G^J&K^G&K,u=q&Y^q&M^Y&M;g=L|0,B=C|0,L=W|0,C=D|0,W=Z|0,D=O|0,{h:Z,l:O}=e(X|0,j|0,k|0,E|0),X=K|0,j=M|0,K=G|0,M=Y|0,G=J|0,Y=q|0;let y=d0(E,H,u);J=u0(y,k,w,f),q=y|0}({h:J,l:q}=e(this.Ah|0,this.Al|0,J|0,q|0)),{h:G,l:Y}=e(this.Bh|0,this.Bl|0,G|0,Y|0),{h:K,l:M}=e(this.Ch|0,this.Cl|0,K|0,M|0),{h:X,l:j}=e(this.Dh|0,this.Dl|0,X|0,j|0),{h:Z,l:O}=e(this.Eh|0,this.El|0,Z|0,O|0),{h:W,l:D}=e(this.Fh|0,this.Fl|0,W|0,D|0),{h:L,l:C}=e(this.Gh|0,this.Gl|0,L|0,C|0),{h:g,l:B}=e(this.Hh|0,this.Hl|0,g|0,B|0),this.set(J,q,G,Y,K,M,X,j,Z,O,W,D,L,C,g,B)}roundClean(){J$(U$,j$)}destroy(){J$(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}var b$=K0(()=>new l0);var j8=K0(()=>new o0);class M0 extends i${constructor($,Q){super();this.finished=!1,this.destroyed=!1,i0($);let J=o$(Q);if(this.iHash=$.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let q=this.blockLen,G=new Uint8Array(q);G.set(J.length>q?$.create().update(J).digest():J);for(let Y=0;Y<G.length;Y++)G[Y]^=54;this.iHash.update(G),this.oHash=$.create();for(let Y=0;Y<G.length;Y++)G[Y]^=106;this.oHash.update(G),J$(G)}update($){return k$(this),this.iHash.update($),this}digestInto($){k$(this),r$($,this.outputLen),this.finished=!0,this.iHash.digestInto($),this.oHash.update($),this.oHash.digestInto($),this.destroy()}digest(){let $=new Uint8Array(this.oHash.outputLen);return this.digestInto($),$}_cloneInto($){$||($=Object.create(Object.getPrototypeOf(this),{}));let{oHash:Q,iHash:J,finished:q,destroyed:G,blockLen:Y,outputLen:K}=this;return $=$,$.finished=q,$.destroyed=G,$.blockLen=Y,$.outputLen=K,$.oHash=Q._cloneInto($.oHash),$.iHash=J._cloneInto($.iHash),$}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}var Z0=($,Q,J)=>new M0($,Q).update(J).digest();Z0.create=($,Q)=>new M0($,Q);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var N0=BigInt(0),z0=BigInt(1);function w$($){return $ instanceof Uint8Array||ArrayBuffer.isView($)&&$.constructor.name==="Uint8Array"}function Y$($){if(!w$($))throw Error("Uint8Array expected")}function x$($,Q){if(typeof Q!=="boolean")throw Error($+" boolean expected, got "+Q)}function v$($){let Q=$.toString(16);return Q.length&1?"0"+Q:Q}function n0($){if(typeof $!=="string")throw Error("hex string expected, got "+typeof $);return $===""?N0:BigInt("0x"+$)}var s0=typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function",bJ=Array.from({length:256},($,Q)=>Q.toString(16).padStart(2,"0"));function P$($){if(Y$($),s0)return $.toHex();let Q="";for(let J=0;J<$.length;J++)Q+=bJ[$[J]];return Q}var q$={_0:48,_9:57,A:65,F:70,a:97,f:102};function a0($){if($>=q$._0&&$<=q$._9)return $-q$._0;if($>=q$.A&&$<=q$.F)return $-(q$.A-10);if($>=q$.a&&$<=q$.f)return $-(q$.a-10);return}function y$($){if(typeof $!=="string")throw Error("hex string expected, got "+typeof $);if(s0)return Uint8Array.fromHex($);let Q=$.length,J=Q/2;if(Q%2)throw Error("hex string expected, got unpadded hex of length "+Q);let q=new Uint8Array(J);for(let G=0,Y=0;G<J;G++,Y+=2){let K=a0($.charCodeAt(Y)),M=a0($.charCodeAt(Y+1));if(K===void 0||M===void 0){let X=$[Y]+$[Y+1];throw Error('hex string expected, got non-hex character "'+X+'" at index '+Y)}q[G]=K*16+M}return q}function o($){return n0(P$($))}function O0($){return Y$($),n0(P$(Uint8Array.from($).reverse()))}function $$($,Q){return y$($.toString(16).padStart(Q*2,"0"))}function C0($,Q){return $$($,Q).reverse()}function d($,Q,J){let q;if(typeof Q==="string")try{q=y$(Q)}catch(Y){throw Error($+" must be hex string or Uint8Array, cause: "+Y)}else if(w$(Q))q=Uint8Array.from(Q);else throw Error($+" must be hex string or Uint8Array");let G=q.length;if(typeof J==="number"&&G!==J)throw Error($+" of length "+J+" expected, got "+G);return q}function h(...$){let Q=0;for(let q=0;q<$.length;q++){let G=$[q];Y$(G),Q+=G.length}let J=new Uint8Array(Q);for(let q=0,G=0;q<$.length;q++){let Y=$[q];J.set(Y,G),G+=Y.length}return J}function p$($){if(typeof $!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode($))}var U0=($)=>typeof $==="bigint"&&N0<=$;function V$($,Q,J){return U0($)&&U0(Q)&&U0(J)&&Q<=$&&$<J}function G$($,Q,J,q){if(!V$(Q,J,q))throw Error("expected valid "+$+": "+J+" <= n < "+q+", got "+Q)}function t0($){let Q;for(Q=0;$>N0;$>>=z0,Q+=1);return Q}var T$=($)=>(z0<<BigInt($))-z0,j0=($)=>new Uint8Array($),p0=($)=>Uint8Array.from($);function e0($,Q,J){if(typeof $!=="number"||$<2)throw Error("hashLen must be a number");if(typeof Q!=="number"||Q<2)throw Error("qByteLen must be a number");if(typeof J!=="function")throw Error("hmacFn must be a function");let q=j0($),G=j0($),Y=0,K=()=>{q.fill(1),G.fill(0),Y=0},M=(...O)=>J(G,q,...O),X=(O=j0(0))=>{if(G=M(p0([0]),O),q=M(),O.length===0)return;G=M(p0([1]),O),q=M()},j=()=>{if(Y++>=1000)throw Error("drbg: tried 1000 values");let O=0,W=[];while(O<Q){q=M();let D=q.slice();W.push(D),O+=q.length}return h(...W)};return(O,W)=>{K(),X(O);let D=void 0;while(!(D=W(j())))X();return K(),D}}var vJ={bigint:($)=>typeof $==="bigint",function:($)=>typeof $==="function",boolean:($)=>typeof $==="boolean",string:($)=>typeof $==="string",stringOrUint8Array:($)=>typeof $==="string"||w$($),isSafeInteger:($)=>Number.isSafeInteger($),array:($)=>Array.isArray($),field:($,Q)=>Q.Fp.isValid($),hash:($)=>typeof $==="function"&&Number.isSafeInteger($.outputLen)};function X$($,Q,J={}){let q=(G,Y,K)=>{let M=vJ[Y];if(typeof M!=="function")throw Error("invalid validator function");let X=$[G];if(K&&X===void 0)return;if(!M(X,$))throw Error("param "+String(G)+" is invalid. Expected "+Y+", got "+X)};for(let[G,Y]of Object.entries(Q))q(G,Y,!1);for(let[G,Y]of Object.entries(J))q(G,Y,!0);return $}function W0($){let Q=new WeakMap;return(J,...q)=>{let G=Q.get(J);if(G!==void 0)return G;let Y=$(J,...q);return Q.set(J,Y),Y}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var l=BigInt(0),m=BigInt(1),A$=BigInt(2),yJ=BigInt(3),QJ=BigInt(4),qJ=BigInt(5),YJ=BigInt(8);function _($,Q){let J=$%Q;return J>=l?J:Q+J}function i($,Q,J){let q=$;while(Q-- >l)q*=q,q%=J;return q}function n$($,Q){if($===l)throw Error("invert: expected non-zero number");if(Q<=l)throw Error("invert: expected positive modulus, got "+Q);let J=_($,Q),q=Q,G=l,Y=m,K=m,M=l;while(J!==l){let j=q/J,Z=q%J,O=G-K*j,W=Y-M*j;q=J,J=Z,G=K,Y=M,K=O,M=W}if(q!==m)throw Error("invert: does not exist");return _(G,Q)}function GJ($,Q){let J=($.ORDER+m)/QJ,q=$.pow(Q,J);if(!$.eql($.sqr(q),Q))throw Error("Cannot find square root");return q}function _J($,Q){let J=($.ORDER-qJ)/YJ,q=$.mul(Q,A$),G=$.pow(q,J),Y=$.mul(Q,G),K=$.mul($.mul(Y,A$),G),M=$.mul(Y,$.sub(K,$.ONE));if(!$.eql($.sqr(M),Q))throw Error("Cannot find square root");return M}function dJ($){if($<BigInt(3))throw Error("sqrt is not defined for small field");let Q=$-m,J=0;while(Q%A$===l)Q/=A$,J++;let q=A$,G=_$($);while($J(G,q)===1)if(q++>1000)throw Error("Cannot find square root: probably non-prime P");if(J===1)return GJ;let Y=G.pow(q,Q),K=(Q+m)/A$;return function(X,j){if(X.is0(j))return j;if($J(X,j)!==1)throw Error("Cannot find square root");let Z=J,O=X.mul(X.ONE,Y),W=X.pow(j,Q),D=X.pow(j,K);while(!X.eql(W,X.ONE)){if(X.is0(W))return X.ZERO;let L=1,C=X.sqr(W);while(!X.eql(C,X.ONE))if(L++,C=X.sqr(C),L===Z)throw Error("Cannot find square root");let g=m<<BigInt(Z-L-1),B=X.pow(O,g);Z=L,O=X.sqr(B),W=X.mul(W,O),D=X.mul(D,B)}return D}}function uJ($){if($%QJ===yJ)return GJ;if($%YJ===qJ)return _J;return dJ($)}var cJ=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function s$($){let Q={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},J=cJ.reduce((q,G)=>{return q[G]="function",q},Q);return X$($,J)}function mJ($,Q,J){if(J<l)throw Error("invalid exponent, negatives unsupported");if(J===l)return $.ONE;if(J===m)return Q;let q=$.ONE,G=Q;while(J>l){if(J&m)q=$.mul(q,G);G=$.sqr(G),J>>=m}return q}function B$($,Q,J=!1){let q=Array(Q.length).fill(J?$.ZERO:void 0),G=Q.reduce((K,M,X)=>{if($.is0(M))return K;return q[X]=K,$.mul(K,M)},$.ONE),Y=$.inv(G);return Q.reduceRight((K,M,X)=>{if($.is0(M))return K;return q[X]=$.mul(K,q[X]),$.mul(K,M)},Y),q}function $J($,Q){let J=($.ORDER-m)/A$,q=$.pow(Q,J),G=$.eql(q,$.ONE),Y=$.eql(q,$.ZERO),K=$.eql(q,$.neg($.ONE));if(!G&&!Y&&!K)throw Error("invalid Legendre symbol result");return G?1:Y?0:-1}function D0($,Q){if(Q!==void 0)JJ(Q);let J=Q!==void 0?Q:$.toString(2).length,q=Math.ceil(J/8);return{nBitLength:J,nByteLength:q}}function _$($,Q,J=!1,q={}){if($<=l)throw Error("invalid field: expected ORDER > 0, got "+$);let{nBitLength:G,nByteLength:Y}=D0($,Q);if(Y>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let K,M=Object.freeze({ORDER:$,isLE:J,BITS:G,BYTES:Y,MASK:T$(G),ZERO:l,ONE:m,create:(X)=>_(X,$),isValid:(X)=>{if(typeof X!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof X);return l<=X&&X<$},is0:(X)=>X===l,isOdd:(X)=>(X&m)===m,neg:(X)=>_(-X,$),eql:(X,j)=>X===j,sqr:(X)=>_(X*X,$),add:(X,j)=>_(X+j,$),sub:(X,j)=>_(X-j,$),mul:(X,j)=>_(X*j,$),pow:(X,j)=>mJ(M,X,j),div:(X,j)=>_(X*n$(j,$),$),sqrN:(X)=>X*X,addN:(X,j)=>X+j,subN:(X,j)=>X-j,mulN:(X,j)=>X*j,inv:(X)=>n$(X,$),sqrt:q.sqrt||((X)=>{if(!K)K=uJ($);return K(M,X)}),toBytes:(X)=>J?C0(X,Y):$$(X,Y),fromBytes:(X)=>{if(X.length!==Y)throw Error("Field.fromBytes: expected "+Y+" bytes, got "+X.length);return J?O0(X):o(X)},invertBatch:(X)=>B$(M,X),cmov:(X,j,Z)=>Z?j:X});return Object.freeze(M)}function XJ($){if(typeof $!=="bigint")throw Error("field order must be bigint");let Q=$.toString(2).length;return Math.ceil(Q/8)}function I0($){let Q=XJ($);return Q+Math.ceil(Q/2)}function KJ($,Q,J=!1){let q=$.length,G=XJ(Q),Y=I0(Q);if(q<16||q<Y||q>1024)throw Error("expected "+Y+"-1024 bytes of input, got "+q);let K=J?O0($):o($),M=_(K,Q-m)+m;return J?C0(M,G):$$(M,G)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var MJ=BigInt(0),R0=BigInt(1);function V0($,Q){let J=Q.negate();return $?J:Q}function UJ($,Q){if(!Number.isSafeInteger($)||$<=0||$>Q)throw Error("invalid window size, expected [1.."+Q+"], got W="+$)}function T0($,Q){UJ($,Q);let J=Math.ceil(Q/$)+1,q=2**($-1),G=2**$,Y=T$($),K=BigInt($);return{windows:J,windowSize:q,mask:Y,maxNumber:G,shiftBy:K}}function ZJ($,Q,J){let{windowSize:q,mask:G,maxNumber:Y,shiftBy:K}=J,M=Number($&G),X=$>>K;if(M>q)M-=Y,X+=R0;let j=Q*q,Z=j+Math.abs(M)-1,O=M===0,W=M<0,D=Q%2!==0;return{nextN:X,offset:Z,isZero:O,isNeg:W,isNegF:D,offsetF:j}}function FJ($,Q){if(!Array.isArray($))throw Error("array expected");$.forEach((J,q)=>{if(!(J instanceof Q))throw Error("invalid point at index "+q)})}function hJ($,Q){if(!Array.isArray($))throw Error("array of scalars expected");$.forEach((J,q)=>{if(!Q.isValid(J))throw Error("invalid scalar at index "+q)})}var A0=new WeakMap,jJ=new WeakMap;function L0($){return jJ.get($)||1}function zJ($,Q){return{constTimeNegate:V0,hasPrecomputes(J){return L0(J)!==1},unsafeLadder(J,q,G=$.ZERO){let Y=J;while(q>MJ){if(q&R0)G=G.add(Y);Y=Y.double(),q>>=R0}return G},precomputeWindow(J,q){let{windows:G,windowSize:Y}=T0(q,Q),K=[],M=J,X=M;for(let j=0;j<G;j++){X=M,K.push(X);for(let Z=1;Z<Y;Z++)X=X.add(M),K.push(X);M=X.double()}return K},wNAF(J,q,G){let{ZERO:Y,BASE:K}=$,M=T0(J,Q);for(let X=0;X<M.windows;X++){let{nextN:j,offset:Z,isZero:O,isNeg:W,isNegF:D,offsetF:L}=ZJ(G,X,M);if(G=j,O)K=K.add(V0(D,q[L]));else Y=Y.add(V0(W,q[Z]))}return{p:Y,f:K}},wNAFUnsafe(J,q,G,Y=$.ZERO){let K=T0(J,Q);for(let M=0;M<K.windows;M++){if(G===MJ)break;let{nextN:X,offset:j,isZero:Z,isNeg:O}=ZJ(G,M,K);if(G=X,Z)continue;else{let W=q[j];Y=Y.add(O?W.negate():W)}}return Y},getPrecomputes(J,q,G){let Y=A0.get(q);if(!Y){if(Y=this.precomputeWindow(q,J),J!==1)A0.set(q,G(Y))}return Y},wNAFCached(J,q,G){let Y=L0(J);return this.wNAF(Y,this.getPrecomputes(Y,J,G),q)},wNAFCachedUnsafe(J,q,G,Y){let K=L0(J);if(K===1)return this.unsafeLadder(J,q,Y);return this.wNAFUnsafe(K,this.getPrecomputes(K,J,G),q,Y)},setWindowSize(J,q){UJ(q,Q),jJ.set(J,q),A0.delete(J)}}}function NJ($,Q,J,q){FJ(J,$),hJ(q,Q);let G=J.length,Y=q.length;if(G!==Y)throw Error("arrays of points and scalars must have equal length");let K=$.ZERO,M=t0(BigInt(G)),X=1;if(M>12)X=M-3;else if(M>4)X=M-2;else if(M>0)X=2;let j=T$(X),Z=Array(Number(j)+1).fill(K),O=Math.floor((Q.BITS-1)/X)*X,W=K;for(let D=O;D>=0;D-=X){Z.fill(K);for(let C=0;C<Y;C++){let g=q[C],B=Number(g>>BigInt(D)&j);Z[B]=Z[B].add(J[C])}let L=K;for(let C=Z.length-1,g=K;C>0;C--)g=g.add(Z[C]),L=L.add(g);if(W=W.add(L),D!==0)for(let C=0;C<X;C++)W=W.double()}return W}function k0($){return s$($.Fp),X$($,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...D0($.n,$.nBitLength),...$,...{p:$.Fp.ORDER}})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function OJ($){if($.lowS!==void 0)x$("lowS",$.lowS);if($.prehash!==void 0)x$("prehash",$.prehash)}function lJ($){let Q=k0($);X$(Q,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});let{endo:J,Fp:q,a:G}=Q;if(J){if(!q.eql(G,q.ZERO))throw Error("invalid endo: CURVE.a must be 0");if(typeof J!=="object"||typeof J.beta!=="bigint"||typeof J.splitScalar!=="function")throw Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...Q})}class CJ extends Error{constructor($=""){super($)}}var K$={Err:CJ,_tlv:{encode:($,Q)=>{let{Err:J}=K$;if($<0||$>256)throw new J("tlv.encode: wrong tag");if(Q.length&1)throw new J("tlv.encode: unpadded data");let q=Q.length/2,G=v$(q);if(G.length/2&128)throw new J("tlv.encode: long form length too big");let Y=q>127?v$(G.length/2|128):"";return v$($)+Y+G+Q},decode($,Q){let{Err:J}=K$,q=0;if($<0||$>256)throw new J("tlv.encode: wrong tag");if(Q.length<2||Q[q++]!==$)throw new J("tlv.decode: wrong tlv");let G=Q[q++],Y=!!(G&128),K=0;if(!Y)K=G;else{let X=G&127;if(!X)throw new J("tlv.decode(long): indefinite length not supported");if(X>4)throw new J("tlv.decode(long): byte length is too big");let j=Q.subarray(q,q+X);if(j.length!==X)throw new J("tlv.decode: length bytes not complete");if(j[0]===0)throw new J("tlv.decode(long): zero leftmost byte");for(let Z of j)K=K<<8|Z;if(q+=X,K<128)throw new J("tlv.decode(long): not minimal encoding")}let M=Q.subarray(q,q+K);if(M.length!==K)throw new J("tlv.decode: wrong value length");return{v:M,l:Q.subarray(q+K)}}},_int:{encode($){let{Err:Q}=K$;if($<n)throw new Q("integer: negative integers are not allowed");let J=v$($);if(Number.parseInt(J[0],16)&8)J="00"+J;if(J.length&1)throw new Q("unexpected DER parsing assertion: unpadded hex");return J},decode($){let{Err:Q}=K$;if($[0]&128)throw new Q("invalid signature integer: negative");if($[0]===0&&!($[1]&128))throw new Q("invalid signature integer: unnecessary leading zero");return o($)}},toSig($){let{Err:Q,_int:J,_tlv:q}=K$,G=d("signature",$),{v:Y,l:K}=q.decode(48,G);if(K.length)throw new Q("invalid signature: left bytes after parsing");let{v:M,l:X}=q.decode(2,Y),{v:j,l:Z}=q.decode(2,X);if(Z.length)throw new Q("invalid signature: left bytes after parsing");return{r:J.decode(M),s:J.decode(j)}},hexFromSig($){let{_tlv:Q,_int:J}=K$,q=Q.encode(2,J.encode($.r)),G=Q.encode(2,J.encode($.s)),Y=q+G;return Q.encode(48,Y)}};function w0($,Q){return P$($$($,Q))}var n=BigInt(0),v=BigInt(1),z$=BigInt(2),d$=BigInt(3),x0=BigInt(4);function rJ($){let Q=lJ($),{Fp:J}=Q,q=_$(Q.n,Q.nBitLength),G=Q.toBytes||((U,N,V)=>{let T=N.toAffine();return h(Uint8Array.from([4]),J.toBytes(T.x),J.toBytes(T.y))}),Y=Q.fromBytes||((U)=>{let N=U.subarray(1),V=J.fromBytes(N.subarray(0,J.BYTES)),T=J.fromBytes(N.subarray(J.BYTES,2*J.BYTES));return{x:V,y:T}});function K(U){let{a:N,b:V}=Q,T=J.sqr(U),R=J.mul(T,U);return J.add(J.add(R,J.mul(U,N)),V)}function M(U,N){let V=J.sqr(N),T=K(U);return J.eql(V,T)}if(!M(Q.Gx,Q.Gy))throw Error("bad curve params: generator point");let X=J.mul(J.pow(Q.a,d$),x0),j=J.mul(J.sqr(Q.b),BigInt(27));if(J.is0(J.add(X,j)))throw Error("bad curve params: a or b");function Z(U){return V$(U,v,Q.n)}function O(U){let{allowedPrivateKeyLengths:N,nByteLength:V,wrapPrivateKey:T,n:R}=Q;if(N&&typeof U!=="bigint"){if(w$(U))U=P$(U);if(typeof U!=="string"||!N.includes(U.length))throw Error("invalid private key");U=U.padStart(V*2,"0")}let k;try{k=typeof U==="bigint"?U:o(d("private key",U,V))}catch(E){throw Error("invalid private key, expected hex or "+V+" bytes, got "+typeof U)}if(T)k=_(k,R);return G$("private key",k,v,R),k}function W(U){if(!(U instanceof C))throw Error("ProjectivePoint expected")}let D=W0((U,N)=>{let{px:V,py:T,pz:R}=U;if(J.eql(R,J.ONE))return{x:V,y:T};let k=U.is0();if(N==null)N=k?J.ONE:J.inv(R);let E=J.mul(V,N),w=J.mul(T,N),H=J.mul(R,N);if(k)return{x:J.ZERO,y:J.ZERO};if(!J.eql(H,J.ONE))throw Error("invZ was invalid");return{x:E,y:w}}),L=W0((U)=>{if(U.is0()){if(Q.allowInfinityPoint&&!J.is0(U.py))return;throw Error("bad point: ZERO")}let{x:N,y:V}=U.toAffine();if(!J.isValid(N)||!J.isValid(V))throw Error("bad point: x or y not FE");if(!M(N,V))throw Error("bad point: equation left != right");if(!U.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class C{constructor(U,N,V){if(U==null||!J.isValid(U))throw Error("x required");if(N==null||!J.isValid(N)||J.is0(N))throw Error("y required");if(V==null||!J.isValid(V))throw Error("z required");this.px=U,this.py=N,this.pz=V,Object.freeze(this)}static fromAffine(U){let{x:N,y:V}=U||{};if(!U||!J.isValid(N)||!J.isValid(V))throw Error("invalid affine point");if(U instanceof C)throw Error("projective point not allowed");let T=(R)=>J.eql(R,J.ZERO);if(T(N)&&T(V))return C.ZERO;return new C(N,V,J.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(U){let N=B$(J,U.map((V)=>V.pz));return U.map((V,T)=>V.toAffine(N[T])).map(C.fromAffine)}static fromHex(U){let N=C.fromAffine(Y(d("pointHex",U)));return N.assertValidity(),N}static fromPrivateKey(U){return C.BASE.multiply(O(U))}static msm(U,N){return NJ(C,q,U,N)}_setWindowSize(U){A.setWindowSize(this,U)}assertValidity(){L(this)}hasEvenY(){let{y:U}=this.toAffine();if(J.isOdd)return!J.isOdd(U);throw Error("Field doesn't support isOdd")}equals(U){W(U);let{px:N,py:V,pz:T}=this,{px:R,py:k,pz:E}=U,w=J.eql(J.mul(N,E),J.mul(R,T)),H=J.eql(J.mul(V,E),J.mul(k,T));return w&&H}negate(){return new C(this.px,J.neg(this.py),this.pz)}double(){let{a:U,b:N}=Q,V=J.mul(N,d$),{px:T,py:R,pz:k}=this,E=J.ZERO,w=J.ZERO,H=J.ZERO,f=J.mul(T,T),u=J.mul(R,R),y=J.mul(k,k),z=J.mul(T,R);return z=J.add(z,z),H=J.mul(T,k),H=J.add(H,H),E=J.mul(U,H),w=J.mul(V,y),w=J.add(E,w),E=J.sub(u,w),w=J.add(u,w),w=J.mul(E,w),E=J.mul(z,E),H=J.mul(V,H),y=J.mul(U,y),z=J.sub(f,y),z=J.mul(U,z),z=J.add(z,H),H=J.add(f,f),f=J.add(H,f),f=J.add(f,y),f=J.mul(f,z),w=J.add(w,f),y=J.mul(R,k),y=J.add(y,y),f=J.mul(y,z),E=J.sub(E,f),H=J.mul(y,u),H=J.add(H,H),H=J.add(H,H),new C(E,w,H)}add(U){W(U);let{px:N,py:V,pz:T}=this,{px:R,py:k,pz:E}=U,w=J.ZERO,H=J.ZERO,f=J.ZERO,u=Q.a,y=J.mul(Q.b,d$),z=J.mul(N,R),I=J.mul(V,k),x=J.mul(T,E),b=J.add(N,V),P=J.add(R,k);b=J.mul(b,P),P=J.add(z,I),b=J.sub(b,P),P=J.add(N,T);let S=J.add(R,E);return P=J.mul(P,S),S=J.add(z,x),P=J.sub(P,S),S=J.add(V,T),w=J.add(k,E),S=J.mul(S,w),w=J.add(I,x),S=J.sub(S,w),f=J.mul(u,P),w=J.mul(y,x),f=J.add(w,f),w=J.sub(I,f),f=J.add(I,f),H=J.mul(w,f),I=J.add(z,z),I=J.add(I,z),x=J.mul(u,x),P=J.mul(y,P),I=J.add(I,x),x=J.sub(z,x),x=J.mul(u,x),P=J.add(P,x),z=J.mul(I,P),H=J.add(H,z),z=J.mul(S,P),w=J.mul(b,w),w=J.sub(w,z),z=J.mul(b,I),f=J.mul(S,f),f=J.add(f,z),new C(w,H,f)}subtract(U){return this.add(U.negate())}is0(){return this.equals(C.ZERO)}wNAF(U){return A.wNAFCached(this,U,C.normalizeZ)}multiplyUnsafe(U){let{endo:N,n:V}=Q;G$("scalar",U,n,V);let T=C.ZERO;if(U===n)return T;if(this.is0()||U===v)return this;if(!N||A.hasPrecomputes(this))return A.wNAFCachedUnsafe(this,U,C.normalizeZ);let{k1neg:R,k1:k,k2neg:E,k2:w}=N.splitScalar(U),H=T,f=T,u=this;while(k>n||w>n){if(k&v)H=H.add(u);if(w&v)f=f.add(u);u=u.double(),k>>=v,w>>=v}if(R)H=H.negate();if(E)f=f.negate();return f=new C(J.mul(f.px,N.beta),f.py,f.pz),H.add(f)}multiply(U){let{endo:N,n:V}=Q;G$("scalar",U,v,V);let T,R;if(N){let{k1neg:k,k1:E,k2neg:w,k2:H}=N.splitScalar(U),{p:f,f:u}=this.wNAF(E),{p:y,f:z}=this.wNAF(H);f=A.constTimeNegate(k,f),y=A.constTimeNegate(w,y),y=new C(J.mul(y.px,N.beta),y.py,y.pz),T=f.add(y),R=u.add(z)}else{let{p:k,f:E}=this.wNAF(U);T=k,R=E}return C.normalizeZ([T,R])[0]}multiplyAndAddUnsafe(U,N,V){let T=C.BASE,R=(E,w)=>w===n||w===v||!E.equals(T)?E.multiplyUnsafe(w):E.multiply(w),k=R(this,N).add(R(U,V));return k.is0()?void 0:k}toAffine(U){return D(this,U)}isTorsionFree(){let{h:U,isTorsionFree:N}=Q;if(U===v)return!0;if(N)return N(C,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:U,clearCofactor:N}=Q;if(U===v)return this;if(N)return N(C,this);return this.multiplyUnsafe(Q.h)}toRawBytes(U=!0){return x$("isCompressed",U),this.assertValidity(),G(C,this,U)}toHex(U=!0){return x$("isCompressed",U),P$(this.toRawBytes(U))}}C.BASE=new C(Q.Gx,Q.Gy,J.ONE),C.ZERO=new C(J.ZERO,J.ONE,J.ZERO);let{endo:g,nBitLength:B}=Q,A=zJ(C,g?Math.ceil(B/2):B);return{CURVE:Q,ProjectivePoint:C,normPrivateKeyToScalar:O,weierstrassEquation:K,isWithinCurveOrder:Z}}function oJ($){let Q=k0($);return X$(Q,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...Q})}function WJ($){let Q=oJ($),{Fp:J,n:q,nByteLength:G,nBitLength:Y}=Q,K=J.BYTES+1,M=2*J.BYTES+1;function X(z){return _(z,q)}function j(z){return n$(z,q)}let{ProjectivePoint:Z,normPrivateKeyToScalar:O,weierstrassEquation:W,isWithinCurveOrder:D}=rJ({...Q,toBytes(z,I,x){let b=I.toAffine(),P=J.toBytes(b.x),S=h;if(x$("isCompressed",x),x)return S(Uint8Array.from([I.hasEvenY()?2:3]),P);else return S(Uint8Array.from([4]),P,J.toBytes(b.y))},fromBytes(z){let I=z.length,x=z[0],b=z.subarray(1);if(I===K&&(x===2||x===3)){let P=o(b);if(!V$(P,v,J.ORDER))throw Error("Point is not on curve");let S=W(P),a;try{a=J.sqrt(S)}catch(t){let r=t instanceof Error?": "+t.message:"";throw Error("Point is not on curve"+r)}let F=(a&v)===v;if((x&1)===1!==F)a=J.neg(a);return{x:P,y:a}}else if(I===M&&x===4){let P=J.fromBytes(b.subarray(0,J.BYTES)),S=J.fromBytes(b.subarray(J.BYTES,2*J.BYTES));return{x:P,y:S}}else{let P=K,S=M;throw Error("invalid Point, expected length of "+P+", or uncompressed "+S+", got "+I)}}});function L(z){let I=q>>v;return z>I}function C(z){return L(z)?X(-z):z}let g=(z,I,x)=>o(z.slice(I,x));class B{constructor(z,I,x){if(G$("r",z,v,q),G$("s",I,v,q),this.r=z,this.s=I,x!=null)this.recovery=x;Object.freeze(this)}static fromCompact(z){let I=G;return z=d("compactSignature",z,I*2),new B(g(z,0,I),g(z,I,2*I))}static fromDER(z){let{r:I,s:x}=K$.toSig(d("DER",z));return new B(I,x)}assertValidity(){}addRecoveryBit(z){return new B(this.r,this.s,z)}recoverPublicKey(z){let{r:I,s:x,recovery:b}=this,P=R(d("msgHash",z));if(b==null||![0,1,2,3].includes(b))throw Error("recovery id invalid");let S=b===2||b===3?I+Q.n:I;if(S>=J.ORDER)throw Error("recovery id 2 or 3 invalid");let a=(b&1)===0?"02":"03",F=Z.fromHex(a+w0(S,J.BYTES)),s=j(S),t=X(-P*s),r=X(x*s),M$=Z.BASE.multiplyAndAddUnsafe(F,t,r);if(!M$)throw Error("point at infinify");return M$.assertValidity(),M$}hasHighS(){return L(this.s)}normalizeS(){return this.hasHighS()?new B(this.r,X(-this.s),this.recovery):this}toDERRawBytes(){return y$(this.toDERHex())}toDERHex(){return K$.hexFromSig(this)}toCompactRawBytes(){return y$(this.toCompactHex())}toCompactHex(){let z=G;return w0(this.r,z)+w0(this.s,z)}}let A={isValidPrivateKey(z){try{return O(z),!0}catch(I){return!1}},normPrivateKeyToScalar:O,randomPrivateKey:()=>{let z=I0(Q.n);return KJ(Q.randomBytes(z),Q.n)},precompute(z=8,I=Z.BASE){return I._setWindowSize(z),I.multiply(BigInt(3)),I}};function U(z,I=!0){return Z.fromPrivateKey(z).toRawBytes(I)}function N(z){if(typeof z==="bigint")return!1;if(z instanceof Z)return!0;let x=d("key",z).length,b=J.BYTES,P=b+1,S=2*b+1;if(Q.allowedPrivateKeyLengths||G===P)return;else return x===P||x===S}function V(z,I,x=!0){if(N(z)===!0)throw Error("first arg must be private key");if(N(I)===!1)throw Error("second arg must be public key");return Z.fromHex(I).multiply(O(z)).toRawBytes(x)}let T=Q.bits2int||function(z){if(z.length>8192)throw Error("input is too large");let I=o(z),x=z.length*8-Y;return x>0?I>>BigInt(x):I},R=Q.bits2int_modN||function(z){return X(T(z))},k=T$(Y);function E(z){return G$("num < 2^"+Y,z,n,k),$$(z,G)}function w(z,I,x=H){if(["recovered","canonical"].some((C$)=>(C$ in x)))throw Error("sign() legacy options not supported");let{hash:b,randomBytes:P}=Q,{lowS:S,prehash:a,extraEntropy:F}=x;if(S==null)S=!0;if(z=d("msgHash",z),OJ(x),a)z=d("prehashed msgHash",b(z));let s=R(z),t=O(I),r=[E(t),E(s)];if(F!=null&&F!==!1){let C$=F===!0?P(J.BYTES):F;r.push(d("extraEntropy",C$))}let M$=h(...r),h$=s;function q0(C$){let L$=T(C$);if(!D(L$))return;let Y0=j(L$),H$=Z.BASE.multiply(L$).toAffine(),W$=X(H$.x);if(W$===n)return;let E$=X(Y0*X(h$+W$*t));if(E$===n)return;let R$=(H$.x===W$?0:2)|Number(H$.y&v),g0=E$;if(S&&L(E$))g0=C(E$),R$^=1;return new B(W$,g0,R$)}return{seed:M$,k2sig:q0}}let H={lowS:Q.lowS,prehash:!1},f={lowS:Q.lowS,prehash:!1};function u(z,I,x=H){let{seed:b,k2sig:P}=w(z,I,x),S=Q;return e0(S.hash.outputLen,S.nByteLength,S.hmac)(b,P)}Z.BASE._setWindowSize(8);function y(z,I,x,b=f){let P=z;I=d("msgHash",I),x=d("publicKey",x);let{lowS:S,prehash:a,format:F}=b;if(OJ(b),"strict"in b)throw Error("options.strict was renamed to lowS");if(F!==void 0&&F!=="compact"&&F!=="der")throw Error("format must be compact or der");let s=typeof P==="string"||w$(P),t=!s&&!F&&typeof P==="object"&&P!==null&&typeof P.r==="bigint"&&typeof P.s==="bigint";if(!s&&!t)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");let r=void 0,M$;try{if(t)r=new B(P.r,P.s);if(s){try{if(F!=="compact")r=B.fromDER(P)}catch(R$){if(!(R$ instanceof K$.Err))throw R$}if(!r&&F!=="der")r=B.fromCompact(P)}M$=Z.fromHex(x)}catch(R$){return!1}if(!r)return!1;if(S&&r.hasHighS())return!1;if(a)I=Q.hash(I);let{r:h$,s:q0}=r,C$=R(I),L$=j(q0),Y0=X(C$*L$),H$=X(h$*L$),W$=Z.BASE.multiplyAndAddUnsafe(M$,Y0,H$)?.toAffine();if(!W$)return!1;return X(W$.x)===h$}return{CURVE:Q,getPublicKey:U,getSharedSecret:V,sign:u,verify:y,ProjectivePoint:Z,Signature:B,utils:A}}function iJ($,Q){let J=$.ORDER,q=n;for(let L=J-v;L%z$===n;L/=z$)q+=v;let G=q,Y=z$<<G-v-v,K=Y*z$,M=(J-v)/K,X=(M-v)/z$,j=K-v,Z=Y,O=$.pow(Q,M),W=$.pow(Q,(M+v)/z$),D=(L,C)=>{let g=O,B=$.pow(C,j),A=$.sqr(B);A=$.mul(A,C);let U=$.mul(L,A);U=$.pow(U,X),U=$.mul(U,B),B=$.mul(U,C),A=$.mul(U,L);let N=$.mul(A,B);U=$.pow(N,Z);let V=$.eql(U,$.ONE);B=$.mul(A,W),U=$.mul(N,g),A=$.cmov(B,A,V),N=$.cmov(U,N,V);for(let T=G;T>v;T--){let R=T-z$;R=z$<<R-v;let k=$.pow(N,R),E=$.eql(k,$.ONE);B=$.mul(A,g),g=$.mul(g,g),k=$.mul(N,g),A=$.cmov(B,A,E),N=$.cmov(k,N,E)}return{isValid:V,value:A}};if($.ORDER%x0===d$){let L=($.ORDER-d$)/x0,C=$.sqrt($.neg(Q));D=(g,B)=>{let A=$.sqr(B),U=$.mul(g,B);A=$.mul(A,U);let N=$.pow(A,L);N=$.mul(N,U);let V=$.mul(N,C),T=$.mul($.sqr(N),B),R=$.eql(T,g),k=$.cmov(V,N,R);return{isValid:R,value:k}}}return D}function DJ($,Q){if(s$($),!$.isValid(Q.A)||!$.isValid(Q.B)||!$.isValid(Q.Z))throw Error("mapToCurveSimpleSWU: invalid opts");let J=iJ($,Q.Z);if(!$.isOdd)throw Error("Fp.isOdd is not implemented!");return(q)=>{let G,Y,K,M,X,j,Z,O;G=$.sqr(q),G=$.mul(G,Q.Z),Y=$.sqr(G),Y=$.add(Y,G),K=$.add(Y,$.ONE),K=$.mul(K,Q.B),M=$.cmov(Q.Z,$.neg(Y),!$.eql(Y,$.ZERO)),M=$.mul(M,Q.A),Y=$.sqr(K),j=$.sqr(M),X=$.mul(j,Q.A),Y=$.add(Y,X),Y=$.mul(Y,K),j=$.mul(j,M),X=$.mul(j,Q.B),Y=$.add(Y,X),Z=$.mul(G,K);let{isValid:W,value:D}=J(Y,j);O=$.mul(G,q),O=$.mul(O,D),Z=$.cmov(Z,K,W),O=$.cmov(O,D,W);let L=$.isOdd(q)===$.isOdd(O);O=$.cmov($.neg(O),O,L);let C=B$($,[M],!0)[0];return Z=$.mul(Z,C),{x:Z,y:O}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function aJ($){return{hash:$,hmac:(Q,...J)=>Z0($,Q,IJ(...J)),randomBytes:t$}}function VJ($,Q){let J=(q)=>WJ({...$,...aJ(q)});return{...J(Q),create:J}}var pJ=o;function N$($,Q){if(u$($),u$(Q),$<0||$>=1<<8*Q)throw Error("invalid I2OSP input: "+$);let J=Array.from({length:Q}).fill(0);for(let q=Q-1;q>=0;q--)J[q]=$&255,$>>>=8;return new Uint8Array(J)}function nJ($,Q){let J=new Uint8Array($.length);for(let q=0;q<$.length;q++)J[q]=$[q]^Q[q];return J}function u$($){if(!Number.isSafeInteger($))throw Error("number expected")}function sJ($,Q,J,q){if(Y$($),Y$(Q),u$(J),Q.length>255)Q=q(h(p$("H2C-OVERSIZE-DST-"),Q));let{outputLen:G,blockLen:Y}=q,K=Math.ceil(J/G);if(J>65535||K>255)throw Error("expand_message_xmd: invalid lenInBytes");let M=h(Q,N$(Q.length,1)),X=N$(0,Y),j=N$(J,2),Z=Array(K),O=q(h(X,$,j,N$(0,1),M));Z[0]=q(h(O,N$(1,1),M));for(let D=1;D<=K;D++){let L=[nJ(O,Z[D-1]),N$(D+1,1),M];Z[D]=q(h(...L))}return h(...Z).slice(0,J)}function tJ($,Q,J,q,G){if(Y$($),Y$(Q),u$(J),Q.length>255){let Y=Math.ceil(2*q/8);Q=G.create({dkLen:Y}).update(p$("H2C-OVERSIZE-DST-")).update(Q).digest()}if(J>65535||Q.length>255)throw Error("expand_message_xof: invalid lenInBytes");return G.create({dkLen:J}).update($).update(N$(J,2)).update(Q).update(N$(Q.length,1)).digest()}function TJ($,Q,J){X$(J,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:q,k:G,m:Y,hash:K,expand:M,DST:X}=J;Y$($),u$(Q);let j=typeof X==="string"?p$(X):X,Z=q.toString(2).length,O=Math.ceil((Z+G)/8),W=Q*Y*O,D;if(M==="xmd")D=sJ($,j,W,K);else if(M==="xof")D=tJ($,j,W,G,K);else if(M==="_internal_pass")D=$;else throw Error('expand must be "xmd" or "xof"');let L=Array(Q);for(let C=0;C<Q;C++){let g=Array(Y);for(let B=0;B<Y;B++){let A=O*(B+C*Y),U=D.subarray(A,A+O);g[B]=_(pJ(U),q)}L[C]=g}return L}function AJ($,Q){let J=Q.map((q)=>Array.from(q).reverse());return(q,G)=>{let[Y,K,M,X]=J.map((O)=>O.reduce((W,D)=>$.add($.mul(W,q),D))),[j,Z]=B$($,[K,X],!0);return q=$.mul(Y,j),G=$.mul(G,$.mul(M,Z)),{x:q,y:G}}}function LJ($,Q,J){if(typeof Q!=="function")throw Error("mapToCurve() must be defined");function q(Y){return $.fromAffine(Q(Y))}function G(Y){let K=Y.clearCofactor();if(K.equals($.ZERO))return $.ZERO;return K.assertValidity(),K}return{defaults:J,hashToCurve(Y,K){let M=TJ(Y,2,{...J,DST:J.DST,...K}),X=q(M[0]),j=q(M[1]);return G(X.add(j))},encodeToCurve(Y,K){let M=TJ(Y,1,{...J,DST:J.encodeDST,...K});return G(q(M[0]))},mapToCurve(Y){if(!Array.isArray(Y))throw Error("expected array of bigints");for(let K of Y)if(typeof K!=="bigint")throw Error("expected array of bigints");return G(q(Y))}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var F$=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),e$=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),H0=BigInt(0),c$=BigInt(1),$0=BigInt(2),RJ=($,Q)=>($+Q/$0)/Q;function wJ($){let Q=F$,J=BigInt(3),q=BigInt(6),G=BigInt(11),Y=BigInt(22),K=BigInt(23),M=BigInt(44),X=BigInt(88),j=$*$*$%Q,Z=j*j*$%Q,O=i(Z,J,Q)*Z%Q,W=i(O,J,Q)*Z%Q,D=i(W,$0,Q)*j%Q,L=i(D,G,Q)*D%Q,C=i(L,Y,Q)*L%Q,g=i(C,M,Q)*C%Q,B=i(g,X,Q)*g%Q,A=i(B,M,Q)*C%Q,U=i(A,J,Q)*Z%Q,N=i(U,K,Q)*L%Q,V=i(N,q,Q)*j%Q,T=i(V,$0,Q);if(!O$.eql(O$.sqr(T),$))throw Error("Cannot find square root");return T}var O$=_$(F$,void 0,void 0,{sqrt:wJ}),Q0=VJ({a:H0,b:BigInt(7),Fp:O$,n:e$,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:($)=>{let Q=e$,J=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),q=-c$*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),G=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),Y=J,K=BigInt("0x100000000000000000000000000000000"),M=RJ(Y*$,Q),X=RJ(-q*$,Q),j=_($-M*J-X*G,Q),Z=_(-M*q-X*Y,Q),O=j>K,W=Z>K;if(O)j=Q-j;if(W)Z=Q-Z;if(j>K||Z>K)throw Error("splitScalar: Endomorphism failed, k="+$);return{k1neg:O,k1:j,k2neg:W,k2:Z}}}},b$),kJ={};function J0($,...Q){let J=kJ[$];if(J===void 0){let q=b$(Uint8Array.from($,(G)=>G.charCodeAt(0)));J=h(q,q),kJ[$]=J}return b$(h(J,...Q))}var E0=($)=>$.toRawBytes(!0).slice(1),B0=($)=>$$($,32),P0=($)=>_($,F$),m$=($)=>_($,e$),S0=(()=>Q0.ProjectivePoint)(),eJ=($,Q,J)=>S0.BASE.multiplyAndAddUnsafe($,Q,J);function f0($){let Q=Q0.utils.normPrivateKeyToScalar($),J=S0.fromPrivateKey(Q);return{scalar:J.hasEvenY()?Q:m$(-Q),bytes:E0(J)}}function xJ($){G$("x",$,c$,F$);let Q=P0($*$),J=P0(Q*$+BigInt(7)),q=wJ(J);if(q%$0!==H0)q=P0(-q);let G=new S0($,q,c$);return G.assertValidity(),G}var f$=o;function PJ(...$){return m$(f$(J0("BIP0340/challenge",...$)))}function $8($){return f0($).bytes}function J8($,Q,J=t$(32)){let q=d("message",$),{bytes:G,scalar:Y}=f0(Q),K=d("auxRand",J,32),M=B0(Y^f$(J0("BIP0340/aux",K))),X=J0("BIP0340/nonce",M,G,q),j=m$(f$(X));if(j===H0)throw Error("sign failed: k is zero");let{bytes:Z,scalar:O}=f0(j),W=PJ(Z,G,q),D=new Uint8Array(64);if(D.set(Z,0),D.set(B0(m$(O+W*Y)),32),!BJ(D,q,G))throw Error("sign: Invalid signature produced");return D}function BJ($,Q,J){let q=d("signature",$,64),G=d("message",Q),Y=d("publicKey",J,32);try{let K=xJ(f$(Y)),M=f$(q.subarray(0,32));if(!V$(M,c$,F$))return!1;let X=f$(q.subarray(32,64));if(!V$(X,c$,e$))return!1;let j=PJ(B0(M),E0(K),G),Z=eJ(K,X,m$(-j));if(!Z||!Z.hasEvenY()||Z.toAffine().x!==M)return!1;return!0}catch(K){return!1}}var c8=(()=>({getPublicKey:$8,sign:J8,verify:BJ,utils:{randomPrivateKey:Q0.utils.randomPrivateKey,lift_x:xJ,pointToBytes:E0,numberToBytesBE:$$,bytesToNumberBE:o,taggedHash:J0,mod:_}}))(),Q8=(()=>AJ(O$,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(($)=>$.map((Q)=>BigInt(Q)))))(),q8=(()=>DJ(O$,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:O$.create(BigInt("-11"))}))(),fJ=(()=>LJ(Q0.ProjectivePoint,($)=>{let{x:Q,y:J}=q8(O$.create($[0]));return Q8(Q,J)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:O$.ORDER,m:1,k:128,expand:"xmd",hash:b$}))(),m8=(()=>fJ.hashToCurve)(),F8=(()=>fJ.encodeToCurve)();
3
+ export{b$ as s,j8 as t,Z0 as u,Q0 as v,c8 as w,fJ as x,m8 as y,F8 as z};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import"./chunk-zy3raqnk.js";function d(){if(typeof WebSocket<"u")return WebSocket;if(typeof global.WebSocket<"u")return global.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw Error("`WebSocket` is not supported in this environment")}var q=d();export{q as WebSocket};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{i as a}from"./chunk-by6w3tsf.js";import"./chunk-zy3raqnk.js";export default a();
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{m as a,n as b,o as c,p as d,q as e,r as f}from"./chunk-h29x1xqe.js";import"./chunk-kn2k3qtn.js";import"./chunk-jrrt57tv.js";import"./chunk-fc5rfx0b.js";import"./chunk-zy3raqnk.js";export{c as saveWallet,b as loadWallet,a as getWalletKeyPath,f as getSetuBalance,e as exportWalletKey,d as ensureWallet};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ var g=Object.create;var{getPrototypeOf:h,defineProperty:f,getOwnPropertyNames:i}=Object;var j=Object.prototype.hasOwnProperty;var k=(a,b,c)=>{c=a!=null?g(h(a)):{};let d=b||!a||!a.__esModule?f(c,"default",{value:a,enumerable:!0}):c;for(let e of i(a))if(!j.call(d,e))f(d,e,{get:()=>a[e],enumerable:!0});return d};var l=(a,b)=>()=>(b||a((b={exports:{}}).exports,b),b.exports);var m=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:!0,configurable:!0,set:(d)=>b[c]=()=>d})};var n=import.meta.require;
3
+ export{k as Cd,l as Dd,m as Ed,n as Fd};
package/dist/cli.js ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env bun
2
+ // @bun
3
+ import{a as S}from"./chunk-esz88g73.js";import{c as u,e as b,f as v,g as a}from"./chunk-5kkvddc1.js";import{l as s,m as i,n as p,o as c,p as r,q as y,r as m}from"./chunk-h29x1xqe.js";import"./chunk-kn2k3qtn.js";import"./chunk-jrrt57tv.js";import"./chunk-fc5rfx0b.js";import"./chunk-zy3raqnk.js";import*as x from"readline";function n(o){let e=x.createInterface({input:process.stdin,output:process.stdout});return new Promise((t)=>{e.question(o,(l)=>{e.close(),t(l.trim())})})}function g(){console.log(`
4
+ openclaw-setu \u2014 Pay for AI with Solana USDC
5
+
6
+ Usage:
7
+ openclaw-setu setup Interactive setup (wallet + config)
8
+ openclaw-setu start Start the local proxy server
9
+ openclaw-setu stop Stop (placeholder \u2014 use Ctrl+C)
10
+
11
+ openclaw-setu wallet generate Generate a new Solana wallet
12
+ openclaw-setu wallet import Import an existing private key
13
+ openclaw-setu wallet export Export your private key
14
+ openclaw-setu wallet info Show wallet address and balances
15
+
16
+ openclaw-setu config inject Inject Setu provider into openclaw.json
17
+ openclaw-setu config remove Remove Setu provider from openclaw.json
18
+ openclaw-setu config status Check if Setu is configured
19
+
20
+ openclaw-setu help Show this help
21
+ `)}async function h(){console.log(`
22
+ Setu \u2014 Pay for AI with Solana USDC
23
+ `);let o=p(),e=o;if(o){if(console.log(` Existing wallet found: ${o.publicKey}`),(await n(" Use existing wallet? (Y/n): ")).toLowerCase()==="n")if((await n(" (g)enerate new or (i)mport existing? ")).toLowerCase()==="i"){let w=await n(" Enter Solana private key (base58): ");if(!s(w))console.error(" Invalid private key."),process.exit(1);e=c(w),console.log(` Wallet imported: ${e.publicKey}`)}else e=r(),console.log(` New wallet generated: ${e.publicKey}`)}else if((await n(" No wallet found. (g)enerate new or (i)mport existing? ")).toLowerCase()==="i"){let l=await n(" Enter Solana private key (base58): ");if(!s(l))console.error(" Invalid private key."),process.exit(1);e=c(l),console.log(` Wallet imported: ${e.publicKey}`)}else e=r(),console.log(` New wallet generated: ${e.publicKey}`);if(!e)console.error(" Failed to set up wallet."),process.exit(1);console.log(`
24
+ Wallet: ${e.publicKey}`),console.log(` Key stored at: ${i()}`),await u(),console.log(` OpenClaw config updated: ${a()}`),console.log(`
25
+ Setup complete!
26
+
27
+ Next steps:
28
+ 1. Fund your wallet with USDC on Solana:
29
+ ${e.publicKey}
30
+
31
+ 2. Start the proxy:
32
+ openclaw-setu start
33
+
34
+ 3. Restart OpenClaw:
35
+ openclaw gateway restart
36
+
37
+ Your wallet address is your identity \u2014 no API keys needed.
38
+ `)}async function k(){let o=p();if(o){if((await n(`Wallet exists (${o.publicKey}). Overwrite? (y/N): `)).toLowerCase()!=="y"){console.log("Cancelled.");return}}let e=r();console.log(`Wallet generated: ${e.publicKey}`),console.log(`Key stored at: ${i()}`),console.log(`
39
+ Fund with USDC on Solana: ${e.publicKey}`)}async function $(){let o=await n("Enter Solana private key (base58): ");if(!s(o))console.error("Invalid private key."),process.exit(1);let e=c(o);console.log(`Wallet imported: ${e.publicKey}`)}function C(){let o=y();if(!o)console.error("No wallet found. Run `openclaw-setu setup` first."),process.exit(1);console.log(o)}async function K(){let o=p();if(!o)console.error("No wallet found. Run `openclaw-setu setup` first."),process.exit(1);console.log(`
40
+ Wallet: ${o.publicKey}`),console.log(`Key path: ${i()}`),console.log(`
41
+ Fetching balances...`);let e=await m(o.privateKey);if(e.setu)console.log(`
42
+ Setu Balance: $${e.setu.balance.toFixed(4)}`),console.log(`Total Spent: $${e.setu.totalSpent.toFixed(4)}`),console.log(`Requests: ${e.setu.requestCount}`);else console.log(`
43
+ Setu Balance: (not available \u2014 wallet may not be registered yet)`);if(e.wallet)console.log(`
44
+ On-chain USDC: $${e.wallet.usdcBalance.toFixed(4)} (${e.wallet.network})`)}async function W(){await u(),console.log(`Setu provider injected into ${a()}`)}function I(){b(),console.log(`Setu provider removed from ${a()}`)}function U(){if(v())console.log(`Setu is configured in ${a()}`);else console.log("Setu is not configured. Run `openclaw-setu setup`.")}function P(){let o=parseInt(process.env.SETU_PROXY_PORT??"8403",10),e=process.argv.includes("--verbose")||process.argv.includes("-v");try{let{wallet:t}=S({port:o,verbose:e});console.log(`
45
+ Setu proxy running on http://localhost:${o}`),console.log(`Wallet: ${t.publicKey}`),console.log(`
46
+ Press Ctrl+C to stop.
47
+ `)}catch(t){console.error(t.message),process.exit(1)}}var[d,f]=process.argv.slice(2);switch(d){case"setup":h();break;case"start":P();break;case"wallet":switch(f){case"generate":k();break;case"import":$();break;case"export":C();break;case"info":K();break;default:console.error("Unknown wallet command. Use: generate, import, export, info"),process.exit(1)}break;case"config":switch(f){case"inject":W();break;case"remove":I();break;case"status":U();break;default:console.error("Unknown config command. Use: inject, remove, status"),process.exit(1)}break;case"help":case"--help":case"-h":case void 0:g();break;default:console.error(`Unknown command: ${d}`),g(),process.exit(1)}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{b as s,c as g,d as C,f as P}from"./chunk-5kkvddc1.js";import{l as f,m as y,n as l,p as h,r as S}from"./chunk-h29x1xqe.js";import"./chunk-kn2k3qtn.js";import"./chunk-jrrt57tv.js";import"./chunk-fc5rfx0b.js";import{Fd as m}from"./chunk-zy3raqnk.js";var $=8403;function x(e){return e.pluginConfig?.port??$}var K={id:"setu",name:"Setu",description:"Pay for AI with Solana USDC \u2014 no API keys, just a wallet.",version:"0.1.0",async register(e){let n=x(e);await g(n).catch(()=>{});try{C()}catch{}if(!e.config.models)e.config.models={providers:{}};if(!e.config.models.providers)e.config.models.providers={};let r=s(n);if(e.config.models.providers.setu={baseUrl:r.baseUrl,api:r.api,apiKey:r.apiKey,models:r.models},!e.config.agents)e.config.agents={};let u=e.config.agents;if(!u.defaults)u.defaults={};let d=u.defaults;if(!d.model)d.model={};let w=d.model;if(!w.primary)w.primary="setu/claude-sonnet-4-6";e.registerProvider({id:"setu",label:"Setu (Solana USDC)",aliases:["setu-solana"],envVars:["SETU_PRIVATE_KEY"],models:s(n),auth:[{id:"setu-wallet",label:"Solana Wallet",hint:"Generate or import a Solana wallet \u2014 pay per token with USDC",kind:"custom",async run(o){let t=l();if(t)return o.prompter.note(`Existing Setu wallet found: ${t.publicKey}`),{profiles:[{profileId:"setu-wallet",credential:{apiKey:"setu-proxy-handles-auth",type:"wallet",walletAddress:t.publicKey}}],configPatch:{models:{providers:{setu:s(n)}}},defaultModel:"setu/claude-sonnet-4-6",notes:[`Wallet: ${t.publicKey}`,"Fund with USDC on Solana to start using.","Run `openclaw-setu start` to start the proxy."]};let a=await o.prompter.text({message:"Enter Solana private key (base58) or press Enter to generate a new one:",validate:(i)=>{if(i&&!f(i))return"Invalid Solana private key";return}}),c=typeof a==="string"?a.trim():"";if(c&&f(c)){let{saveWallet:i}=await import("./chunk-rcdyanw7.js");i(c)}else h();let p=l();return await g(n),{profiles:[{profileId:"setu-wallet",credential:{apiKey:"setu-proxy-handles-auth",type:"wallet",walletAddress:p.publicKey}}],configPatch:{models:{providers:{setu:s(n)}}},defaultModel:"setu/claude-sonnet-4-6",notes:[`Wallet generated: ${p.publicKey}`,`Key stored at: ${y()}`,`Fund with USDC on Solana: ${p.publicKey}`,"Run `openclaw-setu start` to start the proxy."]}}}]});let b={name:"wallet",description:"Show your Setu wallet address and balances",requireAuth:!0,async handler(){let o=l();if(!o)return{text:"No Setu wallet found. Run `openclaw-setu setup`."};let t=await S(o.privateKey),a=[`Wallet: ${o.publicKey}`];if(t.setu)a.push(`Setu Balance: $${t.setu.balance.toFixed(4)}`),a.push(`Total Spent: $${t.setu.totalSpent.toFixed(4)}`),a.push(`Requests: ${t.setu.requestCount}`);if(t.wallet)a.push(`On-chain USDC: $${t.wallet.usdcBalance.toFixed(4)} (${t.wallet.network})`);return{text:a.join(`
3
+ `)}}};e.registerCommand(b);let v={name:"setu-status",description:"Check Setu plugin configuration status",async handler(){let o=l(),t=P();return{text:[`Wallet: ${o?o.publicKey:"not set up"}`,`OpenClaw config: ${t?"injected":"not configured"}`,`Proxy port: ${n}`].join(`
4
+ `)}}};e.registerCommand(v),e.registerService({id:"setu-proxy",async start(){if(!l()){e.logger.warn("Setu: No wallet found. Run `openclaw-setu setup` first.");return}try{let{createProxy:t}=await import("./chunk-e5qz2vx5.js");t({port:n,verbose:!1}),e.logger.info(`Setu proxy running on http://localhost:${n}`)}catch(t){e.logger.error(`Setu proxy failed: ${t.message}`)}}})}},R=K;export{R as default};
package/package.json CHANGED
@@ -1,24 +1,28 @@
1
1
  {
2
2
  "name": "@ottocode/openclaw-setu",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Setu provider for OpenClaw — pay for AI with Solana USDC. No API keys, just a wallet.",
5
5
  "type": "module",
6
- "main": "./src/index.ts",
6
+ "main": "./dist/index.js",
7
7
  "exports": {
8
- ".": "./src/index.ts"
8
+ ".": "./dist/index.js"
9
9
  },
10
10
  "bin": {
11
- "openclaw-setu": "./src/cli.ts"
11
+ "openclaw-setu": "./dist/cli.js"
12
12
  },
13
13
  "openclaw": {
14
14
  "extensions": [
15
- "./src/index.ts"
15
+ "./dist/index.js"
16
16
  ]
17
17
  },
18
18
  "files": [
19
- "src",
19
+ "dist",
20
20
  "openclaw.plugin.json"
21
21
  ],
22
+ "scripts": {
23
+ "build": "bun run build.ts",
24
+ "prepublishOnly": "bun run build"
25
+ },
22
26
  "keywords": [
23
27
  "openclaw",
24
28
  "setu",
@@ -36,9 +40,6 @@
36
40
  "url": "git+https://github.com/nitishxyz/otto.git",
37
41
  "directory": "packages/openclaw-setu"
38
42
  },
39
- "dependencies": {
40
- "@ottocode/ai-sdk": "^0.1.4"
41
- },
42
43
  "peerDependencies": {
43
44
  "openclaw": ">=2025.1.0"
44
45
  },