@layerzerolabs/verify-contract 1.1.28 → 1.1.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +7 -7
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -439,15 +439,15 @@ Filtered results for: ${this.inputValue?this.inputValue:ki.gray("Enter something
|
|
|
439
439
|
Please provide the API URL:
|
|
440
440
|
|
|
441
441
|
- As an apiUrl config parameter in ${i} config
|
|
442
|
-
- As a SCAN_API_URL_${i}
|
|
443
|
-
- As a SCAN_API_URL_${ks(i)}
|
|
442
|
+
- As a SCAN_API_URL_${i} environment variable
|
|
443
|
+
- As a SCAN_API_URL_${ks(i)} environment variable
|
|
444
444
|
`);let o=s.apiKey||TO(i);o||t.debug(`Could not find scan API key for network ${Ed.default.bold(i)}
|
|
445
445
|
|
|
446
446
|
Please provide the API key:
|
|
447
447
|
|
|
448
448
|
- As an apiKey config parameter in ${i} config
|
|
449
|
-
- As a SCAN_API_KEY_${i}
|
|
450
|
-
- As a SCAN_API_KEY_${ks(i)}
|
|
449
|
+
- As a SCAN_API_KEY_${i} environment variable
|
|
450
|
+
- As a SCAN_API_KEY_${ks(i)} environment variable`);let a=s.browserUrl||CO(i)||M1(n);return a||t.debug(`Could not find scan browser URL key for network ${Ed.default.bold(i)}
|
|
451
451
|
|
|
452
452
|
Browser URL is used to display a link to the verified contract
|
|
453
453
|
after successful verification.
|
|
@@ -455,8 +455,8 @@ Please provide the API key:
|
|
|
455
455
|
Please provide the browser URL:
|
|
456
456
|
|
|
457
457
|
- As an browserUrl config parameter in ${i} config
|
|
458
|
-
- As a SCAN_BROWSER_URL_${i}
|
|
459
|
-
- As a SCAN_BROWSER_URL_${ks(i)} enviornment variable`),{...r,[i]:{apiUrl:n,apiKey:o,browserUrl:a}}},{}),EO=t=>{var e,r;return ((e=process.env[`SCAN_API_URL_${t}`])==null?void 0:e.trim())||((r=process.env[`SCAN_API_URL_${ks(t)}`])==null?void 0:r.trim())},CO=t=>{var e,r;return ((e=process.env[`SCAN_BROWSER_URL_${t}`])==null?void 0:e.trim())||((r=process.env[`SCAN_BROWSER_URL_${ks(t)}`])==null?void 0:r.trim())},TO=t=>{var e,r;return ((e=process.env[`SCAN_API_KEY_${t}`])==null?void 0:e.trim())||((r=process.env[`SCAN_API_KEY_${ks(t)}`])==null?void 0:r.trim())},ks=t=>t.toUpperCase().replaceAll("-","_");var Td=(i=>(i[i.None=1]="None",i[i.Unlicense=2]="Unlicense",i[i.MIT=3]="MIT",i[i["GNU-GPLv2"]=4]="GNU-GPLv2",i[i["GNU-GPLv3"]=5]="GNU-GPLv3",i[i["GNU-LGPLv2.1"]=6]="GNU-LGPLv2.1",i[i["GNU-LGPLv3"]=7]="GNU-LGPLv3",i[i["BSD-2-Clause"]=8]="BSD-2-Clause",i[i["BSD-3-Clause"]=9]="BSD-3-Clause",i[i["MPL-2.0"]=10]="MPL-2.0",i[i["OSL-3.0"]=11]="OSL-3.0",i[i["Apache-2.0"]=12]="Apache-2.0",i[i["GNU-AGPLv3"]=13]="GNU-AGPLv3",i[i["BUSL-1.1"]=14]="BUSL-1.1",i))(Td||{}),Ad=t=>{let e=t.match(/\/\/\s*SPDX-License-Identifier:\s*(.*)\s*/i),r=e==null?void 0:e[1];return r==null?1:(r in Td||console.warn("Found unknown SPDX license identifier: %s",r),Td[r])};var Ze;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let n={};for(let o of s)n[o]=o;return n},t.getValidEnumValues=s=>{let n=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(let a of n)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(n){return s[n]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let n=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&n.push(o);return n},t.find=(s,n)=>{for(let o of s)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function i(s,n=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=i,t.jsonStringifyReplacer=(s,n)=>typeof n=="bigint"?n.toString():n;})(Ze||(Ze={}));var Dd;(function(t){t.mergeShapes=(e,r)=>({...e,...r});})(Dd||(Dd={}));var Ee=Ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Vi=t=>{switch(typeof t){case"undefined":return Ee.undefined;case"string":return Ee.string;case"number":return isNaN(t)?Ee.nan:Ee.number;case"boolean":return Ee.boolean;case"function":return Ee.function;case"bigint":return Ee.bigint;case"symbol":return Ee.symbol;case"object":return Array.isArray(t)?Ee.array:t===null?Ee.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ee.promise:typeof Map!="undefined"&&t instanceof Map?Ee.map:typeof Set!="undefined"&&t instanceof Set?Ee.set:typeof Date!="undefined"&&t instanceof Date?Ee.date:Ee.object;default:return Ee.unknown}},ve=Ze.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"]),AO=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Er=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i];},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i];};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e;}get errors(){return this.issues}format(e){let r=e||function(n){return n.message},i={_errors:[]},s=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)i._errors.push(r(o));else {let a=i,u=0;for(;u<o.path.length;){let l=o.path[u];u===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(o))):a[l]=a[l]||{_errors:[]},a=a[l],u++;}}};return s(this),i}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ze.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):i.push(e(s));return {formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};Er.create=t=>new Er(t);var Go=(t,e)=>{let r;switch(t.code){case ve.invalid_type:t.received===Ee.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ve.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.jsonStringifyReplacer)}`;break;case ve.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.joinValues(t.keys,", ")}`;break;case ve.invalid_union:r="Invalid input";break;case ve.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.joinValues(t.options)}`;break;case ve.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.joinValues(t.options)}, received '${t.received}'`;break;case ve.invalid_arguments:r="Invalid function arguments";break;case ve.invalid_return_type:r="Invalid function return type";break;case ve.invalid_date:r="Invalid date";break;case ve.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ze.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ve.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ve.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ve.custom:r="Invalid input";break;case ve.invalid_intersection_types:r="Intersection results could not be merged";break;case ve.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ve.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ze.assertNever(t);}return {message:r}},yy=Go;function wO(t){yy=t;}function zu(){return yy}var Ku=t=>{let{data:e,path:r,errorMaps:i,issueData:s}=t,n=[...r,...s.path||[]],o={...s,path:n},a="",u=i.filter(l=>!!l).slice().reverse();for(let l of u)a=l(o,{data:e,defaultError:a}).message;return {...s,path:n,message:s.message||a}},DO=[];function Te(t,e){let r=Ku({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,zu(),Go].filter(i=>!!i)});t.common.issues.push(r);}var rr=class t{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,r){let i=[];for(let s of r){if(s.status==="aborted")return Pe;s.status==="dirty"&&e.dirty(),i.push(s.value);}return {status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let s of r)i.push({key:await s.key,value:await s.value});return t.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let s of r){let{key:n,value:o}=s;if(n.status==="aborted"||o.status==="aborted")return Pe;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value!="undefined"||s.alwaysSet)&&(i[n.value]=o.value);}return {status:e.value,value:i}}},Pe=Object.freeze({status:"aborted"}),vy=t=>({status:"dirty",value:t}),sr=t=>({status:"valid",value:t}),Sd=t=>t.status==="aborted",Rd=t=>t.status==="dirty",Wo=t=>t.status==="valid",Gu=t=>typeof Promise!="undefined"&&t instanceof Promise,Re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message;})(Re||(Re={}));var Fr=class{constructor(e,r,i,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,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}},gy=(t,e)=>{if(Wo(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;let r=new Er(t.common.issues);return this._error=r,this._error}}};function Be(t){if(!t)return {};let{errorMap:e,invalid_type_error:r,required_error:i,description:s}=t;if(e&&(r||i))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:(o,a)=>o.code!=="invalid_type"?{message:a.defaultError}:typeof a.data=="undefined"?{message:i!=null?i:a.defaultError}:{message:r!=null?r:a.defaultError},description:s}}var je=class{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);}get description(){return this._def.description}_getType(e){return Vi(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Vi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new rr,ctx:{common:e.parent.common,data:e.data,parsedType:Vi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Gu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){var i;let s={common:{issues:[],async:(i=r==null?void 0:r.async)!==null&&i!==void 0?i:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vi(e)},n=this._parseSync({data:e,path:s.path,parent:s});return gy(s,n)}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vi(e)},s=this._parse({data:e,path:i.path,parent:i}),n=await(Gu(s)?s:Promise.resolve(s));return gy(i,n)}refine(e,r){let i=s=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,n)=>{let o=e(s),a=()=>n.addIssue({code:ve.custom,...i(s)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(u=>u?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((i,s)=>e(i)?!0:(s.addIssue(typeof r=="function"?r(i,s):r),!1))}_refinement(e){return new Cr({schema:this,typeName:Oe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return jr.create(this,this._def)}nullable(){return yi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _i.create(this,this._def)}promise(){return Ki.create(this,this._def)}or(e){return Hn.create([this,e],this._def)}and(e){return Un.create(this,e,this._def)}transform(e){return new Cr({...Be(this._def),schema:this,typeName:Oe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Gn({...Be(this._def),innerType:this,defaultValue:r,typeName:Oe.ZodDefault})}brand(){return new Zu({typeName:Oe.ZodBranded,type:this,...Be(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Us({...Be(this._def),innerType:this,catchValue:r,typeName:Oe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Yo.create(this,e)}readonly(){return $s.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},SO=/^c[^\s-]{8,}$/i,RO=/^[a-z][a-z0-9]*$/,NO=/^[0-9A-HJKMNP-TV-Z]{26}$/,OO=/^[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,FO=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,LO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",wd,PO=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,IO=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,kO=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function MO(t,e){return !!((e==="v4"||!e)&&PO.test(t)||(e==="v6"||!e)&&IO.test(t))}var $i=class t extends je{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ee.string){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_type,expected:Ee.string,received:n.parsedType}),Pe}let i=new rr,s;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),i.dirty());else if(n.kind==="max")e.data.length>n.value&&(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),i.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,a=e.data.length<n.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?Te(s,{code:ve.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):a&&Te(s,{code:ve.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),i.dirty());}else if(n.kind==="email")FO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"email",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="emoji")wd||(wd=new RegExp(LO,"u")),wd.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"emoji",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="uuid")OO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"uuid",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="cuid")SO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"cuid",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="cuid2")RO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"cuid2",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="ulid")NO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"ulid",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="url")try{new URL(e.data);}catch(o){s=this._getOrReturnCtx(e,s),Te(s,{validation:"url",code:ve.invalid_string,message:n.message}),i.dirty();}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"regex",code:ve.invalid_string,message:n.message}),i.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),i.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.invalid_string,validation:{startsWith:n.value},message:n.message}),i.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.invalid_string,validation:{endsWith:n.value},message:n.message}),i.dirty()):n.kind==="datetime"?kO(n).test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.invalid_string,validation:"datetime",message:n.message}),i.dirty()):n.kind==="ip"?MO(e.data,n.version)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"ip",code:ve.invalid_string,message:n.message}),i.dirty()):Ze.assertNever(n);return {status:i.value,value:e.data}}_regex(e,r,i){return this.refinement(s=>e.test(s),{validation:r,code:ve.invalid_string,...Re.errToObj(i)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Re.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,...Re.errToObj(e==null?void 0:e.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Re.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...Re.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Re.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Re.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Re.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Re.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Re.errToObj(r)})}nonempty(e){return this.min(1,Re.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return !!this._def.checks.find(e=>e.kind==="datetime")}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 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 minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};$i.create=t=>{var e;return new $i({checks:[],typeName:Oe.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Be(t)})};function BO(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,s=r>i?r:i,n=parseInt(t.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return n%o/Math.pow(10,s)}var In=class t extends je{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)!==Ee.number){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_type,expected:Ee.number,received:n.parsedType}),Pe}let i,s=new rr;for(let n of this._def.checks)n.kind==="int"?Ze.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="multipleOf"?BO(e.data,n.value)!==0&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.not_finite,message:n.message}),s.dirty()):Ze.assertNever(n);return {status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Re.toString(r))}setLimit(e,r,i,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:Re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Re.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Re.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return !!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ze.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return !0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);}return Number.isFinite(r)&&Number.isFinite(e)}};In.create=t=>new In({checks:[],typeName:Oe.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Be(t)});var kn=class t extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte;}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ee.bigint){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_type,expected:Ee.bigint,received:n.parsedType}),Pe}let i,s=new rr;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):Ze.assertNever(n);return {status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Re.toString(r))}setLimit(e,r,i,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:Re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Re.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};kn.create=t=>{var e;return new kn({checks:[],typeName:Oe.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Be(t)})};var Mn=class extends je{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ee.boolean){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.boolean,received:i.parsedType}),Pe}return sr(e.data)}};Mn.create=t=>new Mn({typeName:Oe.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Be(t)});var Bn=class t extends je{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ee.date){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_type,expected:Ee.date,received:n.parsedType}),Pe}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_date}),Pe}let i=new rr,s;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),i.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),i.dirty()):Ze.assertNever(n);return {status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Re.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Re.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Bn.create=t=>new Bn({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Oe.ZodDate,...Be(t)});var Bs=class extends je{_parse(e){if(this._getType(e)!==Ee.symbol){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.symbol,received:i.parsedType}),Pe}return sr(e.data)}};Bs.create=t=>new Bs({typeName:Oe.ZodSymbol,...Be(t)});var jn=class extends je{_parse(e){if(this._getType(e)!==Ee.undefined){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.undefined,received:i.parsedType}),Pe}return sr(e.data)}};jn.create=t=>new jn({typeName:Oe.ZodUndefined,...Be(t)});var qn=class extends je{_parse(e){if(this._getType(e)!==Ee.null){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.null,received:i.parsedType}),Pe}return sr(e.data)}};qn.create=t=>new qn({typeName:Oe.ZodNull,...Be(t)});var zi=class extends je{constructor(){super(...arguments),this._any=!0;}_parse(e){return sr(e.data)}};zi.create=t=>new zi({typeName:Oe.ZodAny,...Be(t)});var gi=class extends je{constructor(){super(...arguments),this._unknown=!0;}_parse(e){return sr(e.data)}};gi.create=t=>new gi({typeName:Oe.ZodUnknown,...Be(t)});var qr=class extends je{_parse(e){let r=this._getOrReturnCtx(e);return Te(r,{code:ve.invalid_type,expected:Ee.never,received:r.parsedType}),Pe}};qr.create=t=>new qr({typeName:Oe.ZodNever,...Be(t)});var js=class extends je{_parse(e){if(this._getType(e)!==Ee.undefined){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.void,received:i.parsedType}),Pe}return sr(e.data)}};js.create=t=>new js({typeName:Oe.ZodVoid,...Be(t)});var _i=class t extends je{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),s=this._def;if(r.parsedType!==Ee.array)return Te(r,{code:ve.invalid_type,expected:Ee.array,received:r.parsedType}),Pe;if(s.exactLength!==null){let o=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(o||a)&&(Te(r,{code:o?ve.too_big:ve.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),i.dirty());}if(s.minLength!==null&&r.data.length<s.minLength.value&&(Te(r,{code:ve.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),i.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(Te(r,{code:ve.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>s.type._parseAsync(new Fr(r,o,r.path,a)))).then(o=>rr.mergeArray(i,o));let n=[...r.data].map((o,a)=>s.type._parseSync(new Fr(r,o,r.path,a)));return rr.mergeArray(i,n)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Re.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Re.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Re.toString(r)}})}nonempty(e){return this.min(1,e)}};_i.create=(t,e)=>new _i({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Oe.ZodArray,...Be(e)});function Ms(t){if(t instanceof cr){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=jr.create(Ms(i));}return new cr({...t._def,shape:()=>e})}else return t instanceof _i?new _i({...t._def,type:Ms(t.element)}):t instanceof jr?jr.create(Ms(t.unwrap())):t instanceof yi?yi.create(Ms(t.unwrap())):t instanceof Jr?Jr.create(t.items.map(e=>Ms(e))):t}var cr=class t extends je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend;}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Ze.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Ee.object){let l=this._getOrReturnCtx(e);return Te(l,{code:ve.invalid_type,expected:Ee.object,received:l.parsedType}),Pe}let{status:i,ctx:s}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof qr&&this._def.unknownKeys==="strip"))for(let l in s.data)o.includes(l)||a.push(l);let u=[];for(let l of o){let h=n[l],c=s.data[l];u.push({key:{status:"valid",value:l},value:h._parse(new Fr(s,c,s.path,l)),alwaysSet:l in s.data});}if(this._def.catchall instanceof qr){let l=this._def.unknownKeys;if(l==="passthrough")for(let h of a)u.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(l==="strict")a.length>0&&(Te(s,{code:ve.unrecognized_keys,keys:a}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let l=this._def.catchall;for(let h of a){let c=s.data[h];u.push({key:{status:"valid",value:h},value:l._parse(new Fr(s,c,s.path,h)),alwaysSet:h in s.data});}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let h of u){let c=await h.key;l.push({key:c,value:await h.value,alwaysSet:h.alwaysSet});}return l}).then(l=>rr.mergeObjectSync(i,l)):rr.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(e){return Re.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{var s,n,o,a;let u=(o=(n=(s=this._def).errorMap)===null||n===void 0?void 0:n.call(s,r,i).message)!==null&&o!==void 0?o:i.defaultError;return r.code==="unrecognized_keys"?{message:(a=Re.errToObj(e).message)!==null&&a!==void 0?a:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Oe.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Ze.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(r[i]=this.shape[i]);}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Ze.objectKeys(this.shape).forEach(i=>{e[i]||(r[i]=this.shape[i]);}),new t({...this._def,shape:()=>r})}deepPartial(){return Ms(this)}partial(e){let r={};return Ze.objectKeys(this.shape).forEach(i=>{let s=this.shape[i];e&&!e[i]?r[i]=s:r[i]=s.optional();}),new t({...this._def,shape:()=>r})}required(e){let r={};return Ze.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])r[i]=this.shape[i];else {let n=this.shape[i];for(;n instanceof jr;)n=n._def.innerType;r[i]=n;}}),new t({...this._def,shape:()=>r})}keyof(){return xy(Ze.objectKeys(this.shape))}};cr.create=(t,e)=>new cr({shape:()=>t,unknownKeys:"strip",catchall:qr.create(),typeName:Oe.ZodObject,...Be(e)});cr.strictCreate=(t,e)=>new cr({shape:()=>t,unknownKeys:"strict",catchall:qr.create(),typeName:Oe.ZodObject,...Be(e)});cr.lazycreate=(t,e)=>new cr({shape:t,unknownKeys:"strip",catchall:qr.create(),typeName:Oe.ZodObject,...Be(e)});var Hn=class extends je{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function s(n){for(let a of n)if(a.result.status==="valid")return a.result;for(let a of n)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=n.map(a=>new Er(a.ctx.common.issues));return Te(r,{code:ve.invalid_union,unionErrors:o}),Pe}if(r.common.async)return Promise.all(i.map(async n=>{let o={...r,common:{...r.common,issues:[]},parent:null};return {result:await n._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let n,o=[];for(let u of i){let l={...r,common:{...r.common,issues:[]},parent:null},h=u._parseSync({data:r.data,path:r.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!n&&(n={result:h,ctx:l}),l.common.issues.length&&o.push(l.common.issues);}if(n)return r.common.issues.push(...n.ctx.common.issues),n.result;let a=o.map(u=>new Er(u));return Te(r,{code:ve.invalid_union,unionErrors:a}),Pe}}get options(){return this._def.options}};Hn.create=(t,e)=>new Hn({options:t,typeName:Oe.ZodUnion,...Be(e)});var $u=t=>t instanceof Vn?$u(t.schema):t instanceof Cr?$u(t.innerType()):t instanceof $n?[t.value]:t instanceof zn?t.options:t instanceof Kn?Object.keys(t.enum):t instanceof Gn?$u(t._def.innerType):t instanceof jn?[void 0]:t instanceof qn?[null]:null,Wu=class t extends je{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ee.object)return Te(r,{code:ve.invalid_type,expected:Ee.object,received:r.parsedType}),Pe;let i=this.discriminator,s=r.data[i],n=this.optionsMap.get(s);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(Te(r,{code:ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){let s=new Map;for(let n of r){let o=$u(n.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,n);}}return new t({typeName:Oe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Be(i)})}};function Nd(t,e){let r=Vi(t),i=Vi(e);if(t===e)return {valid:!0,data:t};if(r===Ee.object&&i===Ee.object){let s=Ze.objectKeys(e),n=Ze.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(let a of n){let u=Nd(t[a],e[a]);if(!u.valid)return {valid:!1};o[a]=u.data;}return {valid:!0,data:o}}else if(r===Ee.array&&i===Ee.array){if(t.length!==e.length)return {valid:!1};let s=[];for(let n=0;n<t.length;n++){let o=t[n],a=e[n],u=Nd(o,a);if(!u.valid)return {valid:!1};s.push(u.data);}return {valid:!0,data:s}}else return r===Ee.date&&i===Ee.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Un=class extends je{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),s=(n,o)=>{if(Sd(n)||Sd(o))return Pe;let a=Nd(n.value,o.value);return a.valid?((Rd(n)||Rd(o))&&r.dirty(),{status:r.value,value:a.data}):(Te(i,{code:ve.invalid_intersection_types}),Pe)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([n,o])=>s(n,o)):s(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Un.create=(t,e,r)=>new Un({left:t,right:e,typeName:Oe.ZodIntersection,...Be(r)});var Jr=class t extends je{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ee.array)return Te(i,{code:ve.invalid_type,expected:Ee.array,received:i.parsedType}),Pe;if(i.data.length<this._def.items.length)return Te(i,{code:ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Pe;!this._def.rest&&i.data.length>this._def.items.length&&(Te(i,{code:ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let n=[...i.data].map((o,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new Fr(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(n).then(o=>rr.mergeArray(r,o)):rr.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Jr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jr({items:t,typeName:Oe.ZodTuple,rest:null,...Be(e)})};var Yu=class t extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ee.object)return Te(i,{code:ve.invalid_type,expected:Ee.object,received:i.parsedType}),Pe;let s=[],n=this._def.keyType,o=this._def.valueType;for(let a in i.data)s.push({key:n._parse(new Fr(i,a,i.path,a)),value:o._parse(new Fr(i,i.data[a],i.path,a))});return i.common.async?rr.mergeObjectAsync(r,s):rr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof je?new t({keyType:e,valueType:r,typeName:Oe.ZodRecord,...Be(i)}):new t({keyType:$i.create(),valueType:e,typeName:Oe.ZodRecord,...Be(r)})}},qs=class extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ee.map)return Te(i,{code:ve.invalid_type,expected:Ee.map,received:i.parsedType}),Pe;let s=this._def.keyType,n=this._def.valueType,o=[...i.data.entries()].map(([a,u],l)=>({key:s._parse(new Fr(i,a,i.path,[l,"key"])),value:n._parse(new Fr(i,u,i.path,[l,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,h=await u.value;if(l.status==="aborted"||h.status==="aborted")return Pe;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(l.value,h.value);}return {status:r.value,value:a}})}else {let a=new Map;for(let u of o){let l=u.key,h=u.value;if(l.status==="aborted"||h.status==="aborted")return Pe;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(l.value,h.value);}return {status:r.value,value:a}}}};qs.create=(t,e,r)=>new qs({valueType:e,keyType:t,typeName:Oe.ZodMap,...Be(r)});var Hs=class t extends je{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ee.set)return Te(i,{code:ve.invalid_type,expected:Ee.set,received:i.parsedType}),Pe;let s=this._def;s.minSize!==null&&i.data.size<s.minSize.value&&(Te(i,{code:ve.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&i.data.size>s.maxSize.value&&(Te(i,{code:ve.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let n=this._def.valueType;function o(u){let l=new Set;for(let h of u){if(h.status==="aborted")return Pe;h.status==="dirty"&&r.dirty(),l.add(h.value);}return {status:r.value,value:l}}let a=[...i.data.values()].map((u,l)=>n._parse(new Fr(i,u,i.path,l)));return i.common.async?Promise.all(a).then(u=>o(u)):o(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:Re.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Re.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Hs.create=(t,e)=>new Hs({valueType:t,minSize:null,maxSize:null,typeName:Oe.ZodSet,...Be(e)});var Ju=class t extends je{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ee.function)return Te(r,{code:ve.invalid_type,expected:Ee.function,received:r.parsedType}),Pe;function i(a,u){return Ku({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zu(),Go].filter(l=>!!l),issueData:{code:ve.invalid_arguments,argumentsError:u}})}function s(a,u){return Ku({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zu(),Go].filter(l=>!!l),issueData:{code:ve.invalid_return_type,returnTypeError:u}})}let n={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Ki){let a=this;return sr(async function(...u){let l=new Er([]),h=await a._def.args.parseAsync(u,n).catch(f=>{throw l.addIssue(i(u,f)),l}),c=await Reflect.apply(o,this,h);return await a._def.returns._def.type.parseAsync(c,n).catch(f=>{throw l.addIssue(s(c,f)),l})})}else {let a=this;return sr(function(...u){let l=a._def.args.safeParse(u,n);if(!l.success)throw new Er([i(u,l.error)]);let h=Reflect.apply(o,this,l.data),c=a._def.returns.safeParse(h,n);if(!c.success)throw new Er([s(h,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Jr.create(e).rest(gi.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new t({args:e||Jr.create([]).rest(gi.create()),returns:r||gi.create(),typeName:Oe.ZodFunction,...Be(i)})}},Vn=class extends je{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Vn.create=(t,e)=>new Vn({getter:t,typeName:Oe.ZodLazy,...Be(e)});var $n=class extends je{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Te(r,{received:r.data,code:ve.invalid_literal,expected:this._def.value}),Pe}return {status:"valid",value:e.data}}get value(){return this._def.value}};$n.create=(t,e)=>new $n({value:t,typeName:Oe.ZodLiteral,...Be(e)});function xy(t,e){return new zn({values:t,typeName:Oe.ZodEnum,...Be(e)})}var zn=class t extends je{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return Te(r,{expected:Ze.joinValues(i),received:r.parsedType,code:ve.invalid_type}),Pe}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),i=this._def.values;return Te(r,{received:r.data,code:ve.invalid_enum_value,options:i}),Pe}return sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e){return t.create(e)}exclude(e){return t.create(this.options.filter(r=>!e.includes(r)))}};zn.create=xy;var Kn=class extends je{_parse(e){let r=Ze.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Ee.string&&i.parsedType!==Ee.number){let s=Ze.objectValues(r);return Te(i,{expected:Ze.joinValues(s),received:i.parsedType,code:ve.invalid_type}),Pe}if(r.indexOf(e.data)===-1){let s=Ze.objectValues(r);return Te(i,{received:i.data,code:ve.invalid_enum_value,options:s}),Pe}return sr(e.data)}get enum(){return this._def.values}};Kn.create=(t,e)=>new Kn({values:t,typeName:Oe.ZodNativeEnum,...Be(e)});var Ki=class extends je{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ee.promise&&r.common.async===!1)return Te(r,{code:ve.invalid_type,expected:Ee.promise,received:r.parsedType}),Pe;let i=r.parsedType===Ee.promise?r.data:Promise.resolve(r.data);return sr(i.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ki.create=(t,e)=>new Ki({type:t,typeName:Oe.ZodPromise,...Be(e)});var Cr=class extends je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),s=this._def.effect||null,n={addIssue:o=>{Te(i,o),o.fatal?r.abort():r.dirty();},get path(){return i.path}};if(n.addIssue=n.addIssue.bind(n),s.type==="preprocess"){let o=s.transform(i.data,n);return i.common.issues.length?{status:"dirty",value:i.data}:i.common.async?Promise.resolve(o).then(a=>this._def.schema._parseAsync({data:a,path:i.path,parent:i})):this._def.schema._parseSync({data:o,path:i.path,parent:i})}if(s.type==="refinement"){let o=a=>{let u=s.refinement(a,n);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?Pe:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?Pe:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(i.common.async===!1){let o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Wo(o))return o;let a=s.transform(o.value,n);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:r.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>Wo(o)?Promise.resolve(s.transform(o.value,n)).then(a=>({status:r.value,value:a})):o);Ze.assertNever(s);}};Cr.create=(t,e,r)=>new Cr({schema:t,typeName:Oe.ZodEffects,effect:e,...Be(r)});Cr.createWithPreprocess=(t,e,r)=>new Cr({schema:e,effect:{type:"preprocess",transform:t},typeName:Oe.ZodEffects,...Be(r)});var jr=class extends je{_parse(e){return this._getType(e)===Ee.undefined?sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};jr.create=(t,e)=>new jr({innerType:t,typeName:Oe.ZodOptional,...Be(e)});var yi=class extends je{_parse(e){return this._getType(e)===Ee.null?sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yi.create=(t,e)=>new yi({innerType:t,typeName:Oe.ZodNullable,...Be(e)});var Gn=class extends je{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===Ee.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Gn.create=(t,e)=>new Gn({innerType:t,typeName:Oe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Be(e)});var Us=class extends je{_parse(e){let{ctx:r}=this._processInputParams(e),i={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Gu(s)?s.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Er(i.common.issues)},input:i.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Er(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Us.create=(t,e)=>new Us({innerType:t,typeName:Oe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Be(e)});var Vs=class extends je{_parse(e){if(this._getType(e)!==Ee.nan){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.nan,received:i.parsedType}),Pe}return {status:"valid",value:e.data}}};Vs.create=t=>new Vs({typeName:Oe.ZodNaN,...Be(t)});var jO=Symbol("zod_brand"),Zu=class extends je{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}},Yo=class t extends je{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return (async()=>{let n=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?Pe:n.status==="dirty"?(r.dirty(),vy(n.value)):this._def.out._parseAsync({data:n.value,path:i.path,parent:i})})();{let s=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?Pe:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:i.path,parent:i})}}static create(e,r){return new t({in:e,out:r,typeName:Oe.ZodPipeline})}},$s=class extends je{_parse(e){let r=this._def.innerType._parse(e);return Wo(r)&&(r.value=Object.freeze(r.value)),r}};$s.create=(t,e)=>new $s({innerType:t,typeName:Oe.ZodReadonly,...Be(e)});var by=(t,e={},r)=>t?zi.create().superRefine((i,s)=>{var n,o;if(!t(i)){let a=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,u=(o=(n=a.fatal)!==null&&n!==void 0?n:r)!==null&&o!==void 0?o:!0,l=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...l,fatal:u});}}):zi.create(),qO={object:cr.lazycreate},Oe;(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";})(Oe||(Oe={}));var HO=(t,e={message:`Input not instance of ${t.name}`})=>by(r=>r instanceof t,e),Ey=$i.create,Cy=In.create,UO=Vs.create,VO=kn.create,Ty=Mn.create,$O=Bn.create,zO=Bs.create,KO=jn.create,GO=qn.create,WO=zi.create,YO=gi.create,JO=qr.create,ZO=js.create,XO=_i.create,QO=cr.create,eF=cr.strictCreate,tF=Hn.create,rF=Wu.create,iF=Un.create,nF=Jr.create,sF=Yu.create,oF=qs.create,aF=Hs.create,uF=Ju.create,lF=Vn.create,cF=$n.create,hF=zn.create,fF=Kn.create,dF=Ki.create,_y=Cr.create,pF=jr.create,mF=yi.create,gF=Cr.createWithPreprocess,_F=Yo.create,yF=()=>Ey().optional(),vF=()=>Cy().optional(),xF=()=>Ty().optional(),bF={string:t=>$i.create({...t,coerce:!0}),number:t=>In.create({...t,coerce:!0}),boolean:t=>Mn.create({...t,coerce:!0}),bigint:t=>kn.create({...t,coerce:!0}),date:t=>Bn.create({...t,coerce:!0})},EF=Pe,Ie=Object.freeze({__proto__:null,defaultErrorMap:Go,setErrorMap:wO,getErrorMap:zu,makeIssue:Ku,EMPTY_PATH:DO,addIssueToContext:Te,ParseStatus:rr,INVALID:Pe,DIRTY:vy,OK:sr,isAborted:Sd,isDirty:Rd,isValid:Wo,isAsync:Gu,get util(){return Ze},get objectUtil(){return Dd},ZodParsedType:Ee,getParsedType:Vi,ZodType:je,ZodString:$i,ZodNumber:In,ZodBigInt:kn,ZodBoolean:Mn,ZodDate:Bn,ZodSymbol:Bs,ZodUndefined:jn,ZodNull:qn,ZodAny:zi,ZodUnknown:gi,ZodNever:qr,ZodVoid:js,ZodArray:_i,ZodObject:cr,ZodUnion:Hn,ZodDiscriminatedUnion:Wu,ZodIntersection:Un,ZodTuple:Jr,ZodRecord:Yu,ZodMap:qs,ZodSet:Hs,ZodFunction:Ju,ZodLazy:Vn,ZodLiteral:$n,ZodEnum:zn,ZodNativeEnum:Kn,ZodPromise:Ki,ZodEffects:Cr,ZodTransformer:Cr,ZodOptional:jr,ZodNullable:yi,ZodDefault:Gn,ZodCatch:Us,ZodNaN:Vs,BRAND:jO,ZodBranded:Zu,ZodPipeline:Yo,ZodReadonly:$s,custom:by,Schema:je,ZodSchema:je,late:qO,get ZodFirstPartyTypeKind(){return Oe},coerce:bF,any:WO,array:XO,bigint:VO,boolean:Ty,date:$O,discriminatedUnion:rF,effect:_y,enum:hF,function:uF,instanceof:HO,intersection:iF,lazy:lF,literal:cF,map:oF,nan:UO,nativeEnum:fF,never:JO,null:GO,nullable:mF,number:Cy,object:QO,oboolean:xF,onumber:vF,optional:pF,ostring:yF,pipeline:_F,preprocess:gF,promise:dF,record:sF,set:aF,strictObject:eF,string:Ey,symbol:zO,transformer:_y,tuple:nF,undefined:KO,union:tF,unknown:YO,void:ZO,NEVER:EF,ZodIssueCode:ve,quotelessJson:AO,ZodError:Er});var Xu=t=>new Promise(e=>{setTimeout(e,t);}),Ay=async(t,e,r)=>{GE__default.default(e>0,`Number of attempts for retry must be larger than 0, got ${e}`);for(let i=0;i<e-1;i++)try{return await t()}catch(s){await(r==null?void 0:r(s,i));}return t()};var wy=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function TF(t){return wy.includes(t)}var AF=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...wy];function wF(t){return AF.includes(t)}var DF=["null","undefined","string","number","bigint","boolean","symbol"];function SF(t){return DF.includes(t)}function zs(t){return e=>typeof e===t}var{toString:RF}=Object.prototype,Jo=t=>{let e=RF.call(t).slice(8,-1);if(/HTML\w+Element/.test(e)&&Y.domElement(t))return "HTMLElement";if(wF(e))return e},st=t=>e=>Jo(e)===t;function Y(t){if(t===null)return "null";switch(typeof t){case"undefined":return "undefined";case"string":return "string";case"number":return Number.isNaN(t)?"NaN":"number";case"boolean":return "boolean";case"function":return "Function";case"bigint":return "bigint";case"symbol":return "symbol";}if(Y.observable(t))return "Observable";if(Y.array(t))return "Array";if(Y.buffer(t))return "Buffer";let e=Jo(t);if(e)return e;if(t instanceof String||t instanceof Boolean||t instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return "Object"}Y.undefined=zs("undefined");Y.string=zs("string");var NF=zs("number");Y.number=t=>NF(t)&&!Y.nan(t);Y.positiveNumber=t=>Y.number(t)&&t>0;Y.negativeNumber=t=>Y.number(t)&&t<0;Y.bigint=zs("bigint");Y.function_=zs("function");Y.null_=t=>t===null;Y.class_=t=>Y.function_(t)&&t.toString().startsWith("class ");Y.boolean=t=>t===!0||t===!1;Y.symbol=zs("symbol");Y.numericString=t=>Y.string(t)&&!Y.emptyStringOrWhitespace(t)&&!Number.isNaN(Number(t));Y.array=(t,e)=>Array.isArray(t)?Y.function_(e)?t.every(r=>e(r)):!0:!1;Y.buffer=t=>{var e,r,i;return (i=(r=(e=t==null?void 0:t.constructor)==null?void 0:e.isBuffer)==null?void 0:r.call(e,t))!=null?i:!1};Y.blob=t=>st("Blob")(t);Y.nullOrUndefined=t=>Y.null_(t)||Y.undefined(t);Y.object=t=>!Y.null_(t)&&(typeof t=="object"||Y.function_(t));Y.iterable=t=>Y.function_(t==null?void 0:t[Symbol.iterator]);Y.asyncIterable=t=>Y.function_(t==null?void 0:t[Symbol.asyncIterator]);Y.generator=t=>Y.iterable(t)&&Y.function_(t==null?void 0:t.next)&&Y.function_(t==null?void 0:t.throw);Y.asyncGenerator=t=>Y.asyncIterable(t)&&Y.function_(t.next)&&Y.function_(t.throw);Y.nativePromise=t=>st("Promise")(t);var OF=t=>Y.function_(t==null?void 0:t.then)&&Y.function_(t==null?void 0:t.catch);Y.promise=t=>Y.nativePromise(t)||OF(t);Y.generatorFunction=st("GeneratorFunction");Y.asyncGeneratorFunction=t=>Jo(t)==="AsyncGeneratorFunction";Y.asyncFunction=t=>Jo(t)==="AsyncFunction";Y.boundFunction=t=>Y.function_(t)&&!t.hasOwnProperty("prototype");Y.regExp=st("RegExp");Y.date=st("Date");Y.error=st("Error");Y.map=t=>st("Map")(t);Y.set=t=>st("Set")(t);Y.weakMap=t=>st("WeakMap")(t);Y.weakSet=t=>st("WeakSet")(t);Y.weakRef=t=>st("WeakRef")(t);Y.int8Array=st("Int8Array");Y.uint8Array=st("Uint8Array");Y.uint8ClampedArray=st("Uint8ClampedArray");Y.int16Array=st("Int16Array");Y.uint16Array=st("Uint16Array");Y.int32Array=st("Int32Array");Y.uint32Array=st("Uint32Array");Y.float32Array=st("Float32Array");Y.float64Array=st("Float64Array");Y.bigInt64Array=st("BigInt64Array");Y.bigUint64Array=st("BigUint64Array");Y.arrayBuffer=st("ArrayBuffer");Y.sharedArrayBuffer=st("SharedArrayBuffer");Y.dataView=st("DataView");Y.enumCase=(t,e)=>Object.values(e).includes(t);Y.directInstanceOf=(t,e)=>Object.getPrototypeOf(t)===e.prototype;Y.urlInstance=t=>st("URL")(t);Y.urlString=t=>{if(!Y.string(t))return !1;try{return new URL(t),!0}catch(e){return !1}};Y.truthy=t=>!!t;Y.falsy=t=>!t;Y.nan=t=>Number.isNaN(t);Y.primitive=t=>Y.null_(t)||SF(typeof t);Y.integer=t=>Number.isInteger(t);Y.safeInteger=t=>Number.isSafeInteger(t);Y.plainObject=t=>{if(typeof t!="object"||t===null)return !1;let e=Object.getPrototypeOf(t);return (e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};Y.typedArray=t=>TF(Jo(t));var FF=t=>Y.safeInteger(t)&&t>=0;Y.arrayLike=t=>!Y.nullOrUndefined(t)&&!Y.function_(t)&&FF(t.length);Y.tupleLike=(t,e)=>Y.array(e)&&Y.array(t)&&e.length===t.length?e.every((r,i)=>r(t[i])):!1;Y.inRange=(t,e)=>{if(Y.number(e))return t>=Math.min(0,e)&&t<=Math.max(e,0);if(Y.array(e)&&e.length===2)return t>=Math.min(...e)&&t<=Math.max(...e);throw new TypeError(`Invalid range: ${JSON.stringify(e)}`)};var LF=1,PF=["innerHTML","ownerDocument","style","attributes","nodeValue"];Y.domElement=t=>Y.object(t)&&t.nodeType===LF&&Y.string(t.nodeName)&&!Y.plainObject(t)&&PF.every(e=>e in t);Y.observable=t=>{var e,r;return t?t===((e=t[Symbol.observable])==null?void 0:e.call(t))||t===((r=t["@@observable"])==null?void 0:r.call(t)):!1};Y.nodeStream=t=>Y.object(t)&&Y.function_(t.pipe)&&!Y.observable(t);Y.infinite=t=>t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY;var Dy=t=>e=>Y.integer(e)&&Math.abs(e%2)===t;Y.evenInteger=Dy(0);Y.oddInteger=Dy(1);Y.emptyArray=t=>Y.array(t)&&t.length===0;Y.nonEmptyArray=t=>Y.array(t)&&t.length>0;Y.emptyString=t=>Y.string(t)&&t.length===0;var IF=t=>Y.string(t)&&!/\S/.test(t);Y.emptyStringOrWhitespace=t=>Y.emptyString(t)||IF(t);Y.nonEmptyString=t=>Y.string(t)&&t.length>0;Y.nonEmptyStringAndNotWhitespace=t=>Y.string(t)&&!Y.emptyStringOrWhitespace(t);Y.emptyObject=t=>Y.object(t)&&!Y.map(t)&&!Y.set(t)&&Object.keys(t).length===0;Y.nonEmptyObject=t=>Y.object(t)&&!Y.map(t)&&!Y.set(t)&&Object.keys(t).length>0;Y.emptySet=t=>Y.set(t)&&t.size===0;Y.nonEmptySet=t=>Y.set(t)&&t.size>0;Y.emptyMap=t=>Y.map(t)&&t.size===0;Y.nonEmptyMap=t=>Y.map(t)&&t.size>0;Y.propertyKey=t=>Y.any([Y.string,Y.number,Y.symbol],t);Y.formData=t=>st("FormData")(t);Y.urlSearchParams=t=>st("URLSearchParams")(t);var Sy=(t,e,r)=>{if(!Y.function_(e))throw new TypeError(`Invalid predicate: ${JSON.stringify(e)}`);if(r.length===0)throw new TypeError("Invalid number of values");return t.call(r,e)};Y.any=(t,...e)=>(Y.array(t)?t:[t]).some(i=>Sy(Array.prototype.some,i,e));Y.all=(t,...e)=>Sy(Array.prototype.every,t,e);var xe=(t,e,r,i={})=>{if(!t){let{multipleValues:s}=i,n=s?`received values of types ${[...new Set(r.map(o=>`\`${Y(o)}\``))].join(", ")}`:`received value of type \`${Y(r)}\``;throw new TypeError(`Expected value which is \`${e}\`, ${n}.`)}},de={undefined:t=>xe(Y.undefined(t),"undefined",t),string:t=>xe(Y.string(t),"string",t),number:t=>xe(Y.number(t),"number",t),positiveNumber:t=>xe(Y.positiveNumber(t),"positive number",t),negativeNumber:t=>xe(Y.negativeNumber(t),"negative number",t),bigint:t=>xe(Y.bigint(t),"bigint",t),function_:t=>xe(Y.function_(t),"Function",t),null_:t=>xe(Y.null_(t),"null",t),class_:t=>xe(Y.class_(t),"Class",t),boolean:t=>xe(Y.boolean(t),"boolean",t),symbol:t=>xe(Y.symbol(t),"symbol",t),numericString:t=>xe(Y.numericString(t),"string with a number",t),array:(t,e)=>{xe(Y.array(t),"Array",t),e&&t.forEach(e);},buffer:t=>xe(Y.buffer(t),"Buffer",t),blob:t=>xe(Y.blob(t),"Blob",t),nullOrUndefined:t=>xe(Y.nullOrUndefined(t),"null or undefined",t),object:t=>xe(Y.object(t),"Object",t),iterable:t=>xe(Y.iterable(t),"Iterable",t),asyncIterable:t=>xe(Y.asyncIterable(t),"AsyncIterable",t),generator:t=>xe(Y.generator(t),"Generator",t),asyncGenerator:t=>xe(Y.asyncGenerator(t),"AsyncGenerator",t),nativePromise:t=>xe(Y.nativePromise(t),"native Promise",t),promise:t=>xe(Y.promise(t),"Promise",t),generatorFunction:t=>xe(Y.generatorFunction(t),"GeneratorFunction",t),asyncGeneratorFunction:t=>xe(Y.asyncGeneratorFunction(t),"AsyncGeneratorFunction",t),asyncFunction:t=>xe(Y.asyncFunction(t),"AsyncFunction",t),boundFunction:t=>xe(Y.boundFunction(t),"Function",t),regExp:t=>xe(Y.regExp(t),"RegExp",t),date:t=>xe(Y.date(t),"Date",t),error:t=>xe(Y.error(t),"Error",t),map:t=>xe(Y.map(t),"Map",t),set:t=>xe(Y.set(t),"Set",t),weakMap:t=>xe(Y.weakMap(t),"WeakMap",t),weakSet:t=>xe(Y.weakSet(t),"WeakSet",t),weakRef:t=>xe(Y.weakRef(t),"WeakRef",t),int8Array:t=>xe(Y.int8Array(t),"Int8Array",t),uint8Array:t=>xe(Y.uint8Array(t),"Uint8Array",t),uint8ClampedArray:t=>xe(Y.uint8ClampedArray(t),"Uint8ClampedArray",t),int16Array:t=>xe(Y.int16Array(t),"Int16Array",t),uint16Array:t=>xe(Y.uint16Array(t),"Uint16Array",t),int32Array:t=>xe(Y.int32Array(t),"Int32Array",t),uint32Array:t=>xe(Y.uint32Array(t),"Uint32Array",t),float32Array:t=>xe(Y.float32Array(t),"Float32Array",t),float64Array:t=>xe(Y.float64Array(t),"Float64Array",t),bigInt64Array:t=>xe(Y.bigInt64Array(t),"BigInt64Array",t),bigUint64Array:t=>xe(Y.bigUint64Array(t),"BigUint64Array",t),arrayBuffer:t=>xe(Y.arrayBuffer(t),"ArrayBuffer",t),sharedArrayBuffer:t=>xe(Y.sharedArrayBuffer(t),"SharedArrayBuffer",t),dataView:t=>xe(Y.dataView(t),"DataView",t),enumCase:(t,e)=>xe(Y.enumCase(t,e),"EnumCase",t),urlInstance:t=>xe(Y.urlInstance(t),"URL",t),urlString:t=>xe(Y.urlString(t),"string with a URL",t),truthy:t=>xe(Y.truthy(t),"truthy",t),falsy:t=>xe(Y.falsy(t),"falsy",t),nan:t=>xe(Y.nan(t),"NaN",t),primitive:t=>xe(Y.primitive(t),"primitive",t),integer:t=>xe(Y.integer(t),"integer",t),safeInteger:t=>xe(Y.safeInteger(t),"integer",t),plainObject:t=>xe(Y.plainObject(t),"plain object",t),typedArray:t=>xe(Y.typedArray(t),"TypedArray",t),arrayLike:t=>xe(Y.arrayLike(t),"array-like",t),tupleLike:(t,e)=>xe(Y.tupleLike(t,e),"tuple-like",t),domElement:t=>xe(Y.domElement(t),"HTMLElement",t),observable:t=>xe(Y.observable(t),"Observable",t),nodeStream:t=>xe(Y.nodeStream(t),"Node.js Stream",t),infinite:t=>xe(Y.infinite(t),"infinite number",t),emptyArray:t=>xe(Y.emptyArray(t),"empty array",t),nonEmptyArray:t=>xe(Y.nonEmptyArray(t),"non-empty array",t),emptyString:t=>xe(Y.emptyString(t),"empty string",t),emptyStringOrWhitespace:t=>xe(Y.emptyStringOrWhitespace(t),"empty string or whitespace",t),nonEmptyString:t=>xe(Y.nonEmptyString(t),"non-empty string",t),nonEmptyStringAndNotWhitespace:t=>xe(Y.nonEmptyStringAndNotWhitespace(t),"non-empty string and not whitespace",t),emptyObject:t=>xe(Y.emptyObject(t),"empty object",t),nonEmptyObject:t=>xe(Y.nonEmptyObject(t),"non-empty object",t),emptySet:t=>xe(Y.emptySet(t),"empty set",t),nonEmptySet:t=>xe(Y.nonEmptySet(t),"non-empty set",t),emptyMap:t=>xe(Y.emptyMap(t),"empty map",t),nonEmptyMap:t=>xe(Y.nonEmptyMap(t),"non-empty map",t),propertyKey:t=>xe(Y.propertyKey(t),"PropertyKey",t),formData:t=>xe(Y.formData(t),"FormData",t),urlSearchParams:t=>xe(Y.urlSearchParams(t),"URLSearchParams",t),evenInteger:t=>xe(Y.evenInteger(t),"even integer",t),oddInteger:t=>xe(Y.oddInteger(t),"odd integer",t),directInstanceOf:(t,e)=>xe(Y.directInstanceOf(t,e),"T",t),inRange:(t,e)=>xe(Y.inRange(t,e),"in range",t),any:(t,...e)=>xe(Y.any(t,...e),"predicate returns truthy for any value",e,{multipleValues:!0}),all:(t,...e)=>xe(Y.all(t,...e),"predicate returns truthy for all values",e,{multipleValues:!0})};Object.defineProperties(Y,{class:{value:Y.class_},function:{value:Y.function_},null:{value:Y.null_}});Object.defineProperties(de,{class:{value:de.class_},function:{value:de.function_},null:{value:de.null_}});var ie=Y;var Od=class extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError";}get isCanceled(){return !0}},Ks=class t{static fn(e){return (...r)=>new t((i,s,n)=>{r.push(n),e(...r).then(i,s);})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((r,i)=>{this._reject=i;let s=a=>{(!this._isCanceled||!o.shouldReject)&&(this._isPending=!1,r(a));},n=a=>{this._isPending=!1,i(a);},o=a=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(a);};Object.defineProperties(o,{shouldReject:{get:()=>this._rejectOnCancel,set:a=>{this._rejectOnCancel=a;}}}),e(s,n,o);});}then(e,r){return this._promise.then(e,r)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!(!this._isPending||this._isCanceled)){if(this._isCanceled=!0,this._cancelHandlers.length>0)try{for(let r of this._cancelHandlers)r();}catch(r){this._reject(r);return}this._rejectOnCancel&&this._reject(new Od(e));}}get isCanceled(){return this._isCanceled}};Object.setPrototypeOf(Ks.prototype,Promise.prototype);function kF(t){return ie.object(t)&&"_onResponse"in t}var Dt=class extends Error{constructor(e,r,i){var s,n;if(super(e),Object.defineProperty(this,"input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Error.captureStackTrace(this,this.constructor),this.name="RequestError",this.code=(s=r.code)!=null?s:"ERR_GOT_REQUEST_ERROR",this.input=r.input,kF(i)?(Object.defineProperty(this,"request",{enumerable:!1,value:i}),Object.defineProperty(this,"response",{enumerable:!1,value:i.response}),this.options=i.options):this.options=i,this.timings=(n=this.request)==null?void 0:n.timings,ie.string(r.stack)&&ie.string(this.stack)){let o=this.stack.indexOf(this.message)+this.message.length,a=this.stack.slice(o).split(`
|
|
458
|
+
- As a SCAN_BROWSER_URL_${i} environment variable
|
|
459
|
+
- As a SCAN_BROWSER_URL_${ks(i)} environment variable`),{...r,[i]:{apiUrl:n,apiKey:o,browserUrl:a}}},{}),EO=t=>{var e,r;return ((e=process.env[`SCAN_API_URL_${t}`])==null?void 0:e.trim())||((r=process.env[`SCAN_API_URL_${ks(t)}`])==null?void 0:r.trim())},CO=t=>{var e,r;return ((e=process.env[`SCAN_BROWSER_URL_${t}`])==null?void 0:e.trim())||((r=process.env[`SCAN_BROWSER_URL_${ks(t)}`])==null?void 0:r.trim())},TO=t=>{var e,r;return ((e=process.env[`SCAN_API_KEY_${t}`])==null?void 0:e.trim())||((r=process.env[`SCAN_API_KEY_${ks(t)}`])==null?void 0:r.trim())},ks=t=>t.toUpperCase().replaceAll("-","_");var Td=(i=>(i[i.None=1]="None",i[i.Unlicense=2]="Unlicense",i[i.MIT=3]="MIT",i[i["GNU-GPLv2"]=4]="GNU-GPLv2",i[i["GNU-GPLv3"]=5]="GNU-GPLv3",i[i["GNU-LGPLv2.1"]=6]="GNU-LGPLv2.1",i[i["GNU-LGPLv3"]=7]="GNU-LGPLv3",i[i["BSD-2-Clause"]=8]="BSD-2-Clause",i[i["BSD-3-Clause"]=9]="BSD-3-Clause",i[i["MPL-2.0"]=10]="MPL-2.0",i[i["OSL-3.0"]=11]="OSL-3.0",i[i["Apache-2.0"]=12]="Apache-2.0",i[i["GNU-AGPLv3"]=13]="GNU-AGPLv3",i[i["BUSL-1.1"]=14]="BUSL-1.1",i))(Td||{}),Ad=t=>{let e=t.match(/\/\/\s*SPDX-License-Identifier:\s*(.*)\s*/i),r=e==null?void 0:e[1];return r==null?1:(r in Td||console.warn("Found unknown SPDX license identifier: %s",r),Td[r])};var Ze;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let n={};for(let o of s)n[o]=o;return n},t.getValidEnumValues=s=>{let n=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(let a of n)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(n){return s[n]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let n=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&n.push(o);return n},t.find=(s,n)=>{for(let o of s)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function i(s,n=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=i,t.jsonStringifyReplacer=(s,n)=>typeof n=="bigint"?n.toString():n;})(Ze||(Ze={}));var Dd;(function(t){t.mergeShapes=(e,r)=>({...e,...r});})(Dd||(Dd={}));var Ee=Ze.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Vi=t=>{switch(typeof t){case"undefined":return Ee.undefined;case"string":return Ee.string;case"number":return isNaN(t)?Ee.nan:Ee.number;case"boolean":return Ee.boolean;case"function":return Ee.function;case"bigint":return Ee.bigint;case"symbol":return Ee.symbol;case"object":return Array.isArray(t)?Ee.array:t===null?Ee.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ee.promise:typeof Map!="undefined"&&t instanceof Map?Ee.map:typeof Set!="undefined"&&t instanceof Set?Ee.set:typeof Date!="undefined"&&t instanceof Date?Ee.date:Ee.object;default:return Ee.unknown}},ve=Ze.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"]),AO=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Er=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i];},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i];};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e;}get errors(){return this.issues}format(e){let r=e||function(n){return n.message},i={_errors:[]},s=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)i._errors.push(r(o));else {let a=i,u=0;for(;u<o.path.length;){let l=o.path[u];u===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(o))):a[l]=a[l]||{_errors:[]},a=a[l],u++;}}};return s(this),i}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ze.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):i.push(e(s));return {formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};Er.create=t=>new Er(t);var Go=(t,e)=>{let r;switch(t.code){case ve.invalid_type:t.received===Ee.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case ve.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,Ze.jsonStringifyReplacer)}`;break;case ve.unrecognized_keys:r=`Unrecognized key(s) in object: ${Ze.joinValues(t.keys,", ")}`;break;case ve.invalid_union:r="Invalid input";break;case ve.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Ze.joinValues(t.options)}`;break;case ve.invalid_enum_value:r=`Invalid enum value. Expected ${Ze.joinValues(t.options)}, received '${t.received}'`;break;case ve.invalid_arguments:r="Invalid function arguments";break;case ve.invalid_return_type:r="Invalid function return type";break;case ve.invalid_date:r="Invalid date";break;case ve.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:Ze.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case ve.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case ve.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case ve.custom:r="Invalid input";break;case ve.invalid_intersection_types:r="Intersection results could not be merged";break;case ve.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case ve.not_finite:r="Number must be finite";break;default:r=e.defaultError,Ze.assertNever(t);}return {message:r}},yy=Go;function wO(t){yy=t;}function zu(){return yy}var Ku=t=>{let{data:e,path:r,errorMaps:i,issueData:s}=t,n=[...r,...s.path||[]],o={...s,path:n},a="",u=i.filter(l=>!!l).slice().reverse();for(let l of u)a=l(o,{data:e,defaultError:a}).message;return {...s,path:n,message:s.message||a}},DO=[];function Te(t,e){let r=Ku({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,zu(),Go].filter(i=>!!i)});t.common.issues.push(r);}var rr=class t{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,r){let i=[];for(let s of r){if(s.status==="aborted")return Pe;s.status==="dirty"&&e.dirty(),i.push(s.value);}return {status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let s of r)i.push({key:await s.key,value:await s.value});return t.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let s of r){let{key:n,value:o}=s;if(n.status==="aborted"||o.status==="aborted")return Pe;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value!="undefined"||s.alwaysSet)&&(i[n.value]=o.value);}return {status:e.value,value:i}}},Pe=Object.freeze({status:"aborted"}),vy=t=>({status:"dirty",value:t}),sr=t=>({status:"valid",value:t}),Sd=t=>t.status==="aborted",Rd=t=>t.status==="dirty",Wo=t=>t.status==="valid",Gu=t=>typeof Promise!="undefined"&&t instanceof Promise,Re;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message;})(Re||(Re={}));var Fr=class{constructor(e,r,i,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,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}},gy=(t,e)=>{if(Wo(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;let r=new Er(t.common.issues);return this._error=r,this._error}}};function Be(t){if(!t)return {};let{errorMap:e,invalid_type_error:r,required_error:i,description:s}=t;if(e&&(r||i))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:(o,a)=>o.code!=="invalid_type"?{message:a.defaultError}:typeof a.data=="undefined"?{message:i!=null?i:a.defaultError}:{message:r!=null?r:a.defaultError},description:s}}var je=class{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);}get description(){return this._def.description}_getType(e){return Vi(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Vi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new rr,ctx:{common:e.parent.common,data:e.data,parsedType:Vi(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Gu(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){var i;let s={common:{issues:[],async:(i=r==null?void 0:r.async)!==null&&i!==void 0?i:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vi(e)},n=this._parseSync({data:e,path:s.path,parent:s});return gy(s,n)}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Vi(e)},s=this._parse({data:e,path:i.path,parent:i}),n=await(Gu(s)?s:Promise.resolve(s));return gy(i,n)}refine(e,r){let i=s=>typeof r=="string"||typeof r=="undefined"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,n)=>{let o=e(s),a=()=>n.addIssue({code:ve.custom,...i(s)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(u=>u?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,r){return this._refinement((i,s)=>e(i)?!0:(s.addIssue(typeof r=="function"?r(i,s):r),!1))}_refinement(e){return new Cr({schema:this,typeName:Oe.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return jr.create(this,this._def)}nullable(){return yi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _i.create(this,this._def)}promise(){return Ki.create(this,this._def)}or(e){return Hn.create([this,e],this._def)}and(e){return Un.create(this,e,this._def)}transform(e){return new Cr({...Be(this._def),schema:this,typeName:Oe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Gn({...Be(this._def),innerType:this,defaultValue:r,typeName:Oe.ZodDefault})}brand(){return new Zu({typeName:Oe.ZodBranded,type:this,...Be(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Us({...Be(this._def),innerType:this,catchValue:r,typeName:Oe.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Yo.create(this,e)}readonly(){return $s.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},SO=/^c[^\s-]{8,}$/i,RO=/^[a-z][a-z0-9]*$/,NO=/^[0-9A-HJKMNP-TV-Z]{26}$/,OO=/^[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,FO=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,LO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",wd,PO=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,IO=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,kO=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function MO(t,e){return !!((e==="v4"||!e)&&PO.test(t)||(e==="v6"||!e)&&IO.test(t))}var $i=class t extends je{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ee.string){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_type,expected:Ee.string,received:n.parsedType}),Pe}let i=new rr,s;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),i.dirty());else if(n.kind==="max")e.data.length>n.value&&(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),i.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,a=e.data.length<n.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?Te(s,{code:ve.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):a&&Te(s,{code:ve.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),i.dirty());}else if(n.kind==="email")FO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"email",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="emoji")wd||(wd=new RegExp(LO,"u")),wd.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"emoji",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="uuid")OO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"uuid",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="cuid")SO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"cuid",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="cuid2")RO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"cuid2",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="ulid")NO.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"ulid",code:ve.invalid_string,message:n.message}),i.dirty());else if(n.kind==="url")try{new URL(e.data);}catch(o){s=this._getOrReturnCtx(e,s),Te(s,{validation:"url",code:ve.invalid_string,message:n.message}),i.dirty();}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"regex",code:ve.invalid_string,message:n.message}),i.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),i.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.invalid_string,validation:{startsWith:n.value},message:n.message}),i.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.invalid_string,validation:{endsWith:n.value},message:n.message}),i.dirty()):n.kind==="datetime"?kO(n).test(e.data)||(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.invalid_string,validation:"datetime",message:n.message}),i.dirty()):n.kind==="ip"?MO(e.data,n.version)||(s=this._getOrReturnCtx(e,s),Te(s,{validation:"ip",code:ve.invalid_string,message:n.message}),i.dirty()):Ze.assertNever(n);return {status:i.value,value:e.data}}_regex(e,r,i){return this.refinement(s=>e.test(s),{validation:r,code:ve.invalid_string,...Re.errToObj(i)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Re.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Re.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Re.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Re.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Re.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Re.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Re.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Re.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!==null&&r!==void 0?r:!1,...Re.errToObj(e==null?void 0:e.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...Re.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...Re.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...Re.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...Re.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...Re.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...Re.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...Re.errToObj(r)})}nonempty(e){return this.min(1,Re.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return !!this._def.checks.find(e=>e.kind==="datetime")}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 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 minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};$i.create=t=>{var e;return new $i({checks:[],typeName:Oe.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Be(t)})};function BO(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,s=r>i?r:i,n=parseInt(t.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return n%o/Math.pow(10,s)}var In=class t extends je{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)!==Ee.number){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_type,expected:Ee.number,received:n.parsedType}),Pe}let i,s=new rr;for(let n of this._def.checks)n.kind==="int"?Ze.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):n.kind==="multipleOf"?BO(e.data,n.value)!==0&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.not_finite,message:n.message}),s.dirty()):Ze.assertNever(n);return {status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Re.toString(r))}setLimit(e,r,i,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:Re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Re.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Re.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:Re.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Re.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Re.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return !!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&Ze.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return !0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value);}return Number.isFinite(r)&&Number.isFinite(e)}};In.create=t=>new In({checks:[],typeName:Oe.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Be(t)});var kn=class t extends je{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte;}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ee.bigint){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_type,expected:Ee.bigint,received:n.parsedType}),Pe}let i,s=new rr;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Te(i,{code:ve.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):Ze.assertNever(n);return {status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,Re.toString(r))}gt(e,r){return this.setLimit("min",e,!1,Re.toString(r))}lte(e,r){return this.setLimit("max",e,!0,Re.toString(r))}lt(e,r){return this.setLimit("max",e,!1,Re.toString(r))}setLimit(e,r,i,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:Re.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Re.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Re.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Re.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Re.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:Re.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};kn.create=t=>{var e;return new kn({checks:[],typeName:Oe.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Be(t)})};var Mn=class extends je{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ee.boolean){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.boolean,received:i.parsedType}),Pe}return sr(e.data)}};Mn.create=t=>new Mn({typeName:Oe.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Be(t)});var Bn=class t extends je{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ee.date){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_type,expected:Ee.date,received:n.parsedType}),Pe}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return Te(n,{code:ve.invalid_date}),Pe}let i=new rr,s;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),i.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),Te(s,{code:ve.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),i.dirty()):Ze.assertNever(n);return {status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:Re.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:Re.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Bn.create=t=>new Bn({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Oe.ZodDate,...Be(t)});var Bs=class extends je{_parse(e){if(this._getType(e)!==Ee.symbol){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.symbol,received:i.parsedType}),Pe}return sr(e.data)}};Bs.create=t=>new Bs({typeName:Oe.ZodSymbol,...Be(t)});var jn=class extends je{_parse(e){if(this._getType(e)!==Ee.undefined){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.undefined,received:i.parsedType}),Pe}return sr(e.data)}};jn.create=t=>new jn({typeName:Oe.ZodUndefined,...Be(t)});var qn=class extends je{_parse(e){if(this._getType(e)!==Ee.null){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.null,received:i.parsedType}),Pe}return sr(e.data)}};qn.create=t=>new qn({typeName:Oe.ZodNull,...Be(t)});var zi=class extends je{constructor(){super(...arguments),this._any=!0;}_parse(e){return sr(e.data)}};zi.create=t=>new zi({typeName:Oe.ZodAny,...Be(t)});var gi=class extends je{constructor(){super(...arguments),this._unknown=!0;}_parse(e){return sr(e.data)}};gi.create=t=>new gi({typeName:Oe.ZodUnknown,...Be(t)});var qr=class extends je{_parse(e){let r=this._getOrReturnCtx(e);return Te(r,{code:ve.invalid_type,expected:Ee.never,received:r.parsedType}),Pe}};qr.create=t=>new qr({typeName:Oe.ZodNever,...Be(t)});var js=class extends je{_parse(e){if(this._getType(e)!==Ee.undefined){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.void,received:i.parsedType}),Pe}return sr(e.data)}};js.create=t=>new js({typeName:Oe.ZodVoid,...Be(t)});var _i=class t extends je{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),s=this._def;if(r.parsedType!==Ee.array)return Te(r,{code:ve.invalid_type,expected:Ee.array,received:r.parsedType}),Pe;if(s.exactLength!==null){let o=r.data.length>s.exactLength.value,a=r.data.length<s.exactLength.value;(o||a)&&(Te(r,{code:o?ve.too_big:ve.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),i.dirty());}if(s.minLength!==null&&r.data.length<s.minLength.value&&(Te(r,{code:ve.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),i.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(Te(r,{code:ve.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((o,a)=>s.type._parseAsync(new Fr(r,o,r.path,a)))).then(o=>rr.mergeArray(i,o));let n=[...r.data].map((o,a)=>s.type._parseSync(new Fr(r,o,r.path,a)));return rr.mergeArray(i,n)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:Re.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:Re.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:Re.toString(r)}})}nonempty(e){return this.min(1,e)}};_i.create=(t,e)=>new _i({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Oe.ZodArray,...Be(e)});function Ms(t){if(t instanceof cr){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=jr.create(Ms(i));}return new cr({...t._def,shape:()=>e})}else return t instanceof _i?new _i({...t._def,type:Ms(t.element)}):t instanceof jr?jr.create(Ms(t.unwrap())):t instanceof yi?yi.create(Ms(t.unwrap())):t instanceof Jr?Jr.create(t.items.map(e=>Ms(e))):t}var cr=class t extends je{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend;}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=Ze.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==Ee.object){let l=this._getOrReturnCtx(e);return Te(l,{code:ve.invalid_type,expected:Ee.object,received:l.parsedType}),Pe}let{status:i,ctx:s}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof qr&&this._def.unknownKeys==="strip"))for(let l in s.data)o.includes(l)||a.push(l);let u=[];for(let l of o){let h=n[l],c=s.data[l];u.push({key:{status:"valid",value:l},value:h._parse(new Fr(s,c,s.path,l)),alwaysSet:l in s.data});}if(this._def.catchall instanceof qr){let l=this._def.unknownKeys;if(l==="passthrough")for(let h of a)u.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(l==="strict")a.length>0&&(Te(s,{code:ve.unrecognized_keys,keys:a}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let l=this._def.catchall;for(let h of a){let c=s.data[h];u.push({key:{status:"valid",value:h},value:l._parse(new Fr(s,c,s.path,h)),alwaysSet:h in s.data});}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let h of u){let c=await h.key;l.push({key:c,value:await h.value,alwaysSet:h.alwaysSet});}return l}).then(l=>rr.mergeObjectSync(i,l)):rr.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(e){return Re.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,i)=>{var s,n,o,a;let u=(o=(n=(s=this._def).errorMap)===null||n===void 0?void 0:n.call(s,r,i).message)!==null&&o!==void 0?o:i.defaultError;return r.code==="unrecognized_keys"?{message:(a=Re.errToObj(e).message)!==null&&a!==void 0?a:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Oe.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return Ze.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(r[i]=this.shape[i]);}),new t({...this._def,shape:()=>r})}omit(e){let r={};return Ze.objectKeys(this.shape).forEach(i=>{e[i]||(r[i]=this.shape[i]);}),new t({...this._def,shape:()=>r})}deepPartial(){return Ms(this)}partial(e){let r={};return Ze.objectKeys(this.shape).forEach(i=>{let s=this.shape[i];e&&!e[i]?r[i]=s:r[i]=s.optional();}),new t({...this._def,shape:()=>r})}required(e){let r={};return Ze.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])r[i]=this.shape[i];else {let n=this.shape[i];for(;n instanceof jr;)n=n._def.innerType;r[i]=n;}}),new t({...this._def,shape:()=>r})}keyof(){return xy(Ze.objectKeys(this.shape))}};cr.create=(t,e)=>new cr({shape:()=>t,unknownKeys:"strip",catchall:qr.create(),typeName:Oe.ZodObject,...Be(e)});cr.strictCreate=(t,e)=>new cr({shape:()=>t,unknownKeys:"strict",catchall:qr.create(),typeName:Oe.ZodObject,...Be(e)});cr.lazycreate=(t,e)=>new cr({shape:t,unknownKeys:"strip",catchall:qr.create(),typeName:Oe.ZodObject,...Be(e)});var Hn=class extends je{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function s(n){for(let a of n)if(a.result.status==="valid")return a.result;for(let a of n)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let o=n.map(a=>new Er(a.ctx.common.issues));return Te(r,{code:ve.invalid_union,unionErrors:o}),Pe}if(r.common.async)return Promise.all(i.map(async n=>{let o={...r,common:{...r.common,issues:[]},parent:null};return {result:await n._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let n,o=[];for(let u of i){let l={...r,common:{...r.common,issues:[]},parent:null},h=u._parseSync({data:r.data,path:r.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!n&&(n={result:h,ctx:l}),l.common.issues.length&&o.push(l.common.issues);}if(n)return r.common.issues.push(...n.ctx.common.issues),n.result;let a=o.map(u=>new Er(u));return Te(r,{code:ve.invalid_union,unionErrors:a}),Pe}}get options(){return this._def.options}};Hn.create=(t,e)=>new Hn({options:t,typeName:Oe.ZodUnion,...Be(e)});var $u=t=>t instanceof Vn?$u(t.schema):t instanceof Cr?$u(t.innerType()):t instanceof $n?[t.value]:t instanceof zn?t.options:t instanceof Kn?Object.keys(t.enum):t instanceof Gn?$u(t._def.innerType):t instanceof jn?[void 0]:t instanceof qn?[null]:null,Wu=class t extends je{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ee.object)return Te(r,{code:ve.invalid_type,expected:Ee.object,received:r.parsedType}),Pe;let i=this.discriminator,s=r.data[i],n=this.optionsMap.get(s);return n?r.common.async?n._parseAsync({data:r.data,path:r.path,parent:r}):n._parseSync({data:r.data,path:r.path,parent:r}):(Te(r,{code:ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Pe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){let s=new Map;for(let n of r){let o=$u(n.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,n);}}return new t({typeName:Oe.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...Be(i)})}};function Nd(t,e){let r=Vi(t),i=Vi(e);if(t===e)return {valid:!0,data:t};if(r===Ee.object&&i===Ee.object){let s=Ze.objectKeys(e),n=Ze.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(let a of n){let u=Nd(t[a],e[a]);if(!u.valid)return {valid:!1};o[a]=u.data;}return {valid:!0,data:o}}else if(r===Ee.array&&i===Ee.array){if(t.length!==e.length)return {valid:!1};let s=[];for(let n=0;n<t.length;n++){let o=t[n],a=e[n],u=Nd(o,a);if(!u.valid)return {valid:!1};s.push(u.data);}return {valid:!0,data:s}}else return r===Ee.date&&i===Ee.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Un=class extends je{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),s=(n,o)=>{if(Sd(n)||Sd(o))return Pe;let a=Nd(n.value,o.value);return a.valid?((Rd(n)||Rd(o))&&r.dirty(),{status:r.value,value:a.data}):(Te(i,{code:ve.invalid_intersection_types}),Pe)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([n,o])=>s(n,o)):s(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};Un.create=(t,e,r)=>new Un({left:t,right:e,typeName:Oe.ZodIntersection,...Be(r)});var Jr=class t extends je{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ee.array)return Te(i,{code:ve.invalid_type,expected:Ee.array,received:i.parsedType}),Pe;if(i.data.length<this._def.items.length)return Te(i,{code:ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Pe;!this._def.rest&&i.data.length>this._def.items.length&&(Te(i,{code:ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let n=[...i.data].map((o,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new Fr(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(n).then(o=>rr.mergeArray(r,o)):rr.mergeArray(r,n)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Jr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jr({items:t,typeName:Oe.ZodTuple,rest:null,...Be(e)})};var Yu=class t extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ee.object)return Te(i,{code:ve.invalid_type,expected:Ee.object,received:i.parsedType}),Pe;let s=[],n=this._def.keyType,o=this._def.valueType;for(let a in i.data)s.push({key:n._parse(new Fr(i,a,i.path,a)),value:o._parse(new Fr(i,i.data[a],i.path,a))});return i.common.async?rr.mergeObjectAsync(r,s):rr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof je?new t({keyType:e,valueType:r,typeName:Oe.ZodRecord,...Be(i)}):new t({keyType:$i.create(),valueType:e,typeName:Oe.ZodRecord,...Be(r)})}},qs=class extends je{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ee.map)return Te(i,{code:ve.invalid_type,expected:Ee.map,received:i.parsedType}),Pe;let s=this._def.keyType,n=this._def.valueType,o=[...i.data.entries()].map(([a,u],l)=>({key:s._parse(new Fr(i,a,i.path,[l,"key"])),value:n._parse(new Fr(i,u,i.path,[l,"value"]))}));if(i.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,h=await u.value;if(l.status==="aborted"||h.status==="aborted")return Pe;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(l.value,h.value);}return {status:r.value,value:a}})}else {let a=new Map;for(let u of o){let l=u.key,h=u.value;if(l.status==="aborted"||h.status==="aborted")return Pe;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),a.set(l.value,h.value);}return {status:r.value,value:a}}}};qs.create=(t,e,r)=>new qs({valueType:e,keyType:t,typeName:Oe.ZodMap,...Be(r)});var Hs=class t extends je{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ee.set)return Te(i,{code:ve.invalid_type,expected:Ee.set,received:i.parsedType}),Pe;let s=this._def;s.minSize!==null&&i.data.size<s.minSize.value&&(Te(i,{code:ve.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&i.data.size>s.maxSize.value&&(Te(i,{code:ve.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let n=this._def.valueType;function o(u){let l=new Set;for(let h of u){if(h.status==="aborted")return Pe;h.status==="dirty"&&r.dirty(),l.add(h.value);}return {status:r.value,value:l}}let a=[...i.data.values()].map((u,l)=>n._parse(new Fr(i,u,i.path,l)));return i.common.async?Promise.all(a).then(u=>o(u)):o(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:Re.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:Re.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};Hs.create=(t,e)=>new Hs({valueType:t,minSize:null,maxSize:null,typeName:Oe.ZodSet,...Be(e)});var Ju=class t extends je{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ee.function)return Te(r,{code:ve.invalid_type,expected:Ee.function,received:r.parsedType}),Pe;function i(a,u){return Ku({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zu(),Go].filter(l=>!!l),issueData:{code:ve.invalid_arguments,argumentsError:u}})}function s(a,u){return Ku({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,zu(),Go].filter(l=>!!l),issueData:{code:ve.invalid_return_type,returnTypeError:u}})}let n={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof Ki){let a=this;return sr(async function(...u){let l=new Er([]),h=await a._def.args.parseAsync(u,n).catch(f=>{throw l.addIssue(i(u,f)),l}),c=await Reflect.apply(o,this,h);return await a._def.returns._def.type.parseAsync(c,n).catch(f=>{throw l.addIssue(s(c,f)),l})})}else {let a=this;return sr(function(...u){let l=a._def.args.safeParse(u,n);if(!l.success)throw new Er([i(u,l.error)]);let h=Reflect.apply(o,this,l.data),c=a._def.returns.safeParse(h,n);if(!c.success)throw new Er([s(h,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Jr.create(e).rest(gi.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new t({args:e||Jr.create([]).rest(gi.create()),returns:r||gi.create(),typeName:Oe.ZodFunction,...Be(i)})}},Vn=class extends je{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Vn.create=(t,e)=>new Vn({getter:t,typeName:Oe.ZodLazy,...Be(e)});var $n=class extends je{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Te(r,{received:r.data,code:ve.invalid_literal,expected:this._def.value}),Pe}return {status:"valid",value:e.data}}get value(){return this._def.value}};$n.create=(t,e)=>new $n({value:t,typeName:Oe.ZodLiteral,...Be(e)});function xy(t,e){return new zn({values:t,typeName:Oe.ZodEnum,...Be(e)})}var zn=class t extends je{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return Te(r,{expected:Ze.joinValues(i),received:r.parsedType,code:ve.invalid_type}),Pe}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),i=this._def.values;return Te(r,{received:r.data,code:ve.invalid_enum_value,options:i}),Pe}return sr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e){return t.create(e)}exclude(e){return t.create(this.options.filter(r=>!e.includes(r)))}};zn.create=xy;var Kn=class extends je{_parse(e){let r=Ze.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Ee.string&&i.parsedType!==Ee.number){let s=Ze.objectValues(r);return Te(i,{expected:Ze.joinValues(s),received:i.parsedType,code:ve.invalid_type}),Pe}if(r.indexOf(e.data)===-1){let s=Ze.objectValues(r);return Te(i,{received:i.data,code:ve.invalid_enum_value,options:s}),Pe}return sr(e.data)}get enum(){return this._def.values}};Kn.create=(t,e)=>new Kn({values:t,typeName:Oe.ZodNativeEnum,...Be(e)});var Ki=class extends je{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==Ee.promise&&r.common.async===!1)return Te(r,{code:ve.invalid_type,expected:Ee.promise,received:r.parsedType}),Pe;let i=r.parsedType===Ee.promise?r.data:Promise.resolve(r.data);return sr(i.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Ki.create=(t,e)=>new Ki({type:t,typeName:Oe.ZodPromise,...Be(e)});var Cr=class extends je{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Oe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),s=this._def.effect||null,n={addIssue:o=>{Te(i,o),o.fatal?r.abort():r.dirty();},get path(){return i.path}};if(n.addIssue=n.addIssue.bind(n),s.type==="preprocess"){let o=s.transform(i.data,n);return i.common.issues.length?{status:"dirty",value:i.data}:i.common.async?Promise.resolve(o).then(a=>this._def.schema._parseAsync({data:a,path:i.path,parent:i})):this._def.schema._parseSync({data:o,path:i.path,parent:i})}if(s.type==="refinement"){let o=a=>{let u=s.refinement(a,n);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){let a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?Pe:(a.status==="dirty"&&r.dirty(),o(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?Pe:(a.status==="dirty"&&r.dirty(),o(a.value).then(()=>({status:r.value,value:a.value}))))}if(s.type==="transform")if(i.common.async===!1){let o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Wo(o))return o;let a=s.transform(o.value,n);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:r.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>Wo(o)?Promise.resolve(s.transform(o.value,n)).then(a=>({status:r.value,value:a})):o);Ze.assertNever(s);}};Cr.create=(t,e,r)=>new Cr({schema:t,typeName:Oe.ZodEffects,effect:e,...Be(r)});Cr.createWithPreprocess=(t,e,r)=>new Cr({schema:e,effect:{type:"preprocess",transform:t},typeName:Oe.ZodEffects,...Be(r)});var jr=class extends je{_parse(e){return this._getType(e)===Ee.undefined?sr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};jr.create=(t,e)=>new jr({innerType:t,typeName:Oe.ZodOptional,...Be(e)});var yi=class extends je{_parse(e){return this._getType(e)===Ee.null?sr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};yi.create=(t,e)=>new yi({innerType:t,typeName:Oe.ZodNullable,...Be(e)});var Gn=class extends je{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===Ee.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Gn.create=(t,e)=>new Gn({innerType:t,typeName:Oe.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Be(e)});var Us=class extends je{_parse(e){let{ctx:r}=this._processInputParams(e),i={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return Gu(s)?s.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Er(i.common.issues)},input:i.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Er(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};Us.create=(t,e)=>new Us({innerType:t,typeName:Oe.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Be(e)});var Vs=class extends je{_parse(e){if(this._getType(e)!==Ee.nan){let i=this._getOrReturnCtx(e);return Te(i,{code:ve.invalid_type,expected:Ee.nan,received:i.parsedType}),Pe}return {status:"valid",value:e.data}}};Vs.create=t=>new Vs({typeName:Oe.ZodNaN,...Be(t)});var jO=Symbol("zod_brand"),Zu=class extends je{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}},Yo=class t extends je{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return (async()=>{let n=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?Pe:n.status==="dirty"?(r.dirty(),vy(n.value)):this._def.out._parseAsync({data:n.value,path:i.path,parent:i})})();{let s=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?Pe:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:i.path,parent:i})}}static create(e,r){return new t({in:e,out:r,typeName:Oe.ZodPipeline})}},$s=class extends je{_parse(e){let r=this._def.innerType._parse(e);return Wo(r)&&(r.value=Object.freeze(r.value)),r}};$s.create=(t,e)=>new $s({innerType:t,typeName:Oe.ZodReadonly,...Be(e)});var by=(t,e={},r)=>t?zi.create().superRefine((i,s)=>{var n,o;if(!t(i)){let a=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,u=(o=(n=a.fatal)!==null&&n!==void 0?n:r)!==null&&o!==void 0?o:!0,l=typeof a=="string"?{message:a}:a;s.addIssue({code:"custom",...l,fatal:u});}}):zi.create(),qO={object:cr.lazycreate},Oe;(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";})(Oe||(Oe={}));var HO=(t,e={message:`Input not instance of ${t.name}`})=>by(r=>r instanceof t,e),Ey=$i.create,Cy=In.create,UO=Vs.create,VO=kn.create,Ty=Mn.create,$O=Bn.create,zO=Bs.create,KO=jn.create,GO=qn.create,WO=zi.create,YO=gi.create,JO=qr.create,ZO=js.create,XO=_i.create,QO=cr.create,eF=cr.strictCreate,tF=Hn.create,rF=Wu.create,iF=Un.create,nF=Jr.create,sF=Yu.create,oF=qs.create,aF=Hs.create,uF=Ju.create,lF=Vn.create,cF=$n.create,hF=zn.create,fF=Kn.create,dF=Ki.create,_y=Cr.create,pF=jr.create,mF=yi.create,gF=Cr.createWithPreprocess,_F=Yo.create,yF=()=>Ey().optional(),vF=()=>Cy().optional(),xF=()=>Ty().optional(),bF={string:t=>$i.create({...t,coerce:!0}),number:t=>In.create({...t,coerce:!0}),boolean:t=>Mn.create({...t,coerce:!0}),bigint:t=>kn.create({...t,coerce:!0}),date:t=>Bn.create({...t,coerce:!0})},EF=Pe,Ie=Object.freeze({__proto__:null,defaultErrorMap:Go,setErrorMap:wO,getErrorMap:zu,makeIssue:Ku,EMPTY_PATH:DO,addIssueToContext:Te,ParseStatus:rr,INVALID:Pe,DIRTY:vy,OK:sr,isAborted:Sd,isDirty:Rd,isValid:Wo,isAsync:Gu,get util(){return Ze},get objectUtil(){return Dd},ZodParsedType:Ee,getParsedType:Vi,ZodType:je,ZodString:$i,ZodNumber:In,ZodBigInt:kn,ZodBoolean:Mn,ZodDate:Bn,ZodSymbol:Bs,ZodUndefined:jn,ZodNull:qn,ZodAny:zi,ZodUnknown:gi,ZodNever:qr,ZodVoid:js,ZodArray:_i,ZodObject:cr,ZodUnion:Hn,ZodDiscriminatedUnion:Wu,ZodIntersection:Un,ZodTuple:Jr,ZodRecord:Yu,ZodMap:qs,ZodSet:Hs,ZodFunction:Ju,ZodLazy:Vn,ZodLiteral:$n,ZodEnum:zn,ZodNativeEnum:Kn,ZodPromise:Ki,ZodEffects:Cr,ZodTransformer:Cr,ZodOptional:jr,ZodNullable:yi,ZodDefault:Gn,ZodCatch:Us,ZodNaN:Vs,BRAND:jO,ZodBranded:Zu,ZodPipeline:Yo,ZodReadonly:$s,custom:by,Schema:je,ZodSchema:je,late:qO,get ZodFirstPartyTypeKind(){return Oe},coerce:bF,any:WO,array:XO,bigint:VO,boolean:Ty,date:$O,discriminatedUnion:rF,effect:_y,enum:hF,function:uF,instanceof:HO,intersection:iF,lazy:lF,literal:cF,map:oF,nan:UO,nativeEnum:fF,never:JO,null:GO,nullable:mF,number:Cy,object:QO,oboolean:xF,onumber:vF,optional:pF,ostring:yF,pipeline:_F,preprocess:gF,promise:dF,record:sF,set:aF,strictObject:eF,string:Ey,symbol:zO,transformer:_y,tuple:nF,undefined:KO,union:tF,unknown:YO,void:ZO,NEVER:EF,ZodIssueCode:ve,quotelessJson:AO,ZodError:Er});var Xu=t=>new Promise(e=>{setTimeout(e,t);}),Ay=async(t,e,r)=>{GE__default.default(e>0,`Number of attempts for retry must be larger than 0, got ${e}`);for(let i=0;i<e-1;i++)try{return await t()}catch(s){await(r==null?void 0:r(s,i));}return t()};var wy=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function TF(t){return wy.includes(t)}var AF=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Blob","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","WeakRef","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","FormData","URLSearchParams","HTMLElement","NaN",...wy];function wF(t){return AF.includes(t)}var DF=["null","undefined","string","number","bigint","boolean","symbol"];function SF(t){return DF.includes(t)}function zs(t){return e=>typeof e===t}var{toString:RF}=Object.prototype,Jo=t=>{let e=RF.call(t).slice(8,-1);if(/HTML\w+Element/.test(e)&&Y.domElement(t))return "HTMLElement";if(wF(e))return e},st=t=>e=>Jo(e)===t;function Y(t){if(t===null)return "null";switch(typeof t){case"undefined":return "undefined";case"string":return "string";case"number":return Number.isNaN(t)?"NaN":"number";case"boolean":return "boolean";case"function":return "Function";case"bigint":return "bigint";case"symbol":return "symbol";}if(Y.observable(t))return "Observable";if(Y.array(t))return "Array";if(Y.buffer(t))return "Buffer";let e=Jo(t);if(e)return e;if(t instanceof String||t instanceof Boolean||t instanceof Number)throw new TypeError("Please don't use object wrappers for primitive types");return "Object"}Y.undefined=zs("undefined");Y.string=zs("string");var NF=zs("number");Y.number=t=>NF(t)&&!Y.nan(t);Y.positiveNumber=t=>Y.number(t)&&t>0;Y.negativeNumber=t=>Y.number(t)&&t<0;Y.bigint=zs("bigint");Y.function_=zs("function");Y.null_=t=>t===null;Y.class_=t=>Y.function_(t)&&t.toString().startsWith("class ");Y.boolean=t=>t===!0||t===!1;Y.symbol=zs("symbol");Y.numericString=t=>Y.string(t)&&!Y.emptyStringOrWhitespace(t)&&!Number.isNaN(Number(t));Y.array=(t,e)=>Array.isArray(t)?Y.function_(e)?t.every(r=>e(r)):!0:!1;Y.buffer=t=>{var e,r,i;return (i=(r=(e=t==null?void 0:t.constructor)==null?void 0:e.isBuffer)==null?void 0:r.call(e,t))!=null?i:!1};Y.blob=t=>st("Blob")(t);Y.nullOrUndefined=t=>Y.null_(t)||Y.undefined(t);Y.object=t=>!Y.null_(t)&&(typeof t=="object"||Y.function_(t));Y.iterable=t=>Y.function_(t==null?void 0:t[Symbol.iterator]);Y.asyncIterable=t=>Y.function_(t==null?void 0:t[Symbol.asyncIterator]);Y.generator=t=>Y.iterable(t)&&Y.function_(t==null?void 0:t.next)&&Y.function_(t==null?void 0:t.throw);Y.asyncGenerator=t=>Y.asyncIterable(t)&&Y.function_(t.next)&&Y.function_(t.throw);Y.nativePromise=t=>st("Promise")(t);var OF=t=>Y.function_(t==null?void 0:t.then)&&Y.function_(t==null?void 0:t.catch);Y.promise=t=>Y.nativePromise(t)||OF(t);Y.generatorFunction=st("GeneratorFunction");Y.asyncGeneratorFunction=t=>Jo(t)==="AsyncGeneratorFunction";Y.asyncFunction=t=>Jo(t)==="AsyncFunction";Y.boundFunction=t=>Y.function_(t)&&!t.hasOwnProperty("prototype");Y.regExp=st("RegExp");Y.date=st("Date");Y.error=st("Error");Y.map=t=>st("Map")(t);Y.set=t=>st("Set")(t);Y.weakMap=t=>st("WeakMap")(t);Y.weakSet=t=>st("WeakSet")(t);Y.weakRef=t=>st("WeakRef")(t);Y.int8Array=st("Int8Array");Y.uint8Array=st("Uint8Array");Y.uint8ClampedArray=st("Uint8ClampedArray");Y.int16Array=st("Int16Array");Y.uint16Array=st("Uint16Array");Y.int32Array=st("Int32Array");Y.uint32Array=st("Uint32Array");Y.float32Array=st("Float32Array");Y.float64Array=st("Float64Array");Y.bigInt64Array=st("BigInt64Array");Y.bigUint64Array=st("BigUint64Array");Y.arrayBuffer=st("ArrayBuffer");Y.sharedArrayBuffer=st("SharedArrayBuffer");Y.dataView=st("DataView");Y.enumCase=(t,e)=>Object.values(e).includes(t);Y.directInstanceOf=(t,e)=>Object.getPrototypeOf(t)===e.prototype;Y.urlInstance=t=>st("URL")(t);Y.urlString=t=>{if(!Y.string(t))return !1;try{return new URL(t),!0}catch(e){return !1}};Y.truthy=t=>!!t;Y.falsy=t=>!t;Y.nan=t=>Number.isNaN(t);Y.primitive=t=>Y.null_(t)||SF(typeof t);Y.integer=t=>Number.isInteger(t);Y.safeInteger=t=>Number.isSafeInteger(t);Y.plainObject=t=>{if(typeof t!="object"||t===null)return !1;let e=Object.getPrototypeOf(t);return (e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)};Y.typedArray=t=>TF(Jo(t));var FF=t=>Y.safeInteger(t)&&t>=0;Y.arrayLike=t=>!Y.nullOrUndefined(t)&&!Y.function_(t)&&FF(t.length);Y.tupleLike=(t,e)=>Y.array(e)&&Y.array(t)&&e.length===t.length?e.every((r,i)=>r(t[i])):!1;Y.inRange=(t,e)=>{if(Y.number(e))return t>=Math.min(0,e)&&t<=Math.max(e,0);if(Y.array(e)&&e.length===2)return t>=Math.min(...e)&&t<=Math.max(...e);throw new TypeError(`Invalid range: ${JSON.stringify(e)}`)};var LF=1,PF=["innerHTML","ownerDocument","style","attributes","nodeValue"];Y.domElement=t=>Y.object(t)&&t.nodeType===LF&&Y.string(t.nodeName)&&!Y.plainObject(t)&&PF.every(e=>e in t);Y.observable=t=>{var e,r;return t?t===((e=t[Symbol.observable])==null?void 0:e.call(t))||t===((r=t["@@observable"])==null?void 0:r.call(t)):!1};Y.nodeStream=t=>Y.object(t)&&Y.function_(t.pipe)&&!Y.observable(t);Y.infinite=t=>t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY;var Dy=t=>e=>Y.integer(e)&&Math.abs(e%2)===t;Y.evenInteger=Dy(0);Y.oddInteger=Dy(1);Y.emptyArray=t=>Y.array(t)&&t.length===0;Y.nonEmptyArray=t=>Y.array(t)&&t.length>0;Y.emptyString=t=>Y.string(t)&&t.length===0;var IF=t=>Y.string(t)&&!/\S/.test(t);Y.emptyStringOrWhitespace=t=>Y.emptyString(t)||IF(t);Y.nonEmptyString=t=>Y.string(t)&&t.length>0;Y.nonEmptyStringAndNotWhitespace=t=>Y.string(t)&&!Y.emptyStringOrWhitespace(t);Y.emptyObject=t=>Y.object(t)&&!Y.map(t)&&!Y.set(t)&&Object.keys(t).length===0;Y.nonEmptyObject=t=>Y.object(t)&&!Y.map(t)&&!Y.set(t)&&Object.keys(t).length>0;Y.emptySet=t=>Y.set(t)&&t.size===0;Y.nonEmptySet=t=>Y.set(t)&&t.size>0;Y.emptyMap=t=>Y.map(t)&&t.size===0;Y.nonEmptyMap=t=>Y.map(t)&&t.size>0;Y.propertyKey=t=>Y.any([Y.string,Y.number,Y.symbol],t);Y.formData=t=>st("FormData")(t);Y.urlSearchParams=t=>st("URLSearchParams")(t);var Sy=(t,e,r)=>{if(!Y.function_(e))throw new TypeError(`Invalid predicate: ${JSON.stringify(e)}`);if(r.length===0)throw new TypeError("Invalid number of values");return t.call(r,e)};Y.any=(t,...e)=>(Y.array(t)?t:[t]).some(i=>Sy(Array.prototype.some,i,e));Y.all=(t,...e)=>Sy(Array.prototype.every,t,e);var xe=(t,e,r,i={})=>{if(!t){let{multipleValues:s}=i,n=s?`received values of types ${[...new Set(r.map(o=>`\`${Y(o)}\``))].join(", ")}`:`received value of type \`${Y(r)}\``;throw new TypeError(`Expected value which is \`${e}\`, ${n}.`)}},de={undefined:t=>xe(Y.undefined(t),"undefined",t),string:t=>xe(Y.string(t),"string",t),number:t=>xe(Y.number(t),"number",t),positiveNumber:t=>xe(Y.positiveNumber(t),"positive number",t),negativeNumber:t=>xe(Y.negativeNumber(t),"negative number",t),bigint:t=>xe(Y.bigint(t),"bigint",t),function_:t=>xe(Y.function_(t),"Function",t),null_:t=>xe(Y.null_(t),"null",t),class_:t=>xe(Y.class_(t),"Class",t),boolean:t=>xe(Y.boolean(t),"boolean",t),symbol:t=>xe(Y.symbol(t),"symbol",t),numericString:t=>xe(Y.numericString(t),"string with a number",t),array:(t,e)=>{xe(Y.array(t),"Array",t),e&&t.forEach(e);},buffer:t=>xe(Y.buffer(t),"Buffer",t),blob:t=>xe(Y.blob(t),"Blob",t),nullOrUndefined:t=>xe(Y.nullOrUndefined(t),"null or undefined",t),object:t=>xe(Y.object(t),"Object",t),iterable:t=>xe(Y.iterable(t),"Iterable",t),asyncIterable:t=>xe(Y.asyncIterable(t),"AsyncIterable",t),generator:t=>xe(Y.generator(t),"Generator",t),asyncGenerator:t=>xe(Y.asyncGenerator(t),"AsyncGenerator",t),nativePromise:t=>xe(Y.nativePromise(t),"native Promise",t),promise:t=>xe(Y.promise(t),"Promise",t),generatorFunction:t=>xe(Y.generatorFunction(t),"GeneratorFunction",t),asyncGeneratorFunction:t=>xe(Y.asyncGeneratorFunction(t),"AsyncGeneratorFunction",t),asyncFunction:t=>xe(Y.asyncFunction(t),"AsyncFunction",t),boundFunction:t=>xe(Y.boundFunction(t),"Function",t),regExp:t=>xe(Y.regExp(t),"RegExp",t),date:t=>xe(Y.date(t),"Date",t),error:t=>xe(Y.error(t),"Error",t),map:t=>xe(Y.map(t),"Map",t),set:t=>xe(Y.set(t),"Set",t),weakMap:t=>xe(Y.weakMap(t),"WeakMap",t),weakSet:t=>xe(Y.weakSet(t),"WeakSet",t),weakRef:t=>xe(Y.weakRef(t),"WeakRef",t),int8Array:t=>xe(Y.int8Array(t),"Int8Array",t),uint8Array:t=>xe(Y.uint8Array(t),"Uint8Array",t),uint8ClampedArray:t=>xe(Y.uint8ClampedArray(t),"Uint8ClampedArray",t),int16Array:t=>xe(Y.int16Array(t),"Int16Array",t),uint16Array:t=>xe(Y.uint16Array(t),"Uint16Array",t),int32Array:t=>xe(Y.int32Array(t),"Int32Array",t),uint32Array:t=>xe(Y.uint32Array(t),"Uint32Array",t),float32Array:t=>xe(Y.float32Array(t),"Float32Array",t),float64Array:t=>xe(Y.float64Array(t),"Float64Array",t),bigInt64Array:t=>xe(Y.bigInt64Array(t),"BigInt64Array",t),bigUint64Array:t=>xe(Y.bigUint64Array(t),"BigUint64Array",t),arrayBuffer:t=>xe(Y.arrayBuffer(t),"ArrayBuffer",t),sharedArrayBuffer:t=>xe(Y.sharedArrayBuffer(t),"SharedArrayBuffer",t),dataView:t=>xe(Y.dataView(t),"DataView",t),enumCase:(t,e)=>xe(Y.enumCase(t,e),"EnumCase",t),urlInstance:t=>xe(Y.urlInstance(t),"URL",t),urlString:t=>xe(Y.urlString(t),"string with a URL",t),truthy:t=>xe(Y.truthy(t),"truthy",t),falsy:t=>xe(Y.falsy(t),"falsy",t),nan:t=>xe(Y.nan(t),"NaN",t),primitive:t=>xe(Y.primitive(t),"primitive",t),integer:t=>xe(Y.integer(t),"integer",t),safeInteger:t=>xe(Y.safeInteger(t),"integer",t),plainObject:t=>xe(Y.plainObject(t),"plain object",t),typedArray:t=>xe(Y.typedArray(t),"TypedArray",t),arrayLike:t=>xe(Y.arrayLike(t),"array-like",t),tupleLike:(t,e)=>xe(Y.tupleLike(t,e),"tuple-like",t),domElement:t=>xe(Y.domElement(t),"HTMLElement",t),observable:t=>xe(Y.observable(t),"Observable",t),nodeStream:t=>xe(Y.nodeStream(t),"Node.js Stream",t),infinite:t=>xe(Y.infinite(t),"infinite number",t),emptyArray:t=>xe(Y.emptyArray(t),"empty array",t),nonEmptyArray:t=>xe(Y.nonEmptyArray(t),"non-empty array",t),emptyString:t=>xe(Y.emptyString(t),"empty string",t),emptyStringOrWhitespace:t=>xe(Y.emptyStringOrWhitespace(t),"empty string or whitespace",t),nonEmptyString:t=>xe(Y.nonEmptyString(t),"non-empty string",t),nonEmptyStringAndNotWhitespace:t=>xe(Y.nonEmptyStringAndNotWhitespace(t),"non-empty string and not whitespace",t),emptyObject:t=>xe(Y.emptyObject(t),"empty object",t),nonEmptyObject:t=>xe(Y.nonEmptyObject(t),"non-empty object",t),emptySet:t=>xe(Y.emptySet(t),"empty set",t),nonEmptySet:t=>xe(Y.nonEmptySet(t),"non-empty set",t),emptyMap:t=>xe(Y.emptyMap(t),"empty map",t),nonEmptyMap:t=>xe(Y.nonEmptyMap(t),"non-empty map",t),propertyKey:t=>xe(Y.propertyKey(t),"PropertyKey",t),formData:t=>xe(Y.formData(t),"FormData",t),urlSearchParams:t=>xe(Y.urlSearchParams(t),"URLSearchParams",t),evenInteger:t=>xe(Y.evenInteger(t),"even integer",t),oddInteger:t=>xe(Y.oddInteger(t),"odd integer",t),directInstanceOf:(t,e)=>xe(Y.directInstanceOf(t,e),"T",t),inRange:(t,e)=>xe(Y.inRange(t,e),"in range",t),any:(t,...e)=>xe(Y.any(t,...e),"predicate returns truthy for any value",e,{multipleValues:!0}),all:(t,...e)=>xe(Y.all(t,...e),"predicate returns truthy for all values",e,{multipleValues:!0})};Object.defineProperties(Y,{class:{value:Y.class_},function:{value:Y.function_},null:{value:Y.null_}});Object.defineProperties(de,{class:{value:de.class_},function:{value:de.function_},null:{value:de.null_}});var ie=Y;var Od=class extends Error{constructor(e){super(e||"Promise was canceled"),this.name="CancelError";}get isCanceled(){return !0}},Ks=class t{static fn(e){return (...r)=>new t((i,s,n)=>{r.push(n),e(...r).then(i,s);})}constructor(e){this._cancelHandlers=[],this._isPending=!0,this._isCanceled=!1,this._rejectOnCancel=!0,this._promise=new Promise((r,i)=>{this._reject=i;let s=a=>{(!this._isCanceled||!o.shouldReject)&&(this._isPending=!1,r(a));},n=a=>{this._isPending=!1,i(a);},o=a=>{if(!this._isPending)throw new Error("The `onCancel` handler was attached after the promise settled.");this._cancelHandlers.push(a);};Object.defineProperties(o,{shouldReject:{get:()=>this._rejectOnCancel,set:a=>{this._rejectOnCancel=a;}}}),e(s,n,o);});}then(e,r){return this._promise.then(e,r)}catch(e){return this._promise.catch(e)}finally(e){return this._promise.finally(e)}cancel(e){if(!(!this._isPending||this._isCanceled)){if(this._isCanceled=!0,this._cancelHandlers.length>0)try{for(let r of this._cancelHandlers)r();}catch(r){this._reject(r);return}this._rejectOnCancel&&this._reject(new Od(e));}}get isCanceled(){return this._isCanceled}};Object.setPrototypeOf(Ks.prototype,Promise.prototype);function kF(t){return ie.object(t)&&"_onResponse"in t}var Dt=class extends Error{constructor(e,r,i){var s,n;if(super(e),Object.defineProperty(this,"input",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"request",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Error.captureStackTrace(this,this.constructor),this.name="RequestError",this.code=(s=r.code)!=null?s:"ERR_GOT_REQUEST_ERROR",this.input=r.input,kF(i)?(Object.defineProperty(this,"request",{enumerable:!1,value:i}),Object.defineProperty(this,"response",{enumerable:!1,value:i.response}),this.options=i.options):this.options=i,this.timings=(n=this.request)==null?void 0:n.timings,ie.string(r.stack)&&ie.string(this.stack)){let o=this.stack.indexOf(this.message)+this.message.length,a=this.stack.slice(o).split(`
|
|
460
460
|
`).reverse(),u=r.stack.slice(r.stack.indexOf(r.message)+r.message.length).split(`
|
|
461
461
|
`).reverse();for(;u.length>0&&u[0]===a[0];)a.shift();this.stack=`${this.stack.slice(0,o)}${a.reverse().join(`
|
|
462
462
|
`)}${u.reverse().join(`
|
|
@@ -470,7 +470,7 @@ ${JSON.stringify(r)}`),await Ay(async()=>{let i=await jP(this.props.apiUrl,r);if
|
|
|
470
470
|
|
|
471
471
|
${JSON.stringify(i)}`),Cx(i.result))throw new Error("API Rate limit has been exceeded");return i},3,async(i,s)=>{this.emit("retry",i,s),await Xu(2e3);})}async __poll(r){for(;;){this.emit("poll",r);let i=await qP(this.props.apiUrl,r);if(this.logger.verbose(`Received raw polling response from ${this.props.apiUrl}:
|
|
472
472
|
|
|
473
|
-
${JSON.stringify(i)}`),i.status===1)return {alreadyVerified:!1};if(Ex(i.result))return {alreadyVerified:!0};if(BP(i.result)){await Xu(1e4);continue}if(Cx(i.result)){await Xu(1e4);continue}throw new Error(`Verification failed with result "${i.result}", status ${i.status} (${i.message})`)}}},Tx=(t,e)=>new N0(t,e),BP=t=>!!(t!=null&&t.match(/Pending/gi)),Ex=t=>!!(t!=null&&t.match(/already verified/gi)),Cx=t=>!!(t!=null&&t.match(/rate/)),jP=async(t,e)=>{try{let r=await R0(t,{method:"POST",form:e,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return Ax.parse(r)}catch(r){throw new Error(`Failed to submit verification request: ${r}`)}},qP=async(t,e)=>{let r=new URL(t);r.searchParams.set("module","contract"),r.searchParams.set("action","checkverifystatus"),r.searchParams.set("guid",e);try{let i=await R0(r).json();return Ax.parse(i)}catch(i){throw new Error(`Failed to check verification status: ${i}`)}},HP=({apiKey:t,address:e,contractName:r,constructorArguments:i,compilerVersion:s,optimizerRuns:n=0,sourceCode:o,evmVersion:a,licenseType:u})=>{let l={action:"verifysourcecode",module:"contract",codeformat:"solidity-standard-json-input",contractaddress:e,contractname:r,compilerversion:`v${s}`,optimizationUsed:n>0?"1":"0",sourceCode:o};return t!=null&&(l.apikey=t),n!=null&&(l.runs=String(n)),i!=null&&(l.constructorArguements=i),a!=null&&(l.evmversion=a),u!=null&&(l.licenseType=String(u)),l},Ax=Ie.object({status:Ie.coerce.number().nullish(),message:Ie.string().nullish(),result:Ie.string().nullish()});var Wa=Kt(Ko());Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()});Ie.record(Ie.string(),Ie.object({content:Ie.string()}));var UP=Ie.array(Ie.record(Ie.string(),Ie.any())),VP=Ie.object({language:Ie.string(),compiler:Ie.object({version:Ie.string()}),settings:Ie.object({compilationTarget:Ie.record(Ie.string(),Ie.string()),evmVersion:Ie.string(),optimizer:Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()})}),sources:Ie.record(Ie.string(),Ie.object({content:Ie.string()}))}),O0=Ie.object({address:Ie.string(),abi:UP,args:Ie.array(Ie.any()),solcInputHash:Ie.string(),metadata:Ie.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:"custom",message:"Invalid JSON"}),Ie.NEVER}}).pipe(VP),bytecode:Ie.string(),deployedBytecode:Ie.string()});var F0=t=>{let{compilationTarget:e,...r}=t.settings,i=Object.entries(t.sources).reduce((s,[n,o])=>({...s,[n]:{content:o.content}}),{});return {language:t.language,settings:r,sources:i}};var Hx=Kt(Dx());var Sx="logger/5.7.0";var Rx=!1,Nx=!1,Al={debug:1,default:2,info:2,warning:3,error:4,off:5},Ox=Al.default,P0=null;function $P(){try{let t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch(r){t.push(e);}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var Fx=$P(),I0;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF";})(I0||(I0={}));var Hr;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED";})(Hr||(Hr={}));var Lx="0123456789abcdef",ke=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1});}_log(e,r){let i=e.toLowerCase();Al[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>Al[i])&&console.log.apply(console,r);}debug(...e){this._log(t.levels.DEBUG,e);}info(...e){this._log(t.levels.INFO,e);}warn(...e){this._log(t.levels.WARNING,e);}makeError(e,r,i){if(Nx)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),i||(i={});let s=[];Object.keys(i).forEach(u=>{let l=i[u];try{if(l instanceof Uint8Array){let h="";for(let c=0;c<l.length;c++)h+=Lx[l[c]>>4],h+=Lx[l[c]&15];s.push(u+"=Uint8Array(0x"+h+")");}else s.push(u+"="+JSON.stringify(l));}catch(h){s.push(u+"="+JSON.stringify(i[u].toString()));}}),s.push(`code=${r}`),s.push(`version=${this.version}`);let n=e,o="";switch(r){case Hr.NUMERIC_FAULT:{o="NUMERIC_FAULT";let u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Hr.CALL_EXCEPTION:case Hr.INSUFFICIENT_FUNDS:case Hr.MISSING_NEW:case Hr.NONCE_EXPIRED:case Hr.REPLACEMENT_UNDERPRICED:case Hr.TRANSACTION_REPLACED:case Hr.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),s.length&&(e+=" ("+s.join(", ")+")");let a=new Error(e);return a.reason=n,a.code=r,Object.keys(i).forEach(function(u){a[u]=i[u];}),a}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,s){e||this.throwError(r,i,s);}assertArgument(e,r,i,s){e||this.throwArgumentError(r,i,s);}checkNormalize(e){Fx&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Fx});}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}));}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,t.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r});}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name});}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name});}static globalLogger(){return P0||(P0=new t(Sx)),P0}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"});}Nx=!!e,Rx=!!r;}static setLogLevel(e){let r=Al[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}Ox=r;}static from(e){return new t(e)}};ke.errors=Hr;ke.levels=I0;var Px="bytes/5.7.0";var xi=new ke(Px);function kx(t){return !!t.toHexString}function ya(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return ya(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ix(t){return typeof t=="number"&&t==t&&t%1===0}function wl(t){if(t==null)return !1;if(t.constructor===Uint8Array)return !0;if(typeof t=="string"||!Ix(t.length)||t.length<0)return !1;for(let e=0;e<t.length;e++){let r=t[e];if(!Ix(r)||r<0||r>=256)return !1}return !0}function It(t,e){if(e||(e={}),typeof t=="number"){xi.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),ya(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),hr(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":xi.throwArgumentError("hex data is odd-length","value",t));let i=[];for(let s=0;s<r.length;s+=2)i.push(parseInt(r.substring(s,s+2),16));return ya(new Uint8Array(i))}return wl(t)?ya(new Uint8Array(t)):xi.throwArgumentError("invalid arrayify value","value",t)}function bi(t){let e=t.map(s=>It(s)),r=e.reduce((s,n)=>s+n.length,0),i=new Uint8Array(r);return e.reduce((s,n)=>(i.set(n,s),s+n.length),0),ya(i)}function hr(t,e){return !(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var k0="0123456789abcdef";function St(t,e){if(e||(e={}),typeof t=="number"){xi.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=k0[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t))return t.toHexString();if(hr(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":xi.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(wl(t)){let r="0x";for(let i=0;i<t.length;i++){let s=t[i];r+=k0[(s&240)>>4]+k0[s&15];}return r}return xi.throwArgumentError("invalid hexlify value","value",t)}function M0(t,e,r){return typeof t!="string"?t=St(t):(!hr(t)||t.length%2)&&xi.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Mx(t){let e="0x";return t.forEach(r=>{e+=St(r).substring(2);}),e}function Dl(t,e){for(typeof t!="string"?t=St(t):hr(t)||xi.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&xi.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var Bx="bignumber/5.7.0";var Sl=Hx.default.BN,Ei=new ke(Bx),B0={},jx=9007199254740991;var qx=!1,Nt=class t{constructor(e,r){e!==B0&&Ei.throwError("cannot call constructor directly; use BigNumber.from",ke.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this);}fromTwos(e){return fr(Ke(this).fromTwos(e))}toTwos(e){return fr(Ke(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return fr(Ke(this).add(Ke(e)))}sub(e){return fr(Ke(this).sub(Ke(e)))}div(e){return t.from(e).isZero()&&Ir("division-by-zero","div"),fr(Ke(this).div(Ke(e)))}mul(e){return fr(Ke(this).mul(Ke(e)))}mod(e){let r=Ke(e);return r.isNeg()&&Ir("division-by-zero","mod"),fr(Ke(this).umod(r))}pow(e){let r=Ke(e);return r.isNeg()&&Ir("negative-power","pow"),fr(Ke(this).pow(r))}and(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","and"),fr(Ke(this).and(r))}or(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","or"),fr(Ke(this).or(r))}xor(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","xor"),fr(Ke(this).xor(r))}mask(e){return (this.isNegative()||e<0)&&Ir("negative-width","mask"),fr(Ke(this).maskn(e))}shl(e){return (this.isNegative()||e<0)&&Ir("negative-width","shl"),fr(Ke(this).shln(e))}shr(e){return (this.isNegative()||e<0)&&Ir("negative-width","shr"),fr(Ke(this).shrn(e))}eq(e){return Ke(this).eq(Ke(e))}lt(e){return Ke(this).lt(Ke(e))}lte(e){return Ke(this).lte(Ke(e))}gt(e){return Ke(this).gt(Ke(e))}gte(e){return Ke(this).gte(Ke(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Ke(this).isZero()}toNumber(){try{return Ke(this).toNumber()}catch(e){Ir("overflow","toNumber",this.toString());}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ei.throwError("this platform does not support BigInt",ke.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?qx||(qx=!0,Ei.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ei.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ke.errors.UNEXPECTED_ARGUMENT,{}):Ei.throwError("BigNumber.toString does not accept parameters",ke.errors.UNEXPECTED_ARGUMENT,{})),Ke(this).toString(10)}toHexString(){return this._hex}toJSON(e){return {type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(B0,va(e)):e.match(/^-?[0-9]+$/)?new t(B0,va(new Sl(e))):Ei.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ir("underflow","BigNumber.from",e),(e>=jx||e<=-jx)&&Ir("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(wl(r))return t.from(St(r));if(r)if(r.toHexString){let i=r.toHexString();if(typeof i=="string")return t.from(i)}else {let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(hr(i)||i[0]==="-"&&hr(i.substring(1))))return t.from(i)}return Ei.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return !!(e&&e._isBigNumber)}};function va(t){if(typeof t!="string")return va(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ei.throwArgumentError("invalid hex","value",t),t=va(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return "0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function fr(t){return Nt.from(va(t))}function Ke(t){let e=Nt.from(t).toHexString();return e[0]==="-"?new Sl("-"+e.substring(3),16):new Sl(e.substring(2),16)}function Ir(t,e,r){let i={fault:t,operation:e};return r!=null&&(i.value=r),Ei.throwError(t,ke.errors.NUMERIC_FAULT,i)}function j0(t){return new Sl(t,36).toString(16)}var Ux="properties/5.7.0";var Vx=new ke(Ux);function Bt(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1});}function xa(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor;}return null}var KP={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function $x(t){if(t==null||KP[typeof t])return !0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return !1;let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]];}catch(s){continue}if(!$x(i))return !1}return !0}return Vx.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function GP(t){if($x(t))return t;if(Array.isArray(t))return Object.freeze(t.map(e=>q0(e)));if(typeof t=="object"){let e={};for(let r in t){let i=t[r];i!==void 0&&Bt(e,r,q0(i));}return e}return Vx.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function q0(t){return GP(t)}var Qn=class{constructor(e){for(let r in e)this[r]=q0(e[r]);}};var Zr="abi/5.7.0";var Ge=new ke(Zr),es={},zx={calldata:!0,memory:!0,storage:!0},WP={calldata:!0,memory:!0};function Rl(t,e){if(t==="bytes"||t==="string"){if(zx[e])return !0}else if(t==="address"){if(e==="payable")return !0}else if((t.indexOf("[")>=0||t==="tuple")&&WP[e])return !0;return (zx[e]||e==="payable")&&Ge.throwArgumentError("invalid modifier","name",e),!1}function YP(t,e){let r=t;function i(a){Ge.throwArgumentError(`unexpected character at position ${a}`,"param",t);}t=t.replace(/\s/g," ");function s(a){let u={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(u.indexed=!1),u}let n={type:"",name:"",state:{allowType:!0}},o=n;for(let a=0;a<t.length;a++){let u=t[a];switch(u){case"(":o.state.allowType&&o.type===""?o.type="tuple":o.state.allowParams||i(a),o.state.allowType=!1,o.type=to(o.type),o.components=[s(o)],o=o.components[0];break;case")":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),Rl(o.type,o.name)&&(o.name=""),o.type=to(o.type);let l=o;o=o.parent,o||i(a),delete l.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),Rl(o.type,o.name)&&(o.name=""),o.type=to(o.type);let h=s(o.parent);o.parent.components.push(h),delete o.parent,o=h;break;case" ":o.state.allowType&&o.type!==""&&(o.type=to(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&o.name!==""&&(o.name==="indexed"?(e||i(a),o.indexed&&i(a),o.indexed=!0,o.name=""):Rl(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||i(a),o.type+=u,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||i(a),o.type+=u,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=u,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=u,delete o.state.allowArray):o.state.readArray?o.type+=u:i(a);}}return o.parent&&Ge.throwArgumentError("unexpected eof","param",t),delete n.state,o.name==="indexed"?(e||i(r.length-7),o.indexed&&i(r.length-7),o.indexed=!0,o.name=""):Rl(o.type,o.name)&&(o.name=""),n.type=to(n.type),n}function Nl(t,e){for(let r in e)Bt(t,r,e[r]);}var Ye=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),JP=new RegExp(/^(.*)\[([0-9]*)\]$/),dr=class t{constructor(e,r){e!==es&&Ge.throwError("use fromString",ke.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Nl(this,r);let i=this.type.match(JP);i?Nl(this,{arrayLength:parseInt(i[2]||"-1"),arrayChildren:t.fromObject({type:i[1],components:this.components}),baseType:"array"}):Nl(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this);}format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json){let i={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.components&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Ye.sighash&&(r+=this.type),r+="("+this.components.map(i=>i.format(e)).join(e===Ye.full?", ":",")+")"):r+=this.type,e!==Ye.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Ye.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?t.fromString(e,r):t.fromObject(e)}static fromObject(e){return t.isParamType(e)?e:new t(es,{name:e.name||null,type:to(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(t.fromObject):null})}static fromString(e,r){function i(s){return t.fromObject({name:s.name,type:s.type,indexed:s.indexed,components:s.components})}return i(YP(e,!!r))}static isParamType(e){return !!(e!=null&&e._isParamType)}};function ba(t,e){return XP(t).map(r=>dr.fromString(r,e))}var ts=class t{constructor(e,r){e!==es&&Ge.throwError("use a static from method",ke.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Nl(this,r),this._isFragment=!0,Object.freeze(this);}static from(e){return t.isFragment(e)?e:typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFragment(e))return e;switch(e.type){case"function":return is.fromObject(e);case"event":return ro.fromObject(e);case"constructor":return rs.fromObject(e);case"error":return Ol.fromObject(e);case"fallback":case"receive":return null}return Ge.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?ro.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?is.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?rs.fromString(e.trim()):e.split(" ")[0]==="error"?Ol.fromString(e.substring(5).trim()):Ge.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return !!(e&&e._isFragment)}},ro=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Ye.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",e!==Ye.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isEventFragment(e))return e;e.type!=="event"&&Ge.throwArgumentError("invalid event object","value",e);let r={name:Ea(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(dr.fromObject):[],type:"event"};return new t(es,r)}static fromString(e){let r=e.match(Ca);r||Ge.throwArgumentError("invalid event string","value",e);let i=!1;return r[3].split(" ").forEach(s=>{switch(s.trim()){case"anonymous":i=!0;break;case"":break;default:Ge.warn("unknown modifier: "+s);}}),t.fromObject({name:r[1].trim(),anonymous:i,inputs:ba(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}};function Gx(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ge.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ge.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Nt.from(r[1]),r[0]):t}function Wx(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r);}});}function Yx(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ge.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ge.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ge.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ge.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ge.throwArgumentError("unable to determine stateMutability","value",t),e}var rs=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});e===Ye.sighash&&Ge.throwError("cannot format a constructor for sighash",ke.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isConstructorFragment(e))return e;e.type!=="constructor"&&Ge.throwArgumentError("invalid constructor object","value",e);let r=Yx(e);r.constant&&Ge.throwArgumentError("constructor cannot be constant","value",e);let i={name:null,type:e.type,inputs:e.inputs?e.inputs.map(dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Nt.from(e.gas):null};return new t(es,i)}static fromString(e){let r={type:"constructor"};e=Gx(e,r);let i=e.match(Ca);return (!i||i[1].trim()!=="constructor")&&Ge.throwArgumentError("invalid constructor string","value",e),r.inputs=ba(i[2].trim(),!1),Wx(i[3].trim(),r),t.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}},is=class t extends rs{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e))),outputs:this.outputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Ye.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",e!==Ye.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(i=>i.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFunctionFragment(e))return e;e.type!=="function"&&Ge.throwArgumentError("invalid function object","value",e);let r=Yx(e),i={type:e.type,name:Ea(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(dr.fromObject):[],outputs:e.outputs?e.outputs.map(dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Nt.from(e.gas):null};return new t(es,i)}static fromString(e){let r={type:"function"};e=Gx(e,r);let i=e.split(" returns ");i.length>2&&Ge.throwArgumentError("invalid function string","value",e);let s=i[0].match(Ca);if(s||Ge.throwArgumentError("invalid function signature","value",e),r.name=s[1].trim(),r.name&&Ea(r.name),r.inputs=ba(s[2],!1),Wx(s[3].trim(),r),i.length>1){let n=i[1].match(Ca);(n[1].trim()!=""||n[3].trim()!="")&&Ge.throwArgumentError("unexpected tokens","value",e),r.outputs=ba(n[2],!1);}else r.outputs=[];return t.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}};function Kx(t){let e=t.format();return (e==="Error(string)"||e==="Panic(uint256)")&&Ge.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}var Ol=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Ye.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isErrorFragment(e))return e;e.type!=="error"&&Ge.throwArgumentError("invalid error object","value",e);let r={type:e.type,name:Ea(e.name),inputs:e.inputs?e.inputs.map(dr.fromObject):[]};return Kx(new t(es,r))}static fromString(e){let r={type:"error"},i=e.match(Ca);return i||Ge.throwArgumentError("invalid error signature","value",e),r.name=i[1].trim(),r.name&&Ea(r.name),r.inputs=ba(i[2],!1),Kx(t.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}};function to(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}var ZP=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ea(t){return (!t||!t.match(ZP))&&Ge.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}var Ca=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function XP(t){t=t.trim();let e=[],r="",i=0;for(let s=0;s<t.length;s++){let n=t[s];n===","&&i===0?(e.push(r),r=""):(r+=n,n==="("?i++:n===")"&&(i--,i===-1&&Ge.throwArgumentError("unbalanced parenthesis","value",t)));}return r&&e.push(r),e}var H0=new ke(Zr);var Ht=class{constructor(e,r,i,s){this.name=e,this.type=r,this.localName=i,this.dynamic=s;}_throwError(e,r){H0.throwArgumentError(e,this.localName,r);}},ns=class{constructor(e){Bt(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e);}get data(){return Mx(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(bi(e._data))}writeBytes(e){let r=It(e),i=r.length%this.wordSize;return i&&(r=bi([r,this._padding.slice(i)])),this._writeData(r)}_getValue(e){let r=It(Nt.from(e));return r.length>this.wordSize&&H0.throwError("value out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=bi([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){let e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r);}}},Fl=class t{constructor(e,r,i,s){Bt(this,"_data",It(e)),Bt(this,"wordSize",r||32),Bt(this,"_coerceFunc",i),Bt(this,"allowLoose",s),this._offset=0;}get data(){return St(this._data)}get consumed(){return this._offset}static coerce(e,r){let i=e.match("^u?int([0-9]+)$");return i&&parseInt(i[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):t.coerce(e,r)}_peekBytes(e,r,i){let s=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+s>this._data.length&&(this.allowLoose&&i&&this._offset+r<=this._data.length?s=r:H0.throwError("data out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+s})),this._data.slice(this._offset,this._offset+s)}subReader(e){return new t(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let i=this._peekBytes(0,e,!!r);return this._offset+=i.length,i.slice(0,e)}readValue(){return Nt.from(this.readBytes(this.wordSize))}};var Zx=Kt(Jx());function ss(t){return "0x"+Zx.default.keccak_256(It(t))}var Xx="address/5.7.0";var Ta=new ke(Xx);function Qx(t){hr(t,20)||Ta.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let s=0;s<40;s++)r[s]=e[s].charCodeAt(0);let i=It(ss(r));for(let s=0;s<40;s+=2)i[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(i[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return "0x"+e.join("")}var QP=9007199254740991;function e7(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var U0={};for(let t=0;t<10;t++)U0[String(t)]=String(t);for(let t=0;t<26;t++)U0[String.fromCharCode(65+t)]=String(10+t);var eb=Math.floor(e7(QP));function t7(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>U0[i]).join("");for(;e.length>=eb;){let i=e.substring(0,eb);e=parseInt(i,10)%97+e.substring(i.length);}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function Aa(t){let e=null;if(typeof t!="string"&&Ta.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Ta.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==t7(t)&&Ta.throwArgumentError("bad icap checksum","address",t),e=j0(t.substring(4));e.length<40;)e="0"+e;e=Qx("0x"+e);}else Ta.throwArgumentError("invalid address","address",t);return e}var Pl=class extends Ht{constructor(e){super("address","address",e,!1);}defaultValue(){return "0x0000000000000000000000000000000000000000"}encode(e,r){try{r=Aa(r);}catch(i){this._throwError(i.message,r);}return e.writeValue(r)}decode(e){return Aa(Dl(e.readValue().toHexString(),20))}};var Il=class extends Ht{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e;}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}};var io=new ke(Zr);function V0(t,e,r){let i=null;if(Array.isArray(r))i=r;else if(r&&typeof r=="object"){let u={};i=e.map(l=>{let h=l.localName;return h||io.throwError("cannot encode object for signature with missing names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]&&io.throwError("cannot encode object for signature with duplicate names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]=!0,r[h]});}else io.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&io.throwArgumentError("types/value length mismatch","tuple",r);let s=new ns(t.wordSize),n=new ns(t.wordSize),o=[];e.forEach((u,l)=>{let h=i[l];if(u.dynamic){let c=n.length;u.encode(n,h);let d=s.writeUpdatableValue();o.push(f=>{d(f+c);});}else u.encode(s,h);}),o.forEach(u=>{u(s.length);});let a=t.appendWriter(s);return a+=t.appendWriter(n),a}function $0(t,e){let r=[],i=t.subReader(0);e.forEach(n=>{let o=null;if(n.dynamic){let a=t.readValue(),u=i.subReader(a.toNumber());try{o=n.decode(u);}catch(l){if(l.code===ke.errors.BUFFER_OVERRUN)throw l;o=l,o.baseType=n.name,o.name=n.localName,o.type=n.type;}}else try{o=n.decode(t);}catch(a){if(a.code===ke.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=n.name,o.name=n.localName,o.type=n.type;}o!=null&&r.push(o);});let s=e.reduce((n,o)=>{let a=o.localName;return a&&(n[a]||(n[a]=0),n[a]++),n},{});e.forEach((n,o)=>{let a=n.localName;if(!a||s[a]!==1||(a==="length"&&(a="_length"),r[a]!=null))return;let u=r[o];u instanceof Error?Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw u}}):r[a]=u;});for(let n=0;n<r.length;n++){let o=r[n];o instanceof Error&&Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}});}return Object.freeze(r)}var kl=class extends Ht{constructor(e,r,i){let s=e.type+"["+(r>=0?r:"")+"]",n=r===-1||e.dynamic;super("array",s,i,n),this.coder=e,this.length=r;}defaultValue(){let e=this.coder.defaultValue(),r=[];for(let i=0;i<this.length;i++)r.push(e);return r}encode(e,r){Array.isArray(r)||this._throwError("expected array value",r);let i=this.length;i===-1&&(i=r.length,e.writeValue(r.length)),io.checkArgumentCount(r.length,i,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let n=0;n<r.length;n++)s.push(this.coder);return V0(e,s,r)}decode(e){let r=this.length;r===-1&&(r=e.readValue().toNumber(),r*32>e._data.length&&io.throwError("insufficient data length",ke.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let i=[];for(let s=0;s<r;s++)i.push(new Il(this.coder));return e.coerce(this.name,$0(e,i))}};var Ml=class extends Ht{constructor(e){super("bool","bool",e,!1);}defaultValue(){return !1}encode(e,r){return e.writeValue(r?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}};var wa=class extends Ht{constructor(e,r){super(e,e,r,!0);}defaultValue(){return "0x"}encode(e,r){r=It(r);let i=e.writeValue(r.length);return i+=e.writeBytes(r),i}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}},Bl=class extends wa{constructor(e){super("bytes",e);}decode(e){return e.coerce(this.name,St(super.decode(e)))}};var jl=class extends Ht{constructor(e,r){let i="bytes"+String(e);super(i,i,r,!1),this.size=e;}defaultValue(){return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,r){let i=It(r);return i.length!==this.size&&this._throwError("incorrect data length",r),e.writeBytes(i)}decode(e){return e.coerce(this.name,St(e.readBytes(this.size)))}};var ql=class extends Ht{constructor(e){super("null","",e,!1);}defaultValue(){return null}encode(e,r){return r!=null&&this._throwError("not null",r),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}};var z0=Nt.from(-1),K0=Nt.from(0),G0=Nt.from(1);var W0=Nt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Hl=class extends Ht{constructor(e,r,i){let s=(r?"int":"uint")+e*8;super(s,s,i,!1),this.size=e,this.signed=r;}defaultValue(){return 0}encode(e,r){let i=Nt.from(r),s=W0.mask(e.wordSize*8);if(this.signed){let n=s.mask(this.size*8-1);(i.gt(n)||i.lt(n.add(G0).mul(z0)))&&this._throwError("value out-of-bounds",r);}else (i.lt(K0)||i.gt(s.mask(this.size*8)))&&this._throwError("value out-of-bounds",r);return i=i.toTwos(this.size*8).mask(this.size*8),this.signed&&(i=i.fromTwos(this.size*8).toTwos(8*e.wordSize)),e.writeValue(i)}decode(e){let r=e.readValue().mask(this.size*8);return this.signed&&(r=r.fromTwos(this.size*8)),e.coerce(this.name,r)}};var tb="strings/5.7.0";var rb=new ke(tb),Da;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD";})(Da||(Da={}));var pr;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation";})(pr||(pr={}));function r7(t,e,r,i,s){return rb.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function ib(t,e,r,i,s){if(t===pr.BAD_PREFIX||t===pr.UNEXPECTED_CONTINUE){let n=0;for(let o=e+1;o<r.length&&r[o]>>6===2;o++)n++;return n}return t===pr.OVERRUN?r.length-e-1:0}function i7(t,e,r,i,s){return t===pr.OVERLONG?(i.push(s),0):(i.push(65533),ib(t,e,r))}var nb=Object.freeze({error:r7,ignore:ib,replace:i7});function n7(t,e){e==null&&(e=nb.error),t=It(t);let r=[],i=0;for(;i<t.length;){let s=t[i++];if(!(s>>7)){r.push(s);continue}let n=null,o=null;if((s&224)===192)n=1,o=127;else if((s&240)===224)n=2,o=2047;else if((s&248)===240)n=3,o=65535;else {(s&192)===128?i+=e(pr.UNEXPECTED_CONTINUE,i-1,t,r):i+=e(pr.BAD_PREFIX,i-1,t,r);continue}if(i-1+n>=t.length){i+=e(pr.OVERRUN,i-1,t,r);continue}let a=s&(1<<8-n-1)-1;for(let u=0;u<n;u++){let l=t[i];if((l&192)!=128){i+=e(pr.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|l&63,i++;}if(a!==null){if(a>1114111){i+=e(pr.OUT_OF_RANGE,i-1-n,t,r,a);continue}if(a>=55296&&a<=57343){i+=e(pr.UTF16_SURROGATE,i-1-n,t,r,a);continue}if(a<=o){i+=e(pr.OVERLONG,i-1-n,t,r,a);continue}r.push(a);}}return r}function Sa(t,e=Da.current){e!=Da.current&&(rb.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);if(s<128)r.push(s);else if(s<2048)r.push(s>>6|192),r.push(s&63|128);else if((s&64512)==55296){i++;let n=t.charCodeAt(i);if(i>=t.length||(n&64512)!==56320)throw new Error("invalid utf-8 string");let o=65536+((s&1023)<<10)+(n&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128);}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);}return It(r)}function s7(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Y0(t,e){return s7(n7(t,e))}var Ul=class extends wa{constructor(e){super("string",e);}defaultValue(){return ""}encode(e,r){return super.encode(e,Sa(r))}decode(e){return Y0(super.decode(e))}};var os=class extends Ht{constructor(e,r){let i=!1,s=[];e.forEach(o=>{o.dynamic&&(i=!0),s.push(o.type);});let n="tuple("+s.join(",")+")";super("tuple",n,r,i),this.coders=e;}defaultValue(){let e=[];this.coders.forEach(i=>{e.push(i.defaultValue());});let r=this.coders.reduce((i,s)=>{let n=s.localName;return n&&(i[n]||(i[n]=0),i[n]++),i},{});return this.coders.forEach((i,s)=>{let n=i.localName;!n||r[n]!==1||(n==="length"&&(n="_length"),e[n]==null&&(e[n]=e[s]));}),Object.freeze(e)}encode(e,r){return V0(e,this.coders,r)}decode(e){return e.coerce(this.name,$0(e,this.coders))}};var Vl=new ke(Zr),o7=new RegExp(/^bytes([0-9]*)$/),a7=new RegExp(/^(u?int)([0-9]*)$/),J0=class{constructor(e){Bt(this,"coerceFunc",e||null);}_getCoder(e){switch(e.baseType){case"address":return new Pl(e.name);case"bool":return new Ml(e.name);case"string":return new Ul(e.name);case"bytes":return new Bl(e.name);case"array":return new kl(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new os((e.components||[]).map(i=>this._getCoder(i)),e.name);case"":return new ql(e.name)}let r=e.type.match(a7);if(r){let i=parseInt(r[2]||"256");return (i===0||i>256||i%8!==0)&&Vl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new Hl(i/8,r[1]==="int",e.name)}if(r=e.type.match(o7),r){let i=parseInt(r[1]);return (i===0||i>32)&&Vl.throwArgumentError("invalid bytes length","param",e),new jl(i,e.name)}return Vl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Fl(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new ns(this._getWordSize())}getDefaultValue(e){let r=e.map(s=>this._getCoder(dr.from(s)));return new os(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Vl.throwError("types/values length mismatch",ke.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});let i=e.map(o=>this._getCoder(dr.from(o))),s=new os(i,"_"),n=this._getWriter();return s.encode(n,r),n.data}decode(e,r,i){let s=e.map(o=>this._getCoder(dr.from(o)));return new os(s,"_").decode(this._getReader(It(r),i))}},sb=new J0;function no(t){return ss(Sa(t))}var Ot=new ke(Zr);var $l=class extends Qn{},zl=class extends Qn{},Z0=class extends Qn{},Ra=class extends Qn{static isIndexed(e){return !!(e&&e._isIndexed)}},u7={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function ob(t,e){let r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}var Na=class{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,Bt(this,"fragments",r.map(i=>ts.from(i)).filter(i=>i!=null)),Bt(this,"_abiCoder",xa(new.target,"getAbiCoder")()),Bt(this,"functions",{}),Bt(this,"errors",{}),Bt(this,"events",{}),Bt(this,"structs",{}),this.fragments.forEach(i=>{let s=null;switch(i.type){case"constructor":if(this.deploy){Ot.warn("duplicate definition - constructor");return}Bt(this,"deploy",i);return;case"function":s=this.functions;break;case"event":s=this.events;break;case"error":s=this.errors;break;default:return}let n=i.format();if(s[n]){Ot.warn("duplicate definition - "+n);return}s[n]=i;}),this.deploy||Bt(this,"deploy",rs.from({payable:!1,type:"constructor"})),Bt(this,"_isInterface",!0);}format(e){e||(e=Ye.full),e===Ye.sighash&&Ot.throwArgumentError("interface does not support formatting sighash","format",e);let r=this.fragments.map(i=>i.format(e));return e===Ye.json?JSON.stringify(r.map(i=>JSON.parse(i))):r}static getAbiCoder(){return sb}static getAddress(e){return Aa(e)}static getSighash(e){return M0(no(e.format()),0,4)}static getEventTopic(e){return no(e.format())}getFunction(e){if(hr(e)){for(let i in this.functions)if(e===this.getSighash(i))return this.functions[i];Ot.throwArgumentError("no matching function","sighash",e);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.functions).filter(n=>n.split("(")[0]===i);return s.length===0?Ot.throwArgumentError("no matching function","name",i):s.length>1&&Ot.throwArgumentError("multiple matching functions","name",i),this.functions[s[0]]}let r=this.functions[is.fromString(e).format()];return r||Ot.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(hr(e)){let i=e.toLowerCase();for(let s in this.events)if(i===this.getEventTopic(s))return this.events[s];Ot.throwArgumentError("no matching event","topichash",i);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.events).filter(n=>n.split("(")[0]===i);return s.length===0?Ot.throwArgumentError("no matching event","name",i):s.length>1&&Ot.throwArgumentError("multiple matching events","name",i),this.events[s[0]]}let r=this.events[ro.fromString(e).format()];return r||Ot.throwArgumentError("no matching event","signature",e),r}getError(e){if(hr(e)){let i=xa(this.constructor,"getSighash");for(let s in this.errors){let n=this.errors[s];if(e===i(n))return this.errors[s]}Ot.throwArgumentError("no matching error","sighash",e);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.errors).filter(n=>n.split("(")[0]===i);return s.length===0?Ot.throwArgumentError("no matching error","name",i):s.length>1&&Ot.throwArgumentError("multiple matching errors","name",i),this.errors[s[0]]}let r=this.errors[is.fromString(e).format()];return r||Ot.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e);}catch(r){try{e=this.getError(e);}catch(i){throw r}}return xa(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),xa(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));let i=It(r);return St(i.slice(0,4))!==this.getSighash(e)&&Ot.throwArgumentError(`data signature does not match error ${e.name}.`,"data",St(i)),this._decodeParams(e.inputs,i.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),St(bi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=It(r);return St(i.slice(0,4))!==this.getSighash(e)&&Ot.throwArgumentError(`data signature does not match function ${e.name}.`,"data",St(i)),this._decodeParams(e.inputs,i.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),St(bi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=It(r),s=null,n="",o=null,a=null,u=null;switch(i.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,i)}catch(l){}break;case 4:{let l=St(i.slice(0,4)),h=u7[l];if(h)o=this._abiCoder.decode(h.inputs,i.slice(4)),a=h.name,u=h.signature,h.reason&&(s=o[0]),a==="Error"?n=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(n=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{let c=this.getError(l);o=this._abiCoder.decode(c.inputs,i.slice(4)),a=c.name,u=c.format();}catch(c){}break}}return Ot.throwError("call revert exception"+n,ke.errors.CALL_EXCEPTION,{method:e.format(),data:St(r),errorArgs:o,errorName:a,errorSignature:u,reason:s})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),St(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&Ot.throwError("too many arguments for "+e.format(),ke.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let i=[];e.anonymous||i.push(this.getEventTopic(e));let s=(n,o)=>n.type==="string"?no(o):n.type==="bytes"?ss(St(o)):(n.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),n.type.match(/^u?int/)&&(o=Nt.from(o).toHexString()),n.type==="address"&&this._abiCoder.encode(["address"],[o]),Dl(St(o),32));for(r.forEach((n,o)=>{let a=e.inputs[o];if(!a.indexed){n!=null&&Ot.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,n);return}n==null?i.push(null):a.baseType==="array"||a.baseType==="tuple"?Ot.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,n):Array.isArray(n)?i.push(n.map(u=>s(a,u))):i.push(s(a,n));});i.length&&i[i.length-1]===null;)i.pop();return i}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));let i=[],s=[],n=[];return e.anonymous||i.push(this.getEventTopic(e)),r.length!==e.inputs.length&&Ot.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{let u=r[a];if(o.indexed)if(o.type==="string")i.push(no(u));else if(o.type==="bytes")i.push(ss(u));else {if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");i.push(this._abiCoder.encode([o.type],[u]));}else s.push(o),n.push(u);}),{data:this._abiCoder.encode(s,n),topics:i}}decodeEventLog(e,r,i){if(typeof e=="string"&&(e=this.getEvent(e)),i!=null&&!e.anonymous){let d=this.getEventTopic(e);(!hr(i[0],32)||i[0].toLowerCase()!==d)&&Ot.throwError("fragment/topic mismatch",ke.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:d,value:i[0]}),i=i.slice(1);}let s=[],n=[],o=[];e.inputs.forEach((d,f)=>{d.indexed?d.type==="string"||d.type==="bytes"||d.baseType==="tuple"||d.baseType==="array"?(s.push(dr.fromObject({type:"bytes32",name:d.name})),o.push(!0)):(s.push(d),o.push(!1)):(n.push(d),o.push(!1));});let a=i!=null?this._abiCoder.decode(s,bi(i)):null,u=this._abiCoder.decode(n,r,!0),l=[],h=0,c=0;e.inputs.forEach((d,f)=>{if(d.indexed)if(a==null)l[f]=new Ra({_isIndexed:!0,hash:null});else if(o[f])l[f]=new Ra({_isIndexed:!0,hash:a[c++]});else try{l[f]=a[c++];}catch(m){l[f]=m;}else try{l[f]=u[h++];}catch(m){l[f]=m;}if(d.name&&l[d.name]==null){let m=l[f];m instanceof Error?Object.defineProperty(l,d.name,{enumerable:!0,get:()=>{throw ob(`property ${JSON.stringify(d.name)}`,m)}}):l[d.name]=m;}});for(let d=0;d<l.length;d++){let f=l[d];f instanceof Error&&Object.defineProperty(l,d,{enumerable:!0,get:()=>{throw ob(`index ${d}`,f)}});}return Object.freeze(l)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new zl({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:Nt.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return !r||r.anonymous?null:new $l({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){let r=St(e),i=this.getError(r.substring(0,10).toLowerCase());return i?new Z0({args:this._abiCoder.decode(i.inputs,"0x"+r.substring(10)),errorFragment:i,name:i.name,signature:i.format(),sighash:this.getSighash(i)}):null}static isInterface(e){return !!(e&&e._isInterface)}};var Cc=Kt(KE()),Zp=(t,e)=>e==null||e.length===0?void 0:new Na(t).encodeDeploy(e).slice(2),WE=t=>{try{let e=Cc.parse(t),r;return Cc.visit(e,{FunctionDefinition:s=>{s.isConstructor&&(r=s);}}),GE__default.default(r!=null,"Could not find constructor definition"),[{type:"constructor",inputs:r.parameters.map(({typeName:s},n)=>(GE__default.default(s!=null,`Missing a type definition for constructor parameter at position ${n}`),{type:YE(s)}))}]}catch(e){throw new Error(`Could not get an ABI from contract source: ${e}`)}},YE=t=>{switch(t.type){case"ElementaryTypeName":return t.name;case"ArrayTypeName":return `${YE(t.baseTypeName)}[]`;default:throw new Error(`Only primitive and array types are currently supported when constructing ABI from contract source, got ${t.type}`)}};var Xp=t=>{var e;return {deployments:(e=t==null?void 0:t.deployments)!=null?e:SI__default.default.resolve(process.cwd(),"deployments")}},JE=t=>{if(t==null)return ()=>!0;switch(typeof t){case"boolean":return ()=>t;case"string":return e=>e===t;case"function":return t;case"object":if(Array.isArray(t)){let e=new Set(t);return r=>e.has(r)}if(t instanceof RegExp)return e=>t.test(e);throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${t}`);default:throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${t}`)}};var XE=t=>{try{return fs.lstatSync(t).isDirectory()}catch(e){return !1}},QE=t=>{try{return fs.lstatSync(t).isFile()}catch(e){return !1}};var r2=async(t,e)=>{let r=Cd(e,t.networks),i=Xp(t.paths),s=bd(e),n=n2(e),o=s2(s),a=t.contracts.flatMap(l=>{var te;let{address:h,network:c,contractName:d,deployment:f}=l;e.info(`Collecting information for contract ${d} on network ${c}`);let m=r[c];if(m==null)return e.info(`No network configured for contract ${d} on network ${c}`),[];let g=`${SI.basename(f,".json")}.json`,v=SI.resolve(i.deployments,c,g);if(!QE(v))return e.error(Jt.error`Deployment file ${v} does not exist or is not a file`),[];let x=ge(v),_=O0.safeParse(x);if(!_.success)return e.error(Jt.error`No network configured for contract ${d} on network ${c}`),[];let E=_.data,b=SI.basename(d,".sol"),w=E.metadata.sources[d];if(w==null)return e.error(Jt.error`Missing source for contract ${d} for network ${c} in ${g}`),[];let D=Ad(w.content),N=WE(w.content),F=Zp(N,l.constructorArguments),V=F0(E.metadata),Z={apiUrl:m.apiUrl,apiKey:m.apiKey,address:h,contractName:`${d}:${b}`,constructorArguments:F,licenseType:D,compilerVersion:E.metadata.compiler.version,sourceCode:JSON.stringify(V),evmVersion:E.metadata.settings.evmVersion,optimizerRuns:(te=E.metadata.settings.optimizer)==null?void 0:te.runs};return s({Contract:d,Network:c,Address:Z.address,License:Z.licenseType,Arguments:l.constructorArguments?JSON.stringify(l.constructorArguments):void 0,Sources:Object.keys(E.metadata.sources),"Scan URL":Z.apiUrl,"Scan API Key":Z.apiKey?xd(Z.apiKey):void 0}),[{networkName:c,networkConfig:m,submitProps:Z}]});if(a.length===0)return e.warn("No contracts match the verification criteria, exiting"),[];if(t.dryRun)return e.debug("Dry run enabled, exiting"),[];let u=await Promise.all(n(a));return u.forEach(o),u},i2=async(t,e)=>{let r=JE(t.filter),i=Cd(e,t.networks),s=Xp(t.paths),n=bd(e),o=n2(e),a=s2(n);if(!XE(s.deployments))throw new Error(`Path ${s.deployments} is not a directory`);let u=new Set(fs.readdirSync(s.deployments)),l=Object.entries(i);e.debug("Verifying deployments for following networks:"),l.forEach(([d,f])=>{e.debug(` - ${d} (API URL ${f.apiUrl})`);});let h=l.flatMap(([d,f])=>{if(e.info(`Collecting deployments for ${d}...`),!u.has(d))return e.warn(`Could not find deployment for network ${d} in ${s.deployments}`),[];let m=SI.resolve(s.deployments,d);return fs.readdirSync(m).filter(v=>v.endsWith(".json")).flatMap(v=>{e.info(`Inspecting deployment file ${v} on network ${d}`);let x=SI.resolve(m,v),_=ge(x),E=O0.safeParse(_);if(!E.success)throw new Error(`Error parsing deployment file ${v} on network ${d}: ${E.error}`);let b=E.data,w=b.metadata.settings.compilationTarget;return Object.entries(w).flatMap(([D,N])=>{var y;if(!r(N,D,d))return e.debug(`Not verifying ${N} in ${v} on network ${d}`),[];let V=b.metadata.sources[D];if(V==null)return e.error(Jt.error`Could not find source for ${N} (${D})`),[];let Z=Ad(V.content),te=Zp(b.abi,b.args),ae=F0(b.metadata),k={apiUrl:f.apiUrl,apiKey:f.apiKey,address:b.address,contractName:`${D}:${N}`,constructorArguments:te,licenseType:Z,compilerVersion:b.metadata.compiler.version,sourceCode:JSON.stringify(ae),evmVersion:b.metadata.settings.evmVersion,optimizerRuns:(y=b.metadata.settings.optimizer)==null?void 0:y.runs};return n({Contract:N,Network:d,Address:b.address,License:k.licenseType,Arguments:JSON.stringify(b.args),Sources:Object.keys(b.metadata.sources),"Scan URL":k.apiUrl,"Scan API Key":k.apiKey?xd(k.apiKey):void 0}),{submitProps:k,networkName:d,networkConfig:f}})})});if(h.length===0)return e.warn("No contracts match the verification criteria, exiting"),[];if(t.dryRun)return e.debug("Dry run enabled, exiting"),[];let c=await Promise.all(o(h));return c.forEach(a),c},n2=t=>e=>e.map(async(r,i)=>{let{submitProps:s}=r,n=Jt.palette[i%Jt.palette.length],o=`[${i+1}/${e.length}]`,a=Wa.default.bold(s.contractName),u=Wa.default.bold(r.networkName);t.info(n`Verifying contract ${a} for network ${u} ${o}`);try{let l=Tx(s,t);l.on("poll",c=>{t.info(n`Polling for verification status of ${a} for network ${u} (GUID ${c}) ${o}`);}),l.on("retry",(c,d)=>{t.verbose(`Received an error: ${c}`),t.info(n`Retrying failed verification attempt of ${a} for network ${u} (attempt ${d+1}) ${o}`);});let h=await l.verify();return {artifact:r,result:h}}catch(l){return t.error(Jt.error`Problem verifying contract ${a} for network ${u} ${o}: ${l} `),{artifact:r,error:l}}}),s2=t=>({artifact:e,response:r,error:i})=>{let s=Wa.default.bold(e.submitProps.contractName),n=Wa.default.bold(e.networkName),o=e.networkConfig.browserUrl?B1(e.networkConfig.browserUrl,e.submitProps.address):void 0;t({Contract:s,Network:n,Result:i==null,"Was verified":r==null?void 0:r.alreadyVerified,"Contract URL":o,Error:i?Jt.error(i):void 0});};var Os=Kt(f3(),1);Kt(kD(),1);var qo=Kt(Ko(),1);Kt(f4(),1);var p4=(t=>(t.error="error",t.warn="warn",t.info="info",t.http="http",t.verbose="verbose",t.debug="debug",t.silly="silly",t))(p4||{});Ie.nativeEnum(p4);var TK="info";var y1=(t=TK,e=Os.format.cli())=>(0, Os.createLogger)({level:t,format:e,transports:[new Os.transports.Console]});(0, Os.format)((t,{label:e})=>({...t,message:`${e?`[${e}] `:""}${t.message}`}));({TRUE:qo.default.rgb(0,153,0),FALSE:qo.default.rgb(255,0,0),NOT_APPLICABLE:qo.default.rgb(255,128,0),DEFAULT_KEY:qo.default.rgb(255,255,255),DEFAULT_VALUE:qo.default.rgb(167,125,255)});var m4="1.1.28";var g4=new Pn("-l,--log-level <level>","Log level").choices(["error","warn","info","http","verbose","debug","silly"]).default("info"),_4=new Pn("-d,--deployments <path>","Path to the deployments folder"),y4=new Pn("--dry-run","Do not verify anything, just output the verifications that would be performed"),v4=new Pn("-n,--network <network name>","Network to verify").makeOptionMandatory(),x4=new Pn("-u,--api-url <url>","Scan API URL (fully qualified, with protocol and path)"),b4=new Pn("-k,--api-key <key>","Scan API Key"),wK=new Mu("non-target").description("Verifies a contract that does not have its own deployment file, i.e. has not been a target of a deployment").addOption(g4).addOption(y4).addOption(_4).addOption(v4).addOption(x4).addOption(b4).requiredOption("--address <address>","Contract address to verify").requiredOption("--name <contract name>","Fully qualified contract name to verify, e.g. contracts/MyToken.sol").requiredOption("--deployment <deployment file name>","Deployment file name, e.g. MyOtherToken.json").option("--arguments <constructor arguments>",'JSON encoded array of constructor arguments, e.g. [1234, "0x0"]',t=>{try{let e=JSON.parse(t);if(!Array.isArray(e))throw new Error(`Constructor arguments must be an array, got ${e}`);return e}catch(e){throw new I1(`Malformed constructor arguments specified: ${e}`)}}).action(async t=>{let e=y1(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},contracts:[{network:t.network,address:t.address,contractName:t.name,deployment:t.deployment,constructorArguments:t.arguments}]};try{await r2(r,e);}catch(i){e.error(Jt.error`The verification script exited with an error: ${i}`),process.exit(1);}}),DK=new Mu("target").description("Verifies contracts that have been a part of a deployment, i.e. have their own deployment files").addOption(g4).addOption(y4).addOption(_4).addOption(v4).addOption(x4).addOption(b4).option("-c,--contracts <contract names>","Comma-separated list of case-sensitive contract names to verify",t=>t!=null&&t.trim()?t.split(",").map(e=>e.trim()):void 0).action(async t=>{let e=y1(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},filter:t.contracts};try{await i2(r,e);}catch(i){e.error(Jt.error`The verification script exited with an error: ${i}`),process.exit(1);}});new Mu("@layerzerolabs/verify-contract").version(m4).description("Verify a set of contracts based on hardhat-deploy outputs").addCommand(wK).addCommand(DK,{isDefault:!0}).parseAsync();
|
|
473
|
+
${JSON.stringify(i)}`),i.status===1)return {alreadyVerified:!1};if(Ex(i.result))return {alreadyVerified:!0};if(BP(i.result)){await Xu(1e4);continue}if(Cx(i.result)){await Xu(1e4);continue}throw new Error(`Verification failed with result "${i.result}", status ${i.status} (${i.message})`)}}},Tx=(t,e)=>new N0(t,e),BP=t=>!!(t!=null&&t.match(/Pending/gi)),Ex=t=>!!(t!=null&&t.match(/already verified/gi)),Cx=t=>!!(t!=null&&t.match(/rate/)),jP=async(t,e)=>{try{let r=await R0(t,{method:"POST",form:e,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}}).json();return Ax.parse(r)}catch(r){throw new Error(`Failed to submit verification request: ${r}`)}},qP=async(t,e)=>{let r=new URL(t);r.searchParams.set("module","contract"),r.searchParams.set("action","checkverifystatus"),r.searchParams.set("guid",e);try{let i=await R0(r).json();return Ax.parse(i)}catch(i){throw new Error(`Failed to check verification status: ${i}`)}},HP=({apiKey:t,address:e,contractName:r,constructorArguments:i,compilerVersion:s,optimizerRuns:n=0,sourceCode:o,evmVersion:a,licenseType:u})=>{let l={action:"verifysourcecode",module:"contract",codeformat:"solidity-standard-json-input",contractaddress:e,contractname:r,compilerversion:`v${s}`,optimizationUsed:n>0?"1":"0",sourceCode:o};return t!=null&&(l.apikey=t),n!=null&&(l.runs=String(n)),i!=null&&(l.constructorArguements=i),a!=null&&(l.evmversion=a),u!=null&&(l.licenseType=String(u)),l},Ax=Ie.object({status:Ie.coerce.number().nullish(),message:Ie.string().nullish(),result:Ie.string().nullish()});var Wa=Kt(Ko());Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()});Ie.record(Ie.string(),Ie.object({content:Ie.string()}));var UP=Ie.array(Ie.record(Ie.string(),Ie.any())),VP=Ie.object({language:Ie.string(),compiler:Ie.object({version:Ie.string()}),settings:Ie.object({compilationTarget:Ie.record(Ie.string(),Ie.string()),evmVersion:Ie.string(),optimizer:Ie.object({enabled:Ie.boolean().optional(),runs:Ie.number().optional()})}),sources:Ie.record(Ie.string(),Ie.object({content:Ie.string()}))}),O0=Ie.object({address:Ie.string(),abi:UP,args:Ie.array(Ie.any()),solcInputHash:Ie.string(),metadata:Ie.string().transform((t,e)=>{try{return JSON.parse(t)}catch(r){return e.addIssue({code:"custom",message:"Invalid JSON"}),Ie.NEVER}}).pipe(VP),bytecode:Ie.string(),deployedBytecode:Ie.string()});var F0=t=>{let{compilationTarget:e,...r}=t.settings,i=Object.entries(t.sources).reduce((s,[n,o])=>({...s,[n]:{content:o.content}}),{});return {language:t.language,settings:r,sources:i}};var Hx=Kt(Dx());var Sx="logger/5.7.0";var Rx=!1,Nx=!1,Al={debug:1,default:2,info:2,warning:3,error:4,off:5},Ox=Al.default,P0=null;function $P(){try{let t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch(r){t.push(e);}}),t.length)throw new Error("missing "+t.join(", "));if("\xE9".normalize("NFD")!=="e\u0301")throw new Error("broken implementation")}catch(t){return t.message}return null}var Fx=$P(),I0;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF";})(I0||(I0={}));var Hr;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED";})(Hr||(Hr={}));var Lx="0123456789abcdef",ke=class t{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1});}_log(e,r){let i=e.toLowerCase();Al[i]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Ox>Al[i])&&console.log.apply(console,r);}debug(...e){this._log(t.levels.DEBUG,e);}info(...e){this._log(t.levels.INFO,e);}warn(...e){this._log(t.levels.WARNING,e);}makeError(e,r,i){if(Nx)return this.makeError("censored error",r,{});r||(r=t.errors.UNKNOWN_ERROR),i||(i={});let s=[];Object.keys(i).forEach(u=>{let l=i[u];try{if(l instanceof Uint8Array){let h="";for(let c=0;c<l.length;c++)h+=Lx[l[c]>>4],h+=Lx[l[c]&15];s.push(u+"=Uint8Array(0x"+h+")");}else s.push(u+"="+JSON.stringify(l));}catch(h){s.push(u+"="+JSON.stringify(i[u].toString()));}}),s.push(`code=${r}`),s.push(`version=${this.version}`);let n=e,o="";switch(r){case Hr.NUMERIC_FAULT:{o="NUMERIC_FAULT";let u=e;switch(u){case"overflow":case"underflow":case"division-by-zero":o+="-"+u;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Hr.CALL_EXCEPTION:case Hr.INSUFFICIENT_FUNDS:case Hr.MISSING_NEW:case Hr.NONCE_EXPIRED:case Hr.REPLACEMENT_UNDERPRICED:case Hr.TRANSACTION_REPLACED:case Hr.UNPREDICTABLE_GAS_LIMIT:o=r;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),s.length&&(e+=" ("+s.join(", ")+")");let a=new Error(e);return a.reason=n,a.code=r,Object.keys(i).forEach(function(u){a[u]=i[u];}),a}throwError(e,r,i){throw this.makeError(e,r,i)}throwArgumentError(e,r,i){return this.throwError(e,t.errors.INVALID_ARGUMENT,{argument:r,value:i})}assert(e,r,i,s){e||this.throwError(r,i,s);}assertArgument(e,r,i,s){e||this.throwArgumentError(r,i,s);}checkNormalize(e){Fx&&this.throwError("platform missing String.prototype.normalize",t.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Fx});}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,t.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}));}checkArgumentCount(e,r,i){i?i=": "+i:i="",e<r&&this.throwError("missing argument"+i,t.errors.MISSING_ARGUMENT,{count:e,expectedCount:r}),e>r&&this.throwError("too many arguments"+i,t.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r});}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name});}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",t.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",t.errors.MISSING_NEW,{name:r.name});}static globalLogger(){return P0||(P0=new t(Sx)),P0}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Rx){if(!e)return;this.globalLogger().throwError("error censorship permanent",t.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"});}Nx=!!e,Rx=!!r;}static setLogLevel(e){let r=Al[e.toLowerCase()];if(r==null){t.globalLogger().warn("invalid log level - "+e);return}Ox=r;}static from(e){return new t(e)}};ke.errors=Hr;ke.levels=I0;var Px="bytes/5.7.0";var xi=new ke(Px);function kx(t){return !!t.toHexString}function ya(t){return t.slice||(t.slice=function(){let e=Array.prototype.slice.call(arguments);return ya(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function Ix(t){return typeof t=="number"&&t==t&&t%1===0}function wl(t){if(t==null)return !1;if(t.constructor===Uint8Array)return !0;if(typeof t=="string"||!Ix(t.length)||t.length<0)return !1;for(let e=0;e<t.length;e++){let r=t[e];if(!Ix(r)||r<0||r>=256)return !1}return !0}function It(t,e){if(e||(e={}),typeof t=="number"){xi.checkSafeUint53(t,"invalid arrayify value");let r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),ya(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t)&&(t=t.toHexString()),hr(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":xi.throwArgumentError("hex data is odd-length","value",t));let i=[];for(let s=0;s<r.length;s+=2)i.push(parseInt(r.substring(s,s+2),16));return ya(new Uint8Array(i))}return wl(t)?ya(new Uint8Array(t)):xi.throwArgumentError("invalid arrayify value","value",t)}function bi(t){let e=t.map(s=>It(s)),r=e.reduce((s,n)=>s+n.length,0),i=new Uint8Array(r);return e.reduce((s,n)=>(i.set(n,s),s+n.length),0),ya(i)}function hr(t,e){return !(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}var k0="0123456789abcdef";function St(t,e){if(e||(e={}),typeof t=="number"){xi.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=k0[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),kx(t))return t.toHexString();if(hr(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":xi.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(wl(t)){let r="0x";for(let i=0;i<t.length;i++){let s=t[i];r+=k0[(s&240)>>4]+k0[s&15];}return r}return xi.throwArgumentError("invalid hexlify value","value",t)}function M0(t,e,r){return typeof t!="string"?t=St(t):(!hr(t)||t.length%2)&&xi.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Mx(t){let e="0x";return t.forEach(r=>{e+=St(r).substring(2);}),e}function Dl(t,e){for(typeof t!="string"?t=St(t):hr(t)||xi.throwArgumentError("invalid hex string","value",t),t.length>2*e+2&&xi.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}var Bx="bignumber/5.7.0";var Sl=Hx.default.BN,Ei=new ke(Bx),B0={},jx=9007199254740991;var qx=!1,Nt=class t{constructor(e,r){e!==B0&&Ei.throwError("cannot call constructor directly; use BigNumber.from",ke.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this);}fromTwos(e){return fr(Ke(this).fromTwos(e))}toTwos(e){return fr(Ke(this).toTwos(e))}abs(){return this._hex[0]==="-"?t.from(this._hex.substring(1)):this}add(e){return fr(Ke(this).add(Ke(e)))}sub(e){return fr(Ke(this).sub(Ke(e)))}div(e){return t.from(e).isZero()&&Ir("division-by-zero","div"),fr(Ke(this).div(Ke(e)))}mul(e){return fr(Ke(this).mul(Ke(e)))}mod(e){let r=Ke(e);return r.isNeg()&&Ir("division-by-zero","mod"),fr(Ke(this).umod(r))}pow(e){let r=Ke(e);return r.isNeg()&&Ir("negative-power","pow"),fr(Ke(this).pow(r))}and(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","and"),fr(Ke(this).and(r))}or(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","or"),fr(Ke(this).or(r))}xor(e){let r=Ke(e);return (this.isNegative()||r.isNeg())&&Ir("unbound-bitwise-result","xor"),fr(Ke(this).xor(r))}mask(e){return (this.isNegative()||e<0)&&Ir("negative-width","mask"),fr(Ke(this).maskn(e))}shl(e){return (this.isNegative()||e<0)&&Ir("negative-width","shl"),fr(Ke(this).shln(e))}shr(e){return (this.isNegative()||e<0)&&Ir("negative-width","shr"),fr(Ke(this).shrn(e))}eq(e){return Ke(this).eq(Ke(e))}lt(e){return Ke(this).lt(Ke(e))}lte(e){return Ke(this).lte(Ke(e))}gt(e){return Ke(this).gt(Ke(e))}gte(e){return Ke(this).gte(Ke(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Ke(this).isZero()}toNumber(){try{return Ke(this).toNumber()}catch(e){Ir("overflow","toNumber",this.toString());}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Ei.throwError("this platform does not support BigInt",ke.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?qx||(qx=!0,Ei.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ei.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ke.errors.UNEXPECTED_ARGUMENT,{}):Ei.throwError("BigNumber.toString does not accept parameters",ke.errors.UNEXPECTED_ARGUMENT,{})),Ke(this).toString(10)}toHexString(){return this._hex}toJSON(e){return {type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof t)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new t(B0,va(e)):e.match(/^-?[0-9]+$/)?new t(B0,va(new Sl(e))):Ei.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ir("underflow","BigNumber.from",e),(e>=jx||e<=-jx)&&Ir("overflow","BigNumber.from",e),t.from(String(e));let r=e;if(typeof r=="bigint")return t.from(r.toString());if(wl(r))return t.from(St(r));if(r)if(r.toHexString){let i=r.toHexString();if(typeof i=="string")return t.from(i)}else {let i=r._hex;if(i==null&&r.type==="BigNumber"&&(i=r.hex),typeof i=="string"&&(hr(i)||i[0]==="-"&&hr(i.substring(1))))return t.from(i)}return Ei.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return !!(e&&e._isBigNumber)}};function va(t){if(typeof t!="string")return va(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&Ei.throwArgumentError("invalid hex","value",t),t=va(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return "0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function fr(t){return Nt.from(va(t))}function Ke(t){let e=Nt.from(t).toHexString();return e[0]==="-"?new Sl("-"+e.substring(3),16):new Sl(e.substring(2),16)}function Ir(t,e,r){let i={fault:t,operation:e};return r!=null&&(i.value=r),Ei.throwError(t,ke.errors.NUMERIC_FAULT,i)}function j0(t){return new Sl(t,36).toString(16)}var Ux="properties/5.7.0";var Vx=new ke(Ux);function Bt(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1});}function xa(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor;}return null}var KP={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function $x(t){if(t==null||KP[typeof t])return !0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return !1;let e=Object.keys(t);for(let r=0;r<e.length;r++){let i=null;try{i=t[e[r]];}catch(s){continue}if(!$x(i))return !1}return !0}return Vx.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function GP(t){if($x(t))return t;if(Array.isArray(t))return Object.freeze(t.map(e=>q0(e)));if(typeof t=="object"){let e={};for(let r in t){let i=t[r];i!==void 0&&Bt(e,r,q0(i));}return e}return Vx.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function q0(t){return GP(t)}var Qn=class{constructor(e){for(let r in e)this[r]=q0(e[r]);}};var Zr="abi/5.7.0";var Ge=new ke(Zr),es={},zx={calldata:!0,memory:!0,storage:!0},WP={calldata:!0,memory:!0};function Rl(t,e){if(t==="bytes"||t==="string"){if(zx[e])return !0}else if(t==="address"){if(e==="payable")return !0}else if((t.indexOf("[")>=0||t==="tuple")&&WP[e])return !0;return (zx[e]||e==="payable")&&Ge.throwArgumentError("invalid modifier","name",e),!1}function YP(t,e){let r=t;function i(a){Ge.throwArgumentError(`unexpected character at position ${a}`,"param",t);}t=t.replace(/\s/g," ");function s(a){let u={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(u.indexed=!1),u}let n={type:"",name:"",state:{allowType:!0}},o=n;for(let a=0;a<t.length;a++){let u=t[a];switch(u){case"(":o.state.allowType&&o.type===""?o.type="tuple":o.state.allowParams||i(a),o.state.allowType=!1,o.type=to(o.type),o.components=[s(o)],o=o.components[0];break;case")":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),Rl(o.type,o.name)&&(o.name=""),o.type=to(o.type);let l=o;o=o.parent,o||i(a),delete l.parent,o.state.allowParams=!1,o.state.allowName=!0,o.state.allowArray=!0;break;case",":delete o.state,o.name==="indexed"&&(e||i(a),o.indexed=!0,o.name=""),Rl(o.type,o.name)&&(o.name=""),o.type=to(o.type);let h=s(o.parent);o.parent.components.push(h),delete o.parent,o=h;break;case" ":o.state.allowType&&o.type!==""&&(o.type=to(o.type),delete o.state.allowType,o.state.allowName=!0,o.state.allowParams=!0),o.state.allowName&&o.name!==""&&(o.name==="indexed"?(e||i(a),o.indexed&&i(a),o.indexed=!0,o.name=""):Rl(o.type,o.name)?o.name="":o.state.allowName=!1);break;case"[":o.state.allowArray||i(a),o.type+=u,o.state.allowArray=!1,o.state.allowName=!1,o.state.readArray=!0;break;case"]":o.state.readArray||i(a),o.type+=u,o.state.readArray=!1,o.state.allowArray=!0,o.state.allowName=!0;break;default:o.state.allowType?(o.type+=u,o.state.allowParams=!0,o.state.allowArray=!0):o.state.allowName?(o.name+=u,delete o.state.allowArray):o.state.readArray?o.type+=u:i(a);}}return o.parent&&Ge.throwArgumentError("unexpected eof","param",t),delete n.state,o.name==="indexed"?(e||i(r.length-7),o.indexed&&i(r.length-7),o.indexed=!0,o.name=""):Rl(o.type,o.name)&&(o.name=""),n.type=to(n.type),n}function Nl(t,e){for(let r in e)Bt(t,r,e[r]);}var Ye=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),JP=new RegExp(/^(.*)\[([0-9]*)\]$/),dr=class t{constructor(e,r){e!==es&&Ge.throwError("use fromString",ke.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Nl(this,r);let i=this.type.match(JP);i?Nl(this,{arrayLength:parseInt(i[2]||"-1"),arrayChildren:t.fromObject({type:i[1],components:this.components}),baseType:"array"}):Nl(this,{arrayLength:null,arrayChildren:null,baseType:this.components!=null?"tuple":this.type}),this._isParamType=!0,Object.freeze(this);}format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json){let i={type:this.baseType==="tuple"?"tuple":this.type,name:this.name||void 0};return typeof this.indexed=="boolean"&&(i.indexed=this.indexed),this.components&&(i.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(i)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Ye.sighash&&(r+=this.type),r+="("+this.components.map(i=>i.format(e)).join(e===Ye.full?", ":",")+")"):r+=this.type,e!==Ye.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Ye.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?t.fromString(e,r):t.fromObject(e)}static fromObject(e){return t.isParamType(e)?e:new t(es,{name:e.name||null,type:to(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(t.fromObject):null})}static fromString(e,r){function i(s){return t.fromObject({name:s.name,type:s.type,indexed:s.indexed,components:s.components})}return i(YP(e,!!r))}static isParamType(e){return !!(e!=null&&e._isParamType)}};function ba(t,e){return XP(t).map(r=>dr.fromString(r,e))}var ts=class t{constructor(e,r){e!==es&&Ge.throwError("use a static from method",ke.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Nl(this,r),this._isFragment=!0,Object.freeze(this);}static from(e){return t.isFragment(e)?e:typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFragment(e))return e;switch(e.type){case"function":return is.fromObject(e);case"event":return ro.fromObject(e);case"constructor":return rs.fromObject(e);case"error":return Ol.fromObject(e);case"fallback":case"receive":return null}return Ge.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?ro.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?is.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?rs.fromString(e.trim()):e.split(" ")[0]==="error"?Ol.fromString(e.substring(5).trim()):Ge.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return !!(e&&e._isFragment)}},ro=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Ye.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",e!==Ye.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isEventFragment(e))return e;e.type!=="event"&&Ge.throwArgumentError("invalid event object","value",e);let r={name:Ea(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(dr.fromObject):[],type:"event"};return new t(es,r)}static fromString(e){let r=e.match(Ca);r||Ge.throwArgumentError("invalid event string","value",e);let i=!1;return r[3].split(" ").forEach(s=>{switch(s.trim()){case"anonymous":i=!0;break;case"":break;default:Ge.warn("unknown modifier: "+s);}}),t.fromObject({name:r[1].trim(),anonymous:i,inputs:ba(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}};function Gx(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ge.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ge.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=Nt.from(r[1]),r[0]):t}function Wx(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r);}});}function Yx(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ge.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ge.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ge.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ge.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ge.throwArgumentError("unable to determine stateMutability","value",t),e}var rs=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});e===Ye.sighash&&Ge.throwError("cannot format a constructor for sighash",ke.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isConstructorFragment(e))return e;e.type!=="constructor"&&Ge.throwArgumentError("invalid constructor object","value",e);let r=Yx(e);r.constant&&Ge.throwArgumentError("constructor cannot be constant","value",e);let i={name:null,type:e.type,inputs:e.inputs?e.inputs.map(dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Nt.from(e.gas):null};return new t(es,i)}static fromString(e){let r={type:"constructor"};e=Gx(e,r);let i=e.match(Ca);return (!i||i[1].trim()!=="constructor")&&Ge.throwArgumentError("invalid constructor string","value",e),r.inputs=ba(i[2].trim(),!1),Wx(i[3].trim(),r),t.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}},is=class t extends rs{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(i=>JSON.parse(i.format(e))),outputs:this.outputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Ye.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",e!==Ye.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(i=>i.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isFunctionFragment(e))return e;e.type!=="function"&&Ge.throwArgumentError("invalid function object","value",e);let r=Yx(e),i={type:e.type,name:Ea(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(dr.fromObject):[],outputs:e.outputs?e.outputs.map(dr.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?Nt.from(e.gas):null};return new t(es,i)}static fromString(e){let r={type:"function"};e=Gx(e,r);let i=e.split(" returns ");i.length>2&&Ge.throwArgumentError("invalid function string","value",e);let s=i[0].match(Ca);if(s||Ge.throwArgumentError("invalid function signature","value",e),r.name=s[1].trim(),r.name&&Ea(r.name),r.inputs=ba(s[2],!1),Wx(s[3].trim(),r),i.length>1){let n=i[1].match(Ca);(n[1].trim()!=""||n[3].trim()!="")&&Ge.throwArgumentError("unexpected tokens","value",e),r.outputs=ba(n[2],!1);}else r.outputs=[];return t.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}};function Kx(t){let e=t.format();return (e==="Error(string)"||e==="Panic(uint256)")&&Ge.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}var Ol=class t extends ts{format(e){if(e||(e=Ye.sighash),Ye[e]||Ge.throwArgumentError("invalid format type","format",e),e===Ye.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});let r="";return e!==Ye.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(i=>i.format(e)).join(e===Ye.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?t.fromString(e):t.fromObject(e)}static fromObject(e){if(t.isErrorFragment(e))return e;e.type!=="error"&&Ge.throwArgumentError("invalid error object","value",e);let r={type:e.type,name:Ea(e.name),inputs:e.inputs?e.inputs.map(dr.fromObject):[]};return Kx(new t(es,r))}static fromString(e){let r={type:"error"},i=e.match(Ca);return i||Ge.throwArgumentError("invalid error signature","value",e),r.name=i[1].trim(),r.name&&Ea(r.name),r.inputs=ba(i[2],!1),Kx(t.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}};function to(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}var ZP=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ea(t){return (!t||!t.match(ZP))&&Ge.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}var Ca=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function XP(t){t=t.trim();let e=[],r="",i=0;for(let s=0;s<t.length;s++){let n=t[s];n===","&&i===0?(e.push(r),r=""):(r+=n,n==="("?i++:n===")"&&(i--,i===-1&&Ge.throwArgumentError("unbalanced parenthesis","value",t)));}return r&&e.push(r),e}var H0=new ke(Zr);var Ht=class{constructor(e,r,i,s){this.name=e,this.type=r,this.localName=i,this.dynamic=s;}_throwError(e,r){H0.throwArgumentError(e,this.localName,r);}},ns=class{constructor(e){Bt(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e);}get data(){return Mx(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(bi(e._data))}writeBytes(e){let r=It(e),i=r.length%this.wordSize;return i&&(r=bi([r,this._padding.slice(i)])),this._writeData(r)}_getValue(e){let r=It(Nt.from(e));return r.length>this.wordSize&&H0.throwError("value out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=bi([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){let e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r);}}},Fl=class t{constructor(e,r,i,s){Bt(this,"_data",It(e)),Bt(this,"wordSize",r||32),Bt(this,"_coerceFunc",i),Bt(this,"allowLoose",s),this._offset=0;}get data(){return St(this._data)}get consumed(){return this._offset}static coerce(e,r){let i=e.match("^u?int([0-9]+)$");return i&&parseInt(i[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):t.coerce(e,r)}_peekBytes(e,r,i){let s=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+s>this._data.length&&(this.allowLoose&&i&&this._offset+r<=this._data.length?s=r:H0.throwError("data out-of-bounds",ke.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+s})),this._data.slice(this._offset,this._offset+s)}subReader(e){return new t(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let i=this._peekBytes(0,e,!!r);return this._offset+=i.length,i.slice(0,e)}readValue(){return Nt.from(this.readBytes(this.wordSize))}};var Zx=Kt(Jx());function ss(t){return "0x"+Zx.default.keccak_256(It(t))}var Xx="address/5.7.0";var Ta=new ke(Xx);function Qx(t){hr(t,20)||Ta.throwArgumentError("invalid address","address",t),t=t.toLowerCase();let e=t.substring(2).split(""),r=new Uint8Array(40);for(let s=0;s<40;s++)r[s]=e[s].charCodeAt(0);let i=It(ss(r));for(let s=0;s<40;s+=2)i[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(i[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return "0x"+e.join("")}var QP=9007199254740991;function e7(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}var U0={};for(let t=0;t<10;t++)U0[String(t)]=String(t);for(let t=0;t<26;t++)U0[String.fromCharCode(65+t)]=String(10+t);var eb=Math.floor(e7(QP));function t7(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(i=>U0[i]).join("");for(;e.length>=eb;){let i=e.substring(0,eb);e=parseInt(i,10)%97+e.substring(i.length);}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function Aa(t){let e=null;if(typeof t!="string"&&Ta.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=Qx(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&Ta.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==t7(t)&&Ta.throwArgumentError("bad icap checksum","address",t),e=j0(t.substring(4));e.length<40;)e="0"+e;e=Qx("0x"+e);}else Ta.throwArgumentError("invalid address","address",t);return e}var Pl=class extends Ht{constructor(e){super("address","address",e,!1);}defaultValue(){return "0x0000000000000000000000000000000000000000"}encode(e,r){try{r=Aa(r);}catch(i){this._throwError(i.message,r);}return e.writeValue(r)}decode(e){return Aa(Dl(e.readValue().toHexString(),20))}};var Il=class extends Ht{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e;}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}};var io=new ke(Zr);function V0(t,e,r){let i=null;if(Array.isArray(r))i=r;else if(r&&typeof r=="object"){let u={};i=e.map(l=>{let h=l.localName;return h||io.throwError("cannot encode object for signature with missing names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]&&io.throwError("cannot encode object for signature with duplicate names",ke.errors.INVALID_ARGUMENT,{argument:"values",coder:l,value:r}),u[h]=!0,r[h]});}else io.throwArgumentError("invalid tuple value","tuple",r);e.length!==i.length&&io.throwArgumentError("types/value length mismatch","tuple",r);let s=new ns(t.wordSize),n=new ns(t.wordSize),o=[];e.forEach((u,l)=>{let h=i[l];if(u.dynamic){let c=n.length;u.encode(n,h);let d=s.writeUpdatableValue();o.push(f=>{d(f+c);});}else u.encode(s,h);}),o.forEach(u=>{u(s.length);});let a=t.appendWriter(s);return a+=t.appendWriter(n),a}function $0(t,e){let r=[],i=t.subReader(0);e.forEach(n=>{let o=null;if(n.dynamic){let a=t.readValue(),u=i.subReader(a.toNumber());try{o=n.decode(u);}catch(l){if(l.code===ke.errors.BUFFER_OVERRUN)throw l;o=l,o.baseType=n.name,o.name=n.localName,o.type=n.type;}}else try{o=n.decode(t);}catch(a){if(a.code===ke.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=n.name,o.name=n.localName,o.type=n.type;}o!=null&&r.push(o);});let s=e.reduce((n,o)=>{let a=o.localName;return a&&(n[a]||(n[a]=0),n[a]++),n},{});e.forEach((n,o)=>{let a=n.localName;if(!a||s[a]!==1||(a==="length"&&(a="_length"),r[a]!=null))return;let u=r[o];u instanceof Error?Object.defineProperty(r,a,{enumerable:!0,get:()=>{throw u}}):r[a]=u;});for(let n=0;n<r.length;n++){let o=r[n];o instanceof Error&&Object.defineProperty(r,n,{enumerable:!0,get:()=>{throw o}});}return Object.freeze(r)}var kl=class extends Ht{constructor(e,r,i){let s=e.type+"["+(r>=0?r:"")+"]",n=r===-1||e.dynamic;super("array",s,i,n),this.coder=e,this.length=r;}defaultValue(){let e=this.coder.defaultValue(),r=[];for(let i=0;i<this.length;i++)r.push(e);return r}encode(e,r){Array.isArray(r)||this._throwError("expected array value",r);let i=this.length;i===-1&&(i=r.length,e.writeValue(r.length)),io.checkArgumentCount(r.length,i,"coder array"+(this.localName?" "+this.localName:""));let s=[];for(let n=0;n<r.length;n++)s.push(this.coder);return V0(e,s,r)}decode(e){let r=this.length;r===-1&&(r=e.readValue().toNumber(),r*32>e._data.length&&io.throwError("insufficient data length",ke.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let i=[];for(let s=0;s<r;s++)i.push(new Il(this.coder));return e.coerce(this.name,$0(e,i))}};var Ml=class extends Ht{constructor(e){super("bool","bool",e,!1);}defaultValue(){return !1}encode(e,r){return e.writeValue(r?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}};var wa=class extends Ht{constructor(e,r){super(e,e,r,!0);}defaultValue(){return "0x"}encode(e,r){r=It(r);let i=e.writeValue(r.length);return i+=e.writeBytes(r),i}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}},Bl=class extends wa{constructor(e){super("bytes",e);}decode(e){return e.coerce(this.name,St(super.decode(e)))}};var jl=class extends Ht{constructor(e,r){let i="bytes"+String(e);super(i,i,r,!1),this.size=e;}defaultValue(){return "0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(e,r){let i=It(r);return i.length!==this.size&&this._throwError("incorrect data length",r),e.writeBytes(i)}decode(e){return e.coerce(this.name,St(e.readBytes(this.size)))}};var ql=class extends Ht{constructor(e){super("null","",e,!1);}defaultValue(){return null}encode(e,r){return r!=null&&this._throwError("not null",r),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}};var z0=Nt.from(-1),K0=Nt.from(0),G0=Nt.from(1);var W0=Nt.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Hl=class extends Ht{constructor(e,r,i){let s=(r?"int":"uint")+e*8;super(s,s,i,!1),this.size=e,this.signed=r;}defaultValue(){return 0}encode(e,r){let i=Nt.from(r),s=W0.mask(e.wordSize*8);if(this.signed){let n=s.mask(this.size*8-1);(i.gt(n)||i.lt(n.add(G0).mul(z0)))&&this._throwError("value out-of-bounds",r);}else (i.lt(K0)||i.gt(s.mask(this.size*8)))&&this._throwError("value out-of-bounds",r);return i=i.toTwos(this.size*8).mask(this.size*8),this.signed&&(i=i.fromTwos(this.size*8).toTwos(8*e.wordSize)),e.writeValue(i)}decode(e){let r=e.readValue().mask(this.size*8);return this.signed&&(r=r.fromTwos(this.size*8)),e.coerce(this.name,r)}};var tb="strings/5.7.0";var rb=new ke(tb),Da;(function(t){t.current="",t.NFC="NFC",t.NFD="NFD",t.NFKC="NFKC",t.NFKD="NFKD";})(Da||(Da={}));var pr;(function(t){t.UNEXPECTED_CONTINUE="unexpected continuation byte",t.BAD_PREFIX="bad codepoint prefix",t.OVERRUN="string overrun",t.MISSING_CONTINUE="missing continuation byte",t.OUT_OF_RANGE="out of UTF-8 range",t.UTF16_SURROGATE="UTF-16 surrogate",t.OVERLONG="overlong representation";})(pr||(pr={}));function r7(t,e,r,i,s){return rb.throwArgumentError(`invalid codepoint at offset ${e}; ${t}`,"bytes",r)}function ib(t,e,r,i,s){if(t===pr.BAD_PREFIX||t===pr.UNEXPECTED_CONTINUE){let n=0;for(let o=e+1;o<r.length&&r[o]>>6===2;o++)n++;return n}return t===pr.OVERRUN?r.length-e-1:0}function i7(t,e,r,i,s){return t===pr.OVERLONG?(i.push(s),0):(i.push(65533),ib(t,e,r))}var nb=Object.freeze({error:r7,ignore:ib,replace:i7});function n7(t,e){e==null&&(e=nb.error),t=It(t);let r=[],i=0;for(;i<t.length;){let s=t[i++];if(!(s>>7)){r.push(s);continue}let n=null,o=null;if((s&224)===192)n=1,o=127;else if((s&240)===224)n=2,o=2047;else if((s&248)===240)n=3,o=65535;else {(s&192)===128?i+=e(pr.UNEXPECTED_CONTINUE,i-1,t,r):i+=e(pr.BAD_PREFIX,i-1,t,r);continue}if(i-1+n>=t.length){i+=e(pr.OVERRUN,i-1,t,r);continue}let a=s&(1<<8-n-1)-1;for(let u=0;u<n;u++){let l=t[i];if((l&192)!=128){i+=e(pr.MISSING_CONTINUE,i,t,r),a=null;break}a=a<<6|l&63,i++;}if(a!==null){if(a>1114111){i+=e(pr.OUT_OF_RANGE,i-1-n,t,r,a);continue}if(a>=55296&&a<=57343){i+=e(pr.UTF16_SURROGATE,i-1-n,t,r,a);continue}if(a<=o){i+=e(pr.OVERLONG,i-1-n,t,r,a);continue}r.push(a);}}return r}function Sa(t,e=Da.current){e!=Da.current&&(rb.checkNormalize(),t=t.normalize(e));let r=[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);if(s<128)r.push(s);else if(s<2048)r.push(s>>6|192),r.push(s&63|128);else if((s&64512)==55296){i++;let n=t.charCodeAt(i);if(i>=t.length||(n&64512)!==56320)throw new Error("invalid utf-8 string");let o=65536+((s&1023)<<10)+(n&1023);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(o&63|128);}else r.push(s>>12|224),r.push(s>>6&63|128),r.push(s&63|128);}return It(r)}function s7(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Y0(t,e){return s7(n7(t,e))}var Ul=class extends wa{constructor(e){super("string",e);}defaultValue(){return ""}encode(e,r){return super.encode(e,Sa(r))}decode(e){return Y0(super.decode(e))}};var os=class extends Ht{constructor(e,r){let i=!1,s=[];e.forEach(o=>{o.dynamic&&(i=!0),s.push(o.type);});let n="tuple("+s.join(",")+")";super("tuple",n,r,i),this.coders=e;}defaultValue(){let e=[];this.coders.forEach(i=>{e.push(i.defaultValue());});let r=this.coders.reduce((i,s)=>{let n=s.localName;return n&&(i[n]||(i[n]=0),i[n]++),i},{});return this.coders.forEach((i,s)=>{let n=i.localName;!n||r[n]!==1||(n==="length"&&(n="_length"),e[n]==null&&(e[n]=e[s]));}),Object.freeze(e)}encode(e,r){return V0(e,this.coders,r)}decode(e){return e.coerce(this.name,$0(e,this.coders))}};var Vl=new ke(Zr),o7=new RegExp(/^bytes([0-9]*)$/),a7=new RegExp(/^(u?int)([0-9]*)$/),J0=class{constructor(e){Bt(this,"coerceFunc",e||null);}_getCoder(e){switch(e.baseType){case"address":return new Pl(e.name);case"bool":return new Ml(e.name);case"string":return new Ul(e.name);case"bytes":return new Bl(e.name);case"array":return new kl(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new os((e.components||[]).map(i=>this._getCoder(i)),e.name);case"":return new ql(e.name)}let r=e.type.match(a7);if(r){let i=parseInt(r[2]||"256");return (i===0||i>256||i%8!==0)&&Vl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new Hl(i/8,r[1]==="int",e.name)}if(r=e.type.match(o7),r){let i=parseInt(r[1]);return (i===0||i>32)&&Vl.throwArgumentError("invalid bytes length","param",e),new jl(i,e.name)}return Vl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Fl(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new ns(this._getWordSize())}getDefaultValue(e){let r=e.map(s=>this._getCoder(dr.from(s)));return new os(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Vl.throwError("types/values length mismatch",ke.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});let i=e.map(o=>this._getCoder(dr.from(o))),s=new os(i,"_"),n=this._getWriter();return s.encode(n,r),n.data}decode(e,r,i){let s=e.map(o=>this._getCoder(dr.from(o)));return new os(s,"_").decode(this._getReader(It(r),i))}},sb=new J0;function no(t){return ss(Sa(t))}var Ot=new ke(Zr);var $l=class extends Qn{},zl=class extends Qn{},Z0=class extends Qn{},Ra=class extends Qn{static isIndexed(e){return !!(e&&e._isIndexed)}},u7={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function ob(t,e){let r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}var Na=class{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,Bt(this,"fragments",r.map(i=>ts.from(i)).filter(i=>i!=null)),Bt(this,"_abiCoder",xa(new.target,"getAbiCoder")()),Bt(this,"functions",{}),Bt(this,"errors",{}),Bt(this,"events",{}),Bt(this,"structs",{}),this.fragments.forEach(i=>{let s=null;switch(i.type){case"constructor":if(this.deploy){Ot.warn("duplicate definition - constructor");return}Bt(this,"deploy",i);return;case"function":s=this.functions;break;case"event":s=this.events;break;case"error":s=this.errors;break;default:return}let n=i.format();if(s[n]){Ot.warn("duplicate definition - "+n);return}s[n]=i;}),this.deploy||Bt(this,"deploy",rs.from({payable:!1,type:"constructor"})),Bt(this,"_isInterface",!0);}format(e){e||(e=Ye.full),e===Ye.sighash&&Ot.throwArgumentError("interface does not support formatting sighash","format",e);let r=this.fragments.map(i=>i.format(e));return e===Ye.json?JSON.stringify(r.map(i=>JSON.parse(i))):r}static getAbiCoder(){return sb}static getAddress(e){return Aa(e)}static getSighash(e){return M0(no(e.format()),0,4)}static getEventTopic(e){return no(e.format())}getFunction(e){if(hr(e)){for(let i in this.functions)if(e===this.getSighash(i))return this.functions[i];Ot.throwArgumentError("no matching function","sighash",e);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.functions).filter(n=>n.split("(")[0]===i);return s.length===0?Ot.throwArgumentError("no matching function","name",i):s.length>1&&Ot.throwArgumentError("multiple matching functions","name",i),this.functions[s[0]]}let r=this.functions[is.fromString(e).format()];return r||Ot.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(hr(e)){let i=e.toLowerCase();for(let s in this.events)if(i===this.getEventTopic(s))return this.events[s];Ot.throwArgumentError("no matching event","topichash",i);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.events).filter(n=>n.split("(")[0]===i);return s.length===0?Ot.throwArgumentError("no matching event","name",i):s.length>1&&Ot.throwArgumentError("multiple matching events","name",i),this.events[s[0]]}let r=this.events[ro.fromString(e).format()];return r||Ot.throwArgumentError("no matching event","signature",e),r}getError(e){if(hr(e)){let i=xa(this.constructor,"getSighash");for(let s in this.errors){let n=this.errors[s];if(e===i(n))return this.errors[s]}Ot.throwArgumentError("no matching error","sighash",e);}if(e.indexOf("(")===-1){let i=e.trim(),s=Object.keys(this.errors).filter(n=>n.split("(")[0]===i);return s.length===0?Ot.throwArgumentError("no matching error","name",i):s.length>1&&Ot.throwArgumentError("multiple matching errors","name",i),this.errors[s[0]]}let r=this.errors[is.fromString(e).format()];return r||Ot.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e);}catch(r){try{e=this.getError(e);}catch(i){throw r}}return xa(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),xa(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));let i=It(r);return St(i.slice(0,4))!==this.getSighash(e)&&Ot.throwArgumentError(`data signature does not match error ${e.name}.`,"data",St(i)),this._decodeParams(e.inputs,i.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),St(bi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=It(r);return St(i.slice(0,4))!==this.getSighash(e)&&Ot.throwArgumentError(`data signature does not match function ${e.name}.`,"data",St(i)),this._decodeParams(e.inputs,i.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),St(bi([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let i=It(r),s=null,n="",o=null,a=null,u=null;switch(i.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,i)}catch(l){}break;case 4:{let l=St(i.slice(0,4)),h=u7[l];if(h)o=this._abiCoder.decode(h.inputs,i.slice(4)),a=h.name,u=h.signature,h.reason&&(s=o[0]),a==="Error"?n=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(n=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{let c=this.getError(l);o=this._abiCoder.decode(c.inputs,i.slice(4)),a=c.name,u=c.format();}catch(c){}break}}return Ot.throwError("call revert exception"+n,ke.errors.CALL_EXCEPTION,{method:e.format(),data:St(r),errorArgs:o,errorName:a,errorSignature:u,reason:s})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),St(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&Ot.throwError("too many arguments for "+e.format(),ke.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let i=[];e.anonymous||i.push(this.getEventTopic(e));let s=(n,o)=>n.type==="string"?no(o):n.type==="bytes"?ss(St(o)):(n.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),n.type.match(/^u?int/)&&(o=Nt.from(o).toHexString()),n.type==="address"&&this._abiCoder.encode(["address"],[o]),Dl(St(o),32));for(r.forEach((n,o)=>{let a=e.inputs[o];if(!a.indexed){n!=null&&Ot.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,n);return}n==null?i.push(null):a.baseType==="array"||a.baseType==="tuple"?Ot.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,n):Array.isArray(n)?i.push(n.map(u=>s(a,u))):i.push(s(a,n));});i.length&&i[i.length-1]===null;)i.pop();return i}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));let i=[],s=[],n=[];return e.anonymous||i.push(this.getEventTopic(e)),r.length!==e.inputs.length&&Ot.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((o,a)=>{let u=r[a];if(o.indexed)if(o.type==="string")i.push(no(u));else if(o.type==="bytes")i.push(ss(u));else {if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");i.push(this._abiCoder.encode([o.type],[u]));}else s.push(o),n.push(u);}),{data:this._abiCoder.encode(s,n),topics:i}}decodeEventLog(e,r,i){if(typeof e=="string"&&(e=this.getEvent(e)),i!=null&&!e.anonymous){let d=this.getEventTopic(e);(!hr(i[0],32)||i[0].toLowerCase()!==d)&&Ot.throwError("fragment/topic mismatch",ke.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:d,value:i[0]}),i=i.slice(1);}let s=[],n=[],o=[];e.inputs.forEach((d,f)=>{d.indexed?d.type==="string"||d.type==="bytes"||d.baseType==="tuple"||d.baseType==="array"?(s.push(dr.fromObject({type:"bytes32",name:d.name})),o.push(!0)):(s.push(d),o.push(!1)):(n.push(d),o.push(!1));});let a=i!=null?this._abiCoder.decode(s,bi(i)):null,u=this._abiCoder.decode(n,r,!0),l=[],h=0,c=0;e.inputs.forEach((d,f)=>{if(d.indexed)if(a==null)l[f]=new Ra({_isIndexed:!0,hash:null});else if(o[f])l[f]=new Ra({_isIndexed:!0,hash:a[c++]});else try{l[f]=a[c++];}catch(m){l[f]=m;}else try{l[f]=u[h++];}catch(m){l[f]=m;}if(d.name&&l[d.name]==null){let m=l[f];m instanceof Error?Object.defineProperty(l,d.name,{enumerable:!0,get:()=>{throw ob(`property ${JSON.stringify(d.name)}`,m)}}):l[d.name]=m;}});for(let d=0;d<l.length;d++){let f=l[d];f instanceof Error&&Object.defineProperty(l,d,{enumerable:!0,get:()=>{throw ob(`index ${d}`,f)}});}return Object.freeze(l)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new zl({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:Nt.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return !r||r.anonymous?null:new $l({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){let r=St(e),i=this.getError(r.substring(0,10).toLowerCase());return i?new Z0({args:this._abiCoder.decode(i.inputs,"0x"+r.substring(10)),errorFragment:i,name:i.name,signature:i.format(),sighash:this.getSighash(i)}):null}static isInterface(e){return !!(e&&e._isInterface)}};var Cc=Kt(KE()),Zp=(t,e)=>e==null||e.length===0?void 0:new Na(t).encodeDeploy(e).slice(2),WE=t=>{try{let e=Cc.parse(t),r;return Cc.visit(e,{FunctionDefinition:s=>{s.isConstructor&&(r=s);}}),GE__default.default(r!=null,"Could not find constructor definition"),[{type:"constructor",inputs:r.parameters.map(({typeName:s},n)=>(GE__default.default(s!=null,`Missing a type definition for constructor parameter at position ${n}`),{type:YE(s)}))}]}catch(e){throw new Error(`Could not get an ABI from contract source: ${e}`)}},YE=t=>{switch(t.type){case"ElementaryTypeName":return t.name;case"ArrayTypeName":return `${YE(t.baseTypeName)}[]`;default:throw new Error(`Only primitive and array types are currently supported when constructing ABI from contract source, got ${t.type}`)}};var Xp=t=>{var e;return {deployments:(e=t==null?void 0:t.deployments)!=null?e:SI__default.default.resolve(process.cwd(),"deployments")}},JE=t=>{if(t==null)return ()=>!0;switch(typeof t){case"boolean":return ()=>t;case"string":return e=>e===t;case"function":return t;case"object":if(Array.isArray(t)){let e=new Set(t);return r=>e.has(r)}if(t instanceof RegExp)return e=>t.test(e);throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${t}`);default:throw new TypeError(`Invalid verify configuration: expected string, string[], boolean, function or a RegExp, got ${t}`)}};var XE=t=>{try{return fs.lstatSync(t).isDirectory()}catch(e){return !1}},QE=t=>{try{return fs.lstatSync(t).isFile()}catch(e){return !1}};var r2=async(t,e)=>{let r=Cd(e,t.networks),i=Xp(t.paths),s=bd(e),n=n2(e),o=s2(s),a=t.contracts.flatMap(l=>{var te;let{address:h,network:c,contractName:d,deployment:f}=l;e.info(`Collecting information for contract ${d} on network ${c}`);let m=r[c];if(m==null)return e.info(`No network configured for contract ${d} on network ${c}`),[];let g=`${SI.basename(f,".json")}.json`,v=SI.resolve(i.deployments,c,g);if(!QE(v))return e.error(Jt.error`Deployment file ${v} does not exist or is not a file`),[];let x=ge(v),_=O0.safeParse(x);if(!_.success)return e.error(Jt.error`No network configured for contract ${d} on network ${c}`),[];let E=_.data,b=SI.basename(d,".sol"),w=E.metadata.sources[d];if(w==null)return e.error(Jt.error`Missing source for contract ${d} for network ${c} in ${g}`),[];let D=Ad(w.content),N=WE(w.content),F=Zp(N,l.constructorArguments),V=F0(E.metadata),Z={apiUrl:m.apiUrl,apiKey:m.apiKey,address:h,contractName:`${d}:${b}`,constructorArguments:F,licenseType:D,compilerVersion:E.metadata.compiler.version,sourceCode:JSON.stringify(V),evmVersion:E.metadata.settings.evmVersion,optimizerRuns:(te=E.metadata.settings.optimizer)==null?void 0:te.runs};return s({Contract:d,Network:c,Address:Z.address,License:Z.licenseType,Arguments:l.constructorArguments?JSON.stringify(l.constructorArguments):void 0,Sources:Object.keys(E.metadata.sources),"Scan URL":Z.apiUrl,"Scan API Key":Z.apiKey?xd(Z.apiKey):void 0}),[{networkName:c,networkConfig:m,submitProps:Z}]});if(a.length===0)return e.warn("No contracts match the verification criteria, exiting"),[];if(t.dryRun)return e.debug("Dry run enabled, exiting"),[];let u=await Promise.all(n(a));return u.forEach(o),u},i2=async(t,e)=>{let r=JE(t.filter),i=Cd(e,t.networks),s=Xp(t.paths),n=bd(e),o=n2(e),a=s2(n);if(!XE(s.deployments))throw new Error(`Path ${s.deployments} is not a directory`);let u=new Set(fs.readdirSync(s.deployments)),l=Object.entries(i);e.debug("Verifying deployments for following networks:"),l.forEach(([d,f])=>{e.debug(` - ${d} (API URL ${f.apiUrl})`);});let h=l.flatMap(([d,f])=>{if(e.info(`Collecting deployments for ${d}...`),!u.has(d))return e.warn(`Could not find deployment for network ${d} in ${s.deployments}`),[];let m=SI.resolve(s.deployments,d);return fs.readdirSync(m).filter(v=>v.endsWith(".json")).flatMap(v=>{e.info(`Inspecting deployment file ${v} on network ${d}`);let x=SI.resolve(m,v),_=ge(x),E=O0.safeParse(_);if(!E.success)throw new Error(`Error parsing deployment file ${v} on network ${d}: ${E.error}`);let b=E.data,w=b.metadata.settings.compilationTarget;return Object.entries(w).flatMap(([D,N])=>{var y;if(!r(N,D,d))return e.debug(`Not verifying ${N} in ${v} on network ${d}`),[];let V=b.metadata.sources[D];if(V==null)return e.error(Jt.error`Could not find source for ${N} (${D})`),[];let Z=Ad(V.content),te=Zp(b.abi,b.args),ae=F0(b.metadata),k={apiUrl:f.apiUrl,apiKey:f.apiKey,address:b.address,contractName:`${D}:${N}`,constructorArguments:te,licenseType:Z,compilerVersion:b.metadata.compiler.version,sourceCode:JSON.stringify(ae),evmVersion:b.metadata.settings.evmVersion,optimizerRuns:(y=b.metadata.settings.optimizer)==null?void 0:y.runs};return n({Contract:N,Network:d,Address:b.address,License:k.licenseType,Arguments:JSON.stringify(b.args),Sources:Object.keys(b.metadata.sources),"Scan URL":k.apiUrl,"Scan API Key":k.apiKey?xd(k.apiKey):void 0}),{submitProps:k,networkName:d,networkConfig:f}})})});if(h.length===0)return e.warn("No contracts match the verification criteria, exiting"),[];if(t.dryRun)return e.debug("Dry run enabled, exiting"),[];let c=await Promise.all(o(h));return c.forEach(a),c},n2=t=>e=>e.map(async(r,i)=>{let{submitProps:s}=r,n=Jt.palette[i%Jt.palette.length],o=`[${i+1}/${e.length}]`,a=Wa.default.bold(s.contractName),u=Wa.default.bold(r.networkName);t.info(n`Verifying contract ${a} for network ${u} ${o}`);try{let l=Tx(s,t);l.on("poll",c=>{t.info(n`Polling for verification status of ${a} for network ${u} (GUID ${c}) ${o}`);}),l.on("retry",(c,d)=>{t.verbose(`Received an error: ${c}`),t.info(n`Retrying failed verification attempt of ${a} for network ${u} (attempt ${d+1}) ${o}`);});let h=await l.verify();return {artifact:r,result:h}}catch(l){return t.error(Jt.error`Problem verifying contract ${a} for network ${u} ${o}: ${l} `),{artifact:r,error:l}}}),s2=t=>({artifact:e,response:r,error:i})=>{let s=Wa.default.bold(e.submitProps.contractName),n=Wa.default.bold(e.networkName),o=e.networkConfig.browserUrl?B1(e.networkConfig.browserUrl,e.submitProps.address):void 0;t({Contract:s,Network:n,Result:i==null,"Was verified":r==null?void 0:r.alreadyVerified,"Contract URL":o,Error:i?Jt.error(i):void 0});};var Os=Kt(f3(),1);Kt(kD(),1);var qo=Kt(Ko(),1);Kt(f4(),1);var p4=(t=>(t.error="error",t.warn="warn",t.info="info",t.http="http",t.verbose="verbose",t.debug="debug",t.silly="silly",t))(p4||{});Ie.nativeEnum(p4);var TK="info";var y1=(t=TK,e=Os.format.cli())=>(0, Os.createLogger)({level:t,format:e,transports:[new Os.transports.Console]});(0, Os.format)((t,{label:e})=>({...t,message:`${e?`[${e}] `:""}${t.message}`}));({TRUE:qo.default.rgb(0,153,0),FALSE:qo.default.rgb(255,0,0),NOT_APPLICABLE:qo.default.rgb(255,128,0),DEFAULT_KEY:qo.default.rgb(255,255,255),DEFAULT_VALUE:qo.default.rgb(167,125,255)});var m4="1.1.29";var g4=new Pn("-l,--log-level <level>","Log level").choices(["error","warn","info","http","verbose","debug","silly"]).default("info"),_4=new Pn("-d,--deployments <path>","Path to the deployments folder"),y4=new Pn("--dry-run","Do not verify anything, just output the verifications that would be performed"),v4=new Pn("-n,--network <network name>","Network to verify").makeOptionMandatory(),x4=new Pn("-u,--api-url <url>","Scan API URL (fully qualified, with protocol and path)"),b4=new Pn("-k,--api-key <key>","Scan API Key"),wK=new Mu("non-target").description("Verifies a contract that does not have its own deployment file, i.e. has not been a target of a deployment").addOption(g4).addOption(y4).addOption(_4).addOption(v4).addOption(x4).addOption(b4).requiredOption("--address <address>","Contract address to verify").requiredOption("--name <contract name>","Fully qualified contract name to verify, e.g. contracts/MyToken.sol").requiredOption("--deployment <deployment file name>","Deployment file name, e.g. MyOtherToken.json").option("--arguments <constructor arguments>",'JSON encoded array of constructor arguments, e.g. [1234, "0x0"]',t=>{try{let e=JSON.parse(t);if(!Array.isArray(e))throw new Error(`Constructor arguments must be an array, got ${e}`);return e}catch(e){throw new I1(`Malformed constructor arguments specified: ${e}`)}}).action(async t=>{let e=y1(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},contracts:[{network:t.network,address:t.address,contractName:t.name,deployment:t.deployment,constructorArguments:t.arguments}]};try{await r2(r,e);}catch(i){e.error(Jt.error`The verification script exited with an error: ${i}`),process.exit(1);}}),DK=new Mu("target").description("Verifies contracts that have been a part of a deployment, i.e. have their own deployment files").addOption(g4).addOption(y4).addOption(_4).addOption(v4).addOption(x4).addOption(b4).option("-c,--contracts <contract names>","Comma-separated list of case-sensitive contract names to verify",t=>t!=null&&t.trim()?t.split(",").map(e=>e.trim()):void 0).action(async t=>{let e=y1(t.logLevel),r={dryRun:t.dryRun,paths:{deployments:t.deployments},networks:{[t.network]:{apiUrl:t.apiUrl,apiKey:t.apiKey}},filter:t.contracts};try{await i2(r,e);}catch(i){e.error(Jt.error`The verification script exited with an error: ${i}`),process.exit(1);}});new Mu("@layerzerolabs/verify-contract").version(m4).description("Verify a set of contracts based on hardhat-deploy outputs").addCommand(wK).addCommand(DK,{isDefault:!0}).parseAsync();
|
|
474
474
|
/*! Bundled license information:
|
|
475
475
|
|
|
476
476
|
js-sha3/src/sha3.js:
|