@boostxyz/cli 6.2.1 → 7.0.0-canary.0

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