@boostxyz/cli 5.0.0 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +0,0 @@
1
- "use strict";const ca=require("node:fs/promises"),ua=require("node:path"),j=require("@boostxyz/sdk"),W=require("./utils-BLfs3EZx.cjs");function xn(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;let n,r;if(Array.isArray(t)&&Array.isArray(e)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!xn(t[r],e[r]))return!1;return!0}if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();const s=Object.keys(t);if(n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(a&&!xn(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}class da extends W.BaseError$1{constructor({value:e}){super(`Number \`${e}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function la(t,e){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(t))throw new da({value:t});let[n,r="0"]=t.split(".");const s=n.startsWith("-");if(s&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),e===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>e){const[a,i,o]=[r.slice(0,e-1),r.slice(e-1,e),r.slice(e)],c=Math.round(+`${i}.${o}`);c>9?r=`${BigInt(a)+BigInt(1)}0`.padStart(a.length+1,"0"):r=`${a}${c}`,r.length>e&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,e)}else r=r.padEnd(e,"0");return BigInt(`${s?"-":""}${n}${r}`)}function Fr(t,e="wei"){return la(t,W.etherUnits[e])}const vr="0x0000000000000000000000000000000000000000",zr="2.21.16";let Nt={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:n})=>e?`${t??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:zr},m=class _n extends Error{constructor(e,n={}){var o;const r=(()=>{var c;return n.cause instanceof _n?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof _n&&n.cause.docsPath||n.docsPath,a=(o=Nt.getDocsUrl)==null?void 0:o.call(Nt,{...n,docsPath:s}),i=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],`Version: ${Nt.version}`].join(`
2
- `);super(i,n.cause?{cause:n.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=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=zr}walk(e){return Zr(this,e)}};function Zr(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t?Zr(t.cause,e):e?null:t}class fa extends m{constructor({max:e,min:n,signed:r,size:s,value:a}){super(`Number "${a}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class ha extends m{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class pa extends m{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}class Dr extends m{constructor({offset:e,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class Lr extends m{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}class wr extends m{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${e} ${r} long.`,{name:"InvalidBytesLengthError"})}}function We(t,{dir:e,size:n=32}={}){return typeof t=="string"?ge(t,{dir:e,size:n}):ma(t,{dir:e,size:n})}function ge(t,{dir:e,size:n=32}={}){if(n===null)return t;const r=t.replace("0x","");if(r.length>n*2)throw new Lr({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function ma(t,{dir:e,size:n=32}={}){if(n===null)return t;if(t.length>n)throw new Lr({size:t.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const a=e==="right";r[a?s:n-s-1]=t[a?s:t.length-s-1]}return r}function he(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function F(t){return he(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}function Un(t,{dir:e="left"}={}){let n=typeof t=="string"?t.replace("0x",""):t,r=0;for(let s=0;s<n.length-1&&n[e==="left"?s:n.length-s-1].toString()==="0";s++)r++;return n=e==="left"?n.slice(r):n.slice(0,n.length-r),typeof t=="string"?(n.length===1&&e==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}const ya=new TextEncoder;function Vn(t,e={}){return typeof t=="number"||typeof t=="bigint"?ga(t,e):typeof t=="boolean"?ba(t,e):he(t)?pe(t,e):Ur(t,e)}function ba(t,e={}){const n=new Uint8Array(1);return n[0]=Number(t),typeof e.size=="number"?(oe(n,{size:e.size}),We(n,{size:e.size})):n}const ue={zero:48,nine:57,A:65,F:70,a:97,f:102};function xr(t){if(t>=ue.zero&&t<=ue.nine)return t-ue.zero;if(t>=ue.A&&t<=ue.F)return t-(ue.A-10);if(t>=ue.a&&t<=ue.f)return t-(ue.a-10)}function pe(t,e={}){let n=t;e.size&&(oe(n,{size:e.size}),n=We(n,{dir:"right",size:e.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,a=new Uint8Array(s);for(let i=0,o=0;i<s;i++){const c=xr(r.charCodeAt(o++)),u=xr(r.charCodeAt(o++));if(c===void 0||u===void 0)throw new m(`Invalid byte sequence ("${r[o-2]}${r[o-1]}" in "${r}").`);a[i]=c*16+u}return a}function ga(t,e){const n=R(t,e);return pe(n)}function Ur(t,e={}){const n=ya.encode(t);return typeof e.size=="number"?(oe(n,{size:e.size}),We(n,{dir:"right",size:e.size})):n}function oe(t,{size:e}){if(F(t)>e)throw new pa({givenSize:F(t),maxSize:e})}function rt(t,e={}){const{signed:n}=e;e.size&&oe(t,{size:e.size});const r=BigInt(t);if(!n)return r;const s=(t.length-2)/2,a=(1n<<BigInt(s)*8n-1n)-1n;return r<=a?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function De(t,e={}){return Number(rt(t,e))}const va=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Pn(t,e={}){return typeof t=="number"||typeof t=="bigint"?R(t,e):typeof t=="string"?Gn(t,e):typeof t=="boolean"?Vr(t,e):G(t,e)}function Vr(t,e={}){const n=`0x${Number(t)}`;return typeof e.size=="number"?(oe(n,{size:e.size}),We(n,{size:e.size})):n}function G(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=va[t[s]];const r=`0x${n}`;return typeof e.size=="number"?(oe(r,{size:e.size}),We(r,{dir:"right",size:e.size})):r}function R(t,e={}){const{signed:n,size:r}=e,s=BigInt(t);let a;r?n?a=(1n<<BigInt(r)*8n-1n)-1n:a=2n**(BigInt(r)*8n)-1n:typeof t=="number"&&(a=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof a=="bigint"&&n?-a-1n:0;if(a&&s>a||s<i){const c=typeof t=="bigint"?"n":"";throw new fa({max:a?`${a}${c}`:void 0,min:`${i}${c}`,signed:n,size:r,value:`${t}${c}`})}const o=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?We(o,{size:r}):o}const wa=new TextEncoder;function Gn(t,e={}){const n=wa.encode(t);return G(n,e)}function Le(t,{includeName:e=!1}={}){if(t.type!=="function"&&t.type!=="event"&&t.type!=="error")throw new Ra(t.type);return`${t.name}(${Hn(t.inputs,{includeName:e})})`}function Hn(t,{includeName:e=!1}={}){return t?t.map(n=>xa(n,{includeName:e})).join(e?", ":","):""}function xa(t,{includeName:e}){return t.type.startsWith("tuple")?`(${Hn(t.components,{includeName:e})})${t.type.slice(5)}`:t.type+(e&&t.name?` ${t.name}`:"")}class _a extends m{constructor({docsPath:e}){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(`
3
- `),{docsPath:e,name:"AbiConstructorNotFoundError"})}}class _r extends m{constructor({docsPath:e}){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(`
4
- `),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class Pa extends m{constructor({data:e,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
5
- `),{metaMessages:[`Params: (${Hn(n,{includeName:!0})})`,`Data: ${e} (${r} 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=e,this.params=n,this.size=r}}class qn extends m{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class Aa extends m{constructor({expectedLength:e,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${n}`].join(`
6
- `),{name:"AbiEncodingArrayLengthMismatchError"})}}class Ea extends m{constructor({expectedSize:e,value:n}){super(`Size of bytes "${n}" (bytes${F(n)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Ta extends m{constructor({expectedLength:e,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${n}`].join(`
7
- `),{name:"AbiEncodingLengthMismatchError"})}}class Gr extends m{constructor(e,{docsPath:n}){super([`Encoded error signature "${e}" 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://openchain.xyz/signatures?query=${e}.`].join(`
8
- `),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class Lt extends m{constructor(e,{docsPath:n}={}){super([`Function ${e?`"${e}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
9
- `),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class ka extends m{constructor(e,{docsPath:n}){super([`Function "${e}" 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(`
10
- `),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class $a extends m{constructor(e,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${Le(e.abiItem)}\`, and`,`\`${n.type}\` in \`${Le(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class Ca extends m{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
11
- `),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Sa extends m{constructor(e,{docsPath:n}){super([`Type "${e}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
12
- `),{docsPath:n,name:"InvalidAbiDecodingType"})}}class Ia extends m{constructor(e){super([`Value "${e}" is not a valid array.`].join(`
13
- `),{name:"InvalidArrayError"})}}class Ra extends m{constructor(e){super([`"${e}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
14
- `),{name:"InvalidDefinitionTypeError"})}}function ke(t){return typeof t[0]=="string"?tn(t):Oa(t)}function Oa(t){let e=0;for(const s of t)e+=s.length;const n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function tn(t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}class Ue extends m{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class Wn extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}function Ot(t,e){const n=e||"hex",r=W.keccak_256(he(t,{strict:!1})?Vn(t):t);return n==="bytes"?r:Pn(r)}const hn=new Wn(8192);function nn(t,e){if(hn.has(`${t}.${e}`))return hn.get(`${t}.${e}`);const n=t.substring(2).toLowerCase(),r=Ot(Ur(n),"bytes"),s=n.split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&s[i]&&(s[i]=s[i].toUpperCase()),(r[i>>1]&15)>=8&&s[i+1]&&(s[i+1]=s[i+1].toUpperCase());const a=`0x${s.join("")}`;return hn.set(`${t}.${e}`,a),a}function Ma(t,e){if(!me(t,{strict:!1}))throw new Ue({address:t});return nn(t,e)}const ja=/^0x[a-fA-F0-9]{40}$/,pn=new Wn(8192);function me(t,e){const{strict:n=!0}=e??{},r=`${t}.${n}`;if(pn.has(r))return pn.get(r);const s=ja.test(t)?t.toLowerCase()===t?!0:n?nn(t)===t:!0:!1;return pn.set(r,s),s}function Ut(t,e,n,{strict:r}={}){return he(t,{strict:!1})?Ba(t,e,n,{strict:r}):Wr(t,e,n,{strict:r})}function Hr(t,e){if(typeof e=="number"&&e>0&&e>F(t)-1)throw new Dr({offset:e,position:"start",size:F(t)})}function qr(t,e,n){if(typeof e=="number"&&typeof n=="number"&&F(t)!==n-e)throw new Dr({offset:n,position:"end",size:F(t)})}function Wr(t,e,n,{strict:r}={}){Hr(t,e);const s=t.slice(e,n);return r&&qr(s,e,n),s}function Ba(t,e,n,{strict:r}={}){Hr(t,e);const s=`0x${t.replace("0x","").slice((e??0)*2,(n??t.length)*2)}`;return r&&qr(s,e,n),s}function Kn(t,e){if(t.length!==e.length)throw new Ta({expectedLength:t.length,givenLength:e.length});const n=Na({params:t,values:e}),r=Yn(n);return r.length===0?"0x":r}function Na({params:t,values:e}){const n=[];for(let r=0;r<t.length;r++)n.push(Jn({param:t[r],value:e[r]}));return n}function Jn({param:t,value:e}){const n=Xn(t.type);if(n){const[r,s]=n;return za(e,{length:r,param:{...t,type:s}})}if(t.type==="tuple")return Va(e,{param:t});if(t.type==="address")return Fa(e);if(t.type==="bool")return Da(e);if(t.type.startsWith("uint")||t.type.startsWith("int")){const r=t.type.startsWith("int");return La(e,{signed:r})}if(t.type.startsWith("bytes"))return Za(e,{param:t});if(t.type==="string")return Ua(e);throw new Ca(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Yn(t){let e=0;for(let a=0;a<t.length;a++){const{dynamic:i,encoded:o}=t[a];i?e+=32:e+=F(o)}const n=[],r=[];let s=0;for(let a=0;a<t.length;a++){const{dynamic:i,encoded:o}=t[a];i?(n.push(R(e+s,{size:32})),r.push(o),s+=F(o)):n.push(o)}return ke([...n,...r])}function Fa(t){if(!me(t))throw new Ue({address:t});return{dynamic:!1,encoded:ge(t.toLowerCase())}}function za(t,{length:e,param:n}){const r=e===null;if(!Array.isArray(t))throw new Ia(t);if(!r&&t.length!==e)throw new Aa({expectedLength:e,givenLength:t.length,type:`${n.type}[${e}]`});let s=!1;const a=[];for(let i=0;i<t.length;i++){const o=Jn({param:n,value:t[i]});o.dynamic&&(s=!0),a.push(o)}if(r||s){const i=Yn(a);if(r){const o=R(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?ke([o,i]):o}}if(s)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:ke(a.map(({encoded:i})=>i))}}function Za(t,{param:e}){const[,n]=e.type.split("bytes"),r=F(t);if(!n){let s=t;return r%32!==0&&(s=ge(s,{dir:"right",size:Math.ceil((t.length-2)/2/32)*32})),{dynamic:!0,encoded:ke([ge(R(r,{size:32})),s])}}if(r!==Number.parseInt(n))throw new Ea({expectedSize:Number.parseInt(n),value:t});return{dynamic:!1,encoded:ge(t,{dir:"right"})}}function Da(t){if(typeof t!="boolean")throw new m(`Invalid boolean value: "${t}" (type: ${typeof t}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:ge(Vr(t))}}function La(t,{signed:e}){return{dynamic:!1,encoded:R(t,{size:32,signed:e})}}function Ua(t){const e=Gn(t),n=Math.ceil(F(e)/32),r=[];for(let s=0;s<n;s++)r.push(ge(Ut(e,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:ke([ge(R(F(e),{size:32})),...r])}}function Va(t,{param:e}){let n=!1;const r=[];for(let s=0;s<e.components.length;s++){const a=e.components[s],i=Array.isArray(t)?s:a.name,o=Jn({param:a,value:t[i]});r.push(o),o.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Yn(r):ke(r.map(({encoded:s})=>s))}}function Xn(t){const e=t.match(/^(.*)\[(\d+)?\]$/);return e?[e[2]?Number(e[2]):null,e[1]]:void 0}const mn="/docs/contract/encodeDeployData";function Kr(t){const{abi:e,args:n,bytecode:r}=t;if(!n||n.length===0)return r;const s=e.find(i=>"type"in i&&i.type==="constructor");if(!s)throw new _a({docsPath:mn});if(!("inputs"in s))throw new _r({docsPath:mn});if(!s.inputs||s.inputs.length===0)throw new _r({docsPath:mn});const a=Kn(s.inputs,n);return tn([r,a])}function ce(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}class Jr extends m{constructor({docsPath:e}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(`
15
- `),{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}class yn extends m{constructor({docsPath:e,metaMessages:n,type:r}){super(`Account type "${r}" is not supported.`,{docsPath:e,metaMessages:n,name:"AccountTypeNotSupportedError"})}}function Ga(t){const e=Ot(`0x${t.substring(4)}`).substring(26);return nn(`0x${e}`)}async function Ha({hash:t,signature:e}){const n=he(t)?t:Pn(t),{secp256k1:r}=await Promise.resolve().then(()=>require("./utils-BLfs3EZx.cjs")).then(i=>i.secp256k1);return`0x${(()=>{if(typeof e=="object"&&"r"in e&&"s"in e){const{r:u,s:d,v:f,yParity:h}=e,b=Number(h??f),v=Pr(b);return new r.Signature(rt(u),rt(d)).addRecoveryBit(v)}const i=he(e)?e:Pn(e),o=De(`0x${i.slice(130)}`),c=Pr(o);return r.Signature.fromCompact(i.substring(2,130)).addRecoveryBit(c)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Pr(t){if(t===0||t===1)return t;if(t===27)return 0;if(t===28)return 1;throw new Error("Invalid yParityOrV value")}async function qa({hash:t,signature:e}){return Ga(await Ha({hash:t,signature:e}))}class Ar extends m{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class Wa extends m{constructor({length:e,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class Ka extends m{constructor({count:e,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const Ja={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 Ka({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(t){if(t<0||t>this.bytes.length-1)throw new Wa({length:this.bytes.length,position:t})},decrementPosition(t){if(t<0)throw new Ar({offset:t});const e=this.position-t;this.assertPosition(e),this.position=e},getReadCount(t){return this.positionReadCount.get(t||this.position)||0},incrementPosition(t){if(t<0)throw new Ar({offset:t});const e=this.position+t;this.assertPosition(e),this.position=e},inspectByte(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectBytes(t,e){const n=e??this.position;return this.assertPosition(n+t-1),this.bytes.subarray(n,n+t)},inspectUint8(t){const e=t??this.position;return this.assertPosition(e),this.bytes[e]},inspectUint16(t){const e=t??this.position;return this.assertPosition(e+1),this.dataView.getUint16(e)},inspectUint24(t){const e=t??this.position;return this.assertPosition(e+2),(this.dataView.getUint16(e)<<8)+this.dataView.getUint8(e+2)},inspectUint32(t){const e=t??this.position;return this.assertPosition(e+3),this.dataView.getUint32(e)},pushByte(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushBytes(t){this.assertPosition(this.position+t.length-1),this.bytes.set(t,this.position),this.position+=t.length},pushUint8(t){this.assertPosition(this.position),this.bytes[this.position]=t,this.position++},pushUint16(t){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,t),this.position+=2},pushUint24(t){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,t>>8),this.dataView.setUint8(this.position+2,t&255),this.position+=3},pushUint32(t){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,t),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const t=this.inspectByte();return this.position++,t},readBytes(t,e){this.assertReadLimit(),this._touch();const n=this.inspectBytes(t);return this.position+=e??t,n},readUint8(){this.assertReadLimit(),this._touch();const t=this.inspectUint8();return this.position+=1,t},readUint16(){this.assertReadLimit(),this._touch();const t=this.inspectUint16();return this.position+=2,t},readUint24(){this.assertReadLimit(),this._touch();const t=this.inspectUint24();return this.position+=3,t},readUint32(){this.assertReadLimit(),this._touch();const t=this.inspectUint32();return this.position+=4,t},get remaining(){return this.bytes.length-this.position},setPosition(t){const e=this.position;return this.assertPosition(t),this.position=t,()=>this.position=e},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const t=this.getReadCount();this.positionReadCount.set(this.position,t+1),t>0&&this.recursiveReadCount++}};function Qn(t,{recursiveReadLimit:e=8192}={}){const n=Object.create(Ja);return n.bytes=t,n.dataView=new DataView(t.buffer,t.byteOffset,t.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=e,n}function Ya(t,e="hex"){const n=Yr(t),r=Qn(new Uint8Array(n.length));return n.encode(r),e==="hex"?G(r.bytes):r.bytes}function Yr(t){return Array.isArray(t)?Xa(t.map(e=>Yr(e))):Qa(t)}function Xa(t){const e=t.reduce((s,a)=>s+a.length,0),n=Xr(e);return{length:e<=55?1+e:1+n+e,encode(s){e<=55?s.pushByte(192+e):(s.pushByte(247+n),n===1?s.pushUint8(e):n===2?s.pushUint16(e):n===3?s.pushUint24(e):s.pushUint32(e));for(const{encode:a}of t)a(s)}}}function Qa(t){const e=typeof t=="string"?pe(t):t,n=Xr(e.length);return{length:e.length===1&&e[0]<128?1:e.length<=55?1+e.length:1+n+e.length,encode(s){e.length===1&&e[0]<128?s.pushBytes(e):e.length<=55?(s.pushByte(128+e.length),s.pushBytes(e)):(s.pushByte(183+n),n===1?s.pushUint8(e.length):n===2?s.pushUint16(e.length):n===3?s.pushUint24(e.length):s.pushUint32(e.length),s.pushBytes(e))}}}function Xr(t){if(t<2**8)return 1;if(t<2**16)return 2;if(t<2**24)return 3;if(t<2**32)return 4;throw new m("Length is too large.")}function ei(t){const{chainId:e,contractAddress:n,nonce:r,to:s}=t,a=Ot(tn(["0x05",Ya([R(e),n,r?R(r):"0x"])]));return s==="bytes"?pe(a):a}async function Qr(t){const{authorization:e,signature:n}=t;return qa({hash:ei(e),signature:n??e})}class An extends m{constructor({blockNumber:e,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class ti extends m{constructor({chain:e,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${e.id} – ${e.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e.id} – ${e.name}`],name:"ChainMismatchError"})}}class ni extends m{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(`
16
- `),{name:"ChainNotFoundError"})}}class es extends m{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}function ri({chain:t,currentChainId:e}){if(!t)throw new ni;if(e!==t.id)throw new ti({chain:t,currentChainId:e})}const si={gwei:9,wei:18},ai={ether:-9,wei:9};function ts(t,e){let n=t.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(e,"0");let[s,a]=[n.slice(0,n.length-e),n.slice(n.length-e)];return a=a.replace(/(0+)$/,""),`${r?"-":""}${s||"0"}${a?`.${a}`:""}`}function V(t,e="wei"){return ts(t,ai[e])}class Be extends m{constructor({cause:e,message:n}={}){var s;const r=(s=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:s.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(Be,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Be,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Vt extends m{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${V(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(Vt,"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 En extends m{constructor({cause:e,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${V(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(En,"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 Tn extends m{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(Tn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class kn extends m{constructor({cause:e,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
17
- `),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(kn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class $n extends m{constructor({cause:e,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty($n,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Cn extends m{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
18
- `),{cause:e,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(Cn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Sn extends m{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Sn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class In extends m{constructor({cause:e,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(In,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Rn extends m{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Rn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Gt extends m{constructor({cause:e,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${V(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${V(r)} gwei`:""}).`].join(`
19
- `),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(Gt,"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 rn extends m{constructor({cause:e}){super(`An error occurred while executing: ${e==null?void 0:e.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}function er(t,e="wei"){return ts(t,si[e])}function Mt(t){const e=Object.entries(t).map(([r,s])=>s===void 0||s===!1?null:[r,s]).filter(Boolean),n=e.reduce((r,[s])=>Math.max(r,s.length),0);return e.map(([r,s])=>` ${`${r}:`.padEnd(n+1)} ${s}`).join(`
20
- `)}class ii extends m{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
21
- `),{name:"FeeConflictError"})}}class oi extends m{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Mt(e),"}","","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 ci extends m{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:i,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:f,value:h}){var v;const b=Mt({chain:s&&`${s==null?void 0:s.name} (id: ${s==null?void 0:s.id})`,from:n==null?void 0:n.address,to:f,value:typeof h<"u"&&`${er(h)} ${((v=s==null?void 0:s.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${V(o)} gwei`,maxFeePerGas:typeof c<"u"&&`${V(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${V(u)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",b].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}const jt=(t,e,n)=>JSON.stringify(t,(r,s)=>typeof s=="bigint"?s.toString():s,n),ui=t=>t,tr=t=>t;class nr extends m{constructor({body:e,cause:n,details:r,headers:s,status:a,url:i}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[a&&`Status: ${a}`,`URL: ${tr(i)}`,e&&`Request body: ${jt(e)}`].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=e,this.headers=s,this.status=a,this.url=i}}class di extends m{constructor({body:e,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${tr(r)}`,`Request body: ${jt(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=n.code}}const li=-1;class H extends m{constructor(e,{code:n,docsPath:r,metaMessages:s,name:a,shortMessage:i}){super(i,{cause:e,docsPath:r,metaMessages:s||(e==null?void 0:e.metaMessages),name:a||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a||e.name,this.code=e instanceof di?e.code:n??li}}class Ke extends H{constructor(e,n){super(e,n),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=n.data}}class st extends H{constructor(e){super(e,{code:st.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(st,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class at extends H{constructor(e){super(e,{code:at.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(at,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class it extends H{constructor(e,{method:n}={}){super(e,{code:it.code,name:"MethodNotFoundRpcError",shortMessage:`The method${n?` "${n}"`:""} does not exist / is not available.`})}}Object.defineProperty(it,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ot extends H{constructor(e){super(e,{code:ot.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
22
- `)})}}Object.defineProperty(ot,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class $e extends H{constructor(e){super(e,{code:$e.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty($e,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class ct extends H{constructor(e){super(e,{code:ct.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
23
- `)})}}Object.defineProperty(ct,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ut extends H{constructor(e){super(e,{code:ut.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ut,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class dt extends H{constructor(e){super(e,{code:dt.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(dt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class lt extends H{constructor(e){super(e,{code:lt.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(lt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class ft extends H{constructor(e,{method:n}={}){super(e,{code:ft.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${n?` "${n}"`:""} is not implemented.`})}}Object.defineProperty(ft,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Ve extends H{constructor(e){super(e,{code:Ve.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Ve,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class ht extends H{constructor(e){super(e,{code:ht.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(ht,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Fe extends Ke{constructor(e){super(e,{code:Fe.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Fe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class pt extends Ke{constructor(e){super(e,{code:pt.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(pt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class mt extends Ke{constructor(e,{method:n}={}){super(e,{code:mt.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${n?` " ${n}"`:""}.`})}}Object.defineProperty(mt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class yt extends Ke{constructor(e){super(e,{code:yt.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(yt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class bt extends Ke{constructor(e){super(e,{code:bt.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(bt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class gt extends Ke{constructor(e){super(e,{code:gt.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class fi extends H{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function rr(t,e){const n=(t.details||"").toLowerCase(),r=t instanceof m?t.walk(s=>(s==null?void 0:s.code)===Be.code):t;return r instanceof m?new Be({cause:t,message:r.details}):Be.nodeMessage.test(n)?new Be({cause:t,message:t.details}):Vt.nodeMessage.test(n)?new Vt({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):En.nodeMessage.test(n)?new En({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas}):Tn.nodeMessage.test(n)?new Tn({cause:t,nonce:e==null?void 0:e.nonce}):kn.nodeMessage.test(n)?new kn({cause:t,nonce:e==null?void 0:e.nonce}):$n.nodeMessage.test(n)?new $n({cause:t,nonce:e==null?void 0:e.nonce}):Cn.nodeMessage.test(n)?new Cn({cause:t}):Sn.nodeMessage.test(n)?new Sn({cause:t,gas:e==null?void 0:e.gas}):In.nodeMessage.test(n)?new In({cause:t,gas:e==null?void 0:e.gas}):Rn.nodeMessage.test(n)?new Rn({cause:t}):Gt.nodeMessage.test(n)?new Gt({cause:t,maxFeePerGas:e==null?void 0:e.maxFeePerGas,maxPriorityFeePerGas:e==null?void 0:e.maxPriorityFeePerGas}):new rn({cause:t})}function hi(t,{docsPath:e,...n}){const r=(()=>{const s=rr(t,n);return s instanceof rn?t:s})();return new ci(r,{docsPath:e,...n})}function sr(t,{format:e}){if(!e)return{};const n={};function r(a){const i=Object.keys(a);for(const o of i)o in t&&(n[o]=t[o]),a[o]&&typeof a[o]=="object"&&!Array.isArray(a[o])&&r(a[o])}const s=e(t||{});return r(s),n}const pi={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function ar(t){const e={};return typeof t.authorizationList<"u"&&(e.authorizationList=mi(t.authorizationList)),typeof t.accessList<"u"&&(e.accessList=t.accessList),typeof t.blobVersionedHashes<"u"&&(e.blobVersionedHashes=t.blobVersionedHashes),typeof t.blobs<"u"&&(typeof t.blobs[0]!="string"?e.blobs=t.blobs.map(n=>G(n)):e.blobs=t.blobs),typeof t.data<"u"&&(e.data=t.data),typeof t.from<"u"&&(e.from=t.from),typeof t.gas<"u"&&(e.gas=R(t.gas)),typeof t.gasPrice<"u"&&(e.gasPrice=R(t.gasPrice)),typeof t.maxFeePerBlobGas<"u"&&(e.maxFeePerBlobGas=R(t.maxFeePerBlobGas)),typeof t.maxFeePerGas<"u"&&(e.maxFeePerGas=R(t.maxFeePerGas)),typeof t.maxPriorityFeePerGas<"u"&&(e.maxPriorityFeePerGas=R(t.maxPriorityFeePerGas)),typeof t.nonce<"u"&&(e.nonce=R(t.nonce)),typeof t.to<"u"&&(e.to=t.to),typeof t.type<"u"&&(e.type=pi[t.type]),typeof t.value<"u"&&(e.value=R(t.value)),e}function mi(t){return t.map(e=>({address:e.contractAddress,r:e.r,s:e.s,chainId:R(e.chainId),nonce:R(e.nonce),...typeof e.yParity<"u"?{yParity:R(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:R(e.v)}:{}}))}function Z(t,e,n){const r=t[e.name];if(typeof r=="function")return r;const s=t[n];return typeof s=="function"?s:a=>e(t,a)}const yi=2n**256n-1n;function sn(t){const{account:e,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:s,to:a}=t,i=e?ce(e):void 0;if(i&&!me(i.address))throw new Ue({address:i.address});if(a&&!me(a))throw new Ue({address:a});if(typeof n<"u"&&(typeof r<"u"||typeof s<"u"))throw new ii;if(r&&r>yi)throw new Vt({maxFeePerGas:r});if(s&&r&&s>r)throw new Gt({maxFeePerGas:r,maxPriorityFeePerGas:s})}async function ns(t){const e=await t.request({method:"eth_chainId"},{dedupe:!0});return De(e)}class bi extends m{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class ir extends m{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class gi extends m{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${V(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class vi extends m{constructor({blockHash:e,blockNumber:n}){let r="Block";e&&(r=`Block at hash "${e}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}const wi={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function xi(t){const e={...t,blockHash:t.blockHash?t.blockHash:null,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,chainId:t.chainId?De(t.chainId):void 0,gas:t.gas?BigInt(t.gas):void 0,gasPrice:t.gasPrice?BigInt(t.gasPrice):void 0,maxFeePerBlobGas:t.maxFeePerBlobGas?BigInt(t.maxFeePerBlobGas):void 0,maxFeePerGas:t.maxFeePerGas?BigInt(t.maxFeePerGas):void 0,maxPriorityFeePerGas:t.maxPriorityFeePerGas?BigInt(t.maxPriorityFeePerGas):void 0,nonce:t.nonce?De(t.nonce):void 0,to:t.to?t.to:null,transactionIndex:t.transactionIndex?Number(t.transactionIndex):null,type:t.type?wi[t.type]:void 0,typeHex:t.type?t.type:void 0,value:t.value?BigInt(t.value):void 0,v:t.v?BigInt(t.v):void 0};return t.authorizationList&&(e.authorizationList=_i(t.authorizationList)),e.yParity=(()=>{if(t.yParity)return Number(t.yParity);if(typeof e.v=="bigint"){if(e.v===0n||e.v===27n)return 0;if(e.v===1n||e.v===28n)return 1;if(e.v>=35n)return e.v%2n===0n?1:0}})(),e.type==="legacy"&&(delete e.accessList,delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas,delete e.yParity),e.type==="eip2930"&&(delete e.maxFeePerBlobGas,delete e.maxFeePerGas,delete e.maxPriorityFeePerGas),e.type==="eip1559"&&delete e.maxFeePerBlobGas,e}function _i(t){return t.map(e=>({contractAddress:e.address,r:e.r,s:e.s,chainId:Number(e.chainId),nonce:Number(e.nonce),...typeof e.yParity<"u"?{yParity:Number(e.yParity)}:{},...typeof e.v<"u"&&typeof e.yParity>"u"?{v:Number(e.v)}:{}}))}function Pi(t){var n;const e=(n=t.transactions)==null?void 0:n.map(r=>typeof r=="string"?r:xi(r));return{...t,baseFeePerGas:t.baseFeePerGas?BigInt(t.baseFeePerGas):null,blobGasUsed:t.blobGasUsed?BigInt(t.blobGasUsed):void 0,difficulty:t.difficulty?BigInt(t.difficulty):void 0,excessBlobGas:t.excessBlobGas?BigInt(t.excessBlobGas):void 0,gasLimit:t.gasLimit?BigInt(t.gasLimit):void 0,gasUsed:t.gasUsed?BigInt(t.gasUsed):void 0,hash:t.hash?t.hash:null,logsBloom:t.logsBloom?t.logsBloom:null,nonce:t.nonce?t.nonce:null,number:t.number?BigInt(t.number):null,size:t.size?BigInt(t.size):void 0,timestamp:t.timestamp?BigInt(t.timestamp):void 0,transactions:e,totalDifficulty:t.totalDifficulty?BigInt(t.totalDifficulty):null}}async function Ht(t,{blockHash:e,blockNumber:n,blockTag:r,includeTransactions:s}={}){var d,f,h;const a=r??"latest",i=s??!1,o=n!==void 0?R(n):void 0;let c=null;if(e?c=await t.request({method:"eth_getBlockByHash",params:[e,i]},{dedupe:!0}):c=await t.request({method:"eth_getBlockByNumber",params:[o||a,i]},{dedupe:!!o}),!c)throw new vi({blockHash:e,blockNumber:n});return(((h=(f=(d=t.chain)==null?void 0:d.formatters)==null?void 0:f.block)==null?void 0:h.format)||Pi)(c)}async function rs(t){const e=await t.request({method:"eth_gasPrice"});return BigInt(e)}async function Ai(t,e){var a,i;const{block:n,chain:r=t.chain,request:s}=e||{};try{const o=((a=r==null?void 0:r.fees)==null?void 0:a.maxPriorityFeePerGas)??((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee);if(typeof o=="function"){const u=n||await Z(t,Ht,"getBlock")({}),d=await o({block:u,client:t,request:s});if(d===null)throw new Error;return d}if(typeof o<"u")return o;const c=await t.request({method:"eth_maxPriorityFeePerGas"});return rt(c)}catch{const[o,c]=await Promise.all([n?Promise.resolve(n):Z(t,Ht,"getBlock")({}),Z(t,rs,"getGasPrice")({})]);if(typeof o.baseFeePerGas!="bigint")throw new ir;const u=c-o.baseFeePerGas;return u<0n?0n:u}}async function Er(t,e){var h,b;const{block:n,chain:r=t.chain,request:s,type:a="eip1559"}=e||{},i=await(async()=>{var v,P;return typeof((v=r==null?void 0:r.fees)==null?void 0:v.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:t,request:s}):((P=r==null?void 0:r.fees)==null?void 0:P.baseFeeMultiplier)??1.2})();if(i<1)throw new bi;const c=10**(((h=i.toString().split(".")[1])==null?void 0:h.length)??0),u=v=>v*BigInt(Math.ceil(i*c))/BigInt(c),d=n||await Z(t,Ht,"getBlock")({});if(typeof((b=r==null?void 0:r.fees)==null?void 0:b.estimateFeesPerGas)=="function"){const v=await r.fees.estimateFeesPerGas({block:n,client:t,multiply:u,request:s,type:a});if(v!==null)return v}if(a==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new ir;const v=typeof(s==null?void 0:s.maxPriorityFeePerGas)=="bigint"?s.maxPriorityFeePerGas:await Ai(t,{block:d,chain:r,request:s}),P=u(d.baseFeePerGas);return{maxFeePerGas:(s==null?void 0:s.maxFeePerGas)??P+v,maxPriorityFeePerGas:v}}return{gasPrice:(s==null?void 0:s.gasPrice)??u(await Z(t,rs,"getGasPrice")({}))}}class Ei extends m{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:i,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:f,value:h}){var v;const b=Mt({from:n==null?void 0:n.address,to:f,value:typeof h<"u"&&`${er(h)} ${((v=s==null?void 0:s.nativeCurrency)==null?void 0:v.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${V(o)} gwei`,maxFeePerGas:typeof c<"u"&&`${V(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${V(u)} gwei`,nonce:d});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",b].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}function Ti(t,{docsPath:e,...n}){const r=(()=>{const s=rr(t,n);return s instanceof rn?t:s})();return new Ei(r,{docsPath:e,...n})}class ki extends m{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class $i extends m{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Tr(t){return t.reduce((e,{slot:n,value:r})=>`${e} ${n}: ${r}
24
- `,"")}function Ci(t){return t.reduce((e,{address:n,...r})=>{let s=`${e} ${n}:
25
- `;return r.nonce&&(s+=` nonce: ${r.nonce}
26
- `),r.balance&&(s+=` balance: ${r.balance}
27
- `),r.code&&(s+=` code: ${r.code}
28
- `),r.state&&(s+=` state:
29
- `,s+=Tr(r.state)),r.stateDiff&&(s+=` stateDiff:
30
- `,s+=Tr(r.stateDiff)),s},` State Override:
31
- `).slice(0,-1)}function kr(t){if(!(!t||t.length===0))return t.reduce((e,{slot:n,value:r})=>{if(n.length!==66)throw new wr({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new wr({size:r.length,targetSize:66,type:"hex"});return e[n]=r,e},{})}function Si(t){const{balance:e,nonce:n,state:r,stateDiff:s,code:a}=t,i={};if(a!==void 0&&(i.code=a),e!==void 0&&(i.balance=R(e)),n!==void 0&&(i.nonce=R(n)),r!==void 0&&(i.state=kr(r)),s!==void 0){if(i.state)throw new $i;i.stateDiff=kr(s)}return i}function ss(t){if(!t)return;const e={};for(const{address:n,...r}of t){if(!me(n,{strict:!1}))throw new Ue({address:n});if(e[n])throw new ki({address:n});e[n]=Si(r)}return e}async function Ii(t,{address:e,blockNumber:n,blockTag:r="latest"}){const s=n?R(n):void 0,a=await t.request({method:"eth_getBalance",params:[e,s||r]});return BigInt(a)}async function Ri(t,e){var s,a,i;const n=e.account??t.account,r=n?ce(n):void 0;try{let Xe=function(U){const{block:X,request:Y,rpcStateOverride:Ae}=U;return t.request({method:"eth_estimateGas",params:Ae?[Y,X??"latest",Ae]:X?[Y,X]:[Y]})};const{accessList:o,authorizationList:c,blobs:u,blobVersionedHashes:d,blockNumber:f,blockTag:h,data:b,gas:v,gasPrice:P,maxFeePerBlobGas:k,maxFeePerGas:S,maxPriorityFeePerGas:A,nonce:I,value:q,stateOverride:J,...B}=await ds(t,{...e,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),$=(f?R(f):void 0)||h,N=ss(J),dn=await(async()=>{if(B.to)return B.to;if(c&&c.length>0)return await Qr({authorization:c[0]}).catch(()=>{throw new m("`to` is required. Could not infer from `authorizationList`")})})();sn(e);const Je=(i=(a=(s=t.chain)==null?void 0:s.formatters)==null?void 0:a.transactionRequest)==null?void 0:i.format,Ye=(Je||ar)({...sr(B,{format:Je}),from:r==null?void 0:r.address,accessList:o,authorizationList:c,blobs:u,blobVersionedHashes:d,data:b,gas:v,gasPrice:P,maxFeePerBlobGas:k,maxFeePerGas:S,maxPriorityFeePerGas:A,nonce:I,to:dn,value:q});let Oe=BigInt(await Xe({block:$,request:Ye,rpcStateOverride:N}));if(c){const U=await Ii(t,{address:Ye.from}),X=await Promise.all(c.map(async Y=>{const{contractAddress:Ae}=Y,Me=await Xe({block:$,request:{authorizationList:void 0,data:b,from:r==null?void 0:r.address,to:Ae,value:R(U)},rpcStateOverride:N}).catch(()=>100000n);return 2n*BigInt(Me)}));Oe+=X.reduce((Y,Ae)=>Y+Ae,0n)}return Oe}catch(o){throw Ti(o,{...e,account:r,chain:t.chain})}}async function Oi(t,{address:e,blockTag:n="latest",blockNumber:r}){const s=await t.request({method:"eth_getTransactionCount",params:[e,r?R(r):n]},{dedupe:!!r});return De(s)}function as(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),r=typeof t.blobs[0]=="string"?t.blobs.map(a=>pe(a)):t.blobs,s=[];for(const a of r)s.push(Uint8Array.from(e.blobToKzgCommitment(a)));return n==="bytes"?s:s.map(a=>G(a))}function is(t){const{kzg:e}=t,n=t.to??(typeof t.blobs[0]=="string"?"hex":"bytes"),r=typeof t.blobs[0]=="string"?t.blobs.map(i=>pe(i)):t.blobs,s=typeof t.commitments[0]=="string"?t.commitments.map(i=>pe(i)):t.commitments,a=[];for(let i=0;i<r.length;i++){const o=r[i],c=s[i];a.push(Uint8Array.from(e.computeBlobKzgProof(o,c)))}return n==="bytes"?a:a.map(i=>G(i))}function Mi(t,e){return W.sha256(he(t,{strict:!1})?Vn(t):t)}function ji(t){const{commitment:e,version:n=1}=t,r=t.to??(typeof e=="string"?"hex":"bytes"),s=Mi(e);return s.set([n],0),r==="bytes"?s:G(s)}function Bi(t){const{commitments:e,version:n}=t,r=t.to??(typeof e[0]=="string"?"hex":"bytes"),s=[];for(const a of e)s.push(ji({commitment:a,to:r,version:n}));return s}const $r=6,os=32,or=4096,cs=os*or,Cr=cs*$r-1-1*or*$r;class Ni extends m{constructor({maxSize:e,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${n} bytes`],name:"BlobSizeTooLargeError"})}}class Fi extends m{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}function zi(t){const e=t.to??(typeof t.data=="string"?"hex":"bytes"),n=typeof t.data=="string"?pe(t.data):t.data,r=F(n);if(!r)throw new Fi;if(r>Cr)throw new Ni({maxSize:Cr,size:r});const s=[];let a=!0,i=0;for(;a;){const o=Qn(new Uint8Array(cs));let c=0;for(;c<or;){const u=n.slice(i,i+(os-1));if(o.pushByte(0),o.pushBytes(u),u.length<31){o.pushByte(128),a=!1;break}c++,i+=31}s.push(o)}return e==="bytes"?s.map(o=>o.bytes):s.map(o=>G(o.bytes))}function Zi(t){const{data:e,kzg:n,to:r}=t,s=t.blobs??zi({data:e,to:r}),a=t.commitments??as({blobs:s,kzg:n,to:r}),i=t.proofs??is({blobs:s,commitments:a,kzg:n,to:r}),o=[];for(let c=0;c<s.length;c++)o.push({blob:s[c],commitment:a[c],proof:i[c]});return o}function Di(t){if(t.type)return t.type;if(typeof t.authorizationList<"u")return"eip7702";if(typeof t.blobs<"u"||typeof t.blobVersionedHashes<"u"||typeof t.maxFeePerBlobGas<"u"||typeof t.sidecars<"u")return"eip4844";if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")return"eip1559";if(typeof t.gasPrice<"u")return typeof t.accessList<"u"?"eip2930":"legacy";throw new oi({transaction:t})}const us=["blobVersionedHashes","chainId","fees","gas","nonce","type"];async function ds(t,e){const{account:n=t.account,blobs:r,chain:s,gas:a,kzg:i,nonce:o,nonceManager:c,parameters:u=us,type:d}=e,f=n?ce(n):void 0,h={...e,...f?{from:f==null?void 0:f.address}:{}};let b;async function v(){return b||(b=await Z(t,Ht,"getBlock")({blockTag:"latest"}),b)}let P;async function k(){return P||(s?s.id:typeof e.chainId<"u"?e.chainId:(P=await Z(t,ns,"getChainId")({}),P))}if((u.includes("blobVersionedHashes")||u.includes("sidecars"))&&r&&i){const S=as({blobs:r,kzg:i});if(u.includes("blobVersionedHashes")){const A=Bi({commitments:S,to:"hex"});h.blobVersionedHashes=A}if(u.includes("sidecars")){const A=is({blobs:r,commitments:S,kzg:i}),I=Zi({blobs:r,commitments:S,proofs:A,to:"hex"});h.sidecars=I}}if(u.includes("chainId")&&(h.chainId=await k()),u.includes("nonce")&&typeof o>"u"&&f)if(c){const S=await k();h.nonce=await c.consume({address:f.address,chainId:S,client:t})}else h.nonce=await Z(t,Oi,"getTransactionCount")({address:f.address,blockTag:"pending"});if((u.includes("fees")||u.includes("type"))&&typeof d>"u")try{h.type=Di(h)}catch{const S=await v();h.type=typeof(S==null?void 0:S.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(u.includes("fees"))if(h.type!=="legacy"&&h.type!=="eip2930"){if(typeof h.maxFeePerGas>"u"||typeof h.maxPriorityFeePerGas>"u"){const S=await v(),{maxFeePerGas:A,maxPriorityFeePerGas:I}=await Er(t,{block:S,chain:s,request:h});if(typeof e.maxPriorityFeePerGas>"u"&&e.maxFeePerGas&&e.maxFeePerGas<I)throw new gi({maxPriorityFeePerGas:I});h.maxPriorityFeePerGas=I,h.maxFeePerGas=A}}else{if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")throw new ir;const S=await v(),{gasPrice:A}=await Er(t,{block:S,chain:s,request:h,type:"legacy"});h.gasPrice=A}return u.includes("gas")&&typeof a>"u"&&(h.gas=await Z(t,Ri,"estimateGas")({...h,account:f?{address:f.address,type:"json-rpc"}:void 0})),sn(h),delete h.parameters,h}async function Li(t,{serializedTransaction:e}){return t.request({method:"eth_sendRawTransaction",params:[e]},{retryCount:0})}async function Ui(t,e){var S,A,I,q;const{account:n=t.account,chain:r=t.chain,accessList:s,authorizationList:a,blobs:i,data:o,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:b,value:v,...P}=e;if(!n)throw new Jr({docsPath:"/docs/actions/wallet/sendTransaction"});const k=ce(n);try{sn(e);const J=await(async()=>{if(e.to)return e.to;if(a&&a.length>0)return await Qr({authorization:a[0]}).catch(()=>{throw new m("`to` is required. Could not infer from `authorizationList`.")})})();if(k.type==="json-rpc"){let B;r!==null&&(B=await Z(t,ns,"getChainId")({}),ri({currentChainId:B,chain:r}));const re=(I=(A=(S=t.chain)==null?void 0:S.formatters)==null?void 0:A.transactionRequest)==null?void 0:I.format,N=(re||ar)({...sr(P,{format:re}),accessList:s,authorizationList:a,blobs:i,chainId:B,data:o,from:k.address,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:b,to:J,value:v});return await t.request({method:"eth_sendTransaction",params:[N]},{retryCount:0})}if(k.type==="local"){const B=await Z(t,ds,"prepareTransactionRequest")({account:k,accessList:s,authorizationList:a,blobs:i,chain:r,data:o,gas:c,gasPrice:u,maxFeePerBlobGas:d,maxFeePerGas:f,maxPriorityFeePerGas:h,nonce:b,nonceManager:k.nonceManager,parameters:[...us,"sidecars"],value:v,...P,to:J}),re=(q=r==null?void 0:r.serializers)==null?void 0:q.transaction,$=await k.signTransaction(B,{serializer:re});return await Z(t,Li,"sendRawTransaction")({serializedTransaction:$})}throw k.type==="smart"?new yn({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new yn({docsPath:"/docs/actions/wallet/sendTransaction",type:k.type})}catch(J){throw J instanceof yn?J:hi(J,{...e,account:k,chain:e.chain||void 0})}}const Sr=[{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"}];function Vi(t,e={}){typeof e.size<"u"&&oe(t,{size:e.size});const n=G(t,e);return rt(n,e)}function Gi(t,e={}){let n=t;if(typeof e.size<"u"&&(oe(n,{size:e.size}),n=Un(n)),n.length>1||n[0]>1)throw new ha(n);return!!n[0]}function fe(t,e={}){typeof e.size<"u"&&oe(t,{size:e.size});const n=G(t,e);return De(n,e)}function Hi(t,e={}){let n=t;return typeof e.size<"u"&&(oe(n,{size:e.size}),n=Un(n,{dir:"right"})),new TextDecoder().decode(n)}function ls(t,e){const n=typeof e=="string"?pe(e):e,r=Qn(n);if(F(n)===0&&t.length>0)throw new qn;if(F(e)&&F(e)<32)throw new Pa({data:typeof e=="string"?e:G(e),params:t,size:F(e)});let s=0;const a=[];for(let i=0;i<t.length;++i){const o=t[i];r.setPosition(s);const[c,u]=ze(r,o,{staticPosition:0});s+=u,a.push(c)}return a}function ze(t,e,{staticPosition:n}){const r=Xn(e.type);if(r){const[s,a]=r;return Wi(t,{...e,type:a},{length:s,staticPosition:n})}if(e.type==="tuple")return Xi(t,e,{staticPosition:n});if(e.type==="address")return qi(t);if(e.type==="bool")return Ki(t);if(e.type.startsWith("bytes"))return Ji(t,e,{staticPosition:n});if(e.type.startsWith("uint")||e.type.startsWith("int"))return Yi(t,e);if(e.type==="string")return Qi(t,{staticPosition:n});throw new Sa(e.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Ir=32,On=32;function qi(t){const e=t.readBytes(32);return[nn(G(Wr(e,-20))),32]}function Wi(t,e,{length:n,staticPosition:r}){if(!n){const i=fe(t.readBytes(On)),o=r+i,c=o+Ir;t.setPosition(o);const u=fe(t.readBytes(Ir)),d=vt(e);let f=0;const h=[];for(let b=0;b<u;++b){t.setPosition(c+(d?b*32:f));const[v,P]=ze(t,e,{staticPosition:c});f+=P,h.push(v)}return t.setPosition(r+32),[h,32]}if(vt(e)){const i=fe(t.readBytes(On)),o=r+i,c=[];for(let u=0;u<n;++u){t.setPosition(o+u*32);const[d]=ze(t,e,{staticPosition:o});c.push(d)}return t.setPosition(r+32),[c,32]}let s=0;const a=[];for(let i=0;i<n;++i){const[o,c]=ze(t,e,{staticPosition:r+s});s+=c,a.push(o)}return[a,s]}function Ki(t){return[Gi(t.readBytes(32),{size:32}),32]}function Ji(t,e,{staticPosition:n}){const[r,s]=e.type.split("bytes");if(!s){const i=fe(t.readBytes(32));t.setPosition(n+i);const o=fe(t.readBytes(32));if(o===0)return t.setPosition(n+32),["0x",32];const c=t.readBytes(o);return t.setPosition(n+32),[G(c),32]}return[G(t.readBytes(Number.parseInt(s),32)),32]}function Yi(t,e){const n=e.type.startsWith("int"),r=Number.parseInt(e.type.split("int")[1]||"256"),s=t.readBytes(32);return[r>48?Vi(s,{signed:n}):fe(s,{signed:n}),32]}function Xi(t,e,{staticPosition:n}){const r=e.components.length===0||e.components.some(({name:i})=>!i),s=r?[]:{};let a=0;if(vt(e)){const i=fe(t.readBytes(On)),o=n+i;for(let c=0;c<e.components.length;++c){const u=e.components[c];t.setPosition(o+a);const[d,f]=ze(t,u,{staticPosition:o});a+=f,s[r?c:u==null?void 0:u.name]=d}return t.setPosition(n+32),[s,32]}for(let i=0;i<e.components.length;++i){const o=e.components[i],[c,u]=ze(t,o,{staticPosition:n});s[r?i:o==null?void 0:o.name]=c,a+=u}return[s,a]}function Qi(t,{staticPosition:e}){const n=fe(t.readBytes(32)),r=e+n;t.setPosition(r);const s=fe(t.readBytes(32));if(s===0)return t.setPosition(e+32),["",32];const a=t.readBytes(s,32),i=Hi(Un(a));return t.setPosition(e+32),[i,32]}function vt(t){var r;const{type:e}=t;if(e==="string"||e==="bytes"||e.endsWith("[]"))return!0;if(e==="tuple")return(r=t.components)==null?void 0:r.some(vt);const n=Xn(t.type);return!!(n&&vt({...t,type:n[1]}))}const eo=t=>Ot(Vn(t));function to(t){return eo(t)}const no="1.0.5";class D extends Error{constructor(e,n={}){var i;const r=n.cause instanceof D?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,s=n.cause instanceof D&&n.cause.docsPath||n.docsPath,a=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${no}`].join(`
32
- `);super(a),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"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=s,this.metaMessages=n.metaMessages,this.shortMessage=e}}function Pe(t,e){const n=t.exec(e);return n==null?void 0:n.groups}const fs=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,hs=/^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)?$/,ps=/^\(.+?\).*?$/,Rr=/^tuple(?<array>(\[(\d*)\])*)$/;function Mn(t){let e=t.type;if(Rr.test(t.type)&&"components"in t){e="(";const n=t.components.length;for(let s=0;s<n;s++){const a=t.components[s];e+=Mn(a),s<n-1&&(e+=", ")}const r=Pe(Rr,t.type);return e+=`)${(r==null?void 0:r.array)??""}`,Mn({...t,type:e})}return"indexed"in t&&t.indexed&&(e=`${e} indexed`),t.name?`${e} ${t.name}`:e}function Qe(t){let e="";const n=t.length;for(let r=0;r<n;r++){const s=t[r];e+=Mn(s),r!==n-1&&(e+=", ")}return e}function ro(t){return t.type==="function"?`function ${t.name}(${Qe(t.inputs)})${t.stateMutability&&t.stateMutability!=="nonpayable"?` ${t.stateMutability}`:""}${t.outputs.length?` returns (${Qe(t.outputs)})`:""}`:t.type==="event"?`event ${t.name}(${Qe(t.inputs)})`:t.type==="error"?`error ${t.name}(${Qe(t.inputs)})`:t.type==="constructor"?`constructor(${Qe(t.inputs)})${t.stateMutability==="payable"?" payable":""}`:t.type==="fallback"?"fallback()":"receive() external payable"}const ms=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function so(t){return ms.test(t)}function ao(t){return Pe(ms,t)}const ys=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function io(t){return ys.test(t)}function oo(t){return Pe(ys,t)}const bs=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function co(t){return bs.test(t)}function uo(t){return Pe(bs,t)}const gs=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function vs(t){return gs.test(t)}function lo(t){return Pe(gs,t)}const ws=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function fo(t){return ws.test(t)}function ho(t){return Pe(ws,t)}const po=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function mo(t){return po.test(t)}const yo=/^receive\(\) external payable$/;function bo(t){return yo.test(t)}const go=new Set(["indexed"]),jn=new Set(["calldata","memory","storage"]);class vo extends D{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" 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 wo extends D{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class xo extends D{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class _o extends D{constructor({param:e,name:n}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${n}" 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 Po extends D{constructor({param:e,type:n,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Ao extends D{constructor({param:e,type:n,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Eo extends D{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class et extends D{constructor({signature:e,type:n}){super(`Invalid ${n} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class To extends D{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class ko extends D{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class $o extends D{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class Co extends D{constructor({current:e,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function So(t,e){return e?`${e}:${t}`:t}const bn=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 Io(t,e={}){if(co(t)){const n=uo(t);if(!n)throw new et({signature:t,type:"function"});const r=Q(n.parameters),s=[],a=r.length;for(let o=0;o<a;o++)s.push(Ee(r[o],{modifiers:jn,structs:e,type:"function"}));const i=[];if(n.returns){const o=Q(n.returns),c=o.length;for(let u=0;u<c;u++)i.push(Ee(o[u],{modifiers:jn,structs:e,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:i}}if(io(t)){const n=oo(t);if(!n)throw new et({signature:t,type:"event"});const r=Q(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Ee(r[i],{modifiers:go,structs:e,type:"event"}));return{name:n.name,type:"event",inputs:s}}if(so(t)){const n=ao(t);if(!n)throw new et({signature:t,type:"error"});const r=Q(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Ee(r[i],{structs:e,type:"error"}));return{name:n.name,type:"error",inputs:s}}if(fo(t)){const n=ho(t);if(!n)throw new et({signature:t,type:"constructor"});const r=Q(n.parameters),s=[],a=r.length;for(let i=0;i<a;i++)s.push(Ee(r[i],{structs:e,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}if(mo(t))return{type:"fallback"};if(bo(t))return{type:"receive",stateMutability:"payable"};throw new To({signature:t})}const Ro=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Oo=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Mo=/^u?int$/;function Ee(t,e){var f,h;const n=So(t,e==null?void 0:e.type);if(bn.has(n))return bn.get(n);const r=ps.test(t),s=Pe(r?Oo:Ro,t);if(!s)throw new xo({param:t});if(s.name&&Bo(s.name))throw new _o({param:t,name:s.name});const a=s.name?{name:s.name}:{},i=s.modifier==="indexed"?{indexed:!0}:{},o=(e==null?void 0:e.structs)??{};let c,u={};if(r){c="tuple";const b=Q(s.type),v=[],P=b.length;for(let k=0;k<P;k++)v.push(Ee(b[k],{structs:o}));u={components:v}}else if(s.type in o)c="tuple",u={components:o[s.type]};else if(Mo.test(s.type))c=`${s.type}256`;else if(c=s.type,(e==null?void 0:e.type)!=="struct"&&!xs(c))throw new wo({type:c});if(s.modifier){if(!((h=(f=e==null?void 0:e.modifiers)==null?void 0:f.has)!=null&&h.call(f,s.modifier)))throw new Po({param:t,type:e==null?void 0:e.type,modifier:s.modifier});if(jn.has(s.modifier)&&!No(c,!!s.array))throw new Ao({param:t,type:e==null?void 0:e.type,modifier:s.modifier})}const d={type:`${c}${s.array??""}`,...a,...i,...u};return bn.set(n,d),d}function Q(t,e=[],n="",r=0){const s=t.trim().length;for(let a=0;a<s;a++){const i=t[a],o=t.slice(a+1);switch(i){case",":return r===0?Q(o,[...e,n.trim()]):Q(o,e,`${n}${i}`,r);case"(":return Q(o,e,`${n}${i}`,r+1);case")":return Q(o,e,`${n}${i}`,r-1);default:return Q(o,e,`${n}${i}`,r)}}if(n==="")return e;if(r!==0)throw new Co({current:n,depth:r});return e.push(n.trim()),e}function xs(t){return t==="address"||t==="bool"||t==="function"||t==="string"||fs.test(t)||hs.test(t)}const jo=/^(?: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 Bo(t){return t==="address"||t==="bool"||t==="function"||t==="string"||t==="tuple"||fs.test(t)||hs.test(t)||jo.test(t)}function No(t,e){return e||t==="bytes"||t==="string"||t==="tuple"}function Fo(t){const e={},n=t.length;for(let i=0;i<n;i++){const o=t[i];if(!vs(o))continue;const c=lo(o);if(!c)throw new et({signature:o,type:"struct"});const u=c.properties.split(";"),d=[],f=u.length;for(let h=0;h<f;h++){const v=u[h].trim();if(!v)continue;const P=Ee(v,{type:"struct"});d.push(P)}if(!d.length)throw new ko({signature:o});e[c.name]=d}const r={},s=Object.entries(e),a=s.length;for(let i=0;i<a;i++){const[o,c]=s[i];r[o]=_s(c,e)}return r}const zo=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function _s(t,e,n=new Set){const r=[],s=t.length;for(let a=0;a<s;a++){const i=t[a];if(ps.test(i.type))r.push(i);else{const c=Pe(zo,i.type);if(!(c!=null&&c.type))throw new Eo({abiParameter:i});const{array:u,type:d}=c;if(d in e){if(n.has(d))throw new $o({type:d});r.push({...i,type:`tuple${u??""}`,components:_s(e[d]??[],e,new Set([...n,d]))})}else if(xs(d))r.push(i);else throw new vo({type:d})}}return r}function Ps(t){const e=Fo(t),n=[],r=t.length;for(let s=0;s<r;s++){const a=t[s];vs(a)||n.push(Io(a,e))}return n}function Zo(t){let e=!0,n="",r=0,s="",a=!1;for(let i=0;i<t.length;i++){const o=t[i];if(["(",")",","].includes(o)&&(e=!0),o==="("&&r++,o===")"&&r--,!!e){if(r===0){if(o===" "&&["event","function",""].includes(s))s="";else if(s+=o,o===")"){a=!0;break}continue}if(o===" "){t[i-1]!==","&&n!==","&&n!==",("&&(n="",e=!1);continue}s+=o,n+=o}}if(!a)throw new m("Unable to normalize signature.");return s}const Do=t=>{const e=typeof t=="string"?t:ro(t);return Zo(e)};function As(t){return to(Do(t))}const Lo=As,cr=t=>Ut(As(t),0,4);function ur(t){const{abi:e,args:n=[],name:r}=t,s=he(r,{strict:!1}),a=e.filter(o=>s?o.type==="function"?cr(o)===r:o.type==="event"?Lo(o)===r:!1:"name"in o&&o.name===r);if(a.length===0)return;if(a.length===1)return a[0];let i;for(const o of a){if(!("inputs"in o))continue;if(!n||n.length===0){if(!o.inputs||o.inputs.length===0)return o;continue}if(!o.inputs||o.inputs.length===0||o.inputs.length!==n.length)continue;if(n.every((u,d)=>{const f="inputs"in o&&o.inputs[d];return f?Bn(u,f):!1})){if(i&&"inputs"in i&&i.inputs){const u=Es(o.inputs,i.inputs,n);if(u)throw new $a({abiItem:o,type:u[0]},{abiItem:i,type:u[1]})}i=o}}return i||a[0]}function Bn(t,e){const n=typeof t,r=e.type;switch(r){case"address":return me(t,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in e?Object.values(e.components).every((s,a)=>Bn(Object.values(t)[a],s)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||t instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(t)&&t.every(s=>Bn(s,{...e,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Es(t,e,n){for(const r in t){const s=t[r],a=e[r];if(s.type==="tuple"&&a.type==="tuple"&&"components"in s&&"components"in a)return Es(s.components,a.components,n[r]);const i=[s.type,a.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?me(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?me(n[r],{strict:!1}):!1)return i}}const gn="/docs/contract/decodeFunctionResult";function dr(t){const{abi:e,args:n,functionName:r,data:s}=t;let a=e[0];if(r){const o=ur({abi:e,args:n,name:r});if(!o)throw new Lt(r,{docsPath:gn});a=o}if(a.type!=="function")throw new Lt(void 0,{docsPath:gn});if(!a.outputs)throw new ka(a.name,{docsPath:gn});const i=ls(a.outputs,s);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}const Or="/docs/contract/encodeFunctionData";function Uo(t){const{abi:e,args:n,functionName:r}=t;let s=e[0];if(r){const a=ur({abi:e,args:n,name:r});if(!a)throw new Lt(r,{docsPath:Or});s=a}if(s.type!=="function")throw new Lt(void 0,{docsPath:Or});return{abi:[s],functionName:cr(Le(s))}}function an(t){const{args:e}=t,{abi:n,functionName:r}=(()=>{var o;return t.abi.length===1&&((o=t.functionName)!=null&&o.startsWith("0x"))?t:Uo(t)})(),s=n[0],a=r,i="inputs"in s&&s.inputs?Kn(s.inputs,e??[]):void 0;return tn([a,i??"0x"])}function Vo({blockNumber:t,chain:e,contract:n}){var s;const r=(s=e==null?void 0:e.contracts)==null?void 0:s[n];if(!r)throw new An({chain:e,contract:{name:n}});if(t&&r.blockCreated&&r.blockCreated>t)throw new An({blockNumber:t,chain:e,contract:{name:n,blockCreated:r.blockCreated}});return r.address}const Go={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."},Ho={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},qo={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function Ts(t){const{abi:e,data:n}=t,r=Ut(n,0,4);if(r==="0x")throw new qn;const a=[...e||[],Ho,qo].find(i=>i.type==="error"&&r===cr(Le(i)));if(!a)throw new Gr(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:a,args:"inputs"in a&&a.inputs&&a.inputs.length>0?ls(a.inputs,Ut(n,4)):void 0,errorName:a.name}}function ks({abiItem:t,args:e,includeFunctionName:n=!0,includeName:r=!1}){if("name"in t&&"inputs"in t&&t.inputs)return`${n?t.name:""}(${t.inputs.map((s,a)=>`${r&&s.name?`${s.name}: `:""}${typeof e[a]=="object"?jt(e[a]):e[a]}`).join(", ")})`}class Wo extends m{constructor(e,{account:n,docsPath:r,chain:s,data:a,gas:i,gasPrice:o,maxFeePerGas:c,maxPriorityFeePerGas:u,nonce:d,to:f,value:h,stateOverride:b}){var k;const v=n?ce(n):void 0;let P=Mt({from:v==null?void 0:v.address,to:f,value:typeof h<"u"&&`${er(h)} ${((k=s==null?void 0:s.nativeCurrency)==null?void 0:k.symbol)||"ETH"}`,data:a,gas:i,gasPrice:typeof o<"u"&&`${V(o)} gwei`,maxFeePerGas:typeof c<"u"&&`${V(c)} gwei`,maxPriorityFeePerGas:typeof u<"u"&&`${V(u)} gwei`,nonce:d});b&&(P+=`
33
- ${Ci(b)}`),super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",P].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class Ko extends m{constructor(e,{abi:n,args:r,contractAddress:s,docsPath:a,functionName:i,sender:o}){const c=ur({abi:n,args:r,name:i}),u=c?ks({abiItem:c,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=c?Le(c,{includeName:!0}):void 0,f=Mt({address:s&&ui(s),function:d,args:u&&u!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${u}`,sender:o});super(e.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:e,docsPath:a,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],f&&"Contract Call:",f].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=n,this.args=r,this.cause=e,this.contractAddress=s,this.functionName=i,this.sender=o}}class Jo extends m{constructor({abi:e,data:n,functionName:r,message:s}){let a,i,o,c;if(n&&n!=="0x")try{i=Ts({abi:e,data:n});const{abiItem:d,errorName:f,args:h}=i;if(f==="Error")c=h[0];else if(f==="Panic"){const[b]=h;c=Go[b]}else{const b=d?Le(d,{includeName:!0}):void 0,v=d&&h?ks({abiItem:d,args:h,includeFunctionName:!1,includeName:!1}):void 0;o=[b?`Error: ${b}`:"",v&&v!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${v}`:""]}}catch(d){a=d}else s&&(c=s);let u;a instanceof Gr&&(u=a.signature,o=[`Unable to decode signature "${u}" 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://openchain.xyz/signatures?query=${u}.`]),super(c&&c!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,c||u].join(`
34
- `):`The contract function "${r}" reverted.`,{cause:a,metaMessages:o,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{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=i,this.reason=c,this.signature=u}}class Yo extends m{constructor({functionName:e}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class Xo extends m{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{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 $s extends m{constructor({data:e,message:n}){super(n||"",{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=e}}const Qo=3;function lr(t,{abi:e,address:n,args:r,docsPath:s,functionName:a,sender:i}){const{code:o,data:c,message:u,shortMessage:d}=t instanceof $s?t:t instanceof m?t.walk(h=>"data"in h)||t.walk():{},f=t instanceof qn?new Yo({functionName:a}):[Qo,$e.code].includes(o)&&(c||u||d)?new Jo({abi:e,data:typeof c=="object"?c.data:c,functionName:a,message:d??u}):t;return new Ko(f,{abi:e,args:r,contractAddress:n,docsPath:s,functionName:a,sender:i})}const ec="0x82ad56cb",tc="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",nc="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function rc(t,{docsPath:e,...n}){const r=(()=>{const s=rr(t,n);return s instanceof rn?t:s})();return new Wo(r,{docsPath:e,...n})}const vn=new Map;function sc({fn:t,id:e,shouldSplitBatch:n,wait:r=0,sort:s}){const a=async()=>{const d=c();i();const f=d.map(({args:h})=>h);f.length!==0&&t(f).then(h=>{var b;s&&Array.isArray(h)&&h.sort(s);for(let v=0;v<d.length;v++){const{pendingPromise:P}=d[v];(b=P.resolve)==null||b.call(P,[h[v],h])}}).catch(h=>{var b;for(let v=0;v<d.length;v++){const{pendingPromise:P}=d[v];(b=P.reject)==null||b.call(P,h)}})},i=()=>vn.delete(e),o=()=>c().map(({args:d})=>d),c=()=>vn.get(e)||[],u=d=>vn.set(e,[...c(),d]);return{flush:i,async schedule(d){const f={},h=new Promise((P,k)=>{f.resolve=P,f.reject=k});return(n==null?void 0:n([...o(),d]))&&a(),c().length>0?(u({args:d,pendingPromise:f}),h):(u({args:d,pendingPromise:f}),setTimeout(a,r),h)}}}async function fr(t,e){var Je,ln,Ye,Xe;const{account:n=t.account,batch:r=!!((Je=t.batch)!=null&&Je.multicall),blockNumber:s,blockTag:a="latest",accessList:i,blobs:o,code:c,data:u,factory:d,factoryData:f,gas:h,gasPrice:b,maxFeePerBlobGas:v,maxFeePerGas:P,maxPriorityFeePerGas:k,nonce:S,to:A,value:I,stateOverride:q,...J}=e,B=n?ce(n):void 0;if(c&&(d||f))throw new m("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(c&&A)throw new m("Cannot provide both `code` & `to` as parameters.");const re=c&&u,$=d&&f&&A&&u,N=re||$,dn=re?oc({code:c,data:u}):$?cc({data:u,factory:d,factoryData:f,to:A}):u;try{sn(e);const U=(s?R(s):void 0)||a,X=ss(q),Y=(Xe=(Ye=(ln=t.chain)==null?void 0:ln.formatters)==null?void 0:Ye.transactionRequest)==null?void 0:Xe.format,Me=(Y||ar)({...sr(J,{format:Y}),from:B==null?void 0:B.address,accessList:i,blobs:o,data:dn,gas:h,gasPrice:b,maxFeePerBlobGas:v,maxFeePerGas:P,maxPriorityFeePerGas:k,nonce:S,to:N?void 0:A,value:I});if(r&&ac({request:Me})&&!X)try{return await ic(t,{...Me,blockNumber:s,blockTag:a})}catch(fn){if(!(fn instanceof es)&&!(fn instanceof An))throw fn}const gr=await t.request({method:"eth_call",params:X?[Me,U,X]:[Me,U]});return gr==="0x"?{data:void 0}:{data:gr}}catch(Oe){const U=uc(Oe),{offchainLookup:X,offchainLookupSignature:Y}=await Promise.resolve().then(()=>require("./ccip-DvDknSPq.cjs"));if(t.ccipRead!==!1&&(U==null?void 0:U.slice(0,10))===Y&&A)return{data:await X(t,{data:U,to:A})};throw N&&(U==null?void 0:U.slice(0,10))==="0x101bb98d"?new Xo({factory:d}):rc(Oe,{...e,account:B,chain:t.chain})}}function ac({request:t}){const{data:e,to:n,...r}=t;return!(!e||e.startsWith(ec)||!n||Object.values(r).filter(s=>typeof s<"u").length>0)}async function ic(t,e){var P;const{batchSize:n=1024,wait:r=0}=typeof((P=t.batch)==null?void 0:P.multicall)=="object"?t.batch.multicall:{},{blockNumber:s,blockTag:a="latest",data:i,multicallAddress:o,to:c}=e;let u=o;if(!u){if(!t.chain)throw new es;u=Vo({blockNumber:s,chain:t.chain,contract:"multicall3"})}const f=(s?R(s):void 0)||a,{schedule:h}=sc({id:`${t.uid}.${f}`,wait:r,shouldSplitBatch(k){return k.reduce((A,{data:I})=>A+(I.length-2),0)>n*2},fn:async k=>{const S=k.map(q=>({allowFailure:!0,callData:q.data,target:q.to})),A=an({abi:Sr,args:[S],functionName:"aggregate3"}),I=await t.request({method:"eth_call",params:[{data:A,to:u},f]});return dr({abi:Sr,args:[S],functionName:"aggregate3",data:I||"0x"})}}),[{returnData:b,success:v}]=await h({data:i,to:c});if(!v)throw new $s({data:b});return b==="0x"?{data:void 0}:{data:b}}function oc(t){const{code:e,data:n}=t;return Kr({abi:Ps(["constructor(bytes, bytes)"]),bytecode:tc,args:[e,n]})}function cc(t){const{data:e,factory:n,factoryData:r,to:s}=t;return Kr({abi:Ps(["constructor(address, bytes, address, bytes)"]),bytecode:nc,args:[s,e,n,r]})}function uc(t){var n;if(!(t instanceof m))return;const e=t.walk();return typeof(e==null?void 0:e.data)=="object"?(n=e.data)==null?void 0:n.data:e.data}async function dc(t,e){const{abi:n,address:r,args:s,functionName:a,...i}=e,o=an({abi:n,args:s,functionName:a});try{const{data:c}=await Z(t,fr,"call")({...i,data:o,to:r});return dr({abi:n,args:s,functionName:a,data:c||"0x"})}catch(c){throw lr(c,{abi:n,address:r,args:s,docsPath:"/docs/contract/readContract",functionName:a})}}async function lc(t){return new Promise(e=>setTimeout(e,t))}const Ft=new Wn(8192);function fc(t,{enabled:e=!0,id:n}){if(!e||!n)return t();if(Ft.get(n))return Ft.get(n);const r=t().finally(()=>Ft.delete(n));return Ft.set(n,r),r}function hc(t,{delay:e=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((s,a)=>{const i=async({count:o=0}={})=>{const c=async({error:u})=>{const d=typeof e=="function"?e({count:o,error:u}):e;d&&await lc(d),i({count:o+1})};try{const u=await t();s(u)}catch(u){if(o<n&&await r({count:o,error:u}))return c({error:u});a(u)}};i()})}function pc(t,e={}){return async(n,r={})=>{const{dedupe:s=!1,retryDelay:a=150,retryCount:i=3,uid:o}={...e,...r},c=s?Ot(Gn(`${o}.${jt(n)}`)):void 0;return fc(()=>hc(async()=>{try{return await t(n)}catch(u){const d=u;switch(d.code){case st.code:throw new st(d);case at.code:throw new at(d);case it.code:throw new it(d,{method:n.method});case ot.code:throw new ot(d);case $e.code:throw new $e(d);case ct.code:throw new ct(d);case ut.code:throw new ut(d);case dt.code:throw new dt(d);case lt.code:throw new lt(d);case ft.code:throw new ft(d,{method:n.method});case Ve.code:throw new Ve(d);case ht.code:throw new ht(d);case Fe.code:throw new Fe(d);case pt.code:throw new pt(d);case mt.code:throw new mt(d);case yt.code:throw new yt(d);case bt.code:throw new bt(d);case gt.code:throw new gt(d);case 5e3:throw new Fe(d);default:throw u instanceof m?u:new fi(d)}}},{delay:({count:u,error:d})=>{var f;if(d&&d instanceof nr){const h=(f=d==null?void 0:d.headers)==null?void 0:f.get("Retry-After");if(h!=null&&h.match(/\d/))return Number.parseInt(h)*1e3}return~~(1<<u)*a},retryCount:i,shouldRetry:({error:u})=>mc(u)}),{enabled:s,id:c})}}function mc(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===Ve.code||t.code===$e.code:t instanceof nr&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}async function yc(t,e){const{abi:n,address:r,args:s,dataSuffix:a,functionName:i,...o}=e,c=o.account?ce(o.account):t.account,u=an({abi:n,args:s,functionName:i});try{const{data:d}=await Z(t,fr,"call")({batch:!1,data:`${u}${a?a.replace("0x",""):""}`,to:r,...o,account:c}),f=dr({abi:n,args:s,functionName:i,data:d||"0x"}),h=n.filter(b=>"name"in b&&b.name===e.functionName);return{result:f,request:{abi:h,address:r,args:s,dataSuffix:a,functionName:i,...o,account:c}}}catch(d){throw lr(d,{abi:n,address:r,args:s,docsPath:"/docs/contract/simulateContract",functionName:i,sender:c==null?void 0:c.address})}}async function bc(t,e){const{abi:n,account:r=t.account,address:s,args:a,dataSuffix:i,functionName:o,...c}=e;if(!r)throw new Jr({docsPath:"/docs/contract/writeContract"});const u=ce(r),d=an({abi:n,args:a,functionName:o});try{return await Z(t,Ui,"sendTransaction")({data:`${d}${i?i.replace("0x",""):""}`,to:s,account:u,...c})}catch(f){throw lr(f,{abi:n,address:s,args:a,docsPath:"/docs/contract/writeContract",functionName:o,sender:u.address})}}const Nn=256;let zt=Nn,Zt;function Cs(t=11){if(!Zt||zt+t>Nn*2){Zt="",zt=0;for(let e=0;e<Nn;e++)Zt+=(256+Math.random()*256|0).toString(16).substring(1)}return Zt.substring(zt,zt+++t)}function gc(t){const{batch:e,cacheTime:n=t.pollingInterval??4e3,ccipRead:r,key:s="base",name:a="Base Client",pollingInterval:i=4e3,type:o="base"}=t,c=t.chain,u=t.account?ce(t.account):void 0,{config:d,request:f,value:h}=t.transport({chain:c,pollingInterval:i}),b={...d,...h},v={account:u,batch:e,cacheTime:n,ccipRead:r,chain:c,key:s,name:a,pollingInterval:i,request:f,transport:b,type:o,uid:Cs()};function P(k){return S=>{const A=S(k);for(const q in v)delete A[q];const I={...k,...A};return Object.assign(I,{extend:P(I)})}}return Object.assign(v,{extend:P(v)})}function vc({key:t,name:e,request:n,retryCount:r=3,retryDelay:s=150,timeout:a,type:i},o){const c=Cs();return{config:{key:t,name:e,request:n,retryCount:r,retryDelay:s,timeout:a,type:i},request:pc(n,{retryCount:r,retryDelay:s,uid:c}),value:o}}function wc(t,e={}){const{key:n="custom",name:r="Custom Provider",retryDelay:s}=e;return({retryCount:a})=>vc({key:n,name:r,request:t.request.bind(t),retryCount:e.retryCount??a,retryDelay:s,type:"custom"})}function on(t){const e=t.state.current,n=t.state.connections.get(e),r=n==null?void 0:n.accounts,s=r==null?void 0:r[0],a=t.chains.find(o=>o.id===(n==null?void 0:n.chainId)),i=t.state.status;switch(i){case"connected":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:i};case"reconnecting":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!!s,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:i};case"connecting":return{address:s,addresses:r,chain:a,chainId:n==null?void 0:n.chainId,connector:n==null?void 0:n.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:i};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:i}}}function hr(t){return t.state.chainId}function pr(t,e,n){const r=t[e.name];if(typeof r=="function")return r;const s=t[n];return typeof s=="function"?s:a=>e(t,a)}const xc="2.13.8",_c=()=>`@wagmi/core@${xc}`;var Ss=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},qt,Is;class Ce extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return _c()}constructor(e,n={}){var r;super(),qt.add(this),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:"WagmiCoreError"});const s=n.cause instanceof Ce?n.cause.details:(r=n.cause)!=null&&r.message?n.cause.message:n.details,a=n.cause instanceof Ce&&n.cause.docsPath||n.docsPath;this.message=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${this.docsBaseUrl}${a}.html${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...s?[`Details: ${s}`]:[],`Version: ${this.version}`].join(`
35
- `),n.cause&&(this.cause=n.cause),this.details=s,this.docsPath=a,this.metaMessages=n.metaMessages,this.shortMessage=e}walk(e){return Ss(this,qt,"m",Is).call(this,this,e)}}qt=new WeakSet,Is=function t(e,n){return n!=null&&n(e)?e:e.cause?Ss(this,qt,"m",t).call(this,e.cause,n):e};class Pc extends Ce{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class Ac extends Ce{constructor({address:e,connector:n}){super(`Account "${e}" not found for connector "${n.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class Ec extends Ce{constructor({connectionChainId:e,connectorChainId:n}){super(`The current chain of the connector (id: ${n}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class Tc extends Ce{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function Rs(t,e={}){let n;if(e.connector){const{connector:u}=e;if(t.state.status==="reconnecting"&&!u.getAccounts&&!u.getChainId)throw new Tc({connector:u});const[d,f]=await Promise.all([u.getAccounts(),u.getChainId()]);n={accounts:d,chainId:f,connector:u}}else n=t.state.connections.get(t.state.current);if(!n)throw new Pc;const r=e.chainId??n.chainId,s=await n.connector.getChainId();if(s!==n.chainId)throw new Ec({connectionChainId:n.chainId,connectorChainId:s});const a=n.connector;if(a.getClient)return a.getClient({chainId:r});const i=ce(e.account??n.accounts[0]);if(i.address=Ma(i.address),e.account&&!n.accounts.some(u=>u.toLowerCase()===i.address.toLowerCase()))throw new Ac({address:i.address,connector:a});const o=t.chains.find(u=>u.id===r),c=await n.connector.getProvider({chainId:r});return gc({account:i,chain:o,name:"Connector Client",transport:u=>wc(c)({...u,retryCount:0})})}async function Fn(t,e){const{abi:n,chainId:r,connector:s,...a}=e;let i;e.account?i=e.account:i=(await Rs(t,{chainId:r,connector:s})).account;const o=t.getClient({chainId:r}),c=pr(o,yc,"simulateContract"),{result:u,request:d}=await c({...a,abi:n,account:i});return{chainId:o.chain.id,result:u,request:{__mode:"prepared",...d,chainId:r}}}function mr(t){return t.address!==void 0&&typeof t.address=="object"?(e,n)=>{var r;const s=hr(e),a=on(e),i=(n==null?void 0:n.chainId)??a.chainId??s;return Fn(e,{...n,...t.functionName?{functionName:t.functionName}:{},address:(r=t.address)==null?void 0:r[i],abi:t.abi})}:(e,n)=>Fn(e,{...n,...t.address?{address:t.address}:{},...t.functionName?{functionName:t.functionName}:{},abi:t.abi})}function Mr(t,e){const{chainId:n,...r}=e,s=t.getClient({chainId:n});return pr(s,dc,"readContract")(r)}function Os(t){return t.address!==void 0&&typeof t.address=="object"?(e,n)=>{var r;const s=hr(e),a=on(e),i=(n==null?void 0:n.chainId)??a.chainId??s;return Mr(e,{...n,...t.functionName?{functionName:t.functionName}:{},address:(r=t.address)==null?void 0:r[i],abi:t.abi})}:(e,n)=>Mr(e,{...n,...t.address?{address:t.address}:{},...t.functionName?{functionName:t.functionName}:{},abi:t.abi})}async function jr(t,e){const{account:n,chainId:r,connector:s,__mode:a,...i}=e;let o;typeof n=="object"&&n.type==="local"?o=t.getClient({chainId:r}):o=await Rs(t,{account:n,chainId:r,connector:s});const{connector:c}=on(t);let u;if(a==="prepared"||c!=null&&c.supportsSimulation)u=i;else{const{request:d}=await Fn(t,{...i,account:n,chainId:r});u=d}return await pr(o,bc,"writeContract")({...u,...n?{account:n}:{},chain:r?{id:r}:null})}function yr(t){return t.address!==void 0&&typeof t.address=="object"?(e,n)=>{var r;const s=hr(e),a=on(e);let i;return n.chainId?i=n.chainId:n.account&&n.account===a.address||n.account===void 0?i=a.chainId:i=s,jr(e,{...n,...t.functionName?{functionName:t.functionName}:{},address:i?(r=t.address)==null?void 0:r[i]:void 0,abi:t.abi})}:(e,n)=>jr(e,{...n,...t.address?{address:t.address}:{},...t.functionName?{functionName:t.functionName}:{},abi:t.abi})}const be=[{type:"error",inputs:[],name:"AllowanceOverflow"},{type:"error",inputs:[],name:"AllowanceUnderflow"},{type:"error",inputs:[],name:"InsufficientAllowance"},{type:"error",inputs:[],name:"InsufficientBalance"},{type:"error",inputs:[],name:"InvalidPermit"},{type:"error",inputs:[],name:"PermitExpired"},{type:"error",inputs:[],name:"TotalSupplyOverflow"},{type:"event",anonymous:!1,inputs:[{name:"owner",internalType:"address",type:"address",indexed:!0},{name:"spender",internalType:"address",type:"address",indexed:!0},{name:"amount",internalType:"uint256",type:"uint256",indexed:!1}],name:"Approval"},{type:"event",anonymous:!1,inputs:[{name:"from",internalType:"address",type:"address",indexed:!0},{name:"to",internalType:"address",type:"address",indexed:!0},{name:"amount",internalType:"uint256",type:"uint256",indexed:!1}],name:"Transfer"},{type:"function",inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{name:"result",internalType:"bytes32",type:"bytes32"}],stateMutability:"view"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"},{name:"spender",internalType:"address",type:"address"}],name:"allowance",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[{name:"spender",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"approve",outputs:[{name:"",internalType:"bool",type:"bool"}],stateMutability:"nonpayable"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"}],name:"balanceOf",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[],name:"decimals",outputs:[{name:"",internalType:"uint8",type:"uint8"}],stateMutability:"view"},{type:"function",inputs:[{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable"},{type:"function",inputs:[{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"mintPayable",outputs:[],stateMutability:"payable"},{type:"function",inputs:[],name:"name",outputs:[{name:"",internalType:"string",type:"string"}],stateMutability:"pure"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"}],name:"nonces",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[{name:"owner",internalType:"address",type:"address"},{name:"spender",internalType:"address",type:"address"},{name:"value",internalType:"uint256",type:"uint256"},{name:"deadline",internalType:"uint256",type:"uint256"},{name:"v",internalType:"uint8",type:"uint8"},{name:"r",internalType:"bytes32",type:"bytes32"},{name:"s",internalType:"bytes32",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable"},{type:"function",inputs:[],name:"symbol",outputs:[{name:"",internalType:"string",type:"string"}],stateMutability:"pure"},{type:"function",inputs:[],name:"totalSupply",outputs:[{name:"result",internalType:"uint256",type:"uint256"}],stateMutability:"view"},{type:"function",inputs:[{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"transfer",outputs:[{name:"",internalType:"bool",type:"bool"}],stateMutability:"nonpayable"},{type:"function",inputs:[{name:"from",internalType:"address",type:"address"},{name:"to",internalType:"address",type:"address"},{name:"amount",internalType:"uint256",type:"uint256"}],name:"transferFrom",outputs:[{name:"",internalType:"bool",type:"bool"}],stateMutability:"nonpayable"}],kc=Os({abi:be,functionName:"allowance"}),$c=Os({abi:be,functionName:"balanceOf"}),Cc=yr({abi:be,functionName:"approve"}),Sc=yr({abi:be,functionName:"mint"}),Ic=yr({abi:be,functionName:"mintPayable"}),Rc=mr({abi:be,functionName:"approve"}),Oc=mr({abi:be,functionName:"mint"}),Mc=mr({abi:be,functionName:"mintPayable"}),jc="0x6080604052348015600e575f80fd5b50610a3c8061001c5f395ff3fe6080604052600436106100d9575f3560e01c806340c10f191161007c57806395d89b411161005757806395d89b4114610323578063a9059cbb14610368578063d505accf14610387578063dd62ed3e146103a6575f80fd5b806340c10f19146102a257806370a08231146102c15780637ecebe00146102f2575f80fd5b806318160ddd116100b757806318160ddd1461017857806323b872dd1461019e578063313ce567146101bd5780633644e515146101d8575f80fd5b806306fdde03146100dd578063095ea7b31461013457806317d304b014610163575b5f80fd5b3480156100e8575f80fd5b5060408051808201909152600a81527f4d6f636b2045524332300000000000000000000000000000000000000000000060208201525b60405161012b9190610833565b60405180910390f35b34801561013f575f80fd5b5061015361014e3660046108ae565b6103da565b604051901515815260200161012b565b6101766101713660046108ae565b610429565b005b348015610183575f80fd5b506805345cdf77eb68f44c545b60405190815260200161012b565b3480156101a9575f80fd5b506101536101b83660046108d6565b6104af565b3480156101c8575f80fd5b506040516012815260200161012b565b3480156101e3575f80fd5b50604080518082018252600a81527f4d6f636b2045524332300000000000000000000000000000000000000000000060209182015281517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81527fa5c9260bf133e670eeaf4d41f5c4289fc23bb146bf11ba8fa70a2ea91ba1a330918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc69181019190915246606082015230608082015260a09020610190565b3480156102ad575f80fd5b506101766102bc3660046108ae565b6104a1565b3480156102cc575f80fd5b506101906102db366004610910565b6387a211a2600c9081525f91909152602090205490565b3480156102fd575f80fd5b5061019061030c366004610910565b6338377508600c9081525f91909152602090205490565b34801561032e575f80fd5b5060408051808201909152600481527f4d4f434b00000000000000000000000000000000000000000000000000000000602082015261011e565b348015610373575f80fd5b506101536103823660046108ae565b610569565b348015610392575f80fd5b506101766103a1366004610930565b6105e0565b3480156103b1575f80fd5b506101906103c036600461099d565b602052637f5e9f20600c9081525f91909152603490205490565b5f82602052637f5e9f20600c52335f52816034600c2055815f52602c5160601c337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560205fa350600192915050565b6104346064826109ce565b3410156104a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4d6f636b45524332303a2067696d6d65206d6f7265206d6f6e65792100000000604482015260640160405180910390fd5b6104ab82826107b7565b5050565b5f8360601b33602052637f5e9f208117600c526034600c20805460018101156104ed57808511156104e7576313be252b5f526004601cfd5b84810382555b50506387a211a28117600c526020600c208054808511156105155763f4d678b85f526004601cfd5b84810382555050835f526020600c208381540181555082602052600c5160601c8160601c7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a3505060019392505050565b5f6387a211a2600c52335f526020600c208054808411156105915763f4d678b85f526004601cfd5b83810382555050825f526020600c208281540181555081602052600c5160601c337fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a350600192915050565b60408051808201909152600a81527f4d6f636b204552433230000000000000000000000000000000000000000000006020909101527fa5c9260bf133e670eeaf4d41f5c4289fc23bb146bf11ba8fa70a2ea91ba1a3308442111561064b57631a15a3cc5f526004601cfd5b6040518860601b60601c98508760601b60601c975065383775081901600e52885f526020600c2080547f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f83528360208401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6604084015246606084015230608084015260a08320602e527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c983528a60208401528960408401528860608401528060808401528760a084015260c08320604e526042602c205f528660ff16602052856040528460605260208060805f60015afa8b3d51146107535763ddafbaef5f526004601cfd5b019055777f5e9f20000000000000000000000000000000000000000088176040526034602c2087905587897f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925602060608501a360405250505f606052505050505050565b6805345cdf77eb68f44c54818101818110156107da5763e5cfe9575f526004601cfd5b806805345cdf77eb68f44c5550506387a211a2600c52815f526020600c208181540181555080602052600c5160601c5f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602080a35050565b602081525f82518060208401528060208501604085015e5f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505092915050565b803573ffffffffffffffffffffffffffffffffffffffff811681146108a9575f80fd5b919050565b5f80604083850312156108bf575f80fd5b6108c883610886565b946020939093013593505050565b5f805f606084860312156108e8575f80fd5b6108f184610886565b92506108ff60208501610886565b929592945050506040919091013590565b5f60208284031215610920575f80fd5b61092982610886565b9392505050565b5f805f805f805f60e0888a031215610946575f80fd5b61094f88610886565b965061095d60208901610886565b95506040880135945060608801359350608088013560ff81168114610980575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f80604083850312156109ae575f80fd5b6109b783610886565b91506109c560208401610886565b90509250929050565b5f82610a01577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea2646970667358221220a27cf4eb58983f34470237d40a3f6ea7247af029518c7eec2d89f9256927389564736f6c634300081a0033";class Ms extends j.Deployable{async balanceOf(e,n){return await $c(this._config,{address:this.assertValidAddress(),args:[e],...n})}async allowance(e,n,r){return await kc(this._config,{address:this.assertValidAddress(),args:[e,n],...r})}async approve(e,n,r){return await this.awaitResult(this.approveRaw(e,n,r))}async approveRaw(e,n,r){const{request:s,result:a}=await Rc(this._config,{address:this.assertValidAddress(),args:[e,n],...this.optionallyAttachAccount(),...r});return{hash:await Cc(this._config,s),result:a}}async mint(e,n,r){return await this.awaitResult(this.mintRaw(e,n,r))}async mintRaw(e,n,r){const{request:s,result:a}=await Oc(this._config,{address:this.assertValidAddress(),args:[e,n],...this.optionallyAttachAccount(),...r});return{hash:await Sc(this._config,s),result:a}}async mintPayable(e,n,r){return await this.awaitResult(this.mintPayableRaw(e,n,r))}async mintPayableRaw(e,n,r){const{request:s,result:a}=await Mc(this._config,{address:this.assertValidAddress(),args:[e,n],...this.optionallyAttachAccount(),...r});return{hash:await Ic(this._config,s),result:a}}buildParameters(e={},n){const[,r]=this.validateDeploymentConfig(e,n);return{abi:be,bytecode:jc,...this.optionallyAttachAccount(r.account)}}}const Bc=[{account:"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",key:"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC",key:"0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a"},{account:"0x90F79bf6EB2c4f870365E785982E1f101E93b906",key:"0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"},{account:"0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65",key:"0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a"},{account:"0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc",key:"0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"},{account:"0x70997970C51812dc3A010C7d01b50e0d17dc79C8",key:"0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"}].map(t=>({...t,privateKey:W.privateKeyToAccount(t.key)}));var C;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(C||(C={}));var zn;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(zn||(zn={}));const g=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),le=t=>{switch(typeof t){case"undefined":return g.undefined;case"string":return g.string;case"number":return isNaN(t)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(t)?g.array:t===null?g.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?g.promise:typeof Map<"u"&&t instanceof Map?g.map:typeof Set<"u"&&t instanceof Set?g.set:typeof Date<"u"&&t instanceof Date?g.date:g.object;default:return g.unknown}},l=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Nc=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class K extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(n(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return s(this),r}static assert(e){if(!(e instanceof K))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}K.create=t=>new K(t);const Ge=(t,e)=>{let n;switch(t.code){case l.invalid_type:t.received===g.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case l.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,C.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:n=`Unrecognized key(s) in object: ${C.joinValues(t.keys,", ")}`;break;case l.invalid_union:n="Invalid input";break;case l.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${C.joinValues(t.options)}`;break;case l.invalid_enum_value:n=`Invalid enum value. Expected ${C.joinValues(t.options)}, received '${t.received}'`;break;case l.invalid_arguments:n="Invalid function arguments";break;case l.invalid_return_type:n="Invalid function return type";break;case l.invalid_date:n="Invalid date";break;case l.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:C.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case l.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case l.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case l.custom:n="Invalid input";break;case l.invalid_intersection_types:n="Intersection results could not be merged";break;case l.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case l.not_finite:n="Number must be finite";break;default:n=e.defaultError,C.assertNever(t)}return{message:n}};let js=Ge;function Fc(t){js=t}function Wt(){return js}const Kt=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}},zc=[];function y(t,e){const n=Wt(),r=Kt({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Ge?void 0:Ge].filter(s=>!!s)});t.common.issues.push(r)}class z{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return _;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const a=await s.key,i=await s.value;r.push({key:a,value:i})}return z.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return _;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const _=Object.freeze({status:"aborted"}),Ne=t=>({status:"dirty",value:t}),L=t=>({status:"valid",value:t}),Zn=t=>t.status==="aborted",Dn=t=>t.status==="dirty",Se=t=>t.status==="valid",wt=t=>typeof Promise<"u"&&t instanceof Promise;function Jt(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Bs(t,e,n,r,s){if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var w;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(w||(w={}));var tt,nt;class ae{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Br=(t,e)=>{if(Se(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new K(t.common.issues);return this._error=n,this._error}}};function E(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{var c,u;const{message:d}=t;return i.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:o.defaultError}},description:s}}class T{get description(){return this._def.description}_getType(e){return le(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new z,ctx:{common:e.parent.common,data:e.data,parsedType:le(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(wt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:le(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Br(s,a)}"~validate"(e){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:le(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return Se(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((r=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>Se(a)?{value:a.value}:{issues:s.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:le(e)},s=this._parse({data:e,path:r.path,parent:r}),a=await(wt(s)?s:Promise.resolve(s));return Br(r,a)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:l.custom,...r(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new ne({schema:this,typeName:x.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return se.create(this,this._def)}nullable(){return _e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return te.create(this)}promise(){return qe.create(this,this._def)}or(e){return At.create([this,e],this._def)}and(e){return Et.create(this,e,this._def)}transform(e){return new ne({...E(this._def),schema:this,typeName:x.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new St({...E(this._def),innerType:this,defaultValue:n,typeName:x.ZodDefault})}brand(){return new br({typeName:x.ZodBranded,type:this,...E(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new It({...E(this._def),innerType:this,catchValue:n,typeName:x.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Bt.create(this,e)}readonly(){return Rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Zc=/^c[^\s-]{8,}$/i,Dc=/^[0-9a-z]+$/,Lc=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Uc=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Vc=/^[a-z0-9_-]{21}$/i,Gc=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hc=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,qc=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let wn;const Kc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Jc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Yc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Xc=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Qc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,eu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ns="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",tu=new RegExp(`^${Ns}$`);function Fs(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function nu(t){return new RegExp(`^${Fs(t)}$`)}function zs(t){let e=`${Ns}T${Fs(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function ru(t,e){return!!((e==="v4"||!e)&&Kc.test(t)||(e==="v6"||!e)&&Yc.test(t))}function su(t,e){if(!Gc.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch{return!1}}function au(t,e){return!!((e==="v4"||!e)&&Jc.test(t)||(e==="v6"||!e)&&Xc.test(t))}class ee extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const a=this._getOrReturnCtx(e);return y(a,{code:l.invalid_type,expected:g.string,received:a.parsedType}),_}const r=new z;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?y(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&y(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")qc.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"email",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="emoji")wn||(wn=new RegExp(Wc,"u")),wn.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"emoji",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Uc.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"uuid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="nanoid")Vc.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"nanoid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Zc.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"cuid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid2")Dc.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"cuid2",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="ulid")Lc.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"ulid",code:l.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),y(s,{validation:"url",code:l.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"regex",code:l.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),y(s,{code:l.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),y(s,{code:l.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),y(s,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?zs(a).test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:l.invalid_string,validation:"datetime",message:a.message}),r.dirty()):a.kind==="date"?tu.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:l.invalid_string,validation:"date",message:a.message}),r.dirty()):a.kind==="time"?nu(a).test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{code:l.invalid_string,validation:"time",message:a.message}),r.dirty()):a.kind==="duration"?Hc.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"duration",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="ip"?ru(e.data,a.version)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"ip",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="jwt"?su(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"jwt",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="cidr"?au(e.data,a.version)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"cidr",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="base64"?Qc.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"base64",code:l.invalid_string,message:a.message}),r.dirty()):a.kind==="base64url"?eu.test(e.data)||(s=this._getOrReturnCtx(e,s),y(s,{validation:"base64url",code:l.invalid_string,message:a.message}),r.dirty()):C.assertNever(a);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:l.invalid_string,...w.errToObj(r)})}_addCheck(e){return new ee({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...w.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...w.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...w.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...w.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...w.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...w.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...w.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...w.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...w.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...w.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...w.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...w.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...w.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...w.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...w.errToObj(n)})}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new ee({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ee({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}ee.create=t=>{var e;return new ee({checks:[],typeName:x.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...E(t)})};function iu(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(t.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class ve extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const a=this._getOrReturnCtx(e);return y(a,{code:l.invalid_type,expected:g.number,received:a.parsedType}),_}let r;const s=new z;for(const a of this._def.checks)a.kind==="int"?C.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:l.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),y(r,{code:l.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),y(r,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?iu(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),y(r,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:l.not_finite,message:a.message}),s.dirty()):C.assertNever(a);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new ve({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]})}_addCheck(e){return new ve({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}ve.create=t=>new ve({checks:[],typeName:x.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...E(t)});class we extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==g.bigint)return this._getInvalidInput(e);let r;const s=new z;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),y(r,{code:l.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),y(r,{code:l.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),y(r,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):C.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return y(n,{code:l.invalid_type,expected:g.bigint,received:n.parsedType}),_}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new we({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]})}_addCheck(e){return new we({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}we.create=t=>{var e;return new we({checks:[],typeName:x.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...E(t)})};class xt extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const r=this._getOrReturnCtx(e);return y(r,{code:l.invalid_type,expected:g.boolean,received:r.parsedType}),_}return L(e.data)}}xt.create=t=>new xt({typeName:x.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...E(t)});class Ie extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const a=this._getOrReturnCtx(e);return y(a,{code:l.invalid_type,expected:g.date,received:a.parsedType}),_}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return y(a,{code:l.invalid_date}),_}const r=new z;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:l.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),y(s,{code:l.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):C.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ie({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ie.create=t=>new Ie({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:x.ZodDate,...E(t)});class Yt extends T{_parse(e){if(this._getType(e)!==g.symbol){const r=this._getOrReturnCtx(e);return y(r,{code:l.invalid_type,expected:g.symbol,received:r.parsedType}),_}return L(e.data)}}Yt.create=t=>new Yt({typeName:x.ZodSymbol,...E(t)});class _t extends T{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return y(r,{code:l.invalid_type,expected:g.undefined,received:r.parsedType}),_}return L(e.data)}}_t.create=t=>new _t({typeName:x.ZodUndefined,...E(t)});class Pt extends T{_parse(e){if(this._getType(e)!==g.null){const r=this._getOrReturnCtx(e);return y(r,{code:l.invalid_type,expected:g.null,received:r.parsedType}),_}return L(e.data)}}Pt.create=t=>new Pt({typeName:x.ZodNull,...E(t)});class He extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return L(e.data)}}He.create=t=>new He({typeName:x.ZodAny,...E(t)});class Te extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return L(e.data)}}Te.create=t=>new Te({typeName:x.ZodUnknown,...E(t)});class ye extends T{_parse(e){const n=this._getOrReturnCtx(e);return y(n,{code:l.invalid_type,expected:g.never,received:n.parsedType}),_}}ye.create=t=>new ye({typeName:x.ZodNever,...E(t)});class Xt extends T{_parse(e){if(this._getType(e)!==g.undefined){const r=this._getOrReturnCtx(e);return y(r,{code:l.invalid_type,expected:g.void,received:r.parsedType}),_}return L(e.data)}}Xt.create=t=>new Xt({typeName:x.ZodVoid,...E(t)});class te extends T{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==g.array)return y(n,{code:l.invalid_type,expected:g.array,received:n.parsedType}),_;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,o=n.data.length<s.exactLength.value;(i||o)&&(y(n,{code:i?l.too_big:l.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(y(n,{code:l.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(y(n,{code:l.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>s.type._parseAsync(new ae(n,i,n.path,o)))).then(i=>z.mergeArray(r,i));const a=[...n.data].map((i,o)=>s.type._parseSync(new ae(n,i,n.path,o)));return z.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new te({...this._def,minLength:{value:e,message:w.toString(n)}})}max(e,n){return new te({...this._def,maxLength:{value:e,message:w.toString(n)}})}length(e,n){return new te({...this._def,exactLength:{value:e,message:w.toString(n)}})}nonempty(e){return this.min(1,e)}}te.create=(t,e)=>new te({type:t,minLength:null,maxLength:null,exactLength:null,typeName:x.ZodArray,...E(e)});function je(t){if(t instanceof M){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=se.create(je(r))}return new M({...t._def,shape:()=>e})}else return t instanceof te?new te({...t._def,type:je(t.element)}):t instanceof se?se.create(je(t.unwrap())):t instanceof _e?_e.create(je(t.unwrap())):t instanceof ie?ie.create(t.items.map(e=>je(e))):t}class M extends T{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=C.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==g.object){const u=this._getOrReturnCtx(e);return y(u,{code:l.invalid_type,expected:g.object,received:u.parsedType}),_}const{status:r,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ye&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const d=a[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new ae(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof ye){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of o)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")o.length>0&&(y(s,{code:l.unrecognized_keys,keys:o}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of o){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new ae(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>z.mergeObjectSync(r,u)):z.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new M({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var s,a,i,o;const c=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}})}strip(){return new M({...this._def,unknownKeys:"strip"})}passthrough(){return new M({...this._def,unknownKeys:"passthrough"})}extend(e){return new M({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new M({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:x.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new M({...this._def,catchall:e})}pick(e){const n={};return C.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new M({...this._def,shape:()=>n})}omit(e){const n={};return C.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new M({...this._def,shape:()=>n})}deepPartial(){return je(this)}partial(e){const n={};return C.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new M({...this._def,shape:()=>n})}required(e){const n={};return C.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof se;)a=a._def.innerType;n[r]=a}}),new M({...this._def,shape:()=>n})}keyof(){return Zs(C.objectKeys(this.shape))}}M.create=(t,e)=>new M({shape:()=>t,unknownKeys:"strip",catchall:ye.create(),typeName:x.ZodObject,...E(e)});M.strictCreate=(t,e)=>new M({shape:()=>t,unknownKeys:"strict",catchall:ye.create(),typeName:x.ZodObject,...E(e)});M.lazycreate=(t,e)=>new M({shape:t,unknownKeys:"strip",catchall:ye.create(),typeName:x.ZodObject,...E(e)});class At extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return n.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new K(o.ctx.common.issues));return y(n,{code:l.invalid_union,unionErrors:i}),_}if(n.common.async)return Promise.all(r.map(async a=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new K(c));return y(n,{code:l.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}At.create=(t,e)=>new At({options:t,typeName:x.ZodUnion,...E(e)});const de=t=>t instanceof kt?de(t.schema):t instanceof ne?de(t.innerType()):t instanceof $t?[t.value]:t instanceof xe?t.options:t instanceof Ct?C.objectValues(t.enum):t instanceof St?de(t._def.innerType):t instanceof _t?[void 0]:t instanceof Pt?[null]:t instanceof se?[void 0,...de(t.unwrap())]:t instanceof _e?[null,...de(t.unwrap())]:t instanceof br||t instanceof Rt?de(t.unwrap()):t instanceof It?de(t._def.innerType):[];class cn extends T{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==g.object)return y(n,{code:l.invalid_type,expected:g.object,received:n.parsedType}),_;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(y(n,{code:l.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const i=de(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new cn({typeName:x.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...E(r)})}}function Ln(t,e){const n=le(t),r=le(e);if(t===e)return{valid:!0,data:t};if(n===g.object&&r===g.object){const s=C.objectKeys(e),a=C.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(const o of a){const c=Ln(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(n===g.array&&r===g.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],c=Ln(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===g.date&&r===g.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Et extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(Zn(a)||Zn(i))return _;const o=Ln(a.value,i.value);return o.valid?((Dn(a)||Dn(i))&&n.dirty(),{status:n.value,value:o.data}):(y(r,{code:l.invalid_intersection_types}),_)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Et.create=(t,e,n)=>new Et({left:t,right:e,typeName:x.ZodIntersection,...E(n)});class ie extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.array)return y(r,{code:l.invalid_type,expected:g.array,received:r.parsedType}),_;if(r.data.length<this._def.items.length)return y(r,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&r.data.length>this._def.items.length&&(y(r,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new ae(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(a).then(i=>z.mergeArray(n,i)):z.mergeArray(n,a)}get items(){return this._def.items}rest(e){return new ie({...this._def,rest:e})}}ie.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ie({items:t,typeName:x.ZodTuple,rest:null,...E(e)})};class Tt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.object)return y(r,{code:l.invalid_type,expected:g.object,received:r.parsedType}),_;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new ae(r,o,r.path,o)),value:i._parse(new ae(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?z.mergeObjectAsync(n,s):z.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof T?new Tt({keyType:e,valueType:n,typeName:x.ZodRecord,...E(r)}):new Tt({keyType:ee.create(),valueType:e,typeName:x.ZodRecord,...E(n)})}}class Qt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.map)return y(r,{code:l.invalid_type,expected:g.map,received:r.parsedType}),_;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,c],u)=>({key:s._parse(new ae(r,o,r.path,[u,"key"])),value:a._parse(new ae(r,c,r.path,[u,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return _;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(u.value,d.value)}return{status:n.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return _;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),o.set(u.value,d.value)}return{status:n.value,value:o}}}}Qt.create=(t,e,n)=>new Qt({valueType:e,keyType:t,typeName:x.ZodMap,...E(n)});class Re extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==g.set)return y(r,{code:l.invalid_type,expected:g.set,received:r.parsedType}),_;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(y(r,{code:l.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(y(r,{code:l.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function i(c){const u=new Set;for(const d of c){if(d.status==="aborted")return _;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const o=[...r.data.values()].map((c,u)=>a._parse(new ae(r,c,r.path,u)));return r.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,n){return new Re({...this._def,minSize:{value:e,message:w.toString(n)}})}max(e,n){return new Re({...this._def,maxSize:{value:e,message:w.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Re.create=(t,e)=>new Re({valueType:t,minSize:null,maxSize:null,typeName:x.ZodSet,...E(e)});class Ze extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==g.function)return y(n,{code:l.invalid_type,expected:g.function,received:n.parsedType}),_;function r(o,c){return Kt({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Wt(),Ge].filter(u=>!!u),issueData:{code:l.invalid_arguments,argumentsError:c}})}function s(o,c){return Kt({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Wt(),Ge].filter(u=>!!u),issueData:{code:l.invalid_return_type,returnTypeError:c}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof qe){const o=this;return L(async function(...c){const u=new K([]),d=await o._def.args.parseAsync(c,a).catch(b=>{throw u.addIssue(r(c,b)),u}),f=await Reflect.apply(i,this,d);return await o._def.returns._def.type.parseAsync(f,a).catch(b=>{throw u.addIssue(s(f,b)),u})})}else{const o=this;return L(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new K([r(c,u.error)]);const d=Reflect.apply(i,this,u.data),f=o._def.returns.safeParse(d,a);if(!f.success)throw new K([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ze({...this._def,args:ie.create(e).rest(Te.create())})}returns(e){return new Ze({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Ze({args:e||ie.create([]).rest(Te.create()),returns:n||Te.create(),typeName:x.ZodFunction,...E(r)})}}class kt extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}kt.create=(t,e)=>new kt({getter:t,typeName:x.ZodLazy,...E(e)});class $t extends T{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return y(n,{received:n.data,code:l.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}$t.create=(t,e)=>new $t({value:t,typeName:x.ZodLiteral,...E(e)});function Zs(t,e){return new xe({values:t,typeName:x.ZodEnum,...E(e)})}class xe extends T{constructor(){super(...arguments),tt.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{expected:C.joinValues(r),received:n.parsedType,code:l.invalid_type}),_}if(Jt(this,tt)||Bs(this,tt,new Set(this._def.values)),!Jt(this,tt).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{received:n.data,code:l.invalid_enum_value,options:r}),_}return L(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return xe.create(e,{...this._def,...n})}exclude(e,n=this._def){return xe.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}tt=new WeakMap;xe.create=Zs;class Ct extends T{constructor(){super(...arguments),nt.set(this,void 0)}_parse(e){const n=C.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==g.string&&r.parsedType!==g.number){const s=C.objectValues(n);return y(r,{expected:C.joinValues(s),received:r.parsedType,code:l.invalid_type}),_}if(Jt(this,nt)||Bs(this,nt,new Set(C.getValidEnumValues(this._def.values))),!Jt(this,nt).has(e.data)){const s=C.objectValues(n);return y(r,{received:r.data,code:l.invalid_enum_value,options:s}),_}return L(e.data)}get enum(){return this._def.values}}nt=new WeakMap;Ct.create=(t,e)=>new Ct({values:t,typeName:x.ZodNativeEnum,...E(e)});class qe extends T{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==g.promise&&n.common.async===!1)return y(n,{code:l.invalid_type,expected:g.promise,received:n.parsedType}),_;const r=n.parsedType===g.promise?n.data:Promise.resolve(n.data);return L(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}qe.create=(t,e)=>new qe({type:t,typeName:x.ZodPromise,...E(e)});class ne extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===x.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{y(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(async o=>{if(n.value==="aborted")return _;const c=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return c.status==="aborted"?_:c.status==="dirty"||n.value==="dirty"?Ne(c.value):c});{if(n.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?_:o.status==="dirty"||n.value==="dirty"?Ne(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?_:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Se(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Se(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);C.assertNever(s)}}ne.create=(t,e,n)=>new ne({schema:t,typeName:x.ZodEffects,effect:e,...E(n)});ne.createWithPreprocess=(t,e,n)=>new ne({schema:e,effect:{type:"preprocess",transform:t},typeName:x.ZodEffects,...E(n)});class se extends T{_parse(e){return this._getType(e)===g.undefined?L(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}se.create=(t,e)=>new se({innerType:t,typeName:x.ZodOptional,...E(e)});class _e extends T{_parse(e){return this._getType(e)===g.null?L(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}_e.create=(t,e)=>new _e({innerType:t,typeName:x.ZodNullable,...E(e)});class St extends T{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===g.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}St.create=(t,e)=>new St({innerType:t,typeName:x.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...E(e)});class It extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return wt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new K(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new K(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}It.create=(t,e)=>new It({innerType:t,typeName:x.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...E(e)});class en extends T{_parse(e){if(this._getType(e)!==g.nan){const r=this._getOrReturnCtx(e);return y(r,{code:l.invalid_type,expected:g.nan,received:r.parsedType}),_}return{status:"valid",value:e.data}}}en.create=t=>new en({typeName:x.ZodNaN,...E(t)});const ou=Symbol("zod_brand");class br extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Bt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?_:a.status==="dirty"?(n.dirty(),Ne(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?_:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Bt({in:e,out:n,typeName:x.ZodPipeline})}}class Rt extends T{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Se(s)&&(s.value=Object.freeze(s.value)),s);return wt(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Rt.create=(t,e)=>new Rt({innerType:t,typeName:x.ZodReadonly,...E(e)});function Ds(t,e={},n){return t?He.create().superRefine((r,s)=>{var a,i;if(!t(r)){const o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...u,fatal:c})}}):He.create()}const cu={object:M.lazycreate};var x;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(x||(x={}));const uu=(t,e={message:`Input not instance of ${t.name}`})=>Ds(n=>n instanceof t,e),Ls=ee.create,Us=ve.create,du=en.create,lu=we.create,Vs=xt.create,fu=Ie.create,hu=Yt.create,pu=_t.create,mu=Pt.create,yu=He.create,bu=Te.create,gu=ye.create,vu=Xt.create,wu=te.create,xu=M.create,_u=M.strictCreate,Pu=At.create,Au=cn.create,Eu=Et.create,Tu=ie.create,ku=Tt.create,$u=Qt.create,Cu=Re.create,Su=Ze.create,Iu=kt.create,Ru=$t.create,Ou=xe.create,Mu=Ct.create,ju=qe.create,Nr=ne.create,Bu=se.create,Nu=_e.create,Fu=ne.createWithPreprocess,zu=Bt.create,Zu=()=>Ls().optional(),Du=()=>Us().optional(),Lu=()=>Vs().optional(),Uu={string:t=>ee.create({...t,coerce:!0}),number:t=>ve.create({...t,coerce:!0}),boolean:t=>xt.create({...t,coerce:!0}),bigint:t=>we.create({...t,coerce:!0}),date:t=>Ie.create({...t,coerce:!0})},Vu=_;var p=Object.freeze({__proto__:null,defaultErrorMap:Ge,setErrorMap:Fc,getErrorMap:Wt,makeIssue:Kt,EMPTY_PATH:zc,addIssueToContext:y,ParseStatus:z,INVALID:_,DIRTY:Ne,OK:L,isAborted:Zn,isDirty:Dn,isValid:Se,isAsync:wt,get util(){return C},get objectUtil(){return zn},ZodParsedType:g,getParsedType:le,ZodType:T,datetimeRegex:zs,ZodString:ee,ZodNumber:ve,ZodBigInt:we,ZodBoolean:xt,ZodDate:Ie,ZodSymbol:Yt,ZodUndefined:_t,ZodNull:Pt,ZodAny:He,ZodUnknown:Te,ZodNever:ye,ZodVoid:Xt,ZodArray:te,ZodObject:M,ZodUnion:At,ZodDiscriminatedUnion:cn,ZodIntersection:Et,ZodTuple:ie,ZodRecord:Tt,ZodMap:Qt,ZodSet:Re,ZodFunction:Ze,ZodLazy:kt,ZodLiteral:$t,ZodEnum:xe,ZodNativeEnum:Ct,ZodPromise:qe,ZodEffects:ne,ZodTransformer:ne,ZodOptional:se,ZodNullable:_e,ZodDefault:St,ZodCatch:It,ZodNaN:en,BRAND:ou,ZodBranded:br,ZodPipeline:Bt,ZodReadonly:Rt,custom:Ds,Schema:T,ZodSchema:T,late:cu,get ZodFirstPartyTypeKind(){return x},coerce:Uu,any:yu,array:wu,bigint:lu,boolean:Vs,date:fu,discriminatedUnion:Au,effect:Nr,enum:Ou,function:Su,instanceof:uu,intersection:Eu,lazy:Iu,literal:Ru,map:$u,nan:du,nativeEnum:Mu,never:gu,null:mu,nullable:Nu,number:Us,object:xu,oboolean:Lu,onumber:Du,optional:Bu,ostring:Zu,pipeline:zu,preprocess:Fu,promise:ju,record:ku,set:Cu,strictObject:_u,string:Ls,symbol:hu,transformer:Nr,tuple:Tu,undefined:pu,union:Pu,unknown:bu,void:vu,NEVER:Vu,ZodIssueCode:l,quotelessJson:Nc,ZodError:K});const Gu="test test test test test test test test test test test junk",Hu=async function(e,n){const r=n.privateKey,s=n.mnemonic??Gu,a=n.chain||"anvil",[{config:i,account:o},c]=W.getDeployableOptions({chain:a,rpcUrl:n.rpcUrl,privateKey:r,mnemonic:s}),u=c.id;if(e.at(0)==="generate")return oa({account:o==null?void 0:o.address,chainId:u});if(e.at(0)==="erc20"){let A=new Ms({config:i,account:o},{});return await A.deploy(),{erc20:A.assertValidAddress()}}const d=j.BOOST_REGISTRY_ADDRESSES[u];if(!d)throw new Error(`Unable to select a deployed BoostRegistry with chain ID ${u}`);const f=new j.BoostRegistry({config:i,account:o,address:d}),h=j.BOOST_CORE_ADDRESSES[u];if(!h)throw new Error(`Unable to select a deployed BoostCore with chain ID ${u}`);const b=new j.BoostCore({config:i,account:o,address:h});if(!e.length)throw new Error("No seed provided");const v=await Promise.all(e.map(qu));let P,k;const S=[];for(const A of v){let I;if(typeof A.budget=="string"&&W.isAddress$1(A.budget))I=b.ManagedBudget(A.budget);else if(xn(k,A.budget)&&P)I=P;else{const $={...A.budget,authorized:[...A.budget.authorized,h],roles:[...A.budget.roles,j.Roles.MANAGER]};I=await f.initialize(crypto.randomUUID(),b.ManagedBudget($)),P=I,k=A.budget}const q=A.incentives.map(async $=>{let N=0n;switch($.type){case"AllowListIncentive":return b.AllowListIncentive($);case"PointsIncentive":return b.PointsIncentive($);case"ERC20Incentive":return $.strategy===j.StrategyType.RAFFLE&&(N+=$.reward),$.strategy===j.StrategyType.POOL&&(N+=$.reward*$.limit),$.shouldMintAndAllocate&&await Dt(I,N,$.asset,{config:i,account:o}),b.ERC20Incentive($);case"ERC20VariableCriteriaIncentive":return N+=$.limit,$.shouldMintAndAllocate&&await Dt(I,N,$.asset,{config:i,account:o}),b.ERC20VariableCriteriaIncentive($);case"ERC20VariableIncentive":return N+=$.limit,$.shouldMintAndAllocate&&await Dt(I,N,$.asset,{config:i,account:o}),b.ERC20VariableIncentive($);case"CGDAIncentive":return N+=$.totalBudget,$.shouldMintAndAllocate&&await Dt(I,N,$.asset,{config:i,account:o}),b.CGDAIncentive($)}}),J=await Promise.all(q),B={protocolFee:A.protocolFee,maxParticipants:A.maxParticipants,budget:I,action:b.EventAction(A.action),allowList:await Ju(A,{core:b}),incentives:J};A.validator&&(B.validator=b.SignerValidator(A.validator));const re=await b.createBoost(B);S.push(re.id.toString())}return{boostIds:S}};async function Dt(t,e,n,r){if(n&&e){let s=new Ms(r,n);await Yu(r,s,t,Fr(e.toString()))}}async function qu(t){const e=await ca.readFile(ua.normalize(t),{encoding:"utf8"});return ia.parse(JSON.parse(e))}const Wu=p.custom(W.isHex$1,"invalid Hex payload"),O=p.string().transform((t,e)=>(/^0x[a-fA-F0-9]{40}$/.test(t)||e.addIssue({code:p.ZodIssueCode.custom,message:`Invalid Address ${t}`}),t)).pipe(p.custom(W.isAddress$1,"invalid eth address")),Ku=p.coerce.number().min(1).max(2).transform(BigInt).pipe(p.custom()),Gs=p.object({type:p.literal("ManagedBudget"),owner:O,authorized:p.array(O),roles:p.array(Ku)}).refine(t=>t.authorized.length===t.roles.length,"length mismatch authorized and roles"),un=p.custom().pipe(p.string().regex(/^(event|function) .*/,{message:"signature must start with `event` or function`"}).transform(t=>{if(t.startsWith("function"))return W.pad(W.toFunctionSelector(t));if(t.startsWith("event"))return W.toEventSelector(t);throw new Error("unreachable")})),Hs=p.object({signatureType:p.nativeEnum(j.SignatureType),signature:un,fieldIndex:p.number().nonnegative(),targetContract:O,chainid:p.number().nonnegative()}),qs=p.object({filterType:p.nativeEnum(j.FilterType),fieldType:p.nativeEnum(j.PrimitiveType),fieldIndex:p.number().nonnegative(),filterData:Wu}),Ws=p.object({signature:un,signatureType:p.nativeEnum(j.SignatureType),actionType:p.number().optional(),targetContract:O,chainid:p.number().nonnegative(),actionParameter:qs}),Ks=p.object({type:p.literal("EventAction"),actionClaimant:Hs,actionSteps:p.array(Ws).max(4)}),Js=p.object({type:p.literal("SignerValidator"),signers:p.array(O),validatorCaller:O}),Ys=p.object({type:p.literal("SimpleDenyList"),owner:O,denied:p.array(O)}),Xs=p.object({type:p.literal("SimpleAllowList"),owner:O,allowed:p.array(O)}),Qs=p.object({type:p.literal("AllowListIncentive"),allowList:O,limit:p.coerce.bigint()}),ea=p.object({type:p.literal("ERC20Incentive"),asset:O,shouldMintAndAllocate:p.boolean().optional().default(!1),strategy:p.nativeEnum(j.StrategyType),reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:O.optional()}),ta=p.object({type:p.literal("ERC20VariableIncentive"),asset:O,shouldMintAndAllocate:p.boolean().optional().default(!1),reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:O}),na=p.object({criteriaType:p.nativeEnum(j.SignatureType),signature:un,fieldIndex:p.number().nonnegative(),targetContract:O}),ra=p.object({type:p.literal("ERC20VariableCriteriaIncentive"),asset:O,shouldMintAndAllocate:p.boolean().optional().default(!1),reward:p.coerce.bigint(),limit:p.coerce.bigint(),manager:O.optional(),criteria:na}),sa=p.object({type:p.literal("CGDAIncentive"),asset:O,shouldMintAndAllocate:p.boolean().optional().default(!1),initialReward:p.coerce.bigint(),rewardDecay:p.coerce.bigint(),rewardBoost:p.coerce.bigint(),totalBudget:p.coerce.bigint(),manager:O}),aa=p.object({type:p.literal("PointsIncentive"),venue:O,selector:un,reward:p.coerce.bigint(),limit:p.coerce.bigint()}),ia=p.object({protocolFee:p.coerce.bigint(),maxParticipants:p.coerce.bigint(),budget:p.union([O,Gs]),action:p.union([O,Ks]),validator:p.union([O,Js]).optional(),allowList:p.union([O,Ys,Xs]).optional(),incentives:p.array(p.union([Qs,ea,ra,ta,sa,aa]))});async function Ju({allowList:t},{core:e}){if(!t)return e.OpenAllowList();if(typeof t=="string"&&W.isAddress$1(t))return await j.allowListFromAddress({config:e._config,account:e._account},t);switch(t.type){case"SimpleAllowList":return e.SimpleAllowList(t);case"SimpleDenyList":return e.SimpleDenyList(t);default:throw new Error("unusupported AllowList: "+t)}}async function Yu(t,e,n,r=Fr("110")){return await e.mint(t.account.address,r),await e.approve(n.assertValidAddress(),r),await n.allocate({amount:r,asset:e.assertValidAddress(),target:t.account.address}),{budget:n,erc20:e}}function oa({asset:t="0xf3B2d0E4f2d8F453DBCc278b10e88b20d7f19f8D",account:e=Bc[0].account,chainId:n}){return{protocolFee:0n,maxParticipants:10n,budget:{type:"ManagedBudget",owner:e,authorized:[e],roles:[j.Roles.MANAGER]},action:{type:"EventAction",actionClaimant:{signatureType:j.SignatureType.FUNC,signature:"function mint(address to, uint256 amount)",fieldIndex:0,targetContract:vr,chainid:n},actionSteps:[{signature:"event Minted(address to, uint256 amount)",signatureType:j.SignatureType.FUNC,actionType:0,targetContract:vr,chainid:n,actionParameter:{filterType:j.FilterType.EQUAL,fieldType:j.PrimitiveType.ADDRESS,fieldIndex:0,filterData:e}}]},validator:{type:"SignerValidator",signers:[e],validatorCaller:e},allowList:{type:"SimpleDenyList",owner:e,denied:[]},incentives:[{type:"ERC20Incentive",asset:t,shouldMintAndAllocate:!1,strategy:0,reward:1n,limit:1n,manager:e}]}}exports.ActionClaimantSchema=Hs;exports.ActionStepCriteriaSchema=qs;exports.ActionStepSchema=Ws;exports.AllowListIncentiveSchema=Qs;exports.BaseError=m;exports.BoostSeedConfigSchema=ia;exports.CGDAIncentiveSchema=sa;exports.ERC20IncentiveSchema=ea;exports.ERC20VariableCriteriaIncentiveSchema=ra;exports.ERC20VariableIncentiveSchema=ta;exports.EventActionSchema=Ks;exports.HttpRequestError=nr;exports.IncentiveCriteriaSchema=na;exports.InvalidAddressError=Ue;exports.ManagedBudgetSchema=Gs;exports.PointsIncentiveSchema=aa;exports.SignerValidatorSchema=Js;exports.SimpleAllowListSchema=Xs;exports.SimpleDenyListSchema=Ys;exports.call=fr;exports.concat=ke;exports.decodeErrorResult=Ts;exports.encodeAbiParameters=Kn;exports.getUrl=tr;exports.isAddress=me;exports.isHex=he;exports.makeSeed=oa;exports.seed=Hu;exports.stringify=jt;