@0xmonaco/mcp-server 1.0.42-develop.791e6f3 → 1.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +6 -6
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -23,7 +23,7 @@ Content-Type: ${i.type||"application/octet-stream"}\r
|
|
|
23
23
|
|| ${a} === "boolean" || ${n} === null`).assign(s,Qe._`[${n}]`)}}}function Qse({gen:e,parentData:t,parentDataProperty:r},o){e.if(Qe._`${t} !== undefined`,()=>e.assign(Qe._`${t}[${r}]`,o))}function g6(e,t,r,o=$d.Correct){let n=o===$d.Correct?Qe.operators.EQ:Qe.operators.NEQ,i;switch(e){case"null":return Qe._`${t} ${n} null`;case"array":i=Qe._`Array.isArray(${t})`;break;case"object":i=Qe._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=a(Qe._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=a();break;default:return Qe._`typeof ${t} ${n} ${e}`}return o===$d.Correct?i:(0,Qe.not)(i);function a(s=Qe.nil){return(0,Qe.and)(Qe._`typeof ${t} == "number"`,s,r?Qe._`isFinite(${t})`:Qe.nil)}}qU.checkDataType=g6;function y6(e,t,r,o){if(e.length===1)return g6(e[0],t,r,o);let n,i=(0,LU.toHash)(e);if(i.array&&i.object){let a=Qe._`typeof ${t} != "object"`;n=i.null?a:Qe._`!${t} || ${a}`,delete i.null,delete i.array,delete i.object}else n=Qe.nil;if(i.number)delete i.integer;for(let a in i)n=(0,Qe.and)(n,g6(a,t,r,o));return n}qU.checkDataTypes=y6;var Xse={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>typeof e=="string"?Qe._`{type: ${e}}`:Qe._`{type: ${t}}`};function b6(e){let t=ece(e);(0,Zse.reportError)(t,Xse)}qU.reportTypeError=b6;function ece(e){let{gen:t,data:r,schema:o}=e,n=(0,LU.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:n,schemaValue:n,parentSchema:o,params:{},it:e}}});var WU=re(function(VU){Object.defineProperty(VU,"__esModule",{value:!0});VU.assignDefaults=void 0;var Od=rt(),sce=ft();function cce(e,t){let{properties:r,items:o}=e.schema;if(t==="object"&&r)for(let n in r)GU(e,n,r[n].default);else if(t==="array"&&Array.isArray(o))o.forEach((n,i)=>GU(e,i,n.default))}VU.assignDefaults=cce;function GU(e,t,r){let{gen:o,compositeRule:n,data:i,opts:a}=e;if(r===void 0)return;let s=Od._`${i}${(0,Od.getProperty)(t)}`;if(n){(0,sce.checkStrictMode)(e,`default is ignored for: ${s}`);return}let c=Od._`${s} === undefined`;if(a.useDefaults==="empty")c=Od._`${c} || ${s} === null || ${s} === ""`;o.if(c,Od._`${s} = ${(0,Od.stringify)(r)}`)}});var co=re(function(YU){Object.defineProperty(YU,"__esModule",{value:!0});YU.validateUnion=YU.validateArray=YU.usePattern=YU.callValidateCode=YU.schemaProperties=YU.allSchemaProperties=YU.noPropertyInData=YU.propertyInData=YU.isOwnProperty=YU.hasPropFunc=YU.reportMissingProp=YU.checkMissingProp=YU.checkReportMissingProp=void 0;var Vt=rt(),x6=ft(),Cs=pa(),uce=ft();function lce(e,t){let{gen:r,data:o,it:n}=e;r.if(_6(r,o,t,n.opts.ownProperties),()=>{e.setParams({missingProperty:Vt._`${t}`},!0),e.error()})}YU.checkReportMissingProp=lce;function dce({gen:e,data:t,it:{opts:r}},o,n){return(0,Vt.or)(...o.map((i)=>(0,Vt.and)(_6(e,t,i,r.ownProperties),Vt._`${n} = ${i}`)))}YU.checkMissingProp=dce;function pce(e,t){e.setParams({missingProperty:t},!0),e.error()}YU.reportMissingProp=pce;function KU(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Vt._`Object.prototype.hasOwnProperty`})}YU.hasPropFunc=KU;function v6(e,t,r){return Vt._`${KU(e)}.call(${t}, ${r})`}YU.isOwnProperty=v6;function fce(e,t,r,o){let n=Vt._`${t}${(0,Vt.getProperty)(r)} !== undefined`;return o?Vt._`${n} && ${v6(e,t,r)}`:n}YU.propertyInData=fce;function _6(e,t,r,o){let n=Vt._`${t}${(0,Vt.getProperty)(r)} === undefined`;return o?(0,Vt.or)(n,(0,Vt.not)(v6(e,t,r))):n}YU.noPropertyInData=_6;function JU(e){return e?Object.keys(e).filter((t)=>t!=="__proto__"):[]}YU.allSchemaProperties=JU;function mce(e,t){return JU(t).filter((r)=>!(0,x6.alwaysValidSchema)(e,t[r]))}YU.schemaProperties=mce;function hce({schemaCode:e,data:t,it:{gen:r,topSchemaRef:o,schemaPath:n,errorPath:i},it:a},s,c,u){let d=u?Vt._`${e}, ${t}, ${o}${n}`:t,p=[[Cs.default.instancePath,(0,Vt.strConcat)(Cs.default.instancePath,i)],[Cs.default.parentData,a.parentData],[Cs.default.parentDataProperty,a.parentDataProperty],[Cs.default.rootData,Cs.default.rootData]];if(a.opts.dynamicRef)p.push([Cs.default.dynamicAnchors,Cs.default.dynamicAnchors]);let m=Vt._`${d}, ${r.object(...p)}`;return c!==Vt.nil?Vt._`${s}.call(${c}, ${m})`:Vt._`${s}(${m})`}YU.callValidateCode=hce;var gce=Vt._`new RegExp`;function yce({gen:e,it:{opts:t}},r){let o=t.unicodeRegExp?"u":"",{regExp:n}=t.code,i=n(r,o);return e.scopeValue("pattern",{key:i.toString(),ref:i,code:Vt._`${n.code==="new RegExp"?gce:(0,uce.useFunc)(e,n)}(${r}, ${o})`})}YU.usePattern=yce;function bce(e){let{gen:t,data:r,keyword:o,it:n}=e,i=t.name("valid");if(n.allErrors){let s=t.let("valid",!0);return a(()=>t.assign(s,!1)),s}return t.var(i,!0),a(()=>t.break()),i;function a(s){let c=t.const("len",Vt._`${r}.length`);t.forRange("i",0,c,(u)=>{e.subschema({keyword:o,dataProp:u,dataPropType:x6.Type.Num},i),t.if((0,Vt.not)(i),s)})}}YU.validateArray=bce;function xce(e){let{gen:t,schema:r,keyword:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some((c)=>(0,x6.alwaysValidSchema)(n,c))&&!n.opts.unevaluated)return;let a=t.let("valid",!1),s=t.name("_valid");t.block(()=>r.forEach((c,u)=>{let d=e.subschema({keyword:o,schemaProp:u,compositeRule:!0},s);if(t.assign(a,Vt._`${a} || ${s}`),!e.mergeValidEvaluated(d,s))t.if((0,Vt.not)(a))})),e.result(a,()=>e.reset(),()=>e.error(!0))}YU.validateUnion=xce});var n8=re(function(t8){Object.defineProperty(t8,"__esModule",{value:!0});t8.validateKeywordUsage=t8.validSchemaType=t8.funcKeywordCode=t8.macroKeywordCode=void 0;var fn=rt(),ru=pa(),Oce=co(),Cce=Dh();function zce(e,t){let{gen:r,keyword:o,schema:n,parentSchema:i,it:a}=e,s=t.macro.call(a.self,n,i,a),c=e8(r,o,s);if(a.opts.validateSchema!==!1)a.self.validateSchema(s,!0);let u=r.name("valid");e.subschema({schema:s,schemaPath:fn.nil,errSchemaPath:`${a.errSchemaPath}/${o}`,topSchemaRef:c,compositeRule:!0},u),e.pass(u,()=>e.error(!0))}t8.macroKeywordCode=zce;function Nce(e,t){var r;let{gen:o,keyword:n,schema:i,parentSchema:a,$data:s,it:c}=e;Bce(c,t);let u=!s&&t.compile?t.compile.call(c.self,i,a,c):t.validate,d=e8(o,n,u),p=o.let("valid");e.block$data(p,m),e.ok((r=t.valid)!==null&&r!==void 0?r:p);function m(){if(t.errors===!1){if(x(),t.modifying)XU(e);S(()=>e.error())}else{let v=t.async?h():y();if(t.modifying)XU(e);S(()=>Mce(e,v))}}function h(){let v=o.let("ruleErrs",null);return o.try(()=>x(fn._`await `),(E)=>o.assign(p,!1).if(fn._`${E} instanceof ${c.ValidationError}`,()=>o.assign(v,fn._`${E}.errors`),()=>o.throw(E))),v}function y(){let v=fn._`${d}.errors`;return o.assign(v,null),x(fn.nil),v}function x(v=t.async?fn._`await `:fn.nil){let E=c.opts.passContext?ru.default.this:ru.default.self,w=!(("compile"in t)&&!s||t.schema===!1);o.assign(p,fn._`${v}${(0,Oce.callValidateCode)(e,d,E,w)}`,t.modifying)}function S(v){var E;o.if((0,fn.not)((E=t.valid)!==null&&E!==void 0?E:p),v)}}t8.funcKeywordCode=Nce;function XU(e){let{gen:t,data:r,it:o}=e;t.if(o.parentData,()=>t.assign(r,fn._`${o.parentData}[${o.parentDataProperty}]`))}function Mce(e,t){let{gen:r}=e;r.if(fn._`Array.isArray(${t})`,()=>{r.assign(ru.default.vErrors,fn._`${ru.default.vErrors} === null ? ${t} : ${ru.default.vErrors}.concat(${t})`).assign(ru.default.errors,fn._`${ru.default.vErrors}.length`),(0,Cce.extendErrors)(e)},()=>e.error())}function Bce({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}function e8(e,t,r){if(r===void 0)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,fn.stringify)(r)})}function Dce(e,t,r=!1){return!t.length||t.some((o)=>o==="array"?Array.isArray(e):o==="object"?e&&typeof e=="object"&&!Array.isArray(e):typeof e==o||r&&typeof e>"u")}t8.validSchemaType=Dce;function Uce({schema:e,opts:t,self:r,errSchemaPath:o},n,i){if(Array.isArray(n.keyword)?!n.keyword.includes(i):n.keyword!==i)throw Error("ajv implementation error");let a=n.dependencies;if(a===null||a===void 0?void 0:a.some((s)=>!Object.prototype.hasOwnProperty.call(e,s)))throw Error(`parent schema must have dependencies of ${i}: ${a.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[i])){let c=`keyword "${i}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if(t.validateSchema==="log")r.logger.error(c);else throw Error(c)}}}t8.validateKeywordUsage=Uce});var s8=re(function(i8){Object.defineProperty(i8,"__esModule",{value:!0});i8.extendSubschemaMode=i8.extendSubschemaData=i8.getSubschema=void 0;var Si=rt(),o8=ft();function qce(e,{keyword:t,schemaProp:r,schema:o,schemaPath:n,errSchemaPath:i,topSchemaRef:a}){if(t!==void 0&&o!==void 0)throw Error('both "keyword" and "schema" passed, only one allowed');if(t!==void 0){let s=e.schema[t];return r===void 0?{schema:s,schemaPath:Si._`${e.schemaPath}${(0,Si.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:s[r],schemaPath:Si._`${e.schemaPath}${(0,Si.getProperty)(t)}${(0,Si.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,o8.escapeFragment)(r)}`}}if(o!==void 0){if(n===void 0||i===void 0||a===void 0)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:o,schemaPath:n,topSchemaRef:a,errSchemaPath:i}}throw Error('either "keyword" or "schema" must be passed')}i8.getSubschema=qce;function Hce(e,t,{dataProp:r,dataPropType:o,data:n,dataTypes:i,propertyName:a}){if(n!==void 0&&r!==void 0)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:s}=t;if(r!==void 0){let{errorPath:u,dataPathArr:d,opts:p}=t,m=s.let("data",Si._`${t.data}${(0,Si.getProperty)(r)}`,!0);c(m),e.errorPath=Si.str`${u}${(0,o8.getErrorPath)(r,o,p.jsPropertySyntax)}`,e.parentDataProperty=Si._`${r}`,e.dataPathArr=[...d,e.parentDataProperty]}if(n!==void 0){let u=n instanceof Si.Name?n:s.let("data",n,!0);if(c(u),a!==void 0)e.propertyName=a}if(i)e.dataTypes=i;function c(u){e.data=u,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,u]}}i8.extendSubschemaData=Hce;function Gce(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:i}){if(o!==void 0)e.compositeRule=o;if(n!==void 0)e.createErrors=n;if(i!==void 0)e.allErrors=i;e.jtdDiscriminator=t,e.jtdMetadata=r}i8.extendSubschemaMode=Gce});var w6=re(function(yAe,c8){c8.exports=function e(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,n,i;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(n=o;n--!==0;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),o=i.length,o!==Object.keys(r).length)return!1;for(n=o;n--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[n]))return!1;for(n=o;n--!==0;){var a=i[n];if(!e(t[a],r[a]))return!1}return!0}return t!==t&&r!==r}});var l8=re(function(bAe,u8){var zs=u8.exports=function(e,t,r){if(typeof t=="function")r=t,t={};r=t.cb||r;var o=typeof r=="function"?r:r.pre||function(){},n=r.post||function(){};d_(t,o,n,e,"",e)};zs.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};zs.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};zs.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};zs.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function d_(e,t,r,o,n,i,a,s,c,u){if(o&&typeof o=="object"&&!Array.isArray(o)){t(o,n,i,a,s,c,u);for(var d in o){var p=o[d];if(Array.isArray(p)){if(d in zs.arrayKeywords)for(var m=0;m<p.length;m++)d_(e,t,r,p[m],n+"/"+d+"/"+m,i,n,d,o,m)}else if(d in zs.propsKeywords){if(p&&typeof p=="object")for(var h in p)d_(e,t,r,p[h],n+"/"+d+"/"+Wce(h),i,n,d,o,h)}else if(d in zs.keywords||e.allKeys&&!(d in zs.skipKeywords))d_(e,t,r,p,n+"/"+d,i,n,d,o)}r(o,n,i,a,s,c,u)}}function Wce(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}});var Lh=re(function(m8){Object.defineProperty(m8,"__esModule",{value:!0});m8.getSchemaRefs=m8.resolveUrl=m8.normalizeId=m8._getFullPath=m8.getFullPath=m8.inlineRef=void 0;var Kce=ft(),Jce=w6(),Yce=l8(),Qce=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Xce(e,t=!0){if(typeof e=="boolean")return!0;if(t===!0)return!S6(e);if(!t)return!1;return d8(e)<=t}m8.inlineRef=Xce;var eue=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function S6(e){for(let t in e){if(eue.has(t))return!0;let r=e[t];if(Array.isArray(r)&&r.some(S6))return!0;if(typeof r=="object"&&S6(r))return!0}return!1}function d8(e){let t=0;for(let r in e){if(r==="$ref")return 1/0;if(t++,Qce.has(r))continue;if(typeof e[r]=="object")(0,Kce.eachItem)(e[r],(o)=>t+=d8(o));if(t===1/0)return 1/0}return t}function p8(e,t="",r){if(r!==!1)t=Cd(t);let o=e.parse(t);return f8(e,o)}m8.getFullPath=p8;function f8(e,t){return e.serialize(t).split("#")[0]+"#"}m8._getFullPath=f8;var tue=/#\/?$/;function Cd(e){return e?e.replace(tue,""):""}m8.normalizeId=Cd;function rue(e,t,r){return r=Cd(r),e.resolve(t,r)}m8.resolveUrl=rue;var nue=/^[a-z_][-a-z0-9._]*$/i;function oue(e,t){if(typeof e=="boolean")return{};let{schemaId:r,uriResolver:o}=this.opts,n=Cd(e[r]||t),i={"":n},a=p8(o,n,!1),s={},c=new Set;return Yce(e,{allKeys:!0},(p,m,h,y)=>{if(y===void 0)return;let x=a+m,S=i[y];if(typeof p[r]=="string")S=v.call(this,p[r]);E.call(this,p.$anchor),E.call(this,p.$dynamicAnchor),i[m]=S;function v(w){let _=this.opts.uriResolver.resolve;if(w=Cd(S?_(S,w):w),c.has(w))throw d(w);c.add(w);let T=this.refs[w];if(typeof T=="string")T=this.refs[T];if(typeof T=="object")u(p,T.schema,w);else if(w!==Cd(x))if(w[0]==="#")u(p,s[w],w),s[w]=p;else this.refs[w]=x;return w}function E(w){if(typeof w=="string"){if(!nue.test(w))throw Error(`invalid anchor "${w}"`);v.call(this,`#${w}`)}}}),s;function u(p,m,h){if(m!==void 0&&!Jce(p,m))throw d(h)}function d(p){return Error(`reference "${p}" resolves to more than one schema`)}}m8.getSchemaRefs=oue});var qh=re(function(R8){Object.defineProperty(R8,"__esModule",{value:!0});R8.getData=R8.KeywordCxt=R8.validateFunctionCode=void 0;var v8=CU(),g8=Uh(),E6=h6(),p_=Uh(),lue=WU(),Fh=n8(),T6=s8(),ke=rt(),He=pa(),due=Lh(),fa=ft(),jh=Dh();function pue(e){if(S8(e)){if(T8(e),w8(e)){hue(e);return}}_8(e,()=>(0,v8.topBoolOrEmptySchema)(e))}R8.validateFunctionCode=pue;function _8({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},i){if(n.code.es5)e.func(t,ke._`${He.default.data}, ${He.default.valCxt}`,o.$async,()=>{e.code(ke._`"use strict"; ${y8(r,n)}`),mue(e,n),e.code(i)});else e.func(t,ke._`${He.default.data}, ${fue(n)}`,o.$async,()=>e.code(y8(r,n)).code(i))}function fue(e){return ke._`{${He.default.instancePath}="", ${He.default.parentData}, ${He.default.parentDataProperty}, ${He.default.rootData}=${He.default.data}${e.dynamicRef?ke._`, ${He.default.dynamicAnchors}={}`:ke.nil}}={}`}function mue(e,t){e.if(He.default.valCxt,()=>{if(e.var(He.default.instancePath,ke._`${He.default.valCxt}.${He.default.instancePath}`),e.var(He.default.parentData,ke._`${He.default.valCxt}.${He.default.parentData}`),e.var(He.default.parentDataProperty,ke._`${He.default.valCxt}.${He.default.parentDataProperty}`),e.var(He.default.rootData,ke._`${He.default.valCxt}.${He.default.rootData}`),t.dynamicRef)e.var(He.default.dynamicAnchors,ke._`${He.default.valCxt}.${He.default.dynamicAnchors}`)},()=>{if(e.var(He.default.instancePath,ke._`""`),e.var(He.default.parentData,ke._`undefined`),e.var(He.default.parentDataProperty,ke._`undefined`),e.var(He.default.rootData,He.default.data),t.dynamicRef)e.var(He.default.dynamicAnchors,ke._`{}`)})}function hue(e){let{schema:t,opts:r,gen:o}=e;_8(e,()=>{if(r.$comment&&t.$comment)I8(e);if(vue(e),o.let(He.default.vErrors,null),o.let(He.default.errors,0),r.unevaluated)gue(e);E8(e),Sue(e)});return}function gue(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",ke._`${r}.evaluated`),t.if(ke._`${e.evaluated}.dynamicProps`,()=>t.assign(ke._`${e.evaluated}.props`,ke._`undefined`)),t.if(ke._`${e.evaluated}.dynamicItems`,()=>t.assign(ke._`${e.evaluated}.items`,ke._`undefined`))}function y8(e,t){let r=typeof e=="object"&&e[t.schemaId];return r&&(t.code.source||t.code.process)?ke._`/*# sourceURL=${r} */`:ke.nil}function yue(e,t){if(S8(e)){if(T8(e),w8(e)){bue(e,t);return}}(0,v8.boolOrEmptySchema)(e,t)}function w8({schema:e,self:t}){if(typeof e=="boolean")return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function S8(e){return typeof e.schema!="boolean"}function bue(e,t){let{schema:r,gen:o,opts:n}=e;if(n.$comment&&r.$comment)I8(e);_ue(e),wue(e);let i=o.const("_errs",He.default.errors);E8(e,i),o.var(t,ke._`${i} === ${He.default.errors}`)}function T8(e){(0,fa.checkUnknownRules)(e),xue(e)}function E8(e,t){if(e.opts.jtd)return b8(e,[],!1,t);let r=(0,g8.getSchemaTypes)(e.schema),o=(0,g8.coerceAndCheckDataType)(e,r);b8(e,r,!o,t)}function xue(e){let{schema:t,errSchemaPath:r,opts:o,self:n}=e;if(t.$ref&&o.ignoreKeywordsWithRef&&(0,fa.schemaHasRulesButRef)(t,n.RULES))n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function vue(e){let{schema:t,opts:r}=e;if(t.default!==void 0&&r.useDefaults&&r.strictSchema)(0,fa.checkStrictMode)(e,"default is ignored in the schema root")}function _ue(e){let t=e.schema[e.opts.schemaId];if(t)e.baseId=(0,due.resolveUrl)(e.opts.uriResolver,e.baseId,t)}function wue(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}function I8({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){let i=r.$comment;if(n.$comment===!0)e.code(ke._`${He.default.self}.logger.log(${i})`);else if(typeof n.$comment=="function"){let a=ke.str`${o}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code(ke._`${He.default.self}.opts.$comment(${i}, ${a}, ${s}.schema)`)}}function Sue(e){let{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:i}=e;if(r.$async)t.if(ke._`${He.default.errors} === 0`,()=>t.return(He.default.data),()=>t.throw(ke._`new ${n}(${He.default.vErrors})`));else{if(t.assign(ke._`${o}.errors`,He.default.vErrors),i.unevaluated)Tue(e);t.return(ke._`${He.default.errors} === 0`)}}function Tue({gen:e,evaluated:t,props:r,items:o}){if(r instanceof ke.Name)e.assign(ke._`${t}.props`,r);if(o instanceof ke.Name)e.assign(ke._`${t}.items`,o)}function b8(e,t,r,o){let{gen:n,schema:i,data:a,allErrors:s,opts:c,self:u}=e,{RULES:d}=u;if(i.$ref&&(c.ignoreKeywordsWithRef||!(0,fa.schemaHasRulesButRef)(i,d))){n.block(()=>k8(e,"$ref",d.all.$ref.definition));return}if(!c.jtd)Eue(e,t);n.block(()=>{for(let m of d.rules)p(m);p(d.post)});function p(m){if(!(0,E6.shouldUseGroup)(i,m))return;if(m.type){if(n.if((0,p_.checkDataType)(m.type,a,c.strictNumbers)),x8(e,m),t.length===1&&t[0]===m.type&&r)n.else(),(0,p_.reportTypeError)(e);n.endIf()}else x8(e,m);if(!s)n.if(ke._`${He.default.errors} === ${o||0}`)}}function x8(e,t){let{gen:r,schema:o,opts:{useDefaults:n}}=e;if(n)(0,lue.assignDefaults)(e,t.type);r.block(()=>{for(let i of t.rules)if((0,E6.shouldUseRule)(o,i))k8(e,i.keyword,i.definition,t.type)})}function Eue(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;if(Iue(e,t),!e.opts.allowUnionTypes)Pue(e,t);kue(e,e.dataTypes)}function Iue(e,t){if(!t.length)return;if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach((r)=>{if(!P8(e.dataTypes,r))I6(e,`type "${r}" not allowed by context "${e.dataTypes.join(",")}"`)}),Rue(e,t)}function Pue(e,t){if(t.length>1&&!(t.length===2&&t.includes("null")))I6(e,"use allowUnionTypes to allow union type keyword")}function kue(e,t){let r=e.self.RULES.all;for(let o in r){let n=r[o];if(typeof n=="object"&&(0,E6.shouldUseRule)(e.schema,n)){let{type:i}=n.definition;if(i.length&&!i.some((a)=>Aue(t,a)))I6(e,`missing type "${i.join(",")}" for keyword "${o}"`)}}}function Aue(e,t){return e.includes(t)||t==="number"&&e.includes("integer")}function P8(e,t){return e.includes(t)||t==="integer"&&e.includes("number")}function Rue(e,t){let r=[];for(let o of e.dataTypes)if(P8(t,o))r.push(o);else if(t.includes("integer")&&o==="number")r.push("integer");e.dataTypes=r}function I6(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,fa.checkStrictMode)(e,t,e.opts.strictTypes)}class P6{constructor(e,t,r){if((0,Fh.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,fa.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",A8(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Fh.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);if("code"in t?t.trackErrors:t.errors!==!1)this.errsCount=e.gen.const("_errs",He.default.errors)}result(e,t,r){this.failResult((0,ke.not)(e),t,r)}failResult(e,t,r){if(this.gen.if(e),r)r();else this.error();if(t){if(this.gen.else(),t(),this.allErrors)this.gen.endIf()}else if(this.allErrors)this.gen.endIf();else this.gen.else()}pass(e,t){this.failResult((0,ke.not)(e),void 0,t)}fail(e){if(e===void 0){if(this.error(),!this.allErrors)this.gen.if(!1);return}if(this.gen.if(e),this.error(),this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:t}=this;this.fail(ke._`${t} !== undefined && (${(0,ke.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?jh.reportExtraError:jh.reportError)(this,this.def.error,t)}$dataError(){(0,jh.reportError)(this,this.def.$dataError||jh.keyword$DataError)}reset(){if(this.errsCount===void 0)throw Error('add "trackErrors" to keyword definition');(0,jh.resetErrorsCount)(this.gen,this.errsCount)}ok(e){if(!this.allErrors)this.gen.if(e)}setParams(e,t){if(t)Object.assign(this.params,e);else this.params=e}block$data(e,t,r=ke.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=ke.nil,t=ke.nil){if(!this.$data)return;let{gen:r,schemaCode:o,schemaType:n,def:i}=this;if(r.if((0,ke.or)(ke._`${o} === undefined`,t)),e!==ke.nil)r.assign(e,!0);if(n.length||i.validateSchema){if(r.elseIf(this.invalid$data()),this.$dataError(),e!==ke.nil)r.assign(e,!1)}r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:o,it:n}=this;return(0,ke.or)(i(),a());function i(){if(r.length){if(!(t instanceof ke.Name))throw Error("ajv implementation error");let s=Array.isArray(r)?r:[r];return ke._`${(0,p_.checkDataTypes)(s,t,n.opts.strictNumbers,p_.DataType.Wrong)}`}return ke.nil}function a(){if(o.validateSchema){let s=e.scopeValue("validate$data",{ref:o.validateSchema});return ke._`!${s}(${t})`}return ke.nil}}subschema(e,t){let r=(0,T6.getSubschema)(this.it,e);(0,T6.extendSubschemaData)(r,this.it,e),(0,T6.extendSubschemaMode)(r,e);let o={...this.it,...r,items:void 0,props:void 0};return yue(o,t),o}mergeEvaluated(e,t){let{it:r,gen:o}=this;if(!r.opts.unevaluated)return;if(r.props!==!0&&e.props!==void 0)r.props=fa.mergeEvaluated.props(o,e.props,r.props,t);if(r.items!==!0&&e.items!==void 0)r.items=fa.mergeEvaluated.items(o,e.items,r.items,t)}mergeValidEvaluated(e,t){let{it:r,gen:o}=this;if(r.opts.unevaluated&&(r.props!==!0||r.items!==!0))return o.if(t,()=>this.mergeEvaluated(e,ke.Name)),!0}}R8.KeywordCxt=P6;function k8(e,t,r,o){let n=new P6(e,r,t);if("code"in r)r.code(n,o);else if(n.$data&&r.validate)(0,Fh.funcKeywordCode)(n,r);else if("macro"in r)(0,Fh.macroKeywordCode)(n,r);else if(r.compile||r.validate)(0,Fh.funcKeywordCode)(n,r)}var $ue=/^\/(?:[^~]|~0|~1)*$/,Oue=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function A8(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,i;if(e==="")return He.default.rootData;if(e[0]==="/"){if(!$ue.test(e))throw Error(`Invalid JSON-pointer: ${e}`);n=e,i=He.default.rootData}else{let u=Oue.exec(e);if(!u)throw Error(`Invalid JSON-pointer: ${e}`);let d=+u[1];if(n=u[2],n==="#"){if(d>=t)throw Error(c("property/index",d));return o[t-d]}if(d>t)throw Error(c("data",d));if(i=r[t-d],!n)return i}let a=i,s=n.split("/");for(let u of s)if(u)i=ke._`${i}${(0,ke.getProperty)((0,fa.unescapeJsonPointer)(u))}`,a=ke._`${a} && ${i}`;return a;function c(u,d){return`Cannot access ${u} ${d} levels up, current level is ${t}`}}R8.getData=A8});var f_=re(function(C8){Object.defineProperty(C8,"__esModule",{value:!0});class O8 extends Error{constructor(e){super("validation failed");this.errors=e,this.ajv=this.validation=!0}}C8.default=O8});var Hh=re(function(N8){Object.defineProperty(N8,"__esModule",{value:!0});var k6=Lh();class z8 extends Error{constructor(e,t,r,o){super(o||`can't resolve reference ${r} from id ${t}`);this.missingRef=(0,k6.resolveUrl)(e,t,r),this.missingSchema=(0,k6.normalizeId)((0,k6.getFullPath)(e,this.missingRef))}}N8.default=z8});var h_=re(function(D8){Object.defineProperty(D8,"__esModule",{value:!0});D8.resolveSchema=D8.getCompilingSchema=D8.resolveRef=D8.compileSchema=D8.SchemaEnv=void 0;var Uo=rt(),Bue=f_(),nu=pa(),Lo=Lh(),M8=ft(),Due=qh();class Gh{constructor(e){var t;this.refs={},this.dynamicAnchors={};let r;if(typeof e.schema=="object")r=e.schema;this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(t=e.baseId)!==null&&t!==void 0?t:(0,Lo.normalizeId)(r===null||r===void 0?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=r===null||r===void 0?void 0:r.$async,this.refs={}}}D8.SchemaEnv=Gh;function R6(e){let t=B8.call(this,e);if(t)return t;let r=(0,Lo.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:o,lines:n}=this.opts.code,{ownProperties:i}=this.opts,a=new Uo.CodeGen(this.scope,{es5:o,lines:n,ownProperties:i}),s;if(e.$async)s=a.scopeValue("Error",{ref:Bue.default,code:Uo._`require("ajv/dist/runtime/validation_error").default`});let c=a.scopeName("validate");e.validateName=c;let u={gen:a,allErrors:this.opts.allErrors,data:nu.default.data,parentData:nu.default.parentData,parentDataProperty:nu.default.parentDataProperty,dataNames:[nu.default.data],dataPathArr:[Uo.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:a.scopeValue("schema",this.opts.code.source===!0?{ref:e.schema,code:(0,Uo.stringify)(e.schema)}:{ref:e.schema}),validateName:c,ValidationError:s,schema:e.schema,schemaEnv:e,rootId:r,baseId:e.baseId||r,schemaPath:Uo.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:Uo._`""`,opts:this.opts,self:this},d;try{this._compilations.add(e),(0,Due.validateFunctionCode)(u),a.optimize(this.opts.code.optimize);let p=a.toString();if(d=`${a.scopeRefs(nu.default.scope)}return ${p}`,this.opts.code.process)d=this.opts.code.process(d,e);let h=Function(`${nu.default.self}`,`${nu.default.scope}`,d)(this,this.scope.get());if(this.scope.value(c,{ref:h}),h.errors=null,h.schema=e.schema,h.schemaEnv=e,e.$async)h.$async=!0;if(this.opts.code.source===!0)h.source={validateName:c,validateCode:p,scopeValues:a._values};if(this.opts.unevaluated){let{props:y,items:x}=u;if(h.evaluated={props:y instanceof Uo.Name?void 0:y,items:x instanceof Uo.Name?void 0:x,dynamicProps:y instanceof Uo.Name,dynamicItems:x instanceof Uo.Name},h.source)h.source.evaluated=(0,Uo.stringify)(h.evaluated)}return e.validate=h,e}catch(p){if(delete e.validate,delete e.validateName,d)this.logger.error("Error compiling schema, function code:",d);throw p}finally{this._compilations.delete(e)}}D8.compileSchema=R6;function Uue(e,t,r){var o;r=(0,Lo.resolveUrl)(this.opts.uriResolver,t,r);let n=e.refs[r];if(n)return n;let i=Fue.call(this,e,r);if(i===void 0){let a=(o=e.localRefs)===null||o===void 0?void 0:o[r],{schemaId:s}=this.opts;if(a)i=new Gh({schema:a,schemaId:s,root:e,baseId:t})}if(i===void 0)return;return e.refs[r]=Lue.call(this,i)}D8.resolveRef=Uue;function Lue(e){if((0,Lo.inlineRef)(e.schema,this.opts.inlineRefs))return e.schema;return e.validate?e:R6.call(this,e)}function B8(e){for(let t of this._compilations)if(jue(t,e))return t}D8.getCompilingSchema=B8;function jue(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function Fue(e,t){let r;while(typeof(r=this.refs[t])=="string")t=r;return r||this.schemas[t]||m_.call(this,e,t)}function m_(e,t){let r=this.opts.uriResolver.parse(t),o=(0,Lo._getFullPath)(this.opts.uriResolver,r),n=(0,Lo.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===n)return A6.call(this,r,e);let i=(0,Lo.normalizeId)(o),a=this.refs[i]||this.schemas[i];if(typeof a=="string"){let s=m_.call(this,e,a);if(typeof(s===null||s===void 0?void 0:s.schema)!=="object")return;return A6.call(this,r,s)}if(typeof(a===null||a===void 0?void 0:a.schema)!=="object")return;if(!a.validate)R6.call(this,a);if(i===(0,Lo.normalizeId)(t)){let{schema:s}=a,{schemaId:c}=this.opts,u=s[c];if(u)n=(0,Lo.resolveUrl)(this.opts.uriResolver,n,u);return new Gh({schema:s,schemaId:c,root:e,baseId:n})}return A6.call(this,r,a)}D8.resolveSchema=m_;var que=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function A6(e,{baseId:t,schema:r,root:o}){var n;if(((n=e.fragment)===null||n===void 0?void 0:n[0])!=="/")return;for(let s of e.fragment.slice(1).split("/")){if(typeof r==="boolean")return;let c=r[(0,M8.unescapeFragment)(s)];if(c===void 0)return;r=c;let u=typeof r==="object"&&r[this.opts.schemaId];if(!que.has(s)&&u)t=(0,Lo.resolveUrl)(this.opts.uriResolver,t,u)}let i;if(typeof r!="boolean"&&r.$ref&&!(0,M8.schemaHasRulesButRef)(r,this.RULES)){let s=(0,Lo.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=m_.call(this,o,s)}let{schemaId:a}=this.opts;if(i=i||new Gh({schema:r,schemaId:a,root:o,baseId:t}),i.schema!==i.root.schema)return i;return}});var L8=re(function(TAe,Wue){Wue.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var C6=re(function(EAe,V8){var Kue=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),F8=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),$6=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),q8=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),Jue=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function O6(e){let t="",r=0,o=0;for(o=0;o<e.length;o++){if(r=e[o].charCodeAt(0),r===48)continue;if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o];break}for(o+=1;o<e.length;o++){if(r=e[o].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[o]}return t}var Yue=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function j8(e){return e.length=0,!0}function Que(e,t,r){if(e.length){let o=O6(e);if(o!=="")t.push(o);else return r.error=!0,!1;e.length=0}return!0}function Xue(e){let t=0,r={error:!1,address:"",zone:""},o=[],n=[],i=!1,a=!1,s=Que;for(let c=0;c<e.length;c++){let u=e[c];if(u==="["||u==="]")continue;if(u===":"){if(i===!0)a=!0;if(!s(n,o,r))break;if(++t>7){r.error=!0;break}if(c>0&&e[c-1]===":")i=!0;o.push(":");continue}else if(u==="%"){if(!s(n,o,r))break;s=j8}else{n.push(u);continue}}if(n.length)if(s===j8)r.zone=n.join("");else if(a)o.push(n.join(""));else o.push(O6(n));return r.address=o.join(""),r}function H8(e){if(ele(e,":")<2)return{host:e,isIPV6:!1};let t=Xue(e);if(!t.error){let{address:r,address:o}=t;if(t.zone)r+="%"+t.zone,o+="%25"+t.zone;return{host:r,isIPV6:!0,escapedHost:o}}else return{host:e,isIPV6:!1}}function ele(e,t){let r=0;for(let o=0;o<e.length;o++)if(e[o]===t)r++;return r}function tle(e){let t=e,r=[],o=-1,n=0;while(n=t.length){if(n===1)if(t===".")break;else if(t==="/"){r.push("/");break}else{r.push(t);break}else if(n===2){if(t[0]==="."){if(t[1]===".")break;else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."||t[1]==="/"){r.push("/");break}}}else if(n===3){if(t==="/.."){if(r.length!==0)r.pop();r.push("/");break}}if(t[0]==="."){if(t[1]==="."){if(t[2]==="/"){t=t.slice(3);continue}}else if(t[1]==="/"){t=t.slice(2);continue}}else if(t[0]==="/"){if(t[1]==="."){if(t[2]==="/"){t=t.slice(2);continue}else if(t[2]==="."){if(t[3]==="/"){if(t=t.slice(3),r.length!==0)r.pop();continue}}}}if((o=t.indexOf("/",1))===-1){r.push(t);break}else r.push(t.slice(0,o)),t=t.slice(o)}return r.join("")}var rle={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},nle=/[@/?#:]/g,ole=/[@/?#]/g;function G8(e,t){let r=t?ole:nle;return r.lastIndex=0,e.replace(r,(o)=>rle[o])}function ile(e,t=!1){if(e.indexOf("%")===-1)return e;let r="";for(let o=0;o<e.length;o++){if(e[o]==="%"&&o+2<e.length){let n=e.slice(o+1,o+3);if($6(n)){let i=n.toUpperCase(),a=String.fromCharCode(parseInt(i,16));if(t&&q8(a))r+=a;else r+="%"+i;o+=2;continue}}r+=e[o]}return r}function ale(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if($6(o)){let n=o.toUpperCase(),i=String.fromCharCode(parseInt(n,16));if(i!=="."&&q8(i))t+=i;else t+="%"+n;r+=2;continue}}if(Jue(e[r]))t+=e[r];else t+=escape(e[r])}return t}function sle(e){let t="";for(let r=0;r<e.length;r++){if(e[r]==="%"&&r+2<e.length){let o=e.slice(r+1,r+3);if($6(o)){t+="%"+o.toUpperCase(),r+=2;continue}}t+=escape(e[r])}return t}function cle(e){let t=[];if(e.userinfo!==void 0)t.push(e.userinfo),t.push("@");if(e.host!==void 0){let r=unescape(e.host);if(!F8(r)){let o=H8(r);if(o.isIPV6===!0)r=`[${o.escapedHost}]`;else r=G8(r,!1)}t.push(r)}if(typeof e.port==="number"||typeof e.port==="string")t.push(":"),t.push(String(e.port));return t.length?t.join(""):void 0}V8.exports={nonSimpleDomain:Yue,recomposeAuthority:cle,reescapeHostDelimiters:G8,normalizePercentEncoding:ile,normalizePathEncoding:ale,escapePreservingEscapes:sle,removeDotSegments:tle,isIPv4:F8,isUUID:Kue,normalizeIPv6:H8,stringArrayToHexStripped:O6}});var Y8=re(function(IAe,J8){var{isUUID:ule}=C6(),lle=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,dle=["http","https","ws","wss","urn","urn:uuid"];function ple(e){return dle.indexOf(e)!==-1}function z6(e){if(e.secure===!0)return!0;else if(e.secure===!1)return!1;else if(e.scheme)return e.scheme.length===3&&(e.scheme[0]==="w"||e.scheme[0]==="W")&&(e.scheme[1]==="s"||e.scheme[1]==="S")&&(e.scheme[2]==="s"||e.scheme[2]==="S");else return!1}function Z8(e){if(!e.host)e.error=e.error||"HTTP URIs must have a host.";return e}function W8(e){let t=String(e.scheme).toLowerCase()==="https";if(e.port===(t?443:80)||e.port==="")e.port=void 0;if(!e.path)e.path="/";return e}function fle(e){return e.secure=z6(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e}function mle(e){if(e.port===(z6(e)?443:80)||e.port==="")e.port=void 0;if(typeof e.secure==="boolean")e.scheme=e.secure?"wss":"ws",e.secure=void 0;if(e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&t!=="/"?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}function hle(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(lle);if(r){let o=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let n=`${o}:${t.nid||e.nid}`,i=N6(n);if(e.path=void 0,i)e=i.parse(e,t)}else e.error=e.error||"URN can not be parsed.";return e}function gle(e,t){if(e.nid===void 0)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,i=N6(n);if(i)e=i.serialize(e,t);let a=e,s=e.nss;return a.path=`${o||t.nid}:${s}`,t.skipEscape=!0,a}function yle(e,t){let r=e;if(r.uuid=r.nss,r.nss=void 0,!t.tolerant&&(!r.uuid||!ule(r.uuid)))r.error=r.error||"UUID is not valid.";return r}function ble(e){let t=e;return t.nss=(e.uuid||"").toLowerCase(),t}var K8={scheme:"http",domainHost:!0,parse:Z8,serialize:W8},xle={scheme:"https",domainHost:K8.domainHost,parse:Z8,serialize:W8},g_={scheme:"ws",domainHost:!0,parse:fle,serialize:mle},vle={scheme:"wss",domainHost:g_.domainHost,parse:g_.parse,serialize:g_.serialize},_le={scheme:"urn",parse:hle,serialize:gle,skipNormalize:!0},wle={scheme:"urn:uuid",parse:yle,serialize:ble,skipNormalize:!0},y_={http:K8,https:xle,ws:g_,wss:vle,urn:_le,"urn:uuid":wle};Object.setPrototypeOf(y_,null);function N6(e){return e&&(y_[e]||y_[e.toLowerCase()])||void 0}J8.exports={wsIsSecure:z6,SCHEMES:y_,isValidSchemeName:ple,getSchemeHandler:N6}});var nL=re(function(PAe,b_){var{normalizeIPv6:Sle,removeDotSegments:Vh,recomposeAuthority:Tle,normalizePercentEncoding:Ele,normalizePathEncoding:Ile,escapePreservingEscapes:Ple,reescapeHostDelimiters:kle,isIPv4:Ale,nonSimpleDomain:Rle}=C6(),{SCHEMES:$le,getSchemeHandler:X8}=Y8();function Ole(e,t){if(typeof e==="string")e=Ble(e,t);else if(typeof e==="object")e=zd(ou(e,t),t);return e}function Cle(e,t,r){let o=r?Object.assign({scheme:"null"},r):{scheme:"null"},n=eL(zd(e,o),zd(t,o),o,!0);return o.skipEscape=!0,ou(n,o)}function eL(e,t,r,o){let n={};if(!o)e=zd(ou(e,r),r),t=zd(ou(t,r),r);if(r=r||{},!r.tolerant&&t.scheme)n.scheme=t.scheme,n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=Vh(t.path||""),n.query=t.query;else{if(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)n.userinfo=t.userinfo,n.host=t.host,n.port=t.port,n.path=Vh(t.path||""),n.query=t.query;else{if(!t.path)if(n.path=e.path,t.query!==void 0)n.query=t.query;else n.query=e.query;else{if(t.path[0]==="/")n.path=Vh(t.path);else{if((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path)n.path="/"+t.path;else if(!e.path)n.path=t.path;else n.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path;n.path=Vh(n.path)}n.query=t.query}n.userinfo=e.userinfo,n.host=e.host,n.port=e.port}n.scheme=e.scheme}return n.fragment=t.fragment,n}function zle(e,t,r){let o=Q8(e,r),n=Q8(t,r);return o!==void 0&&n!==void 0&&o.toLowerCase()===n.toLowerCase()}function ou(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},o=Object.assign({},t),n=[],i=X8(o.scheme||r.scheme);if(i&&i.serialize)i.serialize(r,o);if(r.path!==void 0)if(!o.skipEscape){if(r.path=Ple(r.path),r.scheme!==void 0)r.path=r.path.split("%3A").join(":")}else r.path=Ele(r.path);if(o.reference!=="suffix"&&r.scheme)n.push(r.scheme,":");let a=Tle(r);if(a!==void 0){if(o.reference!=="suffix")n.push("//");if(n.push(a),r.path&&r.path[0]!=="/")n.push("/")}if(r.path!==void 0){let s=r.path;if(!o.absolutePath&&(!i||!i.absolutePath))s=Vh(s);if(a===void 0&&s[0]==="/"&&s[1]==="/")s="/%2F"+s.slice(2);n.push(s)}if(r.query!==void 0)n.push("?",r.query);if(r.fragment!==void 0)n.push("#",r.fragment);return n.join("")}var Nle=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Mle(e,t){if(t[2]!==void 0&&e.path&&e.path[0]!=="/")return'URI path must start with "/" when authority is present.';if(typeof e.port==="number"&&(e.port<0||e.port>65535))return"URI port is malformed.";return}function tL(e,t){let r=Object.assign({},t),o={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},n=!1,i=!1;if(r.reference==="suffix")if(r.scheme)e=r.scheme+":"+e;else e="//"+e;let a=e.match(Nle);if(a){if(o.scheme=a[1],o.userinfo=a[3],o.host=a[4],o.port=parseInt(a[5],10),o.path=a[6]||"",o.query=a[7],o.fragment=a[8],isNaN(o.port))o.port=a[5];let s=Mle(o,a);if(s!==void 0)o.error=o.error||s,n=!0;if(o.host)if(Ale(o.host)===!1){let d=Sle(o.host);o.host=d.host.toLowerCase(),i=d.isIPV6}else i=!0;if(o.scheme===void 0&&o.userinfo===void 0&&o.host===void 0&&o.port===void 0&&o.query===void 0&&!o.path)o.reference="same-document";else if(o.scheme===void 0)o.reference="relative";else if(o.fragment===void 0)o.reference="absolute";else o.reference="uri";if(r.reference&&r.reference!=="suffix"&&r.reference!==o.reference)o.error=o.error||"URI is not a "+r.reference+" reference.";let c=X8(r.scheme||o.scheme);if(!r.unicodeSupport&&(!c||!c.unicodeSupport)){if(o.host&&(r.domainHost||c&&c.domainHost)&&i===!1&&Rle(o.host))try{o.host=URL.domainToASCII(o.host.toLowerCase())}catch(u){o.error=o.error||"Host's domain name can not be converted to ASCII: "+u}}if(!c||c&&!c.skipNormalize){if(e.indexOf("%")!==-1){if(o.scheme!==void 0)o.scheme=unescape(o.scheme);if(o.host!==void 0)o.host=kle(unescape(o.host),i)}if(o.path)o.path=Ile(o.path);if(o.fragment)try{o.fragment=encodeURI(decodeURIComponent(o.fragment))}catch{o.error=o.error||"URI malformed"}}if(c&&c.parse)c.parse(o,r)}else o.error=o.error||"URI can not be parsed.";return{parsed:o,malformedAuthorityOrPort:n}}function zd(e,t){return tL(e,t).parsed}function Ble(e,t){return rL(e,t).normalized}function rL(e,t){let{parsed:r,malformedAuthorityOrPort:o}=tL(e,t);return{normalized:o?e:ou(r,t),malformedAuthorityOrPort:o}}function Q8(e,t){if(typeof e==="string"){let{normalized:r,malformedAuthorityOrPort:o}=rL(e,t);return o?void 0:r}if(typeof e==="object")return ou(e,t)}var M6={SCHEMES:$le,normalize:Ole,resolve:Cle,resolveComponent:eL,equal:zle,serialize:ou,parse:zd};b_.exports=M6;b_.exports.default=M6;b_.exports.fastUri=M6});var aL=re(function(iL){Object.defineProperty(iL,"__esModule",{value:!0});var oL=nL();oL.code='require("ajv/dist/runtime/uri").default';iL.default=oL});var mL=re(function(ma){Object.defineProperty(ma,"__esModule",{value:!0});ma.CodeGen=ma.Name=ma.nil=ma.stringify=ma.str=ma._=ma.KeywordCxt=void 0;var Ule=qh();Object.defineProperty(ma,"KeywordCxt",{enumerable:!0,get:function(){return Ule.KeywordCxt}});var Nd=rt();Object.defineProperty(ma,"_",{enumerable:!0,get:function(){return Nd._}});Object.defineProperty(ma,"str",{enumerable:!0,get:function(){return Nd.str}});Object.defineProperty(ma,"stringify",{enumerable:!0,get:function(){return Nd.stringify}});Object.defineProperty(ma,"nil",{enumerable:!0,get:function(){return Nd.nil}});Object.defineProperty(ma,"Name",{enumerable:!0,get:function(){return Nd.Name}});Object.defineProperty(ma,"CodeGen",{enumerable:!0,get:function(){return Nd.CodeGen}});var Lle=f_(),dL=Hh(),jle=m6(),Zh=h_(),Fle=rt(),Wh=Lh(),x_=Uh(),D6=ft(),sL=L8(),qle=aL(),pL=(e,t)=>new RegExp(e,t);pL.code="new RegExp";var Hle=["removeAdditional","useDefaults","coerceTypes"],Gle=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Vle={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},Zle={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},cL=200;function Wle(e){var t,r,o,n,i,a,s,c,u,d,p,m,h,y,x,S,v,E,w,_,T,k,O,z,L;let P=e.strict,F=(t=e.code)===null||t===void 0?void 0:t.optimize,G=F===!0||F===void 0?1:F||0,ue=(o=(r=e.code)===null||r===void 0?void 0:r.regExp)!==null&&o!==void 0?o:pL,W=(n=e.uriResolver)!==null&&n!==void 0?n:qle.default;return{strictSchema:(a=(i=e.strictSchema)!==null&&i!==void 0?i:P)!==null&&a!==void 0?a:!0,strictNumbers:(c=(s=e.strictNumbers)!==null&&s!==void 0?s:P)!==null&&c!==void 0?c:!0,strictTypes:(d=(u=e.strictTypes)!==null&&u!==void 0?u:P)!==null&&d!==void 0?d:"log",strictTuples:(m=(p=e.strictTuples)!==null&&p!==void 0?p:P)!==null&&m!==void 0?m:"log",strictRequired:(y=(h=e.strictRequired)!==null&&h!==void 0?h:P)!==null&&y!==void 0?y:!1,code:e.code?{...e.code,optimize:G,regExp:ue}:{optimize:G,regExp:ue},loopRequired:(x=e.loopRequired)!==null&&x!==void 0?x:cL,loopEnum:(S=e.loopEnum)!==null&&S!==void 0?S:cL,meta:(v=e.meta)!==null&&v!==void 0?v:!0,messages:(E=e.messages)!==null&&E!==void 0?E:!0,inlineRefs:(w=e.inlineRefs)!==null&&w!==void 0?w:!0,schemaId:(_=e.schemaId)!==null&&_!==void 0?_:"$id",addUsedSchema:(T=e.addUsedSchema)!==null&&T!==void 0?T:!0,validateSchema:(k=e.validateSchema)!==null&&k!==void 0?k:!0,validateFormats:(O=e.validateFormats)!==null&&O!==void 0?O:!0,unicodeRegExp:(z=e.unicodeRegExp)!==null&&z!==void 0?z:!0,int32range:(L=e.int32range)!==null&&L!==void 0?L:!0,uriResolver:W}}class v_{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Wle(e)};let{es5:t,lines:r}=this.opts.code;this.scope=new Fle.ValueScope({scope:{},prefixes:Gle,es5:t,lines:r}),this.logger=ede(e.logger);let o=e.validateFormats;if(e.validateFormats=!1,this.RULES=(0,jle.getRules)(),uL.call(this,Vle,e,"NOT SUPPORTED"),uL.call(this,Zle,e,"DEPRECATED","warn"),this._metaOpts=Qle.call(this),e.formats)Jle.call(this);if(this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords)Yle.call(this,e.keywords);if(typeof e.meta=="object")this.addMetaSchema(e.meta);Kle.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,o=sL;if(r==="id")o={...sL},o.id=o.$id,delete o.$id;if(t&&e)this.addMetaSchema(o,o[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[t]||e:void 0}validate(e,t){let r;if(typeof e=="string"){if(r=this.getSchema(e),!r)throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let o=r(t);if(!("$async"in r))this.errors=r.errors;return o}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if(typeof this.opts.loadSchema!="function")throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(u,d){await n.call(this,u.$schema);let p=this._addSchema(u,d);return p.validate||i.call(this,p)}async function n(u){if(u&&!this.getSchema(u))await o.call(this,{$ref:u},!0)}async function i(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof dL.default))throw d;return a.call(this,d),await s.call(this,d.missingSchema),i.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function s(u){let d=await c.call(this,u);if(!this.refs[u])await n.call(this,d.$schema);if(!this.refs[u])this.addSchema(d,u,t)}async function c(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=r(u))}finally{delete this._loading[u]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,r,o);return this}let n;if(typeof e==="object"){let{schemaId:i}=this.opts;if(n=e[i],n!==void 0&&typeof n!="string")throw Error(`schema ${i} must be string`)}return t=(0,Wh.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if(typeof e=="boolean")return!0;let r;if(r=e.$schema,r!==void 0&&typeof r!="string")throw Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let o=this.validate(r,e);if(!o&&t){let n="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(n);else throw Error(n)}return o}getSchema(e){let t;while(typeof(t=lL.call(this,e))=="string")e=t;if(t===void 0){let{schemaId:r}=this.opts,o=new Zh.SchemaEnv({schema:{},schemaId:r});if(t=Zh.resolveSchema.call(this,o,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=lL.call(this,e);if(typeof t=="object")this._cache.delete(t.schema);return delete this.schemas[e],delete this.refs[e],this}case"object":{let t=e;this._cache.delete(t);let r=e[this.opts.schemaId];if(r)r=(0,Wh.normalizeId)(r),delete this.schemas[r],delete this.refs[r];return this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if(typeof e=="string"){if(r=e,typeof t=="object")this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r}else if(typeof e=="object"&&t===void 0){if(t=e,r=t.keyword,Array.isArray(r)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(rde.call(this,r,t),!t)return(0,D6.eachItem)(r,(n)=>B6.call(this,n)),this;ode.call(this,t);let o={...t,type:(0,x_.getJSONTypes)(t.type),schemaType:(0,x_.getJSONTypes)(t.schemaType)};return(0,D6.eachItem)(r,o.type.length===0?(n)=>B6.call(this,n,o):(n)=>o.type.forEach((i)=>B6.call(this,n,o,i))),this}getKeyword(e){let t=this.RULES.all[e];return typeof t=="object"?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(let r of t.rules){let o=r.rules.findIndex((n)=>n.keyword===e);if(o>=0)r.rules.splice(o,1)}return this}addFormat(e,t){if(typeof t=="string")t=new RegExp(t);return this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){if(!e||e.length===0)return"No errors";return e.map((o)=>`${r}${o.instancePath} ${o.message}`).reduce((o,n)=>o+t+n)}$dataMetaSchema(e,t){let r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of t){let n=o.split("/").slice(1),i=e;for(let a of n)i=i[a];for(let a in r){let s=r[a];if(typeof s!="object")continue;let{$data:c}=s.definition,u=i[a];if(c&&u)i[a]=fL(u)}}return e}_removeAllSchemas(e,t){for(let r in e){let o=e[r];if(!t||t.test(r)){if(typeof o=="string")delete e[r];else if(o&&!o.meta)this._cache.delete(o.schema),delete e[r]}}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else if(this.opts.jtd)throw Error("schema must be object");else if(typeof e!="boolean")throw Error("schema must be object or boolean");let s=this._cache.get(e);if(s!==void 0)return s;r=(0,Wh.normalizeId)(i||r);let c=Wh.getSchemaRefs.call(this,e,r);if(s=new Zh.SchemaEnv({schema:e,schemaId:a,meta:t,baseId:r,localRefs:c}),this._cache.set(s.schema,s),n&&!r.startsWith("#")){if(r)this._checkUnique(r);this.refs[r]=s}if(o)this.validateSchema(e,!0);return s}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta)this._compileMetaSchema(e);else Zh.compileSchema.call(this,e);if(!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{Zh.compileSchema.call(this,e)}finally{this.opts=t}}}v_.ValidationError=Lle.default;v_.MissingRefError=dL.default;ma.default=v_;function uL(e,t,r,o="error"){for(let n in e){let i=n;if(i in t)this.logger[o](`${r}: option ${n}. ${e[i]}`)}}function lL(e){return e=(0,Wh.normalizeId)(e),this.schemas[e]||this.refs[e]}function Kle(){let e=this.opts.schemas;if(!e)return;if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function Jle(){for(let e in this.opts.formats){let t=this.opts.formats[e];if(t)this.addFormat(e,t)}}function Yle(e){if(Array.isArray(e)){this.addVocabulary(e);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let t in e){let r=e[t];if(!r.keyword)r.keyword=t;this.addKeyword(r)}}function Qle(){let e={...this.opts};for(let t of Hle)delete e[t];return e}var Xle={log(){},warn(){},error(){}};function ede(e){if(e===!1)return Xle;if(e===void 0)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}var tde=/^[a-z_$][a-z0-9_$:-]*$/i;function rde(e,t){let{RULES:r}=this;if((0,D6.eachItem)(e,(o)=>{if(r.keywords[o])throw Error(`Keyword ${o} is already defined`);if(!tde.test(o))throw Error(`Keyword ${o} has invalid name`)}),!t)return;if(t.$data&&!(("code"in t)||("validate"in t)))throw Error('$data keyword must have "code" or "validate" function')}function B6(e,t,r){var o;let n=t===null||t===void 0?void 0:t.post;if(r&&n)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,a=n?i.post:i.rules.find(({type:c})=>c===r);if(!a)a={type:r,rules:[]},i.rules.push(a);if(i.keywords[e]=!0,!t)return;let s={keyword:e,definition:{...t,type:(0,x_.getJSONTypes)(t.type),schemaType:(0,x_.getJSONTypes)(t.schemaType)}};if(t.before)nde.call(this,a,s,t.before);else a.rules.push(s);i.all[e]=s,(o=t.implements)===null||o===void 0||o.forEach((c)=>this.addKeyword(c))}function nde(e,t,r){let o=e.rules.findIndex((n)=>n.keyword===r);if(o>=0)e.rules.splice(o,0,t);else e.rules.push(t),this.logger.warn(`rule ${r} is not defined`)}function ode(e){let{metaSchema:t}=e;if(t===void 0)return;if(e.$data&&this.opts.$data)t=fL(t);e.validateSchema=this.compile(t,!0)}var ide={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function fL(e){return{anyOf:[e,ide]}}});var gL=re(function(hL){Object.defineProperty(hL,"__esModule",{value:!0});var cde={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};hL.default=cde});var wL=re(function(vL){Object.defineProperty(vL,"__esModule",{value:!0});vL.callRef=vL.getValidate=void 0;var lde=Hh(),yL=co(),Mn=rt(),Md=pa(),bL=h_(),__=ft(),dde={keyword:"$ref",schemaType:"string",code(e){let{gen:t,schema:r,it:o}=e,{baseId:n,schemaEnv:i,validateName:a,opts:s,self:c}=o,{root:u}=i;if((r==="#"||r==="#/")&&n===u.baseId)return p();let d=bL.resolveRef.call(c,u,n,r);if(d===void 0)throw new lde.default(o.opts.uriResolver,n,r);if(d instanceof bL.SchemaEnv)return m(d);return h(d);function p(){if(i===u)return w_(e,a,i,i.$async);let y=t.scopeValue("root",{ref:u});return w_(e,Mn._`${y}.validate`,u,u.$async)}function m(y){let x=xL(e,y);w_(e,x,y,y.$async)}function h(y){let x=t.scopeValue("schema",s.code.source===!0?{ref:y,code:(0,Mn.stringify)(y)}:{ref:y}),S=t.name("valid"),v=e.subschema({schema:y,dataTypes:[],schemaPath:Mn.nil,topSchemaRef:x,errSchemaPath:r},S);e.mergeEvaluated(v),e.ok(S)}}};function xL(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):Mn._`${r.scopeValue("wrapper",{ref:t})}.validate`}vL.getValidate=xL;function w_(e,t,r,o){let{gen:n,it:i}=e,{allErrors:a,schemaEnv:s,opts:c}=i,u=c.passContext?Md.default.this:Mn.nil;if(o)d();else p();function d(){if(!s.$async)throw Error("async schema referenced by sync schema");let y=n.let("valid");n.try(()=>{if(n.code(Mn._`await ${(0,yL.callValidateCode)(e,t,u)}`),h(t),!a)n.assign(y,!0)},(x)=>{if(n.if(Mn._`!(${x} instanceof ${i.ValidationError})`,()=>n.throw(x)),m(x),!a)n.assign(y,!1)}),e.ok(y)}function p(){e.result((0,yL.callValidateCode)(e,t,u),()=>h(t),()=>m(t))}function m(y){let x=Mn._`${y}.errors`;n.assign(Md.default.vErrors,Mn._`${Md.default.vErrors} === null ? ${x} : ${Md.default.vErrors}.concat(${x})`),n.assign(Md.default.errors,Mn._`${Md.default.vErrors}.length`)}function h(y){var x;if(!i.opts.unevaluated)return;let S=(x=r===null||r===void 0?void 0:r.validate)===null||x===void 0?void 0:x.evaluated;if(i.props!==!0)if(S&&!S.dynamicProps){if(S.props!==void 0)i.props=__.mergeEvaluated.props(n,S.props,i.props)}else{let v=n.var("props",Mn._`${y}.evaluated.props`);i.props=__.mergeEvaluated.props(n,v,i.props,Mn.Name)}if(i.items!==!0)if(S&&!S.dynamicItems){if(S.items!==void 0)i.items=__.mergeEvaluated.items(n,S.items,i.items)}else{let v=n.var("items",Mn._`${y}.evaluated.items`);i.items=__.mergeEvaluated.items(n,v,i.items,Mn.Name)}}}vL.callRef=w_;vL.default=dde});var TL=re(function(SL){Object.defineProperty(SL,"__esModule",{value:!0});var mde=gL(),hde=wL(),gde=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",mde.default,hde.default];SL.default=gde});var IL=re(function(EL){Object.defineProperty(EL,"__esModule",{value:!0});var S_=rt(),Ns=S_.operators,T_={maximum:{okStr:"<=",ok:Ns.LTE,fail:Ns.GT},minimum:{okStr:">=",ok:Ns.GTE,fail:Ns.LT},exclusiveMaximum:{okStr:"<",ok:Ns.LT,fail:Ns.GTE},exclusiveMinimum:{okStr:">",ok:Ns.GT,fail:Ns.LTE}},bde={message:({keyword:e,schemaCode:t})=>S_.str`must be ${T_[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>S_._`{comparison: ${T_[e].okStr}, limit: ${t}}`},xde={keyword:Object.keys(T_),type:"number",schemaType:"number",$data:!0,error:bde,code(e){let{keyword:t,data:r,schemaCode:o}=e;e.fail$data(S_._`${r} ${T_[t].fail} ${o} || isNaN(${r})`)}};EL.default=xde});var kL=re(function(PL){Object.defineProperty(PL,"__esModule",{value:!0});var Kh=rt(),_de={message:({schemaCode:e})=>Kh.str`must be multiple of ${e}`,params:({schemaCode:e})=>Kh._`{multipleOf: ${e}}`},wde={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:_de,code(e){let{gen:t,data:r,schemaCode:o,it:n}=e,i=n.opts.multipleOfPrecision,a=t.let("res"),s=i?Kh._`Math.abs(Math.round(${a}) - ${a}) > 1e-${i}`:Kh._`${a} !== parseInt(${a})`;e.fail$data(Kh._`(${o} === 0 || (${a} = ${r}/${o}, ${s}))`)}};PL.default=wde});var $L=re(function(RL){Object.defineProperty(RL,"__esModule",{value:!0});function AL(e){let t=e.length,r=0,o=0,n;while(o<t)if(r++,n=e.charCodeAt(o++),n>=55296&&n<=56319&&o<t){if(n=e.charCodeAt(o),(n&64512)===56320)o++}return r}RL.default=AL;AL.code='require("ajv/dist/runtime/ucs2length").default'});var CL=re(function(OL){Object.defineProperty(OL,"__esModule",{value:!0});var iu=rt(),Ede=ft(),Ide=$L(),Pde={message({keyword:e,schemaCode:t}){let r=e==="maxLength"?"more":"fewer";return iu.str`must NOT have ${r} than ${t} characters`},params:({schemaCode:e})=>iu._`{limit: ${e}}`},kde={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Pde,code(e){let{keyword:t,data:r,schemaCode:o,it:n}=e,i=t==="maxLength"?iu.operators.GT:iu.operators.LT,a=n.opts.unicode===!1?iu._`${r}.length`:iu._`${(0,Ede.useFunc)(e.gen,Ide.default)}(${r})`;e.fail$data(iu._`${a} ${i} ${o}`)}};OL.default=kde});var NL=re(function(zL){Object.defineProperty(zL,"__esModule",{value:!0});var Rde=co(),$de=ft(),Bd=rt(),Ode={message:({schemaCode:e})=>Bd.str`must match pattern "${e}"`,params:({schemaCode:e})=>Bd._`{pattern: ${e}}`},Cde={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:Ode,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:i,it:a}=e,s=a.opts.unicodeRegExp?"u":"";if(o){let{regExp:c}=a.opts.code,u=c.code==="new RegExp"?Bd._`new RegExp`:(0,$de.useFunc)(t,c),d=t.let("valid");t.try(()=>t.assign(d,Bd._`${u}(${i}, ${s}).test(${r})`),()=>t.assign(d,!1)),e.fail$data(Bd._`!${d}`)}else{let c=(0,Rde.usePattern)(e,n);e.fail$data(Bd._`!${c}.test(${r})`)}}};zL.default=Cde});var BL=re(function(ML){Object.defineProperty(ML,"__esModule",{value:!0});var Jh=rt(),Nde={message({keyword:e,schemaCode:t}){let r=e==="maxProperties"?"more":"fewer";return Jh.str`must NOT have ${r} than ${t} properties`},params:({schemaCode:e})=>Jh._`{limit: ${e}}`},Mde={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Nde,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxProperties"?Jh.operators.GT:Jh.operators.LT;e.fail$data(Jh._`Object.keys(${r}).length ${n} ${o}`)}};ML.default=Mde});var UL=re(function(DL){Object.defineProperty(DL,"__esModule",{value:!0});var Yh=co(),Qh=rt(),Dde=ft(),Ude={message:({params:{missingProperty:e}})=>Qh.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>Qh._`{missingProperty: ${e}}`},Lde={keyword:"required",type:"object",schemaType:"array",$data:!0,error:Ude,code(e){let{gen:t,schema:r,schemaCode:o,data:n,$data:i,it:a}=e,{opts:s}=a;if(!i&&r.length===0)return;let c=r.length>=s.loopRequired;if(a.allErrors)u();else d();if(s.strictRequired){let h=e.parentSchema.properties,{definedProperties:y}=e.it;for(let x of r)if((h===null||h===void 0?void 0:h[x])===void 0&&!y.has(x)){let S=a.schemaEnv.baseId+a.errSchemaPath,v=`required property "${x}" is not defined at "${S}" (strictRequired)`;(0,Dde.checkStrictMode)(a,v,a.opts.strictRequired)}}function u(){if(c||i)e.block$data(Qh.nil,p);else for(let h of r)(0,Yh.checkReportMissingProp)(e,h)}function d(){let h=t.let("missing");if(c||i){let y=t.let("valid",!0);e.block$data(y,()=>m(h,y)),e.ok(y)}else t.if((0,Yh.checkMissingProp)(e,r,h)),(0,Yh.reportMissingProp)(e,h),t.else()}function p(){t.forOf("prop",o,(h)=>{e.setParams({missingProperty:h}),t.if((0,Yh.noPropertyInData)(t,n,h,s.ownProperties),()=>e.error())})}function m(h,y){e.setParams({missingProperty:h}),t.forOf(h,o,()=>{t.assign(y,(0,Yh.propertyInData)(t,n,h,s.ownProperties)),t.if((0,Qh.not)(y),()=>{e.error(),t.break()})},Qh.nil)}}};DL.default=Lde});var jL=re(function(LL){Object.defineProperty(LL,"__esModule",{value:!0});var Xh=rt(),Fde={message({keyword:e,schemaCode:t}){let r=e==="maxItems"?"more":"fewer";return Xh.str`must NOT have ${r} than ${t} items`},params:({schemaCode:e})=>Xh._`{limit: ${e}}`},qde={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:Fde,code(e){let{keyword:t,data:r,schemaCode:o}=e,n=t==="maxItems"?Xh.operators.GT:Xh.operators.LT;e.fail$data(Xh._`${r}.length ${n} ${o}`)}};LL.default=qde});var E_=re(function(qL){Object.defineProperty(qL,"__esModule",{value:!0});var FL=w6();FL.code='require("ajv/dist/runtime/equal").default';qL.default=FL});var GL=re(function(HL){Object.defineProperty(HL,"__esModule",{value:!0});var U6=Uh(),Lr=rt(),Vde=ft(),Zde=E_(),Wde={message:({params:{i:e,j:t}})=>Lr.str`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>Lr._`{i: ${e}, j: ${t}}`},Kde={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Wde,code(e){let{gen:t,data:r,$data:o,schema:n,parentSchema:i,schemaCode:a,it:s}=e;if(!o&&!n)return;let c=t.let("valid"),u=i.items?(0,U6.getSchemaTypes)(i.items):[];e.block$data(c,d,Lr._`${a} === false`),e.ok(c);function d(){let y=t.let("i",Lr._`${r}.length`),x=t.let("j");e.setParams({i:y,j:x}),t.assign(c,!0),t.if(Lr._`${y} > 1`,()=>(p()?m:h)(y,x))}function p(){return u.length>0&&!u.some((y)=>y==="object"||y==="array")}function m(y,x){let S=t.name("item"),v=(0,U6.checkDataTypes)(u,S,s.opts.strictNumbers,U6.DataType.Wrong),E=t.const("indices",Lr._`{}`);t.for(Lr._`;${y}--;`,()=>{if(t.let(S,Lr._`${r}[${y}]`),t.if(v,Lr._`continue`),u.length>1)t.if(Lr._`typeof ${S} == "string"`,Lr._`${S} += "_"`);t.if(Lr._`typeof ${E}[${S}] == "number"`,()=>{t.assign(x,Lr._`${E}[${S}]`),e.error(),t.assign(c,!1).break()}).code(Lr._`${E}[${S}] = ${y}`)})}function h(y,x){let S=(0,Vde.useFunc)(t,Zde.default),v=t.name("outer");t.label(v).for(Lr._`;${y}--;`,()=>t.for(Lr._`${x} = ${y}; ${x}--;`,()=>t.if(Lr._`${S}(${r}[${y}], ${r}[${x}])`,()=>{e.error(),t.assign(c,!1).break(v)})))}}};HL.default=Kde});var ZL=re(function(VL){Object.defineProperty(VL,"__esModule",{value:!0});var L6=rt(),Yde=ft(),Qde=E_(),Xde={message:"must be equal to constant",params:({schemaCode:e})=>L6._`{allowedValue: ${e}}`},epe={keyword:"const",$data:!0,error:Xde,code(e){let{gen:t,data:r,$data:o,schemaCode:n,schema:i}=e;if(o||i&&typeof i=="object")e.fail$data(L6._`!${(0,Yde.useFunc)(t,Qde.default)}(${r}, ${n})`);else e.fail(L6._`${i} !== ${r}`)}};VL.default=epe});var KL=re(function(WL){Object.defineProperty(WL,"__esModule",{value:!0});var eg=rt(),rpe=ft(),npe=E_(),ope={message:"must be equal to one of the allowed values",params:({schemaCode:e})=>eg._`{allowedValues: ${e}}`},ipe={keyword:"enum",schemaType:"array",$data:!0,error:ope,code(e){let{gen:t,data:r,$data:o,schema:n,schemaCode:i,it:a}=e;if(!o&&n.length===0)throw Error("enum must have non-empty array");let s=n.length>=a.opts.loopEnum,c,u=()=>c!==null&&c!==void 0?c:c=(0,rpe.useFunc)(t,npe.default),d;if(s||o)d=t.let("valid"),e.block$data(d,p);else{if(!Array.isArray(n))throw Error("ajv implementation error");let h=t.const("vSchema",i);d=(0,eg.or)(...n.map((y,x)=>m(h,x)))}e.pass(d);function p(){t.assign(d,!1),t.forOf("v",i,(h)=>t.if(eg._`${u()}(${r}, ${h})`,()=>t.assign(d,!0).break()))}function m(h,y){let x=n[y];return typeof x==="object"&&x!==null?eg._`${u()}(${r}, ${h}[${y}])`:eg._`${r} === ${x}`}}};WL.default=ipe});var YL=re(function(JL){Object.defineProperty(JL,"__esModule",{value:!0});var spe=IL(),cpe=kL(),upe=CL(),lpe=NL(),dpe=BL(),ppe=UL(),fpe=jL(),mpe=GL(),hpe=ZL(),gpe=KL(),ype=[spe.default,cpe.default,upe.default,lpe.default,dpe.default,ppe.default,fpe.default,mpe.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},hpe.default,gpe.default];JL.default=ype});var F6=re(function(XL){Object.defineProperty(XL,"__esModule",{value:!0});XL.validateAdditionalItems=void 0;var au=rt(),j6=ft(),xpe={message:({params:{len:e}})=>au.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>au._`{limit: ${e}}`},vpe={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:xpe,code(e){let{parentSchema:t,it:r}=e,{items:o}=t;if(!Array.isArray(o)){(0,j6.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}QL(e,o)}};function QL(e,t){let{gen:r,schema:o,data:n,keyword:i,it:a}=e;a.items=!0;let s=r.const("len",au._`${n}.length`);if(o===!1)e.setParams({len:t.length}),e.pass(au._`${s} <= ${t.length}`);else if(typeof o=="object"&&!(0,j6.alwaysValidSchema)(a,o)){let u=r.var("valid",au._`${s} <= ${t.length}`);r.if((0,au.not)(u),()=>c(u)),e.ok(u)}function c(u){r.forRange("i",t.length,s,(d)=>{if(e.subschema({keyword:i,dataProp:d,dataPropType:j6.Type.Num},u),!a.allErrors)r.if((0,au.not)(u),()=>r.break())})}}XL.validateAdditionalItems=QL;XL.default=vpe});var q6=re(function(nj){Object.defineProperty(nj,"__esModule",{value:!0});nj.validateTuple=void 0;var tj=rt(),I_=ft(),wpe=co(),Spe={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return rj(e,"additionalItems",t);if(r.items=!0,(0,I_.alwaysValidSchema)(r,t))return;e.ok((0,wpe.validateArray)(e))}};function rj(e,t,r=e.schema){let{gen:o,parentSchema:n,data:i,keyword:a,it:s}=e;if(d(n),s.opts.unevaluated&&r.length&&s.items!==!0)s.items=I_.mergeEvaluated.items(o,r.length,s.items);let c=o.name("valid"),u=o.const("len",tj._`${i}.length`);r.forEach((p,m)=>{if((0,I_.alwaysValidSchema)(s,p))return;o.if(tj._`${u} > ${m}`,()=>e.subschema({keyword:a,schemaProp:m,dataProp:m},c)),e.ok(c)});function d(p){let{opts:m,errSchemaPath:h}=s,y=r.length,x=y===p.minItems&&(y===p.maxItems||p[t]===!1);if(m.strictTuples&&!x){let S=`"${a}" is ${y}-tuple, but minItems or maxItems/${t} are not specified or different at path "${h}"`;(0,I_.checkStrictMode)(s,S,m.strictTuples)}}}nj.validateTuple=rj;nj.default=Spe});var aj=re(function(ij){Object.defineProperty(ij,"__esModule",{value:!0});var Epe=q6(),Ipe={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:(e)=>(0,Epe.validateTuple)(e,"items")};ij.default=Ipe});var uj=re(function(cj){Object.defineProperty(cj,"__esModule",{value:!0});var sj=rt(),kpe=ft(),Ape=co(),Rpe=F6(),$pe={message:({params:{len:e}})=>sj.str`must NOT have more than ${e} items`,params:({params:{len:e}})=>sj._`{limit: ${e}}`},Ope={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:$pe,code(e){let{schema:t,parentSchema:r,it:o}=e,{prefixItems:n}=r;if(o.items=!0,(0,kpe.alwaysValidSchema)(o,t))return;if(n)(0,Rpe.validateAdditionalItems)(e,n);else e.ok((0,Ape.validateArray)(e))}};cj.default=Ope});var dj=re(function(lj){Object.defineProperty(lj,"__esModule",{value:!0});var uo=rt(),P_=ft(),zpe={message:({params:{min:e,max:t}})=>t===void 0?uo.str`must contain at least ${e} valid item(s)`:uo.str`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>t===void 0?uo._`{minContains: ${e}}`:uo._`{minContains: ${e}, maxContains: ${t}}`},Npe={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:zpe,code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:i}=e,a,s,{minContains:c,maxContains:u}=o;if(i.opts.next)a=c===void 0?1:c,s=u;else a=1;let d=t.const("len",uo._`${n}.length`);if(e.setParams({min:a,max:s}),s===void 0&&a===0){(0,P_.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(s!==void 0&&a>s){(0,P_.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,P_.alwaysValidSchema)(i,r)){let x=uo._`${d} >= ${a}`;if(s!==void 0)x=uo._`${x} && ${d} <= ${s}`;e.pass(x);return}i.items=!0;let p=t.name("valid");if(s===void 0&&a===1)h(p,()=>t.if(p,()=>t.break()));else if(a===0){if(t.let(p,!0),s!==void 0)t.if(uo._`${n}.length > 0`,m)}else t.let(p,!1),m();e.result(p,()=>e.reset());function m(){let x=t.name("_valid"),S=t.let("count",0);h(x,()=>t.if(x,()=>y(S)))}function h(x,S){t.forRange("i",0,d,(v)=>{e.subschema({keyword:"contains",dataProp:v,dataPropType:P_.Type.Num,compositeRule:!0},x),S()})}function y(x){if(t.code(uo._`${x}++`),s===void 0)t.if(uo._`${x} >= ${a}`,()=>t.assign(p,!0).break());else if(t.if(uo._`${x} > ${s}`,()=>t.assign(p,!1).break()),a===1)t.assign(p,!0);else t.if(uo._`${x} >= ${a}`,()=>t.assign(p,!0))}}};lj.default=Npe});var yj=re(function(mj){Object.defineProperty(mj,"__esModule",{value:!0});mj.validateSchemaDeps=mj.validatePropertyDeps=mj.error=void 0;var H6=rt(),Bpe=ft(),tg=co();mj.error={message:({params:{property:e,depsCount:t,deps:r}})=>{let o=t===1?"property":"properties";return H6.str`must have ${o} ${r} when property ${e} is present`},params:({params:{property:e,depsCount:t,deps:r,missingProperty:o}})=>H6._`{property: ${e},
|
|
24
24
|
missingProperty: ${o},
|
|
25
25
|
depsCount: ${t},
|
|
26
|
-
deps: ${r}}`};var Dpe={keyword:"dependencies",type:"object",schemaType:"object",error:mj.error,code(e){let[t,r]=Upe(e);pj(e,t),fj(e,r)}};function Upe({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function pj(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,tg.propertyInData)(r,o,a,n.opts.ownProperties);if(e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),n.allErrors)r.if(c,()=>{for(let u of s)(0,tg.checkReportMissingProp)(e,u)});else r.if(H6._`${c} && (${(0,tg.checkMissingProp)(e,s,i)})`),(0,tg.reportMissingProp)(e,i),r.else()}}mj.validatePropertyDeps=pj;function fj(e,t=e.schema){let{gen:r,data:o,keyword:n,it:i}=e,a=r.name("valid");for(let s in t){if((0,Bpe.alwaysValidSchema)(i,t[s]))continue;r.if((0,tg.propertyInData)(r,o,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a)}}mj.validateSchemaDeps=fj;mj.default=Dpe});var vj=re(function(xj){Object.defineProperty(xj,"__esModule",{value:!0});var bj=rt(),Fpe=ft(),qpe={message:"property name must be valid",params:({params:e})=>bj._`{propertyName: ${e.propertyName}}`},Hpe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:qpe,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,Fpe.alwaysValidSchema)(n,r))return;let i=t.name("valid");t.forIn("key",o,(a)=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,bj.not)(i),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(i)}};xj.default=Hpe});var G6=re(function(_j){Object.defineProperty(_j,"__esModule",{value:!0});var k_=co(),jo=rt(),Vpe=pa(),A_=ft(),Zpe={message:"must NOT have additional properties",params:({params:e})=>jo._`{additionalProperty: ${e.additionalProperty}}`},Wpe={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Zpe,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:i,it:a}=e;if(!i)throw Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,A_.alwaysValidSchema)(a,r))return;let u=(0,k_.allSchemaProperties)(o.properties),d=(0,k_.allSchemaProperties)(o.patternProperties);p(),e.ok(jo._`${i} === ${Vpe.default.errors}`);function p(){t.forIn("key",n,(S)=>{if(!u.length&&!d.length)y(S);else t.if(m(S),()=>y(S))})}function m(S){let v;if(u.length>8){let E=(0,A_.schemaRefOrVal)(a,o.properties,"properties");v=(0,k_.isOwnProperty)(t,E,S)}else if(u.length)v=(0,jo.or)(...u.map((E)=>jo._`${S} === ${E}`));else v=jo.nil;if(d.length)v=(0,jo.or)(v,...d.map((E)=>jo._`${(0,k_.usePattern)(e,E)}.test(${S})`));return(0,jo.not)(v)}function h(S){t.code(jo._`delete ${n}[${S}]`)}function y(S){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){h(S);return}if(r===!1){if(e.setParams({additionalProperty:S}),e.error(),!s)t.break();return}if(typeof r=="object"&&!(0,A_.alwaysValidSchema)(a,r)){let v=t.name("valid");if(c.removeAdditional==="failing")x(S,v,!1),t.if((0,jo.not)(v),()=>{e.reset(),h(S)});else if(x(S,v),!s)t.if((0,jo.not)(v),()=>t.break())}}function x(S,v,E){let w={keyword:"additionalProperties",dataProp:S,dataPropType:A_.Type.Str};if(E===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(w,v)}}};_j.default=Wpe});var Ej=re(function(Tj){Object.defineProperty(Tj,"__esModule",{value:!0});var Jpe=qh(),wj=co(),V6=ft(),Sj=G6(),Ype={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:i}=e;if(i.opts.removeAdditional==="all"&&o.additionalProperties===void 0)Sj.default.code(new Jpe.KeywordCxt(i,Sj.default,"additionalProperties"));let a=(0,wj.allSchemaProperties)(r);for(let p of a)i.definedProperties.add(p);if(i.opts.unevaluated&&a.length&&i.props!==!0)i.props=V6.mergeEvaluated.props(t,(0,V6.toHash)(a),i.props);let s=a.filter((p)=>!(0,V6.alwaysValidSchema)(i,r[p]));if(s.length===0)return;let c=t.name("valid");for(let p of s){if(u(p))d(p);else{if(t.if((0,wj.propertyInData)(t,n,p,i.opts.ownProperties)),d(p),!i.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(c)}function u(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function d(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};Tj.default=Ype});var Rj=re(function(Aj){Object.defineProperty(Aj,"__esModule",{value:!0});var Ij=co(),R_=rt(),Pj=ft(),kj=ft(),Xpe={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:i}=e,{opts:a}=i,s=(0,Ij.allSchemaProperties)(r),c=s.filter((x)=>(0,Pj.alwaysValidSchema)(i,r[x]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&n.properties,d=t.name("valid");if(i.props!==!0&&!(i.props instanceof R_.Name))i.props=(0,kj.evaluatedPropsToName)(t,i.props);let{props:p}=i;m();function m(){for(let x of s){if(u)h(x);if(i.allErrors)y(x);else t.var(d,!0),y(x),t.if(d)}}function h(x){for(let S in u)if(new RegExp(x).test(S))(0,Pj.checkStrictMode)(i,`property ${S} matches pattern ${x} (use allowMatchingProperties)`)}function y(x){t.forIn("key",o,(S)=>{t.if(R_._`${(0,Ij.usePattern)(e,x)}.test(${S})`,()=>{let v=c.includes(x);if(!v)e.subschema({keyword:"patternProperties",schemaProp:x,dataProp:S,dataPropType:kj.Type.Str},d);if(i.opts.unevaluated&&p!==!0)t.assign(R_._`${p}[${S}]`,!0);else if(!v&&!i.allErrors)t.if((0,R_.not)(d),()=>t.break())})})}}};Aj.default=Xpe});var Oj=re(function($j){Object.defineProperty($j,"__esModule",{value:!0});var tfe=ft(),rfe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,tfe.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};$j.default=rfe});var zj=re(function(Cj){Object.defineProperty(Cj,"__esModule",{value:!0});var ofe=co(),ife={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ofe.validateUnion,error:{message:"must match a schema in anyOf"}};Cj.default=ife});var Mj=re(function(Nj){Object.defineProperty(Nj,"__esModule",{value:!0});var $_=rt(),sfe=ft(),cfe={message:"must match exactly one schema in oneOf",params:({params:e})=>$_._`{passingSchemas: ${e.passing}}`},ufe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:cfe,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((d,p)=>{let m;if((0,sfe.alwaysValidSchema)(n,d))t.var(c,!0);else m=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c);if(p>0)t.if($_._`${c} && ${a}`).assign(a,!1).assign(s,$_._`[${s}, ${p}]`).else();t.if(c,()=>{if(t.assign(a,!0),t.assign(s,p),m)e.mergeEvaluated(m,$_.Name)})})}}};Nj.default=ufe});var Dj=re(function(Bj){Object.defineProperty(Bj,"__esModule",{value:!0});var dfe=ft(),pfe={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((i,a)=>{if((0,dfe.alwaysValidSchema)(o,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},n);e.ok(n),e.mergeEvaluated(s)})}};Bj.default=pfe});var Fj=re(function(jj){Object.defineProperty(jj,"__esModule",{value:!0});var O_=rt(),Lj=ft(),mfe={message:({params:e})=>O_.str`must match "${e.ifClause}" schema`,params:({params:e})=>O_._`{failingKeyword: ${e.ifClause}}`},hfe={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:mfe,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)(0,Lj.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=Uj(o,"then"),i=Uj(o,"else");if(!n&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),n&&i){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(s,u("then",d),u("else",d))}else if(n)t.if(s,u("then"));else t.if((0,O_.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(d)}function u(d,p){return()=>{let m=e.subschema({keyword:d},s);if(t.assign(a,s),e.mergeValidEvaluated(m,a),p)t.assign(p,O_._`${d}`);else e.setParams({ifClause:d})}}}};function Uj(e,t){let r=e.schema[t];return r!==void 0&&!(0,Lj.alwaysValidSchema)(e,r)}jj.default=hfe});var Hj=re(function(qj){Object.defineProperty(qj,"__esModule",{value:!0});var yfe=ft(),bfe={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,yfe.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};qj.default=bfe});var Vj=re(function(Gj){Object.defineProperty(Gj,"__esModule",{value:!0});var vfe=F6(),_fe=aj(),wfe=q6(),Sfe=uj(),Tfe=dj(),Efe=yj(),Ife=vj(),Pfe=G6(),kfe=Ej(),Afe=Rj(),Rfe=Oj(),$fe=zj(),Ofe=Mj(),Cfe=Dj(),zfe=Fj(),Nfe=Hj();function Mfe(e=!1){let t=[Rfe.default,$fe.default,Ofe.default,Cfe.default,zfe.default,Nfe.default,Ife.default,Pfe.default,Efe.default,kfe.default,Afe.default];if(e)t.push(_fe.default,Sfe.default);else t.push(vfe.default,wfe.default);return t.push(Tfe.default),t}Gj.default=Mfe});var Wj=re(function(Zj){Object.defineProperty(Zj,"__esModule",{value:!0});var sr=rt(),Dfe={message:({schemaCode:e})=>sr.str`must match format "${e}"`,params:({schemaCode:e})=>sr._`{format: ${e}}`},Ufe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Dfe,code(e,t){let{gen:r,data:o,$data:n,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:p}=s;if(!c.validateFormats)return;if(n)m();else h();function m(){let y=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),x=r.const("fDef",sr._`${y}[${a}]`),S=r.let("fType"),v=r.let("format");r.if(sr._`typeof ${x} == "object" && !(${x} instanceof RegExp)`,()=>r.assign(S,sr._`${x}.type || "string"`).assign(v,sr._`${x}.validate`),()=>r.assign(S,sr._`"string"`).assign(v,x)),e.fail$data((0,sr.or)(E(),w()));function E(){if(c.strictSchema===!1)return sr.nil;return sr._`${a} && !${v}`}function w(){let _=d.$async?sr._`(${x}.async ? await ${v}(${o}) : ${v}(${o}))`:sr._`${v}(${o})`,T=sr._`(typeof ${v} == "function" ? ${_} : ${v}.test(${o}))`;return sr._`${v} && ${v} !== true && ${S} === ${t} && !${T}`}}function h(){let y=p.formats[i];if(!y){E();return}if(y===!0)return;let[x,S,v]=w(y);if(x===t)e.pass(_());function E(){if(c.strictSchema===!1){p.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function w(T){let k=T instanceof RegExp?(0,sr.regexpCode)(T):c.code.formats?sr._`${c.code.formats}${(0,sr.getProperty)(i)}`:void 0,O=r.scopeValue("formats",{key:i,ref:T,code:k});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,sr._`${O}.validate`];return["string",T,O]}function _(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!d.$async)throw Error("async format in sync schema");return sr._`await ${v}(${o})`}return typeof S=="function"?sr._`${v}(${o})`:sr._`${v}.test(${o})`}}}};Zj.default=Ufe});var Jj=re(function(Kj){Object.defineProperty(Kj,"__esModule",{value:!0});var jfe=Wj(),Ffe=[jfe.default];Kj.default=Ffe});var Xj=re(function(Yj){Object.defineProperty(Yj,"__esModule",{value:!0});Yj.contentVocabulary=Yj.metadataVocabulary=void 0;Yj.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Yj.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var r3=re(function(t3){Object.defineProperty(t3,"__esModule",{value:!0});var Gfe=TL(),Vfe=YL(),Zfe=Vj(),Wfe=Jj(),e3=Xj(),Kfe=[Gfe.default,Vfe.default,(0,Zfe.default)(),Wfe.default,e3.metadataVocabulary,e3.contentVocabulary];t3.default=Kfe});var a3=re(function(o3){Object.defineProperty(o3,"__esModule",{value:!0});o3.DiscrError=void 0;var n3;(function(e){e.Tag="tag",e.Mapping="mapping"})(n3||(o3.DiscrError=n3={}))});var u3=re(function(c3){Object.defineProperty(c3,"__esModule",{value:!0});var Dd=rt(),Z6=a3(),s3=h_(),Yfe=Hh(),Qfe=ft(),Xfe={message:({params:{discrError:e,tagName:t}})=>e===Z6.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Dd._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},eme={keyword:"discriminator",type:"object",schemaType:"object",error:Xfe,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:i}=e,{oneOf:a}=n;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let s=o.propertyName;if(typeof s!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!a)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",Dd._`${r}${(0,Dd.getProperty)(s)}`);t.if(Dd._`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:Z6.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function d(){let h=m();t.if(!1);for(let y in h)t.elseIf(Dd._`${u} === ${y}`),t.assign(c,p(h[y]));t.else(),e.error(!1,{discrError:Z6.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function p(h){let y=t.name("valid"),x=e.subschema({keyword:"oneOf",schemaProp:h},y);return e.mergeEvaluated(x,Dd.Name),y}function m(){var h;let y={},x=v(n),S=!0;for(let _=0;_<a.length;_++){let T=a[_];if((T===null||T===void 0?void 0:T.$ref)&&!(0,Qfe.schemaHasRulesButRef)(T,i.self.RULES)){let O=T.$ref;if(T=s3.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,O),T instanceof s3.SchemaEnv)T=T.schema;if(T===void 0)throw new Yfe.default(i.opts.uriResolver,i.baseId,O)}let k=(h=T===null||T===void 0?void 0:T.properties)===null||h===void 0?void 0:h[s];if(typeof k!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);S=S&&(x||v(T)),E(k,_)}if(!S)throw Error(`discriminator: "${s}" must be required`);return y;function v({required:_}){return Array.isArray(_)&&_.includes(s)}function E(_,T){if(_.const)w(_.const,T);else if(_.enum)for(let k of _.enum)w(k,T);else throw Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function w(_,T){if(typeof _!="string"||_ in y)throw Error(`discriminator: "${s}" values must be unique strings`);y[_]=T}}}};c3.default=eme});var l3=re(function(_6e,rme){rme.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var K6=re(function(Bn,W6){Object.defineProperty(Bn,"__esModule",{value:!0});Bn.MissingRefError=Bn.ValidationError=Bn.CodeGen=Bn.Name=Bn.nil=Bn.stringify=Bn.str=Bn._=Bn.KeywordCxt=Bn.Ajv=void 0;var nme=mL(),ome=r3(),ime=u3(),d3=l3(),ame=["/properties"],C_="http://json-schema.org/draft-07/schema";class rg extends nme.default{_addVocabularies(){if(super._addVocabularies(),ome.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(ime.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(d3,ame):d3;this.addMetaSchema(e,C_,!1),this.refs["http://json-schema.org/schema"]=C_}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(C_)?C_:void 0)}}Bn.Ajv=rg;W6.exports=Bn=rg;W6.exports.Ajv=rg;Object.defineProperty(Bn,"__esModule",{value:!0});Bn.default=rg;var sme=qh();Object.defineProperty(Bn,"KeywordCxt",{enumerable:!0,get:function(){return sme.KeywordCxt}});var Ud=rt();Object.defineProperty(Bn,"_",{enumerable:!0,get:function(){return Ud._}});Object.defineProperty(Bn,"str",{enumerable:!0,get:function(){return Ud.str}});Object.defineProperty(Bn,"stringify",{enumerable:!0,get:function(){return Ud.stringify}});Object.defineProperty(Bn,"nil",{enumerable:!0,get:function(){return Ud.nil}});Object.defineProperty(Bn,"Name",{enumerable:!0,get:function(){return Ud.Name}});Object.defineProperty(Bn,"CodeGen",{enumerable:!0,get:function(){return Ud.CodeGen}});var cme=f_();Object.defineProperty(Bn,"ValidationError",{enumerable:!0,get:function(){return cme.default}});var ume=Hh();Object.defineProperty(Bn,"MissingRefError",{enumerable:!0,get:function(){return ume.default}})});var _3=re(function(x3){Object.defineProperty(x3,"__esModule",{value:!0});x3.formatNames=x3.fastFormats=x3.fullFormats=void 0;function Ti(e,t){return{validate:e,compare:t}}x3.fullFormats={date:Ti(h3,X6),time:Ti(Y6(!0),eR),"date-time":Ti(p3(!0),y3),"iso-time":Ti(Y6(),g3),"iso-date-time":Ti(p3(),b3),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:yme,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:Tme,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:bme,int32:{type:"number",validate:_me},int64:{type:"number",validate:wme},float:{type:"number",validate:m3},double:{type:"number",validate:m3},password:!0,binary:!0};x3.fastFormats={...x3.fullFormats,date:Ti(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,X6),time:Ti(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,eR),"date-time":Ti(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,y3),"iso-time":Ti(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,g3),"iso-date-time":Ti(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,b3),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};x3.formatNames=Object.keys(x3.fullFormats);function pme(e){return e%4===0&&(e%100!==0||e%400===0)}var fme=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,mme=[0,31,28,31,30,31,30,31,31,30,31,30,31];function h3(e){let t=fme.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&pme(r)?29:mme[o])}function X6(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var J6=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Y6(e){return function(r){let o=J6.exec(r);if(!o)return!1;let n=+o[1],i=+o[2],a=+o[3],s=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),d=+(o[7]||0);if(u>23||d>59||e&&!s)return!1;if(n<=23&&i<=59&&a<60)return!0;let p=i-d*c,m=n-u*c-(p<0?1:0);return(m===23||m===-1)&&(p===59||p===-1)&&a<61}}function eR(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function g3(e,t){if(!(e&&t))return;let r=J6.exec(e),o=J6.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var Q6=/t|\s/i;function p3(e){let t=Y6(e);return function(o){let n=o.split(Q6);return n.length===2&&h3(n[0])&&t(n[1])}}function y3(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function b3(e,t){if(!(e&&t))return;let[r,o]=e.split(Q6),[n,i]=t.split(Q6),a=X6(r,n);if(a===void 0)return;return a||eR(o,i)}var hme=/\/|:/,gme=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function yme(e){return hme.test(e)&&gme.test(e)}var f3=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function bme(e){return f3.lastIndex=0,f3.test(e)}var xme=-2147483648,vme=2147483647;function _me(e){return Number.isInteger(e)&&e<=vme&&e>=xme}function wme(e){return Number.isInteger(e)}function m3(){return!0}var Sme=/[^\\]\\Z/;function Tme(e){if(Sme.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var S3=re(function(w3){Object.defineProperty(w3,"__esModule",{value:!0});w3.formatLimitDefinition=void 0;var Ime=K6(),Fo=rt(),Ms=Fo.operators,z_={formatMaximum:{okStr:"<=",ok:Ms.LTE,fail:Ms.GT},formatMinimum:{okStr:">=",ok:Ms.GTE,fail:Ms.LT},formatExclusiveMaximum:{okStr:"<",ok:Ms.LT,fail:Ms.GTE},formatExclusiveMinimum:{okStr:">",ok:Ms.GT,fail:Ms.LTE}},Pme={message:({keyword:e,schemaCode:t})=>Fo.str`should be ${z_[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Fo._`{comparison: ${z_[e].okStr}, limit: ${t}}`};w3.formatLimitDefinition={keyword:Object.keys(z_),type:"string",schemaType:"string",$data:!0,error:Pme,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new Ime.KeywordCxt(i,s.RULES.all.format.definition,"format");if(c.$data)u();else d();function u(){let m=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),h=t.const("fmt",Fo._`${m}[${c.schemaCode}]`);e.fail$data((0,Fo.or)(Fo._`typeof ${h} != "object"`,Fo._`${h} instanceof RegExp`,Fo._`typeof ${h}.compare != "function"`,p(h)))}function d(){let m=c.schema,h=s.formats[m];if(!h||h===!0)return;if(typeof h!="object"||h instanceof RegExp||typeof h.compare!="function")throw Error(`"${n}": format "${m}" does not define "compare" function`);let y=t.scopeValue("formats",{key:m,ref:h,code:a.code.formats?Fo._`${a.code.formats}${(0,Fo.getProperty)(m)}`:void 0});e.fail$data(p(y))}function p(m){return Fo._`${m}.compare(${r}, ${o}) ${z_[n].fail} 0`}},dependencies:["format"]};var kme=(e)=>(e.addKeyword(w3.formatLimitDefinition),e);w3.default=kme});var P3=re(function(ng,I3){Object.defineProperty(ng,"__esModule",{value:!0});var Ld=_3(),Rme=S3(),nR=rt(),T3=new nR.Name("fullFormats"),$me=new nR.Name("fastFormats"),oR=(e,t={keywords:!0})=>{if(Array.isArray(t))return E3(e,t,Ld.fullFormats,T3),e;let[r,o]=t.mode==="fast"?[Ld.fastFormats,$me]:[Ld.fullFormats,T3],n=t.formats||Ld.formatNames;if(E3(e,n,r,o),t.keywords)(0,Rme.default)(e);return e};oR.get=(e,t="full")=>{let o=(t==="fast"?Ld.fastFormats:Ld.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function E3(e,t,r,o){var n,i;(n=(i=e.opts.code).formats)!==null&&n!==void 0||(i.formats=nR._`require("ajv-formats/dist/formats").${o}`);for(let a of t)e.addFormat(a,r[a])}I3.exports=ng=oR;Object.defineProperty(ng,"__esModule",{value:!0});ng.default=oR});import*as ha from"node:crypto";var cu;var J3=J(()=>{cu=ha&&typeof ha==="object"&&"webcrypto"in ha?ha.webcrypto:ha&&typeof ha==="object"&&("randomBytes"in ha)?ha:void 0});function Hme(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function uu(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function qo(e,...t){if(!Hme(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function Q3(e){if(typeof e!=="function"||typeof e.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");uu(e.outputLen),uu(e.blockLen)}function ya(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function B_(e,t){qo(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function X3(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function po(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function D_(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ho(e,t){return e<<32-t|e>>>t}function Vme(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Zme(e){for(let t=0;t<e.length;t++)e[t]=Vme(e[t]);return e}function lu(e){if(qo(e),eF)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=Wme[e[r]];return t}function Y3(e){if(e>=ga._0&&e<=ga._9)return e-ga._0;if(e>=ga.A&&e<=ga.F)return e-(ga.A-10);if(e>=ga.a&&e<=ga.f)return e-(ga.a-10);return}function ig(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);if(eF)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let o=new Uint8Array(r);for(let n=0,i=0;n<r;n++,i+=2){let a=Y3(e.charCodeAt(i)),s=Y3(e.charCodeAt(i+1));if(a===void 0||s===void 0){let c=e[i]+e[i+1];throw Error('hex string expected, got non-hex character "'+c+'" at index '+i)}o[n]=a*16+s}return o}function jd(e){if(typeof e!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function du(e){if(typeof e==="string")e=jd(e);return qo(e),e}function bR(...e){let t=0;for(let o=0;o<e.length;o++){let n=e[o];qo(n),t+=n.length}let r=new Uint8Array(t);for(let o=0,n=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return r}class pu{}function ag(e){let t=(o)=>e().update(du(o)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Fd(e=32){if(cu&&typeof cu.getRandomValues==="function")return cu.getRandomValues(new Uint8Array(e));if(cu&&typeof cu.randomBytes==="function")return Uint8Array.from(cu.randomBytes(e));throw Error("crypto.getRandomValues must be defined")}var Gme,yR,eF,Wme,ga;var fo=J(()=>{J3();/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Gme=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();yR=Gme?(e)=>e:Zme,eF=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),Wme=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));ga={_0:48,_9:57,A:65,F:70,a:97,f:102}});function Kme(e,t,r,o){if(typeof e.setBigUint64==="function")return e.setBigUint64(t,r,o);let n=BigInt(32),i=BigInt(4294967295),a=Number(r>>n&i),s=Number(r&i),c=o?4:0,u=o?0:4;e.setUint32(t+c,a,o),e.setUint32(t+u,s,o)}function tF(e,t,r){return e&t^~e&r}function rF(e,t,r){return e&t^e&r^t&r}var U_,ba,jr;var nF=J(()=>{fo();U_=class U_ extends pu{constructor(e,t,r,o){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(e),this.view=D_(this.buffer)}update(e){ya(this),e=du(e),qo(e);let{view:t,buffer:r,blockLen:o}=this,n=e.length;for(let i=0;i<n;){let a=Math.min(o-this.pos,n-i);if(a===o){let s=D_(e);for(;o<=n-i;i+=o)this.process(s,i);continue}if(r.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o)this.process(t,0),this.pos=0}return this.length+=e.length,this.roundClean(),this}digestInto(e){ya(this),B_(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:o,isLE:n}=this,{pos:i}=this;if(t[i++]=128,po(this.buffer.subarray(i)),this.padOffset>o-i)this.process(r,0),i=0;for(let d=i;d<o;d++)t[d]=0;Kme(r,o-8,BigInt(this.length*8),n),this.process(r,0);let a=D_(e),s=this.outputLen;if(s%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=s/4,u=this.get();if(c>u.length)throw Error("_sha2: outputLen bigger than state");for(let d=0;d<c;d++)a.setUint32(4*d,u[d],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:o,finished:n,destroyed:i,pos:a}=this;if(e.destroyed=i,e.finished=n,e.length=o,e.pos=a,o%t)e.buffer.set(r);return e}clone(){return this._cloneInto()}};ba=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),jr=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function Jme(e,t=!1){if(t)return{h:Number(e&L_),l:Number(e>>oF&L_)};return{h:Number(e>>oF&L_)|0,l:Number(e&L_)|0}}function j_(e,t=!1){let r=e.length,o=new Uint32Array(r),n=new Uint32Array(r);for(let i=0;i<r;i++){let{h:a,l:s}=Jme(e[i],t);[o[i],n[i]]=[a,s]}return[o,n]}function Ii(e,t,r,o){let n=(t>>>0)+(o>>>0);return{h:e+r+(n/4294967296|0)|0,l:n|0}}var L_,oF,xR=(e,t,r)=>e>>>r,vR=(e,t,r)=>e<<32-r|t>>>r,fu=(e,t,r)=>e>>>r|t<<32-r,mu=(e,t,r)=>e<<32-r|t>>>r,sg=(e,t,r)=>e<<64-r|t>>>r-32,cg=(e,t,r)=>e>>>r-32|t<<64-r,iF=(e,t,r)=>e<<r|t>>>32-r,aF=(e,t,r)=>t<<r|e>>>32-r,sF=(e,t,r)=>t<<r-32|e>>>64-r,cF=(e,t,r)=>e<<r-32|t>>>64-r,uF=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),lF=(e,t,r,o)=>t+r+o+(e/4294967296|0)|0,dF=(e,t,r,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0),pF=(e,t,r,o,n)=>t+r+o+n+(e/4294967296|0)|0,fF=(e,t,r,o,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0)+(n>>>0),mF=(e,t,r,o,n,i)=>t+r+o+n+i+(e/4294967296|0)|0;var _R=J(()=>{L_=BigInt(4294967295),oF=BigInt(32)});var Qme,Ds,wR,hF,Xme,ehe,Us,Ls,gF,xa,yF;var ug=J(()=>{nF();_R();fo();Qme=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ds=new Uint32Array(64);wR=class wR extends U_{constructor(e=32){super(64,e,8,!1);this.A=ba[0]|0,this.B=ba[1]|0,this.C=ba[2]|0,this.D=ba[3]|0,this.E=ba[4]|0,this.F=ba[5]|0,this.G=ba[6]|0,this.H=ba[7]|0}get(){let{A:e,B:t,C:r,D:o,E:n,F:i,G:a,H:s}=this;return[e,t,r,o,n,i,a,s]}set(e,t,r,o,n,i,a,s){this.A=e|0,this.B=t|0,this.C=r|0,this.D=o|0,this.E=n|0,this.F=i|0,this.G=a|0,this.H=s|0}process(e,t){for(let d=0;d<16;d++,t+=4)Ds[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let p=Ds[d-15],m=Ds[d-2],h=Ho(p,7)^Ho(p,18)^p>>>3,y=Ho(m,17)^Ho(m,19)^m>>>10;Ds[d]=y+Ds[d-7]+h+Ds[d-16]|0}let{A:r,B:o,C:n,D:i,E:a,F:s,G:c,H:u}=this;for(let d=0;d<64;d++){let p=Ho(a,6)^Ho(a,11)^Ho(a,25),m=u+p+tF(a,s,c)+Qme[d]+Ds[d]|0,y=(Ho(r,2)^Ho(r,13)^Ho(r,22))+rF(r,o,n)|0;u=c,c=s,s=a,a=i+m|0,i=n,n=o,o=r,r=m+y|0}r=r+this.A|0,o=o+this.B|0,n=n+this.C|0,i=i+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,o,n,i,a,s,c,u)}roundClean(){po(Ds)}destroy(){this.set(0,0,0,0,0,0,0,0),po(this.buffer)}};hF=(()=>j_(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e)=>BigInt(e))))(),Xme=(()=>hF[0])(),ehe=(()=>hF[1])(),Us=new Uint32Array(80),Ls=new Uint32Array(80);gF=class gF extends U_{constructor(e=64){super(128,e,16,!1);this.Ah=jr[0]|0,this.Al=jr[1]|0,this.Bh=jr[2]|0,this.Bl=jr[3]|0,this.Ch=jr[4]|0,this.Cl=jr[5]|0,this.Dh=jr[6]|0,this.Dl=jr[7]|0,this.Eh=jr[8]|0,this.El=jr[9]|0,this.Fh=jr[10]|0,this.Fl=jr[11]|0,this.Gh=jr[12]|0,this.Gl=jr[13]|0,this.Hh=jr[14]|0,this.Hl=jr[15]|0}get(){let{Ah:e,Al:t,Bh:r,Bl:o,Ch:n,Cl:i,Dh:a,Dl:s,Eh:c,El:u,Fh:d,Fl:p,Gh:m,Gl:h,Hh:y,Hl:x}=this;return[e,t,r,o,n,i,a,s,c,u,d,p,m,h,y,x]}set(e,t,r,o,n,i,a,s,c,u,d,p,m,h,y,x){this.Ah=e|0,this.Al=t|0,this.Bh=r|0,this.Bl=o|0,this.Ch=n|0,this.Cl=i|0,this.Dh=a|0,this.Dl=s|0,this.Eh=c|0,this.El=u|0,this.Fh=d|0,this.Fl=p|0,this.Gh=m|0,this.Gl=h|0,this.Hh=y|0,this.Hl=x|0}process(e,t){for(let E=0;E<16;E++,t+=4)Us[E]=e.getUint32(t),Ls[E]=e.getUint32(t+=4);for(let E=16;E<80;E++){let w=Us[E-15]|0,_=Ls[E-15]|0,T=fu(w,_,1)^fu(w,_,8)^xR(w,_,7),k=mu(w,_,1)^mu(w,_,8)^vR(w,_,7),O=Us[E-2]|0,z=Ls[E-2]|0,L=fu(O,z,19)^sg(O,z,61)^xR(O,z,6),P=mu(O,z,19)^cg(O,z,61)^vR(O,z,6),F=dF(k,P,Ls[E-7],Ls[E-16]),G=pF(F,T,L,Us[E-7],Us[E-16]);Us[E]=G|0,Ls[E]=F|0}let{Ah:r,Al:o,Bh:n,Bl:i,Ch:a,Cl:s,Dh:c,Dl:u,Eh:d,El:p,Fh:m,Fl:h,Gh:y,Gl:x,Hh:S,Hl:v}=this;for(let E=0;E<80;E++){let w=fu(d,p,14)^fu(d,p,18)^sg(d,p,41),_=mu(d,p,14)^mu(d,p,18)^cg(d,p,41),T=d&m^~d&y,k=p&h^~p&x,O=fF(v,_,k,ehe[E],Ls[E]),z=mF(O,S,w,T,Xme[E],Us[E]),L=O|0,P=fu(r,o,28)^sg(r,o,34)^sg(r,o,39),F=mu(r,o,28)^cg(r,o,34)^cg(r,o,39),G=r&n^r&a^n&a,ue=o&i^o&s^i&s;S=y|0,v=x|0,y=m|0,x=h|0,m=d|0,h=p|0,{h:d,l:p}=Ii(c|0,u|0,z|0,L|0),c=a|0,u=s|0,a=n|0,s=i|0,n=r|0,i=o|0;let W=uF(L,F,ue);r=lF(W,z,P,G),o=W|0}({h:r,l:o}=Ii(this.Ah|0,this.Al|0,r|0,o|0)),{h:n,l:i}=Ii(this.Bh|0,this.Bl|0,n|0,i|0),{h:a,l:s}=Ii(this.Ch|0,this.Cl|0,a|0,s|0),{h:c,l:u}=Ii(this.Dh|0,this.Dl|0,c|0,u|0),{h:d,l:p}=Ii(this.Eh|0,this.El|0,d|0,p|0),{h:m,l:h}=Ii(this.Fh|0,this.Fl|0,m|0,h|0),{h:y,l:x}=Ii(this.Gh|0,this.Gl|0,y|0,x|0),{h:S,l:v}=Ii(this.Hh|0,this.Hl|0,S|0,v|0),this.set(r,o,n,i,a,s,c,u,d,p,m,h,y,x,S,v)}roundClean(){po(Us,Ls)}destroy(){po(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};xa=ag(()=>new wR),yF=ag(()=>new gF)});function qd(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function _a(e){if(!qd(e))throw Error("Uint8Array expected")}function Pi(e,t){if(typeof t!=="boolean")throw Error(e+" boolean expected, got "+t)}function lg(e){let t=e.toString(16);return t.length&1?"0"+t:t}function vF(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);return e===""?IR:BigInt("0x"+e)}function js(e){if(_a(e),_F)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=the[e[r]];return t}function bF(e){if(e>=va._0&&e<=va._9)return e-va._0;if(e>=va.A&&e<=va.F)return e-(va.A-10);if(e>=va.a&&e<=va.f)return e-(va.a-10);return}function dg(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);if(_F)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let o=new Uint8Array(r);for(let n=0,i=0;n<r;n++,i+=2){let a=bF(e.charCodeAt(i)),s=bF(e.charCodeAt(i+1));if(a===void 0||s===void 0){let c=e[i]+e[i+1];throw Error('hex string expected, got non-hex character "'+c+'" at index '+i)}o[n]=a*16+s}return o}function Dn(e){return vF(js(e))}function hu(e){return _a(e),vF(js(Uint8Array.from(e).reverse()))}function ki(e,t){return dg(e.toString(16).padStart(t*2,"0"))}function Hd(e,t){return ki(e,t).reverse()}function It(e,t,r){let o;if(typeof t==="string")try{o=dg(t)}catch(i){throw Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(qd(t))o=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=o.length;if(typeof r==="number"&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return o}function Tr(...e){let t=0;for(let o=0;o<e.length;o++){let n=e[o];_a(n),t+=n.length}let r=new Uint8Array(t);for(let o=0,n=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return r}function F_(e){if(typeof e!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function gu(e,t,r){return SR(e)&&SR(t)&&SR(r)&&t<=e&&e<r}function mn(e,t,r,o){if(!gu(t,r,o))throw Error("expected valid "+e+": "+r+" <= n < "+o+", got "+t)}function wF(e){let t;for(t=0;e>IR;e>>=ER,t+=1);return t}function SF(e,t,r){if(typeof e!=="number"||e<2)throw Error("hashLen must be a number");if(typeof t!=="number"||t<2)throw Error("qByteLen must be a number");if(typeof r!=="function")throw Error("hmacFn must be a function");let o=TR(e),n=TR(e),i=0,a=()=>{o.fill(1),n.fill(0),i=0},s=(...p)=>r(n,o,...p),c=(p=TR(0))=>{if(n=s(xF([0]),p),o=s(),p.length===0)return;n=s(xF([1]),p),o=s()},u=()=>{if(i++>=1000)throw Error("drbg: tried 1000 values");let p=0,m=[];while(p<t){o=s();let h=o.slice();m.push(h),p+=o.length}return Tr(...m)};return(p,m)=>{a(),c(p);let h=void 0;while(!(h=m(u())))c();return a(),h}}function Go(e,t,r={}){let o=(n,i,a)=>{let s=rhe[i];if(typeof s!=="function")throw Error("invalid validator function");let c=e[n];if(a&&c===void 0)return;if(!s(c,e))throw Error("param "+String(n)+" is invalid. Expected "+i+", got "+c)};for(let[n,i]of Object.entries(t))o(n,i,!1);for(let[n,i]of Object.entries(r))o(n,i,!0);return e}function Gd(e){let t=new WeakMap;return(r,...o)=>{let n=t.get(r);if(n!==void 0)return n;let i=e(r,...o);return t.set(r,i),i}}var IR,ER,_F,the,va,SR=(e)=>typeof e==="bigint"&&IR<=e,yu=(e)=>(ER<<BigInt(e))-ER,TR=(e)=>new Uint8Array(e),xF=(e)=>Uint8Array.from(e),rhe;var bu=J(()=>{/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */IR=BigInt(0),ER=BigInt(1);_F=typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function",the=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));va={_0:48,_9:57,A:65,F:70,a:97,f:102};rhe={bigint:(e)=>typeof e==="bigint",function:(e)=>typeof e==="function",boolean:(e)=>typeof e==="boolean",string:(e)=>typeof e==="string",stringOrUint8Array:(e)=>typeof e==="string"||qd(e),isSafeInteger:(e)=>Number.isSafeInteger(e),array:(e)=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:(e)=>typeof e==="function"&&Number.isSafeInteger(e.outputLen)}});function yt(e,t){let r=e%t;return r>=hn?r:t+r}function Yt(e,t,r){let o=e;while(t-- >hn)o*=o,o%=r;return o}function q_(e,t){if(e===hn)throw Error("invert: expected non-zero number");if(t<=hn)throw Error("invert: expected positive modulus, got "+t);let r=yt(e,t),o=t,n=hn,i=Er,a=Er,s=hn;while(r!==hn){let u=o/r,d=o%r,p=n-a*u,m=i-s*u;o=r,r=d,n=a,i=s,a=p,s=m}if(o!==Er)throw Error("invert: does not exist");return yt(n,t)}function kF(e,t){let r=(e.ORDER+Er)/EF,o=e.pow(t,r);if(!e.eql(e.sqr(o),t))throw Error("Cannot find square root");return o}function ohe(e,t){let r=(e.ORDER-IF)/PF,o=e.mul(t,xu),n=e.pow(o,r),i=e.mul(t,n),a=e.mul(e.mul(i,xu),n),s=e.mul(i,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),t))throw Error("Cannot find square root");return s}function ihe(e){if(e<BigInt(3))throw Error("sqrt is not defined for small field");let t=e-Er,r=0;while(t%xu===hn)t/=xu,r++;let o=xu,n=Sa(e);while(TF(n,o)===1)if(o++>1000)throw Error("Cannot find square root: probably non-prime P");if(r===1)return kF;let i=n.pow(o,t),a=(t+Er)/xu;return function(c,u){if(c.is0(u))return u;if(TF(c,u)!==1)throw Error("Cannot find square root");let d=r,p=c.mul(c.ONE,i),m=c.pow(u,t),h=c.pow(u,a);while(!c.eql(m,c.ONE)){if(c.is0(m))return c.ZERO;let y=1,x=c.sqr(m);while(!c.eql(x,c.ONE))if(y++,x=c.sqr(x),y===d)throw Error("Cannot find square root");let S=Er<<BigInt(d-y-1),v=c.pow(p,S);d=y,p=c.sqr(v),m=c.mul(m,p),h=c.mul(h,v)}return h}}function ahe(e){if(e%EF===nhe)return kF;if(e%PF===IF)return ohe;return ihe(e)}function H_(e){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=she.reduce((o,n)=>(o[n]="function",o),t);return Go(e,r)}function che(e,t,r){if(r<hn)throw Error("invalid exponent, negatives unsupported");if(r===hn)return e.ONE;if(r===Er)return t;let o=e.ONE,n=t;while(r>hn){if(r&Er)o=e.mul(o,n);n=e.sqr(n),r>>=Er}return o}function wa(e,t,r=!1){let o=Array(t.length).fill(r?e.ZERO:void 0),n=t.reduce((a,s,c)=>{if(e.is0(s))return a;return o[c]=a,e.mul(a,s)},e.ONE),i=e.inv(n);return t.reduceRight((a,s,c)=>{if(e.is0(s))return a;return o[c]=e.mul(a,o[c]),e.mul(a,s)},i),o}function TF(e,t){let r=(e.ORDER-Er)/xu,o=e.pow(t,r),n=e.eql(o,e.ONE),i=e.eql(o,e.ZERO),a=e.eql(o,e.neg(e.ONE));if(!n&&!i&&!a)throw Error("invalid Legendre symbol result");return n?1:i?0:-1}function PR(e,t){if(t!==void 0)uu(t);let r=t!==void 0?t:e.toString(2).length,o=Math.ceil(r/8);return{nBitLength:r,nByteLength:o}}function Sa(e,t,r=!1,o={}){if(e<=hn)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:n,nByteLength:i}=PR(e,t);if(i>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let a,s=Object.freeze({ORDER:e,isLE:r,BITS:n,BYTES:i,MASK:yu(n),ZERO:hn,ONE:Er,create:(c)=>yt(c,e),isValid:(c)=>{if(typeof c!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof c);return hn<=c&&c<e},is0:(c)=>c===hn,isOdd:(c)=>(c&Er)===Er,neg:(c)=>yt(-c,e),eql:(c,u)=>c===u,sqr:(c)=>yt(c*c,e),add:(c,u)=>yt(c+u,e),sub:(c,u)=>yt(c-u,e),mul:(c,u)=>yt(c*u,e),pow:(c,u)=>che(s,c,u),div:(c,u)=>yt(c*q_(u,e),e),sqrN:(c)=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:(c)=>q_(c,e),sqrt:o.sqrt||((c)=>{if(!a)a=ahe(e);return a(s,c)}),toBytes:(c)=>r?Hd(c,i):ki(c,i),fromBytes:(c)=>{if(c.length!==i)throw Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return r?hu(c):Dn(c)},invertBatch:(c)=>wa(s,c),cmov:(c,u,d)=>d?u:c});return Object.freeze(s)}function RF(e){if(typeof e!=="bigint")throw Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function kR(e){let t=RF(e);return t+Math.ceil(t/2)}function $F(e,t,r=!1){let o=e.length,n=RF(t),i=kR(t);if(o<16||o<i||o>1024)throw Error("expected "+i+"-1024 bytes of input, got "+o);let a=r?hu(e):Dn(e),s=yt(a,t-Er)+Er;return r?Hd(s,n):ki(s,n)}var hn,Er,xu,nhe,EF,IF,PF,AF=(e,t)=>(yt(e,t)&Er)===Er,she;var vu=J(()=>{fo();bu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */hn=BigInt(0),Er=BigInt(1),xu=BigInt(2),nhe=BigInt(3),EF=BigInt(4),IF=BigInt(5),PF=BigInt(8);she=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function AR(e,t){let r=t.negate();return e?r:t}function zF(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function RR(e,t){zF(e,t);let r=Math.ceil(t/e)+1,o=2**(e-1),n=2**e,i=yu(e),a=BigInt(e);return{windows:r,windowSize:o,mask:i,maxNumber:n,shiftBy:a}}function CF(e,t,r){let{windowSize:o,mask:n,maxNumber:i,shiftBy:a}=r,s=Number(e&n),c=e>>a;if(s>o)s-=i,c+=CR;let u=t*o,d=u+Math.abs(s)-1,p=s===0,m=s<0,h=t%2!==0;return{nextN:c,offset:d,isZero:p,isNeg:m,isNegF:h,offsetF:u}}function uhe(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((r,o)=>{if(!(r instanceof t))throw Error("invalid point at index "+o)})}function lhe(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((r,o)=>{if(!t.isValid(r))throw Error("invalid scalar at index "+o)})}function OR(e){return NF.get(e)||1}function G_(e,t){return{constTimeNegate:AR,hasPrecomputes(r){return OR(r)!==1},unsafeLadder(r,o,n=e.ZERO){let i=r;while(o>OF){if(o&CR)n=n.add(i);i=i.double(),o>>=CR}return n},precomputeWindow(r,o){let{windows:n,windowSize:i}=RR(o,t),a=[],s=r,c=s;for(let u=0;u<n;u++){c=s,a.push(c);for(let d=1;d<i;d++)c=c.add(s),a.push(c);s=c.double()}return a},wNAF(r,o,n){let{ZERO:i,BASE:a}=e,s=RR(r,t);for(let c=0;c<s.windows;c++){let{nextN:u,offset:d,isZero:p,isNeg:m,isNegF:h,offsetF:y}=CF(n,c,s);if(n=u,p)a=a.add(AR(h,o[y]));else i=i.add(AR(m,o[d]))}return{p:i,f:a}},wNAFUnsafe(r,o,n,i=e.ZERO){let a=RR(r,t);for(let s=0;s<a.windows;s++){if(n===OF)break;let{nextN:c,offset:u,isZero:d,isNeg:p}=CF(n,s,a);if(n=c,d)continue;else{let m=o[u];i=i.add(p?m.negate():m)}}return i},getPrecomputes(r,o,n){let i=$R.get(o);if(!i){if(i=this.precomputeWindow(o,r),r!==1)$R.set(o,n(i))}return i},wNAFCached(r,o,n){let i=OR(r);return this.wNAF(i,this.getPrecomputes(i,r,n),o)},wNAFCachedUnsafe(r,o,n,i){let a=OR(r);if(a===1)return this.unsafeLadder(r,o,i);return this.wNAFUnsafe(a,this.getPrecomputes(a,r,n),o,i)},setWindowSize(r,o){zF(o,t),NF.set(r,o),$R.delete(r)}}}function V_(e,t,r,o){uhe(r,e),lhe(o,t);let n=r.length,i=o.length;if(n!==i)throw Error("arrays of points and scalars must have equal length");let a=e.ZERO,s=wF(BigInt(n)),c=1;if(s>12)c=s-3;else if(s>4)c=s-2;else if(s>0)c=2;let u=yu(c),d=Array(Number(u)+1).fill(a),p=Math.floor((t.BITS-1)/c)*c,m=a;for(let h=p;h>=0;h-=c){d.fill(a);for(let x=0;x<i;x++){let S=o[x],v=Number(S>>BigInt(h)&u);d[v]=d[v].add(r[x])}let y=a;for(let x=d.length-1,S=a;x>0;x--)S=S.add(d[x]),y=y.add(S);if(m=m.add(y),h!==0)for(let x=0;x<c;x++)m=m.double()}return m}function pg(e){return H_(e.Fp),Go(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...PR(e.n,e.nBitLength),...e,...{p:e.Fp.ORDER}})}var OF,CR,$R,NF;var zR=J(()=>{vu();bu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */OF=BigInt(0),CR=BigInt(1);$R=new WeakMap,NF=new WeakMap});function Fs(e,t){if(fg(e),fg(t),e<0||e>=1<<8*t)throw Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let o=t-1;o>=0;o--)r[o]=e&255,e>>>=8;return new Uint8Array(r)}function hhe(e,t){let r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e[o]^t[o];return r}function fg(e){if(!Number.isSafeInteger(e))throw Error("number expected")}function ghe(e,t,r,o){if(_a(e),_a(t),fg(r),t.length>255)t=o(Tr(F_("H2C-OVERSIZE-DST-"),t));let{outputLen:n,blockLen:i}=o,a=Math.ceil(r/n);if(r>65535||a>255)throw Error("expand_message_xmd: invalid lenInBytes");let s=Tr(t,Fs(t.length,1)),c=Fs(0,i),u=Fs(r,2),d=Array(a),p=o(Tr(c,e,u,Fs(0,1),s));d[0]=o(Tr(p,Fs(1,1),s));for(let h=1;h<=a;h++){let y=[hhe(p,d[h-1]),Fs(h+1,1),s];d[h]=o(Tr(...y))}return Tr(...d).slice(0,r)}function yhe(e,t,r,o,n){if(_a(e),_a(t),fg(r),t.length>255){let i=Math.ceil(2*o/8);t=n.create({dkLen:i}).update(F_("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw Error("expand_message_xof: invalid lenInBytes");return n.create({dkLen:r}).update(e).update(Fs(r,2)).update(t).update(Fs(t.length,1)).digest()}function DF(e,t,r){Go(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:o,k:n,m:i,hash:a,expand:s,DST:c}=r;_a(e),fg(t);let u=typeof c==="string"?F_(c):c,d=o.toString(2).length,p=Math.ceil((d+n)/8),m=t*i*p,h;if(s==="xmd")h=ghe(e,u,m,a);else if(s==="xof")h=yhe(e,u,m,n,a);else if(s==="_internal_pass")h=e;else throw Error('expand must be "xmd" or "xof"');let y=Array(t);for(let x=0;x<t;x++){let S=Array(i);for(let v=0;v<i;v++){let E=p*(v+x*i),w=h.subarray(E,E+p);S[v]=yt(mhe(w),o)}y[x]=S}return y}function UF(e,t){let r=t.map((o)=>Array.from(o).reverse());return(o,n)=>{let[i,a,s,c]=r.map((p)=>p.reduce((m,h)=>e.add(e.mul(m,o),h))),[u,d]=wa(e,[a,c],!0);return o=e.mul(i,u),n=e.mul(n,e.mul(s,d)),{x:o,y:n}}}function LF(e,t,r){if(typeof t!=="function")throw Error("mapToCurve() must be defined");function o(i){return e.fromAffine(t(i))}function n(i){let a=i.clearCofactor();if(a.equals(e.ZERO))return e.ZERO;return a.assertValidity(),a}return{defaults:r,hashToCurve(i,a){let s=DF(i,2,{...r,DST:r.DST,...a}),c=o(s[0]),u=o(s[1]);return n(c.add(u))},encodeToCurve(i,a){let s=DF(i,1,{...r,DST:r.encodeDST,...a});return n(o(s[0]))},mapToCurve(i){if(!Array.isArray(i))throw Error("expected array of bigints");for(let a of i)if(typeof a!=="bigint")throw Error("expected array of bigints");return n(o(i))}}}var mhe;var jF=J(()=>{vu();bu();mhe=Dn});var UR=re(function(YF){Object.defineProperty(YF,"__esModule",{value:!0});YF.USE_PROXY=YF.UNSUPPORTED_MEDIA_TYPE=YF.UNPROCESSABLE_ENTITY=YF.UNAUTHORIZED=YF.TOO_MANY_REQUESTS=YF.TEMPORARY_REDIRECT=YF.SWITCHING_PROTOCOLS=YF.SERVICE_UNAVAILABLE=YF.SEE_OTHER=YF.RESET_CONTENT=YF.REQUESTED_RANGE_NOT_SATISFIABLE=YF.REQUEST_URI_TOO_LONG=YF.REQUEST_TOO_LONG=YF.REQUEST_TIMEOUT=YF.REQUEST_HEADER_FIELDS_TOO_LARGE=YF.PROXY_AUTHENTICATION_REQUIRED=YF.PROCESSING=YF.PRECONDITION_REQUIRED=YF.PRECONDITION_FAILED=YF.PERMANENT_REDIRECT=YF.PAYMENT_REQUIRED=YF.PARTIAL_CONTENT=YF.OK=YF.NOT_MODIFIED=YF.NOT_IMPLEMENTED=YF.NOT_FOUND=YF.NOT_ACCEPTABLE=YF.NON_AUTHORITATIVE_INFORMATION=YF.NO_CONTENT=YF.NETWORK_AUTHENTICATION_REQUIRED=YF.MULTIPLE_CHOICES=YF.MULTI_STATUS=YF.MOVED_TEMPORARILY=YF.MOVED_PERMANENTLY=YF.METHOD_NOT_ALLOWED=YF.METHOD_FAILURE=YF.LOCKED=YF.LENGTH_REQUIRED=YF.INTERNAL_SERVER_ERROR=YF.INSUFFICIENT_STORAGE=YF.INSUFFICIENT_SPACE_ON_RESOURCE=YF.IM_A_TEAPOT=YF.HTTP_VERSION_NOT_SUPPORTED=YF.GONE=YF.GATEWAY_TIMEOUT=YF.FORBIDDEN=YF.FAILED_DEPENDENCY=YF.EXPECTATION_FAILED=YF.CREATED=YF.CONTINUE=YF.CONFLICT=YF.BAD_REQUEST=YF.BAD_GATEWAY=YF.ACCEPTED=void 0;YF.ACCEPTED=202;YF.BAD_GATEWAY=502;YF.BAD_REQUEST=400;YF.CONFLICT=409;YF.CONTINUE=100;YF.CREATED=201;YF.EXPECTATION_FAILED=417;YF.FAILED_DEPENDENCY=424;YF.FORBIDDEN=403;YF.GATEWAY_TIMEOUT=504;YF.GONE=410;YF.HTTP_VERSION_NOT_SUPPORTED=505;YF.IM_A_TEAPOT=418;YF.INSUFFICIENT_SPACE_ON_RESOURCE=419;YF.INSUFFICIENT_STORAGE=507;YF.INTERNAL_SERVER_ERROR=500;YF.LENGTH_REQUIRED=411;YF.LOCKED=423;YF.METHOD_FAILURE=420;YF.METHOD_NOT_ALLOWED=405;YF.MOVED_PERMANENTLY=301;YF.MOVED_TEMPORARILY=302;YF.MULTI_STATUS=207;YF.MULTIPLE_CHOICES=300;YF.NETWORK_AUTHENTICATION_REQUIRED=511;YF.NO_CONTENT=204;YF.NON_AUTHORITATIVE_INFORMATION=203;YF.NOT_ACCEPTABLE=406;YF.NOT_FOUND=404;YF.NOT_IMPLEMENTED=501;YF.NOT_MODIFIED=304;YF.OK=200;YF.PARTIAL_CONTENT=206;YF.PAYMENT_REQUIRED=402;YF.PERMANENT_REDIRECT=308;YF.PRECONDITION_FAILED=412;YF.PRECONDITION_REQUIRED=428;YF.PROCESSING=102;YF.PROXY_AUTHENTICATION_REQUIRED=407;YF.REQUEST_HEADER_FIELDS_TOO_LARGE=431;YF.REQUEST_TIMEOUT=408;YF.REQUEST_TOO_LONG=413;YF.REQUEST_URI_TOO_LONG=414;YF.REQUESTED_RANGE_NOT_SATISFIABLE=416;YF.RESET_CONTENT=205;YF.SEE_OTHER=303;YF.SERVICE_UNAVAILABLE=503;YF.SWITCHING_PROTOCOLS=101;YF.TEMPORARY_REDIRECT=307;YF.TOO_MANY_REQUESTS=429;YF.UNAUTHORIZED=401;YF.UNPROCESSABLE_ENTITY=422;YF.UNSUPPORTED_MEDIA_TYPE=415;YF.USE_PROXY=305;YF.default={ACCEPTED:YF.ACCEPTED,BAD_GATEWAY:YF.BAD_GATEWAY,BAD_REQUEST:YF.BAD_REQUEST,CONFLICT:YF.CONFLICT,CONTINUE:YF.CONTINUE,CREATED:YF.CREATED,EXPECTATION_FAILED:YF.EXPECTATION_FAILED,FORBIDDEN:YF.FORBIDDEN,GATEWAY_TIMEOUT:YF.GATEWAY_TIMEOUT,GONE:YF.GONE,HTTP_VERSION_NOT_SUPPORTED:YF.HTTP_VERSION_NOT_SUPPORTED,IM_A_TEAPOT:YF.IM_A_TEAPOT,INSUFFICIENT_SPACE_ON_RESOURCE:YF.INSUFFICIENT_SPACE_ON_RESOURCE,INSUFFICIENT_STORAGE:YF.INSUFFICIENT_STORAGE,INTERNAL_SERVER_ERROR:YF.INTERNAL_SERVER_ERROR,LENGTH_REQUIRED:YF.LENGTH_REQUIRED,LOCKED:YF.LOCKED,METHOD_FAILURE:YF.METHOD_FAILURE,METHOD_NOT_ALLOWED:YF.METHOD_NOT_ALLOWED,MOVED_PERMANENTLY:YF.MOVED_PERMANENTLY,MOVED_TEMPORARILY:YF.MOVED_TEMPORARILY,MULTI_STATUS:YF.MULTI_STATUS,MULTIPLE_CHOICES:YF.MULTIPLE_CHOICES,NETWORK_AUTHENTICATION_REQUIRED:YF.NETWORK_AUTHENTICATION_REQUIRED,NO_CONTENT:YF.NO_CONTENT,NON_AUTHORITATIVE_INFORMATION:YF.NON_AUTHORITATIVE_INFORMATION,NOT_ACCEPTABLE:YF.NOT_ACCEPTABLE,NOT_FOUND:YF.NOT_FOUND,NOT_IMPLEMENTED:YF.NOT_IMPLEMENTED,NOT_MODIFIED:YF.NOT_MODIFIED,OK:YF.OK,PARTIAL_CONTENT:YF.PARTIAL_CONTENT,PAYMENT_REQUIRED:YF.PAYMENT_REQUIRED,PERMANENT_REDIRECT:YF.PERMANENT_REDIRECT,PRECONDITION_FAILED:YF.PRECONDITION_FAILED,PRECONDITION_REQUIRED:YF.PRECONDITION_REQUIRED,PROCESSING:YF.PROCESSING,PROXY_AUTHENTICATION_REQUIRED:YF.PROXY_AUTHENTICATION_REQUIRED,REQUEST_HEADER_FIELDS_TOO_LARGE:YF.REQUEST_HEADER_FIELDS_TOO_LARGE,REQUEST_TIMEOUT:YF.REQUEST_TIMEOUT,REQUEST_TOO_LONG:YF.REQUEST_TOO_LONG,REQUEST_URI_TOO_LONG:YF.REQUEST_URI_TOO_LONG,REQUESTED_RANGE_NOT_SATISFIABLE:YF.REQUESTED_RANGE_NOT_SATISFIABLE,RESET_CONTENT:YF.RESET_CONTENT,SEE_OTHER:YF.SEE_OTHER,SERVICE_UNAVAILABLE:YF.SERVICE_UNAVAILABLE,SWITCHING_PROTOCOLS:YF.SWITCHING_PROTOCOLS,TEMPORARY_REDIRECT:YF.TEMPORARY_REDIRECT,TOO_MANY_REQUESTS:YF.TOO_MANY_REQUESTS,UNAUTHORIZED:YF.UNAUTHORIZED,UNPROCESSABLE_ENTITY:YF.UNPROCESSABLE_ENTITY,UNSUPPORTED_MEDIA_TYPE:YF.UNSUPPORTED_MEDIA_TYPE,USE_PROXY:YF.USE_PROXY}});var Q9=re(function(J9){Object.defineProperty(J9,"__esModule",{value:!0});J9.reasonPhraseToStatusCode=J9.statusCodeToReasonPhrase=void 0;J9.statusCodeToReasonPhrase={"202":"Accepted","502":"Bad Gateway","400":"Bad Request","409":"Conflict","100":"Continue","201":"Created","417":"Expectation Failed","424":"Failed Dependency","403":"Forbidden","504":"Gateway Timeout","410":"Gone","505":"HTTP Version Not Supported","418":"I'm a teapot","419":"Insufficient Space on Resource","507":"Insufficient Storage","500":"Internal Server Error","411":"Length Required","423":"Locked","420":"Method Failure","405":"Method Not Allowed","301":"Moved Permanently","302":"Moved Temporarily","207":"Multi-Status","300":"Multiple Choices","511":"Network Authentication Required","204":"No Content","203":"Non Authoritative Information","406":"Not Acceptable","404":"Not Found","501":"Not Implemented","304":"Not Modified","200":"OK","206":"Partial Content","402":"Payment Required","308":"Permanent Redirect","412":"Precondition Failed","428":"Precondition Required","102":"Processing","103":"Early Hints","426":"Upgrade Required","407":"Proxy Authentication Required","431":"Request Header Fields Too Large","408":"Request Timeout","413":"Request Entity Too Large","414":"Request-URI Too Long","416":"Requested Range Not Satisfiable","205":"Reset Content","303":"See Other","503":"Service Unavailable","101":"Switching Protocols","307":"Temporary Redirect","429":"Too Many Requests","401":"Unauthorized","451":"Unavailable For Legal Reasons","422":"Unprocessable Entity","415":"Unsupported Media Type","305":"Use Proxy","421":"Misdirected Request"};J9.reasonPhraseToStatusCode={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Early Hints":103,"Upgrade Required":426,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421}});var LR=re(function(tq){Object.defineProperty(tq,"__esModule",{value:!0});tq.getStatusText=tq.getStatusCode=tq.getReasonPhrase=void 0;var X9=Q9();function eq(e){var t=X9.statusCodeToReasonPhrase[e.toString()];if(!t)throw Error("Status code does not exist: "+e);return t}tq.getReasonPhrase=eq;function Zhe(e){var t=X9.reasonPhraseToStatusCode[e];if(!t)throw Error("Reason phrase does not exist: "+e);return t}tq.getStatusCode=Zhe;tq.getStatusText=eq});var oq=re(function(nq){Object.defineProperty(nq,"__esModule",{value:!0});nq.StatusCodes=void 0;var Jhe;(function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(Jhe=nq.StatusCodes||(nq.StatusCodes={}))});var aq=re(function(iq){Object.defineProperty(iq,"__esModule",{value:!0});iq.ReasonPhrases=void 0;var Yhe;(function(e){e.ACCEPTED="Accepted",e.BAD_GATEWAY="Bad Gateway",e.BAD_REQUEST="Bad Request",e.CONFLICT="Conflict",e.CONTINUE="Continue",e.CREATED="Created",e.EXPECTATION_FAILED="Expectation Failed",e.FAILED_DEPENDENCY="Failed Dependency",e.FORBIDDEN="Forbidden",e.GATEWAY_TIMEOUT="Gateway Timeout",e.GONE="Gone",e.HTTP_VERSION_NOT_SUPPORTED="HTTP Version Not Supported",e.IM_A_TEAPOT="I'm a teapot",e.INSUFFICIENT_SPACE_ON_RESOURCE="Insufficient Space on Resource",e.INSUFFICIENT_STORAGE="Insufficient Storage",e.INTERNAL_SERVER_ERROR="Internal Server Error",e.LENGTH_REQUIRED="Length Required",e.LOCKED="Locked",e.METHOD_FAILURE="Method Failure",e.METHOD_NOT_ALLOWED="Method Not Allowed",e.MOVED_PERMANENTLY="Moved Permanently",e.MOVED_TEMPORARILY="Moved Temporarily",e.MULTI_STATUS="Multi-Status",e.MULTIPLE_CHOICES="Multiple Choices",e.NETWORK_AUTHENTICATION_REQUIRED="Network Authentication Required",e.NO_CONTENT="No Content",e.NON_AUTHORITATIVE_INFORMATION="Non Authoritative Information",e.NOT_ACCEPTABLE="Not Acceptable",e.NOT_FOUND="Not Found",e.NOT_IMPLEMENTED="Not Implemented",e.NOT_MODIFIED="Not Modified",e.OK="OK",e.PARTIAL_CONTENT="Partial Content",e.PAYMENT_REQUIRED="Payment Required",e.PERMANENT_REDIRECT="Permanent Redirect",e.PRECONDITION_FAILED="Precondition Failed",e.PRECONDITION_REQUIRED="Precondition Required",e.PROCESSING="Processing",e.EARLY_HINTS="Early Hints",e.UPGRADE_REQUIRED="Upgrade Required",e.PROXY_AUTHENTICATION_REQUIRED="Proxy Authentication Required",e.REQUEST_HEADER_FIELDS_TOO_LARGE="Request Header Fields Too Large",e.REQUEST_TIMEOUT="Request Timeout",e.REQUEST_TOO_LONG="Request Entity Too Large",e.REQUEST_URI_TOO_LONG="Request-URI Too Long",e.REQUESTED_RANGE_NOT_SATISFIABLE="Requested Range Not Satisfiable",e.RESET_CONTENT="Reset Content",e.SEE_OTHER="See Other",e.SERVICE_UNAVAILABLE="Service Unavailable",e.SWITCHING_PROTOCOLS="Switching Protocols",e.TEMPORARY_REDIRECT="Temporary Redirect",e.TOO_MANY_REQUESTS="Too Many Requests",e.UNAUTHORIZED="Unauthorized",e.UNAVAILABLE_FOR_LEGAL_REASONS="Unavailable For Legal Reasons",e.UNPROCESSABLE_ENTITY="Unprocessable Entity",e.UNSUPPORTED_MEDIA_TYPE="Unsupported Media Type",e.USE_PROXY="Use Proxy",e.MISDIRECTED_REQUEST="Misdirected Request"})(Yhe=iq.ReasonPhrases||(iq.ReasonPhrases={}))});var X_=re(function(Fr){var Q_=Fr&&Fr.__assign||function(){return Q_=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]}return e},Q_.apply(this,arguments)},Qhe=Fr&&Fr.__createBinding||(Object.create?function(e,t,r,o){if(o===void 0)o=r;Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){if(o===void 0)o=r;e[o]=t[r]}),Xhe=Fr&&Fr.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))Qhe(t,e,r)},ege=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fr,"__esModule",{value:!0});var tge=ege(UR()),sq=LR(),qR=LR();Object.defineProperty(Fr,"getStatusCode",{enumerable:!0,get:function(){return qR.getStatusCode}});Object.defineProperty(Fr,"getReasonPhrase",{enumerable:!0,get:function(){return qR.getReasonPhrase}});Object.defineProperty(Fr,"getStatusText",{enumerable:!0,get:function(){return qR.getStatusText}});var rge=oq();Object.defineProperty(Fr,"StatusCodes",{enumerable:!0,get:function(){return rge.StatusCodes}});var nge=aq();Object.defineProperty(Fr,"ReasonPhrases",{enumerable:!0,get:function(){return nge.ReasonPhrases}});Xhe(UR(),Fr);Fr.default=Q_(Q_({},tge.default),{getStatusCode:sq.getStatusCode,getStatusText:sq.getStatusText})});function Zt(e){if(typeof e==="string")return{address:e,type:"json-rpc"};return e}var Zo,nw,lq,ow,dq,VR,ZR,WR,gg,iw;var Ri=J(()=>{Zo=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],nw=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],lq=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],ow=[...lq,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],dq=[...lq,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],VR=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],ZR=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],WR=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],gg=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],iw=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}]});function br(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new KR(e.type);return`${e.name}(${yg(e.inputs,{includeName:t})})`}function yg(e,{includeName:t=!1}={}){if(!e)return"";return e.map((r)=>uge(r,{includeName:t})).join(t?", ":",")}function uge(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${yg(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}var Ea=J(()=>{ur()});function lr(e,{strict:t=!0}={}){if(!e)return!1;if(typeof e!=="string")return!1;return t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function ht(e){if(lr(e,{strict:!1}))return Math.ceil((e.length-2)/2);return e.length}var mo=()=>{};var JR="2.48.8";function pq(e,t){if(t?.(e))return e;if(e&&typeof e==="object"&&"cause"in e&&e.cause!==void 0)return pq(e.cause,t);return t?null:e}var YR,j;var pt=J(()=>{YR={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${JR}`};j=class j extends Error{constructor(e,t={}){let r=(()=>{if(t.cause instanceof j)return t.cause.details;if(t.cause?.message)return t.cause.message;return t.details})(),o=(()=>{if(t.cause instanceof j)return t.cause.docsPath||t.docsPath;return t.docsPath})(),n=YR.getDocsUrl?.({...t,docsPath:o}),i=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...YR.version?[`Version: ${YR.version}`]:[]].join(`
|
|
26
|
+
deps: ${r}}`};var Dpe={keyword:"dependencies",type:"object",schemaType:"object",error:mj.error,code(e){let[t,r]=Upe(e);pj(e,t),fj(e,r)}};function Upe({schema:e}){let t={},r={};for(let o in e){if(o==="__proto__")continue;let n=Array.isArray(e[o])?t:r;n[o]=e[o]}return[t,r]}function pj(e,t=e.schema){let{gen:r,data:o,it:n}=e;if(Object.keys(t).length===0)return;let i=r.let("missing");for(let a in t){let s=t[a];if(s.length===0)continue;let c=(0,tg.propertyInData)(r,o,a,n.opts.ownProperties);if(e.setParams({property:a,depsCount:s.length,deps:s.join(", ")}),n.allErrors)r.if(c,()=>{for(let u of s)(0,tg.checkReportMissingProp)(e,u)});else r.if(H6._`${c} && (${(0,tg.checkMissingProp)(e,s,i)})`),(0,tg.reportMissingProp)(e,i),r.else()}}mj.validatePropertyDeps=pj;function fj(e,t=e.schema){let{gen:r,data:o,keyword:n,it:i}=e,a=r.name("valid");for(let s in t){if((0,Bpe.alwaysValidSchema)(i,t[s]))continue;r.if((0,tg.propertyInData)(r,o,s,i.opts.ownProperties),()=>{let c=e.subschema({keyword:n,schemaProp:s},a);e.mergeValidEvaluated(c,a)},()=>r.var(a,!0)),e.ok(a)}}mj.validateSchemaDeps=fj;mj.default=Dpe});var vj=re(function(xj){Object.defineProperty(xj,"__esModule",{value:!0});var bj=rt(),Fpe=ft(),qpe={message:"property name must be valid",params:({params:e})=>bj._`{propertyName: ${e.propertyName}}`},Hpe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:qpe,code(e){let{gen:t,schema:r,data:o,it:n}=e;if((0,Fpe.alwaysValidSchema)(n,r))return;let i=t.name("valid");t.forIn("key",o,(a)=>{e.setParams({propertyName:a}),e.subschema({keyword:"propertyNames",data:a,dataTypes:["string"],propertyName:a,compositeRule:!0},i),t.if((0,bj.not)(i),()=>{if(e.error(!0),!n.allErrors)t.break()})}),e.ok(i)}};xj.default=Hpe});var G6=re(function(_j){Object.defineProperty(_j,"__esModule",{value:!0});var k_=co(),jo=rt(),Vpe=pa(),A_=ft(),Zpe={message:"must NOT have additional properties",params:({params:e})=>jo._`{additionalProperty: ${e.additionalProperty}}`},Wpe={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Zpe,code(e){let{gen:t,schema:r,parentSchema:o,data:n,errsCount:i,it:a}=e;if(!i)throw Error("ajv implementation error");let{allErrors:s,opts:c}=a;if(a.props=!0,c.removeAdditional!=="all"&&(0,A_.alwaysValidSchema)(a,r))return;let u=(0,k_.allSchemaProperties)(o.properties),d=(0,k_.allSchemaProperties)(o.patternProperties);p(),e.ok(jo._`${i} === ${Vpe.default.errors}`);function p(){t.forIn("key",n,(S)=>{if(!u.length&&!d.length)y(S);else t.if(m(S),()=>y(S))})}function m(S){let v;if(u.length>8){let E=(0,A_.schemaRefOrVal)(a,o.properties,"properties");v=(0,k_.isOwnProperty)(t,E,S)}else if(u.length)v=(0,jo.or)(...u.map((E)=>jo._`${S} === ${E}`));else v=jo.nil;if(d.length)v=(0,jo.or)(v,...d.map((E)=>jo._`${(0,k_.usePattern)(e,E)}.test(${S})`));return(0,jo.not)(v)}function h(S){t.code(jo._`delete ${n}[${S}]`)}function y(S){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){h(S);return}if(r===!1){if(e.setParams({additionalProperty:S}),e.error(),!s)t.break();return}if(typeof r=="object"&&!(0,A_.alwaysValidSchema)(a,r)){let v=t.name("valid");if(c.removeAdditional==="failing")x(S,v,!1),t.if((0,jo.not)(v),()=>{e.reset(),h(S)});else if(x(S,v),!s)t.if((0,jo.not)(v),()=>t.break())}}function x(S,v,E){let w={keyword:"additionalProperties",dataProp:S,dataPropType:A_.Type.Str};if(E===!1)Object.assign(w,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(w,v)}}};_j.default=Wpe});var Ej=re(function(Tj){Object.defineProperty(Tj,"__esModule",{value:!0});var Jpe=qh(),wj=co(),V6=ft(),Sj=G6(),Ype={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:n,it:i}=e;if(i.opts.removeAdditional==="all"&&o.additionalProperties===void 0)Sj.default.code(new Jpe.KeywordCxt(i,Sj.default,"additionalProperties"));let a=(0,wj.allSchemaProperties)(r);for(let p of a)i.definedProperties.add(p);if(i.opts.unevaluated&&a.length&&i.props!==!0)i.props=V6.mergeEvaluated.props(t,(0,V6.toHash)(a),i.props);let s=a.filter((p)=>!(0,V6.alwaysValidSchema)(i,r[p]));if(s.length===0)return;let c=t.name("valid");for(let p of s){if(u(p))d(p);else{if(t.if((0,wj.propertyInData)(t,n,p,i.opts.ownProperties)),d(p),!i.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(p),e.ok(c)}function u(p){return i.opts.useDefaults&&!i.compositeRule&&r[p].default!==void 0}function d(p){e.subschema({keyword:"properties",schemaProp:p,dataProp:p},c)}}};Tj.default=Ype});var Rj=re(function(Aj){Object.defineProperty(Aj,"__esModule",{value:!0});var Ij=co(),R_=rt(),Pj=ft(),kj=ft(),Xpe={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:n,it:i}=e,{opts:a}=i,s=(0,Ij.allSchemaProperties)(r),c=s.filter((x)=>(0,Pj.alwaysValidSchema)(i,r[x]));if(s.length===0||c.length===s.length&&(!i.opts.unevaluated||i.props===!0))return;let u=a.strictSchema&&!a.allowMatchingProperties&&n.properties,d=t.name("valid");if(i.props!==!0&&!(i.props instanceof R_.Name))i.props=(0,kj.evaluatedPropsToName)(t,i.props);let{props:p}=i;m();function m(){for(let x of s){if(u)h(x);if(i.allErrors)y(x);else t.var(d,!0),y(x),t.if(d)}}function h(x){for(let S in u)if(new RegExp(x).test(S))(0,Pj.checkStrictMode)(i,`property ${S} matches pattern ${x} (use allowMatchingProperties)`)}function y(x){t.forIn("key",o,(S)=>{t.if(R_._`${(0,Ij.usePattern)(e,x)}.test(${S})`,()=>{let v=c.includes(x);if(!v)e.subschema({keyword:"patternProperties",schemaProp:x,dataProp:S,dataPropType:kj.Type.Str},d);if(i.opts.unevaluated&&p!==!0)t.assign(R_._`${p}[${S}]`,!0);else if(!v&&!i.allErrors)t.if((0,R_.not)(d),()=>t.break())})})}}};Aj.default=Xpe});var Oj=re(function($j){Object.defineProperty($j,"__esModule",{value:!0});var tfe=ft(),rfe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:o}=e;if((0,tfe.alwaysValidSchema)(o,r)){e.fail();return}let n=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),e.failResult(n,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};$j.default=rfe});var zj=re(function(Cj){Object.defineProperty(Cj,"__esModule",{value:!0});var ofe=co(),ife={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:ofe.validateUnion,error:{message:"must match a schema in anyOf"}};Cj.default=ife});var Mj=re(function(Nj){Object.defineProperty(Nj,"__esModule",{value:!0});var $_=rt(),sfe=ft(),cfe={message:"must match exactly one schema in oneOf",params:({params:e})=>$_._`{passingSchemas: ${e.passing}}`},ufe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:cfe,code(e){let{gen:t,schema:r,parentSchema:o,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let i=r,a=t.let("valid",!1),s=t.let("passing",null),c=t.name("_valid");e.setParams({passing:s}),t.block(u),e.result(a,()=>e.reset(),()=>e.error(!0));function u(){i.forEach((d,p)=>{let m;if((0,sfe.alwaysValidSchema)(n,d))t.var(c,!0);else m=e.subschema({keyword:"oneOf",schemaProp:p,compositeRule:!0},c);if(p>0)t.if($_._`${c} && ${a}`).assign(a,!1).assign(s,$_._`[${s}, ${p}]`).else();t.if(c,()=>{if(t.assign(a,!0),t.assign(s,p),m)e.mergeEvaluated(m,$_.Name)})})}}};Nj.default=ufe});var Dj=re(function(Bj){Object.defineProperty(Bj,"__esModule",{value:!0});var dfe=ft(),pfe={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:o}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let n=t.name("valid");r.forEach((i,a)=>{if((0,dfe.alwaysValidSchema)(o,i))return;let s=e.subschema({keyword:"allOf",schemaProp:a},n);e.ok(n),e.mergeEvaluated(s)})}};Bj.default=pfe});var Fj=re(function(jj){Object.defineProperty(jj,"__esModule",{value:!0});var O_=rt(),Lj=ft(),mfe={message:({params:e})=>O_.str`must match "${e.ifClause}" schema`,params:({params:e})=>O_._`{failingKeyword: ${e.ifClause}}`},hfe={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:mfe,code(e){let{gen:t,parentSchema:r,it:o}=e;if(r.then===void 0&&r.else===void 0)(0,Lj.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=Uj(o,"then"),i=Uj(o,"else");if(!n&&!i)return;let a=t.let("valid",!0),s=t.name("_valid");if(c(),e.reset(),n&&i){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(s,u("then",d),u("else",d))}else if(n)t.if(s,u("then"));else t.if((0,O_.not)(s),u("else"));e.pass(a,()=>e.error(!0));function c(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},s);e.mergeEvaluated(d)}function u(d,p){return()=>{let m=e.subschema({keyword:d},s);if(t.assign(a,s),e.mergeValidEvaluated(m,a),p)t.assign(p,O_._`${d}`);else e.setParams({ifClause:d})}}}};function Uj(e,t){let r=e.schema[t];return r!==void 0&&!(0,Lj.alwaysValidSchema)(e,r)}jj.default=hfe});var Hj=re(function(qj){Object.defineProperty(qj,"__esModule",{value:!0});var yfe=ft(),bfe={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)(0,yfe.checkStrictMode)(r,`"${e}" without "if" is ignored`)}};qj.default=bfe});var Vj=re(function(Gj){Object.defineProperty(Gj,"__esModule",{value:!0});var vfe=F6(),_fe=aj(),wfe=q6(),Sfe=uj(),Tfe=dj(),Efe=yj(),Ife=vj(),Pfe=G6(),kfe=Ej(),Afe=Rj(),Rfe=Oj(),$fe=zj(),Ofe=Mj(),Cfe=Dj(),zfe=Fj(),Nfe=Hj();function Mfe(e=!1){let t=[Rfe.default,$fe.default,Ofe.default,Cfe.default,zfe.default,Nfe.default,Ife.default,Pfe.default,Efe.default,kfe.default,Afe.default];if(e)t.push(_fe.default,Sfe.default);else t.push(vfe.default,wfe.default);return t.push(Tfe.default),t}Gj.default=Mfe});var Wj=re(function(Zj){Object.defineProperty(Zj,"__esModule",{value:!0});var sr=rt(),Dfe={message:({schemaCode:e})=>sr.str`must match format "${e}"`,params:({schemaCode:e})=>sr._`{format: ${e}}`},Ufe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Dfe,code(e,t){let{gen:r,data:o,$data:n,schema:i,schemaCode:a,it:s}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:p}=s;if(!c.validateFormats)return;if(n)m();else h();function m(){let y=r.scopeValue("formats",{ref:p.formats,code:c.code.formats}),x=r.const("fDef",sr._`${y}[${a}]`),S=r.let("fType"),v=r.let("format");r.if(sr._`typeof ${x} == "object" && !(${x} instanceof RegExp)`,()=>r.assign(S,sr._`${x}.type || "string"`).assign(v,sr._`${x}.validate`),()=>r.assign(S,sr._`"string"`).assign(v,x)),e.fail$data((0,sr.or)(E(),w()));function E(){if(c.strictSchema===!1)return sr.nil;return sr._`${a} && !${v}`}function w(){let _=d.$async?sr._`(${x}.async ? await ${v}(${o}) : ${v}(${o}))`:sr._`${v}(${o})`,T=sr._`(typeof ${v} == "function" ? ${_} : ${v}.test(${o}))`;return sr._`${v} && ${v} !== true && ${S} === ${t} && !${T}`}}function h(){let y=p.formats[i];if(!y){E();return}if(y===!0)return;let[x,S,v]=w(y);if(x===t)e.pass(_());function E(){if(c.strictSchema===!1){p.logger.warn(T());return}throw Error(T());function T(){return`unknown format "${i}" ignored in schema at path "${u}"`}}function w(T){let k=T instanceof RegExp?(0,sr.regexpCode)(T):c.code.formats?sr._`${c.code.formats}${(0,sr.getProperty)(i)}`:void 0,O=r.scopeValue("formats",{key:i,ref:T,code:k});if(typeof T=="object"&&!(T instanceof RegExp))return[T.type||"string",T.validate,sr._`${O}.validate`];return["string",T,O]}function _(){if(typeof y=="object"&&!(y instanceof RegExp)&&y.async){if(!d.$async)throw Error("async format in sync schema");return sr._`await ${v}(${o})`}return typeof S=="function"?sr._`${v}(${o})`:sr._`${v}.test(${o})`}}}};Zj.default=Ufe});var Jj=re(function(Kj){Object.defineProperty(Kj,"__esModule",{value:!0});var jfe=Wj(),Ffe=[jfe.default];Kj.default=Ffe});var Xj=re(function(Yj){Object.defineProperty(Yj,"__esModule",{value:!0});Yj.contentVocabulary=Yj.metadataVocabulary=void 0;Yj.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Yj.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var r3=re(function(t3){Object.defineProperty(t3,"__esModule",{value:!0});var Gfe=TL(),Vfe=YL(),Zfe=Vj(),Wfe=Jj(),e3=Xj(),Kfe=[Gfe.default,Vfe.default,(0,Zfe.default)(),Wfe.default,e3.metadataVocabulary,e3.contentVocabulary];t3.default=Kfe});var a3=re(function(o3){Object.defineProperty(o3,"__esModule",{value:!0});o3.DiscrError=void 0;var n3;(function(e){e.Tag="tag",e.Mapping="mapping"})(n3||(o3.DiscrError=n3={}))});var u3=re(function(c3){Object.defineProperty(c3,"__esModule",{value:!0});var Dd=rt(),Z6=a3(),s3=h_(),Yfe=Hh(),Qfe=ft(),Xfe={message:({params:{discrError:e,tagName:t}})=>e===Z6.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>Dd._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},eme={keyword:"discriminator",type:"object",schemaType:"object",error:Xfe,code(e){let{gen:t,data:r,schema:o,parentSchema:n,it:i}=e,{oneOf:a}=n;if(!i.opts.discriminator)throw Error("discriminator: requires discriminator option");let s=o.propertyName;if(typeof s!="string")throw Error("discriminator: requires propertyName");if(o.mapping)throw Error("discriminator: mapping is not supported");if(!a)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",Dd._`${r}${(0,Dd.getProperty)(s)}`);t.if(Dd._`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:Z6.DiscrError.Tag,tag:u,tagName:s})),e.ok(c);function d(){let h=m();t.if(!1);for(let y in h)t.elseIf(Dd._`${u} === ${y}`),t.assign(c,p(h[y]));t.else(),e.error(!1,{discrError:Z6.DiscrError.Mapping,tag:u,tagName:s}),t.endIf()}function p(h){let y=t.name("valid"),x=e.subschema({keyword:"oneOf",schemaProp:h},y);return e.mergeEvaluated(x,Dd.Name),y}function m(){var h;let y={},x=v(n),S=!0;for(let _=0;_<a.length;_++){let T=a[_];if((T===null||T===void 0?void 0:T.$ref)&&!(0,Qfe.schemaHasRulesButRef)(T,i.self.RULES)){let O=T.$ref;if(T=s3.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,O),T instanceof s3.SchemaEnv)T=T.schema;if(T===void 0)throw new Yfe.default(i.opts.uriResolver,i.baseId,O)}let k=(h=T===null||T===void 0?void 0:T.properties)===null||h===void 0?void 0:h[s];if(typeof k!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${s}"`);S=S&&(x||v(T)),E(k,_)}if(!S)throw Error(`discriminator: "${s}" must be required`);return y;function v({required:_}){return Array.isArray(_)&&_.includes(s)}function E(_,T){if(_.const)w(_.const,T);else if(_.enum)for(let k of _.enum)w(k,T);else throw Error(`discriminator: "properties/${s}" must have "const" or "enum"`)}function w(_,T){if(typeof _!="string"||_ in y)throw Error(`discriminator: "${s}" values must be unique strings`);y[_]=T}}}};c3.default=eme});var l3=re(function(_6e,rme){rme.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var K6=re(function(Bn,W6){Object.defineProperty(Bn,"__esModule",{value:!0});Bn.MissingRefError=Bn.ValidationError=Bn.CodeGen=Bn.Name=Bn.nil=Bn.stringify=Bn.str=Bn._=Bn.KeywordCxt=Bn.Ajv=void 0;var nme=mL(),ome=r3(),ime=u3(),d3=l3(),ame=["/properties"],C_="http://json-schema.org/draft-07/schema";class rg extends nme.default{_addVocabularies(){if(super._addVocabularies(),ome.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(ime.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(d3,ame):d3;this.addMetaSchema(e,C_,!1),this.refs["http://json-schema.org/schema"]=C_}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(C_)?C_:void 0)}}Bn.Ajv=rg;W6.exports=Bn=rg;W6.exports.Ajv=rg;Object.defineProperty(Bn,"__esModule",{value:!0});Bn.default=rg;var sme=qh();Object.defineProperty(Bn,"KeywordCxt",{enumerable:!0,get:function(){return sme.KeywordCxt}});var Ud=rt();Object.defineProperty(Bn,"_",{enumerable:!0,get:function(){return Ud._}});Object.defineProperty(Bn,"str",{enumerable:!0,get:function(){return Ud.str}});Object.defineProperty(Bn,"stringify",{enumerable:!0,get:function(){return Ud.stringify}});Object.defineProperty(Bn,"nil",{enumerable:!0,get:function(){return Ud.nil}});Object.defineProperty(Bn,"Name",{enumerable:!0,get:function(){return Ud.Name}});Object.defineProperty(Bn,"CodeGen",{enumerable:!0,get:function(){return Ud.CodeGen}});var cme=f_();Object.defineProperty(Bn,"ValidationError",{enumerable:!0,get:function(){return cme.default}});var ume=Hh();Object.defineProperty(Bn,"MissingRefError",{enumerable:!0,get:function(){return ume.default}})});var _3=re(function(x3){Object.defineProperty(x3,"__esModule",{value:!0});x3.formatNames=x3.fastFormats=x3.fullFormats=void 0;function Ti(e,t){return{validate:e,compare:t}}x3.fullFormats={date:Ti(h3,X6),time:Ti(Y6(!0),eR),"date-time":Ti(p3(!0),y3),"iso-time":Ti(Y6(),g3),"iso-date-time":Ti(p3(),b3),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:yme,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:Tme,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:bme,int32:{type:"number",validate:_me},int64:{type:"number",validate:wme},float:{type:"number",validate:m3},double:{type:"number",validate:m3},password:!0,binary:!0};x3.fastFormats={...x3.fullFormats,date:Ti(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,X6),time:Ti(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,eR),"date-time":Ti(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,y3),"iso-time":Ti(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,g3),"iso-date-time":Ti(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,b3),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};x3.formatNames=Object.keys(x3.fullFormats);function pme(e){return e%4===0&&(e%100!==0||e%400===0)}var fme=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,mme=[0,31,28,31,30,31,30,31,31,30,31,30,31];function h3(e){let t=fme.exec(e);if(!t)return!1;let r=+t[1],o=+t[2],n=+t[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&pme(r)?29:mme[o])}function X6(e,t){if(!(e&&t))return;if(e>t)return 1;if(e<t)return-1;return 0}var J6=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Y6(e){return function(r){let o=J6.exec(r);if(!o)return!1;let n=+o[1],i=+o[2],a=+o[3],s=o[4],c=o[5]==="-"?-1:1,u=+(o[6]||0),d=+(o[7]||0);if(u>23||d>59||e&&!s)return!1;if(n<=23&&i<=59&&a<60)return!0;let p=i-d*c,m=n-u*c-(p<0?1:0);return(m===23||m===-1)&&(p===59||p===-1)&&a<61}}function eR(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),o=new Date("2020-01-01T"+t).valueOf();if(!(r&&o))return;return r-o}function g3(e,t){if(!(e&&t))return;let r=J6.exec(e),o=J6.exec(t);if(!(r&&o))return;if(e=r[1]+r[2]+r[3],t=o[1]+o[2]+o[3],e>t)return 1;if(e<t)return-1;return 0}var Q6=/t|\s/i;function p3(e){let t=Y6(e);return function(o){let n=o.split(Q6);return n.length===2&&h3(n[0])&&t(n[1])}}function y3(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),o=new Date(t).valueOf();if(!(r&&o))return;return r-o}function b3(e,t){if(!(e&&t))return;let[r,o]=e.split(Q6),[n,i]=t.split(Q6),a=X6(r,n);if(a===void 0)return;return a||eR(o,i)}var hme=/\/|:/,gme=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function yme(e){return hme.test(e)&&gme.test(e)}var f3=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function bme(e){return f3.lastIndex=0,f3.test(e)}var xme=-2147483648,vme=2147483647;function _me(e){return Number.isInteger(e)&&e<=vme&&e>=xme}function wme(e){return Number.isInteger(e)}function m3(){return!0}var Sme=/[^\\]\\Z/;function Tme(e){if(Sme.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}}});var S3=re(function(w3){Object.defineProperty(w3,"__esModule",{value:!0});w3.formatLimitDefinition=void 0;var Ime=K6(),Fo=rt(),Ms=Fo.operators,z_={formatMaximum:{okStr:"<=",ok:Ms.LTE,fail:Ms.GT},formatMinimum:{okStr:">=",ok:Ms.GTE,fail:Ms.LT},formatExclusiveMaximum:{okStr:"<",ok:Ms.LT,fail:Ms.GTE},formatExclusiveMinimum:{okStr:">",ok:Ms.GT,fail:Ms.LTE}},Pme={message:({keyword:e,schemaCode:t})=>Fo.str`should be ${z_[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Fo._`{comparison: ${z_[e].okStr}, limit: ${t}}`};w3.formatLimitDefinition={keyword:Object.keys(z_),type:"string",schemaType:"string",$data:!0,error:Pme,code(e){let{gen:t,data:r,schemaCode:o,keyword:n,it:i}=e,{opts:a,self:s}=i;if(!a.validateFormats)return;let c=new Ime.KeywordCxt(i,s.RULES.all.format.definition,"format");if(c.$data)u();else d();function u(){let m=t.scopeValue("formats",{ref:s.formats,code:a.code.formats}),h=t.const("fmt",Fo._`${m}[${c.schemaCode}]`);e.fail$data((0,Fo.or)(Fo._`typeof ${h} != "object"`,Fo._`${h} instanceof RegExp`,Fo._`typeof ${h}.compare != "function"`,p(h)))}function d(){let m=c.schema,h=s.formats[m];if(!h||h===!0)return;if(typeof h!="object"||h instanceof RegExp||typeof h.compare!="function")throw Error(`"${n}": format "${m}" does not define "compare" function`);let y=t.scopeValue("formats",{key:m,ref:h,code:a.code.formats?Fo._`${a.code.formats}${(0,Fo.getProperty)(m)}`:void 0});e.fail$data(p(y))}function p(m){return Fo._`${m}.compare(${r}, ${o}) ${z_[n].fail} 0`}},dependencies:["format"]};var kme=(e)=>(e.addKeyword(w3.formatLimitDefinition),e);w3.default=kme});var P3=re(function(ng,I3){Object.defineProperty(ng,"__esModule",{value:!0});var Ld=_3(),Rme=S3(),nR=rt(),T3=new nR.Name("fullFormats"),$me=new nR.Name("fastFormats"),oR=(e,t={keywords:!0})=>{if(Array.isArray(t))return E3(e,t,Ld.fullFormats,T3),e;let[r,o]=t.mode==="fast"?[Ld.fastFormats,$me]:[Ld.fullFormats,T3],n=t.formats||Ld.formatNames;if(E3(e,n,r,o),t.keywords)(0,Rme.default)(e);return e};oR.get=(e,t="full")=>{let o=(t==="fast"?Ld.fastFormats:Ld.fullFormats)[e];if(!o)throw Error(`Unknown format "${e}"`);return o};function E3(e,t,r,o){var n,i;(n=(i=e.opts.code).formats)!==null&&n!==void 0||(i.formats=nR._`require("ajv-formats/dist/formats").${o}`);for(let a of t)e.addFormat(a,r[a])}I3.exports=ng=oR;Object.defineProperty(ng,"__esModule",{value:!0});ng.default=oR});import*as ha from"node:crypto";var cu;var J3=J(()=>{cu=ha&&typeof ha==="object"&&"webcrypto"in ha?ha.webcrypto:ha&&typeof ha==="object"&&("randomBytes"in ha)?ha:void 0});function Hme(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function uu(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function qo(e,...t){if(!Hme(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function Q3(e){if(typeof e!=="function"||typeof e.create!=="function")throw Error("Hash should be wrapped by utils.createHasher");uu(e.outputLen),uu(e.blockLen)}function ya(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function B_(e,t){qo(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function X3(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function po(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function D_(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ho(e,t){return e<<32-t|e>>>t}function Vme(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Zme(e){for(let t=0;t<e.length;t++)e[t]=Vme(e[t]);return e}function lu(e){if(qo(e),eF)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=Wme[e[r]];return t}function Y3(e){if(e>=ga._0&&e<=ga._9)return e-ga._0;if(e>=ga.A&&e<=ga.F)return e-(ga.A-10);if(e>=ga.a&&e<=ga.f)return e-(ga.a-10);return}function ig(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);if(eF)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let o=new Uint8Array(r);for(let n=0,i=0;n<r;n++,i+=2){let a=Y3(e.charCodeAt(i)),s=Y3(e.charCodeAt(i+1));if(a===void 0||s===void 0){let c=e[i]+e[i+1];throw Error('hex string expected, got non-hex character "'+c+'" at index '+i)}o[n]=a*16+s}return o}function jd(e){if(typeof e!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function du(e){if(typeof e==="string")e=jd(e);return qo(e),e}function bR(...e){let t=0;for(let o=0;o<e.length;o++){let n=e[o];qo(n),t+=n.length}let r=new Uint8Array(t);for(let o=0,n=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return r}class pu{}function ag(e){let t=(o)=>e().update(du(o)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Fd(e=32){if(cu&&typeof cu.getRandomValues==="function")return cu.getRandomValues(new Uint8Array(e));if(cu&&typeof cu.randomBytes==="function")return Uint8Array.from(cu.randomBytes(e));throw Error("crypto.getRandomValues must be defined")}var Gme,yR,eF,Wme,ga;var fo=J(()=>{J3();/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Gme=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();yR=Gme?(e)=>e:Zme,eF=(()=>typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function")(),Wme=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));ga={_0:48,_9:57,A:65,F:70,a:97,f:102}});function Kme(e,t,r,o){if(typeof e.setBigUint64==="function")return e.setBigUint64(t,r,o);let n=BigInt(32),i=BigInt(4294967295),a=Number(r>>n&i),s=Number(r&i),c=o?4:0,u=o?0:4;e.setUint32(t+c,a,o),e.setUint32(t+u,s,o)}function tF(e,t,r){return e&t^~e&r}function rF(e,t,r){return e&t^e&r^t&r}var U_,ba,jr;var nF=J(()=>{fo();U_=class U_ extends pu{constructor(e,t,r,o){super();this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(e),this.view=D_(this.buffer)}update(e){ya(this),e=du(e),qo(e);let{view:t,buffer:r,blockLen:o}=this,n=e.length;for(let i=0;i<n;){let a=Math.min(o-this.pos,n-i);if(a===o){let s=D_(e);for(;o<=n-i;i+=o)this.process(s,i);continue}if(r.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===o)this.process(t,0),this.pos=0}return this.length+=e.length,this.roundClean(),this}digestInto(e){ya(this),B_(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:o,isLE:n}=this,{pos:i}=this;if(t[i++]=128,po(this.buffer.subarray(i)),this.padOffset>o-i)this.process(r,0),i=0;for(let d=i;d<o;d++)t[d]=0;Kme(r,o-8,BigInt(this.length*8),n),this.process(r,0);let a=D_(e),s=this.outputLen;if(s%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=s/4,u=this.get();if(c>u.length)throw Error("_sha2: outputLen bigger than state");for(let d=0;d<c;d++)a.setUint32(4*d,u[d],n)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:o,finished:n,destroyed:i,pos:a}=this;if(e.destroyed=i,e.finished=n,e.length=o,e.pos=a,o%t)e.buffer.set(r);return e}clone(){return this._cloneInto()}};ba=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),jr=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209])});function Jme(e,t=!1){if(t)return{h:Number(e&L_),l:Number(e>>oF&L_)};return{h:Number(e>>oF&L_)|0,l:Number(e&L_)|0}}function j_(e,t=!1){let r=e.length,o=new Uint32Array(r),n=new Uint32Array(r);for(let i=0;i<r;i++){let{h:a,l:s}=Jme(e[i],t);[o[i],n[i]]=[a,s]}return[o,n]}function Ii(e,t,r,o){let n=(t>>>0)+(o>>>0);return{h:e+r+(n/4294967296|0)|0,l:n|0}}var L_,oF,xR=(e,t,r)=>e>>>r,vR=(e,t,r)=>e<<32-r|t>>>r,fu=(e,t,r)=>e>>>r|t<<32-r,mu=(e,t,r)=>e<<32-r|t>>>r,sg=(e,t,r)=>e<<64-r|t>>>r-32,cg=(e,t,r)=>e>>>r-32|t<<64-r,iF=(e,t,r)=>e<<r|t>>>32-r,aF=(e,t,r)=>t<<r|e>>>32-r,sF=(e,t,r)=>t<<r-32|e>>>64-r,cF=(e,t,r)=>e<<r-32|t>>>64-r,uF=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),lF=(e,t,r,o)=>t+r+o+(e/4294967296|0)|0,dF=(e,t,r,o)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0),pF=(e,t,r,o,n)=>t+r+o+n+(e/4294967296|0)|0,fF=(e,t,r,o,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(o>>>0)+(n>>>0),mF=(e,t,r,o,n,i)=>t+r+o+n+i+(e/4294967296|0)|0;var _R=J(()=>{L_=BigInt(4294967295),oF=BigInt(32)});var Qme,Ds,wR,hF,Xme,ehe,Us,Ls,gF,xa,yF;var ug=J(()=>{nF();_R();fo();Qme=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ds=new Uint32Array(64);wR=class wR extends U_{constructor(e=32){super(64,e,8,!1);this.A=ba[0]|0,this.B=ba[1]|0,this.C=ba[2]|0,this.D=ba[3]|0,this.E=ba[4]|0,this.F=ba[5]|0,this.G=ba[6]|0,this.H=ba[7]|0}get(){let{A:e,B:t,C:r,D:o,E:n,F:i,G:a,H:s}=this;return[e,t,r,o,n,i,a,s]}set(e,t,r,o,n,i,a,s){this.A=e|0,this.B=t|0,this.C=r|0,this.D=o|0,this.E=n|0,this.F=i|0,this.G=a|0,this.H=s|0}process(e,t){for(let d=0;d<16;d++,t+=4)Ds[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let p=Ds[d-15],m=Ds[d-2],h=Ho(p,7)^Ho(p,18)^p>>>3,y=Ho(m,17)^Ho(m,19)^m>>>10;Ds[d]=y+Ds[d-7]+h+Ds[d-16]|0}let{A:r,B:o,C:n,D:i,E:a,F:s,G:c,H:u}=this;for(let d=0;d<64;d++){let p=Ho(a,6)^Ho(a,11)^Ho(a,25),m=u+p+tF(a,s,c)+Qme[d]+Ds[d]|0,y=(Ho(r,2)^Ho(r,13)^Ho(r,22))+rF(r,o,n)|0;u=c,c=s,s=a,a=i+m|0,i=n,n=o,o=r,r=m+y|0}r=r+this.A|0,o=o+this.B|0,n=n+this.C|0,i=i+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,o,n,i,a,s,c,u)}roundClean(){po(Ds)}destroy(){this.set(0,0,0,0,0,0,0,0),po(this.buffer)}};hF=(()=>j_(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e)=>BigInt(e))))(),Xme=(()=>hF[0])(),ehe=(()=>hF[1])(),Us=new Uint32Array(80),Ls=new Uint32Array(80);gF=class gF extends U_{constructor(e=64){super(128,e,16,!1);this.Ah=jr[0]|0,this.Al=jr[1]|0,this.Bh=jr[2]|0,this.Bl=jr[3]|0,this.Ch=jr[4]|0,this.Cl=jr[5]|0,this.Dh=jr[6]|0,this.Dl=jr[7]|0,this.Eh=jr[8]|0,this.El=jr[9]|0,this.Fh=jr[10]|0,this.Fl=jr[11]|0,this.Gh=jr[12]|0,this.Gl=jr[13]|0,this.Hh=jr[14]|0,this.Hl=jr[15]|0}get(){let{Ah:e,Al:t,Bh:r,Bl:o,Ch:n,Cl:i,Dh:a,Dl:s,Eh:c,El:u,Fh:d,Fl:p,Gh:m,Gl:h,Hh:y,Hl:x}=this;return[e,t,r,o,n,i,a,s,c,u,d,p,m,h,y,x]}set(e,t,r,o,n,i,a,s,c,u,d,p,m,h,y,x){this.Ah=e|0,this.Al=t|0,this.Bh=r|0,this.Bl=o|0,this.Ch=n|0,this.Cl=i|0,this.Dh=a|0,this.Dl=s|0,this.Eh=c|0,this.El=u|0,this.Fh=d|0,this.Fl=p|0,this.Gh=m|0,this.Gl=h|0,this.Hh=y|0,this.Hl=x|0}process(e,t){for(let E=0;E<16;E++,t+=4)Us[E]=e.getUint32(t),Ls[E]=e.getUint32(t+=4);for(let E=16;E<80;E++){let w=Us[E-15]|0,_=Ls[E-15]|0,T=fu(w,_,1)^fu(w,_,8)^xR(w,_,7),k=mu(w,_,1)^mu(w,_,8)^vR(w,_,7),O=Us[E-2]|0,z=Ls[E-2]|0,L=fu(O,z,19)^sg(O,z,61)^xR(O,z,6),P=mu(O,z,19)^cg(O,z,61)^vR(O,z,6),F=dF(k,P,Ls[E-7],Ls[E-16]),G=pF(F,T,L,Us[E-7],Us[E-16]);Us[E]=G|0,Ls[E]=F|0}let{Ah:r,Al:o,Bh:n,Bl:i,Ch:a,Cl:s,Dh:c,Dl:u,Eh:d,El:p,Fh:m,Fl:h,Gh:y,Gl:x,Hh:S,Hl:v}=this;for(let E=0;E<80;E++){let w=fu(d,p,14)^fu(d,p,18)^sg(d,p,41),_=mu(d,p,14)^mu(d,p,18)^cg(d,p,41),T=d&m^~d&y,k=p&h^~p&x,O=fF(v,_,k,ehe[E],Ls[E]),z=mF(O,S,w,T,Xme[E],Us[E]),L=O|0,P=fu(r,o,28)^sg(r,o,34)^sg(r,o,39),F=mu(r,o,28)^cg(r,o,34)^cg(r,o,39),G=r&n^r&a^n&a,ue=o&i^o&s^i&s;S=y|0,v=x|0,y=m|0,x=h|0,m=d|0,h=p|0,{h:d,l:p}=Ii(c|0,u|0,z|0,L|0),c=a|0,u=s|0,a=n|0,s=i|0,n=r|0,i=o|0;let W=uF(L,F,ue);r=lF(W,z,P,G),o=W|0}({h:r,l:o}=Ii(this.Ah|0,this.Al|0,r|0,o|0)),{h:n,l:i}=Ii(this.Bh|0,this.Bl|0,n|0,i|0),{h:a,l:s}=Ii(this.Ch|0,this.Cl|0,a|0,s|0),{h:c,l:u}=Ii(this.Dh|0,this.Dl|0,c|0,u|0),{h:d,l:p}=Ii(this.Eh|0,this.El|0,d|0,p|0),{h:m,l:h}=Ii(this.Fh|0,this.Fl|0,m|0,h|0),{h:y,l:x}=Ii(this.Gh|0,this.Gl|0,y|0,x|0),{h:S,l:v}=Ii(this.Hh|0,this.Hl|0,S|0,v|0),this.set(r,o,n,i,a,s,c,u,d,p,m,h,y,x,S,v)}roundClean(){po(Us,Ls)}destroy(){po(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};xa=ag(()=>new wR),yF=ag(()=>new gF)});function qd(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function _a(e){if(!qd(e))throw Error("Uint8Array expected")}function Pi(e,t){if(typeof t!=="boolean")throw Error(e+" boolean expected, got "+t)}function lg(e){let t=e.toString(16);return t.length&1?"0"+t:t}function vF(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);return e===""?IR:BigInt("0x"+e)}function js(e){if(_a(e),_F)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=the[e[r]];return t}function bF(e){if(e>=va._0&&e<=va._9)return e-va._0;if(e>=va.A&&e<=va.F)return e-(va.A-10);if(e>=va.a&&e<=va.f)return e-(va.a-10);return}function dg(e){if(typeof e!=="string")throw Error("hex string expected, got "+typeof e);if(_F)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let o=new Uint8Array(r);for(let n=0,i=0;n<r;n++,i+=2){let a=bF(e.charCodeAt(i)),s=bF(e.charCodeAt(i+1));if(a===void 0||s===void 0){let c=e[i]+e[i+1];throw Error('hex string expected, got non-hex character "'+c+'" at index '+i)}o[n]=a*16+s}return o}function Dn(e){return vF(js(e))}function hu(e){return _a(e),vF(js(Uint8Array.from(e).reverse()))}function ki(e,t){return dg(e.toString(16).padStart(t*2,"0"))}function Hd(e,t){return ki(e,t).reverse()}function It(e,t,r){let o;if(typeof t==="string")try{o=dg(t)}catch(i){throw Error(e+" must be hex string or Uint8Array, cause: "+i)}else if(qd(t))o=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=o.length;if(typeof r==="number"&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return o}function Tr(...e){let t=0;for(let o=0;o<e.length;o++){let n=e[o];_a(n),t+=n.length}let r=new Uint8Array(t);for(let o=0,n=0;o<e.length;o++){let i=e[o];r.set(i,n),n+=i.length}return r}function F_(e){if(typeof e!=="string")throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function gu(e,t,r){return SR(e)&&SR(t)&&SR(r)&&t<=e&&e<r}function mn(e,t,r,o){if(!gu(t,r,o))throw Error("expected valid "+e+": "+r+" <= n < "+o+", got "+t)}function wF(e){let t;for(t=0;e>IR;e>>=ER,t+=1);return t}function SF(e,t,r){if(typeof e!=="number"||e<2)throw Error("hashLen must be a number");if(typeof t!=="number"||t<2)throw Error("qByteLen must be a number");if(typeof r!=="function")throw Error("hmacFn must be a function");let o=TR(e),n=TR(e),i=0,a=()=>{o.fill(1),n.fill(0),i=0},s=(...p)=>r(n,o,...p),c=(p=TR(0))=>{if(n=s(xF([0]),p),o=s(),p.length===0)return;n=s(xF([1]),p),o=s()},u=()=>{if(i++>=1000)throw Error("drbg: tried 1000 values");let p=0,m=[];while(p<t){o=s();let h=o.slice();m.push(h),p+=o.length}return Tr(...m)};return(p,m)=>{a(),c(p);let h=void 0;while(!(h=m(u())))c();return a(),h}}function Go(e,t,r={}){let o=(n,i,a)=>{let s=rhe[i];if(typeof s!=="function")throw Error("invalid validator function");let c=e[n];if(a&&c===void 0)return;if(!s(c,e))throw Error("param "+String(n)+" is invalid. Expected "+i+", got "+c)};for(let[n,i]of Object.entries(t))o(n,i,!1);for(let[n,i]of Object.entries(r))o(n,i,!0);return e}function Gd(e){let t=new WeakMap;return(r,...o)=>{let n=t.get(r);if(n!==void 0)return n;let i=e(r,...o);return t.set(r,i),i}}var IR,ER,_F,the,va,SR=(e)=>typeof e==="bigint"&&IR<=e,yu=(e)=>(ER<<BigInt(e))-ER,TR=(e)=>new Uint8Array(e),xF=(e)=>Uint8Array.from(e),rhe;var bu=J(()=>{/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */IR=BigInt(0),ER=BigInt(1);_F=typeof Uint8Array.from([]).toHex==="function"&&typeof Uint8Array.fromHex==="function",the=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));va={_0:48,_9:57,A:65,F:70,a:97,f:102};rhe={bigint:(e)=>typeof e==="bigint",function:(e)=>typeof e==="function",boolean:(e)=>typeof e==="boolean",string:(e)=>typeof e==="string",stringOrUint8Array:(e)=>typeof e==="string"||qd(e),isSafeInteger:(e)=>Number.isSafeInteger(e),array:(e)=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:(e)=>typeof e==="function"&&Number.isSafeInteger(e.outputLen)}});function xt(e,t){let r=e%t;return r>=hn?r:t+r}function Yt(e,t,r){let o=e;while(t-- >hn)o*=o,o%=r;return o}function q_(e,t){if(e===hn)throw Error("invert: expected non-zero number");if(t<=hn)throw Error("invert: expected positive modulus, got "+t);let r=xt(e,t),o=t,n=hn,i=Er,a=Er,s=hn;while(r!==hn){let u=o/r,d=o%r,p=n-a*u,m=i-s*u;o=r,r=d,n=a,i=s,a=p,s=m}if(o!==Er)throw Error("invert: does not exist");return xt(n,t)}function kF(e,t){let r=(e.ORDER+Er)/EF,o=e.pow(t,r);if(!e.eql(e.sqr(o),t))throw Error("Cannot find square root");return o}function ohe(e,t){let r=(e.ORDER-IF)/PF,o=e.mul(t,xu),n=e.pow(o,r),i=e.mul(t,n),a=e.mul(e.mul(i,xu),n),s=e.mul(i,e.sub(a,e.ONE));if(!e.eql(e.sqr(s),t))throw Error("Cannot find square root");return s}function ihe(e){if(e<BigInt(3))throw Error("sqrt is not defined for small field");let t=e-Er,r=0;while(t%xu===hn)t/=xu,r++;let o=xu,n=Sa(e);while(TF(n,o)===1)if(o++>1000)throw Error("Cannot find square root: probably non-prime P");if(r===1)return kF;let i=n.pow(o,t),a=(t+Er)/xu;return function(c,u){if(c.is0(u))return u;if(TF(c,u)!==1)throw Error("Cannot find square root");let d=r,p=c.mul(c.ONE,i),m=c.pow(u,t),h=c.pow(u,a);while(!c.eql(m,c.ONE)){if(c.is0(m))return c.ZERO;let y=1,x=c.sqr(m);while(!c.eql(x,c.ONE))if(y++,x=c.sqr(x),y===d)throw Error("Cannot find square root");let S=Er<<BigInt(d-y-1),v=c.pow(p,S);d=y,p=c.sqr(v),m=c.mul(m,p),h=c.mul(h,v)}return h}}function ahe(e){if(e%EF===nhe)return kF;if(e%PF===IF)return ohe;return ihe(e)}function H_(e){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=she.reduce((o,n)=>(o[n]="function",o),t);return Go(e,r)}function che(e,t,r){if(r<hn)throw Error("invalid exponent, negatives unsupported");if(r===hn)return e.ONE;if(r===Er)return t;let o=e.ONE,n=t;while(r>hn){if(r&Er)o=e.mul(o,n);n=e.sqr(n),r>>=Er}return o}function wa(e,t,r=!1){let o=Array(t.length).fill(r?e.ZERO:void 0),n=t.reduce((a,s,c)=>{if(e.is0(s))return a;return o[c]=a,e.mul(a,s)},e.ONE),i=e.inv(n);return t.reduceRight((a,s,c)=>{if(e.is0(s))return a;return o[c]=e.mul(a,o[c]),e.mul(a,s)},i),o}function TF(e,t){let r=(e.ORDER-Er)/xu,o=e.pow(t,r),n=e.eql(o,e.ONE),i=e.eql(o,e.ZERO),a=e.eql(o,e.neg(e.ONE));if(!n&&!i&&!a)throw Error("invalid Legendre symbol result");return n?1:i?0:-1}function PR(e,t){if(t!==void 0)uu(t);let r=t!==void 0?t:e.toString(2).length,o=Math.ceil(r/8);return{nBitLength:r,nByteLength:o}}function Sa(e,t,r=!1,o={}){if(e<=hn)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:n,nByteLength:i}=PR(e,t);if(i>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let a,s=Object.freeze({ORDER:e,isLE:r,BITS:n,BYTES:i,MASK:yu(n),ZERO:hn,ONE:Er,create:(c)=>xt(c,e),isValid:(c)=>{if(typeof c!=="bigint")throw Error("invalid field element: expected bigint, got "+typeof c);return hn<=c&&c<e},is0:(c)=>c===hn,isOdd:(c)=>(c&Er)===Er,neg:(c)=>xt(-c,e),eql:(c,u)=>c===u,sqr:(c)=>xt(c*c,e),add:(c,u)=>xt(c+u,e),sub:(c,u)=>xt(c-u,e),mul:(c,u)=>xt(c*u,e),pow:(c,u)=>che(s,c,u),div:(c,u)=>xt(c*q_(u,e),e),sqrN:(c)=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:(c)=>q_(c,e),sqrt:o.sqrt||((c)=>{if(!a)a=ahe(e);return a(s,c)}),toBytes:(c)=>r?Hd(c,i):ki(c,i),fromBytes:(c)=>{if(c.length!==i)throw Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return r?hu(c):Dn(c)},invertBatch:(c)=>wa(s,c),cmov:(c,u,d)=>d?u:c});return Object.freeze(s)}function RF(e){if(typeof e!=="bigint")throw Error("field order must be bigint");let t=e.toString(2).length;return Math.ceil(t/8)}function kR(e){let t=RF(e);return t+Math.ceil(t/2)}function $F(e,t,r=!1){let o=e.length,n=RF(t),i=kR(t);if(o<16||o<i||o>1024)throw Error("expected "+i+"-1024 bytes of input, got "+o);let a=r?hu(e):Dn(e),s=xt(a,t-Er)+Er;return r?Hd(s,n):ki(s,n)}var hn,Er,xu,nhe,EF,IF,PF,AF=(e,t)=>(xt(e,t)&Er)===Er,she;var vu=J(()=>{fo();bu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */hn=BigInt(0),Er=BigInt(1),xu=BigInt(2),nhe=BigInt(3),EF=BigInt(4),IF=BigInt(5),PF=BigInt(8);she=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"]});function AR(e,t){let r=t.negate();return e?r:t}function zF(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function RR(e,t){zF(e,t);let r=Math.ceil(t/e)+1,o=2**(e-1),n=2**e,i=yu(e),a=BigInt(e);return{windows:r,windowSize:o,mask:i,maxNumber:n,shiftBy:a}}function CF(e,t,r){let{windowSize:o,mask:n,maxNumber:i,shiftBy:a}=r,s=Number(e&n),c=e>>a;if(s>o)s-=i,c+=CR;let u=t*o,d=u+Math.abs(s)-1,p=s===0,m=s<0,h=t%2!==0;return{nextN:c,offset:d,isZero:p,isNeg:m,isNegF:h,offsetF:u}}function uhe(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((r,o)=>{if(!(r instanceof t))throw Error("invalid point at index "+o)})}function lhe(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((r,o)=>{if(!t.isValid(r))throw Error("invalid scalar at index "+o)})}function OR(e){return NF.get(e)||1}function G_(e,t){return{constTimeNegate:AR,hasPrecomputes(r){return OR(r)!==1},unsafeLadder(r,o,n=e.ZERO){let i=r;while(o>OF){if(o&CR)n=n.add(i);i=i.double(),o>>=CR}return n},precomputeWindow(r,o){let{windows:n,windowSize:i}=RR(o,t),a=[],s=r,c=s;for(let u=0;u<n;u++){c=s,a.push(c);for(let d=1;d<i;d++)c=c.add(s),a.push(c);s=c.double()}return a},wNAF(r,o,n){let{ZERO:i,BASE:a}=e,s=RR(r,t);for(let c=0;c<s.windows;c++){let{nextN:u,offset:d,isZero:p,isNeg:m,isNegF:h,offsetF:y}=CF(n,c,s);if(n=u,p)a=a.add(AR(h,o[y]));else i=i.add(AR(m,o[d]))}return{p:i,f:a}},wNAFUnsafe(r,o,n,i=e.ZERO){let a=RR(r,t);for(let s=0;s<a.windows;s++){if(n===OF)break;let{nextN:c,offset:u,isZero:d,isNeg:p}=CF(n,s,a);if(n=c,d)continue;else{let m=o[u];i=i.add(p?m.negate():m)}}return i},getPrecomputes(r,o,n){let i=$R.get(o);if(!i){if(i=this.precomputeWindow(o,r),r!==1)$R.set(o,n(i))}return i},wNAFCached(r,o,n){let i=OR(r);return this.wNAF(i,this.getPrecomputes(i,r,n),o)},wNAFCachedUnsafe(r,o,n,i){let a=OR(r);if(a===1)return this.unsafeLadder(r,o,i);return this.wNAFUnsafe(a,this.getPrecomputes(a,r,n),o,i)},setWindowSize(r,o){zF(o,t),NF.set(r,o),$R.delete(r)}}}function V_(e,t,r,o){uhe(r,e),lhe(o,t);let n=r.length,i=o.length;if(n!==i)throw Error("arrays of points and scalars must have equal length");let a=e.ZERO,s=wF(BigInt(n)),c=1;if(s>12)c=s-3;else if(s>4)c=s-2;else if(s>0)c=2;let u=yu(c),d=Array(Number(u)+1).fill(a),p=Math.floor((t.BITS-1)/c)*c,m=a;for(let h=p;h>=0;h-=c){d.fill(a);for(let x=0;x<i;x++){let S=o[x],v=Number(S>>BigInt(h)&u);d[v]=d[v].add(r[x])}let y=a;for(let x=d.length-1,S=a;x>0;x--)S=S.add(d[x]),y=y.add(S);if(m=m.add(y),h!==0)for(let x=0;x<c;x++)m=m.double()}return m}function pg(e){return H_(e.Fp),Go(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...PR(e.n,e.nBitLength),...e,...{p:e.Fp.ORDER}})}var OF,CR,$R,NF;var zR=J(()=>{vu();bu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */OF=BigInt(0),CR=BigInt(1);$R=new WeakMap,NF=new WeakMap});function Fs(e,t){if(fg(e),fg(t),e<0||e>=1<<8*t)throw Error("invalid I2OSP input: "+e);let r=Array.from({length:t}).fill(0);for(let o=t-1;o>=0;o--)r[o]=e&255,e>>>=8;return new Uint8Array(r)}function hhe(e,t){let r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e[o]^t[o];return r}function fg(e){if(!Number.isSafeInteger(e))throw Error("number expected")}function ghe(e,t,r,o){if(_a(e),_a(t),fg(r),t.length>255)t=o(Tr(F_("H2C-OVERSIZE-DST-"),t));let{outputLen:n,blockLen:i}=o,a=Math.ceil(r/n);if(r>65535||a>255)throw Error("expand_message_xmd: invalid lenInBytes");let s=Tr(t,Fs(t.length,1)),c=Fs(0,i),u=Fs(r,2),d=Array(a),p=o(Tr(c,e,u,Fs(0,1),s));d[0]=o(Tr(p,Fs(1,1),s));for(let h=1;h<=a;h++){let y=[hhe(p,d[h-1]),Fs(h+1,1),s];d[h]=o(Tr(...y))}return Tr(...d).slice(0,r)}function yhe(e,t,r,o,n){if(_a(e),_a(t),fg(r),t.length>255){let i=Math.ceil(2*o/8);t=n.create({dkLen:i}).update(F_("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw Error("expand_message_xof: invalid lenInBytes");return n.create({dkLen:r}).update(e).update(Fs(r,2)).update(t).update(Fs(t.length,1)).digest()}function DF(e,t,r){Go(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});let{p:o,k:n,m:i,hash:a,expand:s,DST:c}=r;_a(e),fg(t);let u=typeof c==="string"?F_(c):c,d=o.toString(2).length,p=Math.ceil((d+n)/8),m=t*i*p,h;if(s==="xmd")h=ghe(e,u,m,a);else if(s==="xof")h=yhe(e,u,m,n,a);else if(s==="_internal_pass")h=e;else throw Error('expand must be "xmd" or "xof"');let y=Array(t);for(let x=0;x<t;x++){let S=Array(i);for(let v=0;v<i;v++){let E=p*(v+x*i),w=h.subarray(E,E+p);S[v]=xt(mhe(w),o)}y[x]=S}return y}function UF(e,t){let r=t.map((o)=>Array.from(o).reverse());return(o,n)=>{let[i,a,s,c]=r.map((p)=>p.reduce((m,h)=>e.add(e.mul(m,o),h))),[u,d]=wa(e,[a,c],!0);return o=e.mul(i,u),n=e.mul(n,e.mul(s,d)),{x:o,y:n}}}function LF(e,t,r){if(typeof t!=="function")throw Error("mapToCurve() must be defined");function o(i){return e.fromAffine(t(i))}function n(i){let a=i.clearCofactor();if(a.equals(e.ZERO))return e.ZERO;return a.assertValidity(),a}return{defaults:r,hashToCurve(i,a){let s=DF(i,2,{...r,DST:r.DST,...a}),c=o(s[0]),u=o(s[1]);return n(c.add(u))},encodeToCurve(i,a){let s=DF(i,1,{...r,DST:r.encodeDST,...a});return n(o(s[0]))},mapToCurve(i){if(!Array.isArray(i))throw Error("expected array of bigints");for(let a of i)if(typeof a!=="bigint")throw Error("expected array of bigints");return n(o(i))}}}var mhe;var jF=J(()=>{vu();bu();mhe=Dn});var UR=re(function(YF){Object.defineProperty(YF,"__esModule",{value:!0});YF.USE_PROXY=YF.UNSUPPORTED_MEDIA_TYPE=YF.UNPROCESSABLE_ENTITY=YF.UNAUTHORIZED=YF.TOO_MANY_REQUESTS=YF.TEMPORARY_REDIRECT=YF.SWITCHING_PROTOCOLS=YF.SERVICE_UNAVAILABLE=YF.SEE_OTHER=YF.RESET_CONTENT=YF.REQUESTED_RANGE_NOT_SATISFIABLE=YF.REQUEST_URI_TOO_LONG=YF.REQUEST_TOO_LONG=YF.REQUEST_TIMEOUT=YF.REQUEST_HEADER_FIELDS_TOO_LARGE=YF.PROXY_AUTHENTICATION_REQUIRED=YF.PROCESSING=YF.PRECONDITION_REQUIRED=YF.PRECONDITION_FAILED=YF.PERMANENT_REDIRECT=YF.PAYMENT_REQUIRED=YF.PARTIAL_CONTENT=YF.OK=YF.NOT_MODIFIED=YF.NOT_IMPLEMENTED=YF.NOT_FOUND=YF.NOT_ACCEPTABLE=YF.NON_AUTHORITATIVE_INFORMATION=YF.NO_CONTENT=YF.NETWORK_AUTHENTICATION_REQUIRED=YF.MULTIPLE_CHOICES=YF.MULTI_STATUS=YF.MOVED_TEMPORARILY=YF.MOVED_PERMANENTLY=YF.METHOD_NOT_ALLOWED=YF.METHOD_FAILURE=YF.LOCKED=YF.LENGTH_REQUIRED=YF.INTERNAL_SERVER_ERROR=YF.INSUFFICIENT_STORAGE=YF.INSUFFICIENT_SPACE_ON_RESOURCE=YF.IM_A_TEAPOT=YF.HTTP_VERSION_NOT_SUPPORTED=YF.GONE=YF.GATEWAY_TIMEOUT=YF.FORBIDDEN=YF.FAILED_DEPENDENCY=YF.EXPECTATION_FAILED=YF.CREATED=YF.CONTINUE=YF.CONFLICT=YF.BAD_REQUEST=YF.BAD_GATEWAY=YF.ACCEPTED=void 0;YF.ACCEPTED=202;YF.BAD_GATEWAY=502;YF.BAD_REQUEST=400;YF.CONFLICT=409;YF.CONTINUE=100;YF.CREATED=201;YF.EXPECTATION_FAILED=417;YF.FAILED_DEPENDENCY=424;YF.FORBIDDEN=403;YF.GATEWAY_TIMEOUT=504;YF.GONE=410;YF.HTTP_VERSION_NOT_SUPPORTED=505;YF.IM_A_TEAPOT=418;YF.INSUFFICIENT_SPACE_ON_RESOURCE=419;YF.INSUFFICIENT_STORAGE=507;YF.INTERNAL_SERVER_ERROR=500;YF.LENGTH_REQUIRED=411;YF.LOCKED=423;YF.METHOD_FAILURE=420;YF.METHOD_NOT_ALLOWED=405;YF.MOVED_PERMANENTLY=301;YF.MOVED_TEMPORARILY=302;YF.MULTI_STATUS=207;YF.MULTIPLE_CHOICES=300;YF.NETWORK_AUTHENTICATION_REQUIRED=511;YF.NO_CONTENT=204;YF.NON_AUTHORITATIVE_INFORMATION=203;YF.NOT_ACCEPTABLE=406;YF.NOT_FOUND=404;YF.NOT_IMPLEMENTED=501;YF.NOT_MODIFIED=304;YF.OK=200;YF.PARTIAL_CONTENT=206;YF.PAYMENT_REQUIRED=402;YF.PERMANENT_REDIRECT=308;YF.PRECONDITION_FAILED=412;YF.PRECONDITION_REQUIRED=428;YF.PROCESSING=102;YF.PROXY_AUTHENTICATION_REQUIRED=407;YF.REQUEST_HEADER_FIELDS_TOO_LARGE=431;YF.REQUEST_TIMEOUT=408;YF.REQUEST_TOO_LONG=413;YF.REQUEST_URI_TOO_LONG=414;YF.REQUESTED_RANGE_NOT_SATISFIABLE=416;YF.RESET_CONTENT=205;YF.SEE_OTHER=303;YF.SERVICE_UNAVAILABLE=503;YF.SWITCHING_PROTOCOLS=101;YF.TEMPORARY_REDIRECT=307;YF.TOO_MANY_REQUESTS=429;YF.UNAUTHORIZED=401;YF.UNPROCESSABLE_ENTITY=422;YF.UNSUPPORTED_MEDIA_TYPE=415;YF.USE_PROXY=305;YF.default={ACCEPTED:YF.ACCEPTED,BAD_GATEWAY:YF.BAD_GATEWAY,BAD_REQUEST:YF.BAD_REQUEST,CONFLICT:YF.CONFLICT,CONTINUE:YF.CONTINUE,CREATED:YF.CREATED,EXPECTATION_FAILED:YF.EXPECTATION_FAILED,FORBIDDEN:YF.FORBIDDEN,GATEWAY_TIMEOUT:YF.GATEWAY_TIMEOUT,GONE:YF.GONE,HTTP_VERSION_NOT_SUPPORTED:YF.HTTP_VERSION_NOT_SUPPORTED,IM_A_TEAPOT:YF.IM_A_TEAPOT,INSUFFICIENT_SPACE_ON_RESOURCE:YF.INSUFFICIENT_SPACE_ON_RESOURCE,INSUFFICIENT_STORAGE:YF.INSUFFICIENT_STORAGE,INTERNAL_SERVER_ERROR:YF.INTERNAL_SERVER_ERROR,LENGTH_REQUIRED:YF.LENGTH_REQUIRED,LOCKED:YF.LOCKED,METHOD_FAILURE:YF.METHOD_FAILURE,METHOD_NOT_ALLOWED:YF.METHOD_NOT_ALLOWED,MOVED_PERMANENTLY:YF.MOVED_PERMANENTLY,MOVED_TEMPORARILY:YF.MOVED_TEMPORARILY,MULTI_STATUS:YF.MULTI_STATUS,MULTIPLE_CHOICES:YF.MULTIPLE_CHOICES,NETWORK_AUTHENTICATION_REQUIRED:YF.NETWORK_AUTHENTICATION_REQUIRED,NO_CONTENT:YF.NO_CONTENT,NON_AUTHORITATIVE_INFORMATION:YF.NON_AUTHORITATIVE_INFORMATION,NOT_ACCEPTABLE:YF.NOT_ACCEPTABLE,NOT_FOUND:YF.NOT_FOUND,NOT_IMPLEMENTED:YF.NOT_IMPLEMENTED,NOT_MODIFIED:YF.NOT_MODIFIED,OK:YF.OK,PARTIAL_CONTENT:YF.PARTIAL_CONTENT,PAYMENT_REQUIRED:YF.PAYMENT_REQUIRED,PERMANENT_REDIRECT:YF.PERMANENT_REDIRECT,PRECONDITION_FAILED:YF.PRECONDITION_FAILED,PRECONDITION_REQUIRED:YF.PRECONDITION_REQUIRED,PROCESSING:YF.PROCESSING,PROXY_AUTHENTICATION_REQUIRED:YF.PROXY_AUTHENTICATION_REQUIRED,REQUEST_HEADER_FIELDS_TOO_LARGE:YF.REQUEST_HEADER_FIELDS_TOO_LARGE,REQUEST_TIMEOUT:YF.REQUEST_TIMEOUT,REQUEST_TOO_LONG:YF.REQUEST_TOO_LONG,REQUEST_URI_TOO_LONG:YF.REQUEST_URI_TOO_LONG,REQUESTED_RANGE_NOT_SATISFIABLE:YF.REQUESTED_RANGE_NOT_SATISFIABLE,RESET_CONTENT:YF.RESET_CONTENT,SEE_OTHER:YF.SEE_OTHER,SERVICE_UNAVAILABLE:YF.SERVICE_UNAVAILABLE,SWITCHING_PROTOCOLS:YF.SWITCHING_PROTOCOLS,TEMPORARY_REDIRECT:YF.TEMPORARY_REDIRECT,TOO_MANY_REQUESTS:YF.TOO_MANY_REQUESTS,UNAUTHORIZED:YF.UNAUTHORIZED,UNPROCESSABLE_ENTITY:YF.UNPROCESSABLE_ENTITY,UNSUPPORTED_MEDIA_TYPE:YF.UNSUPPORTED_MEDIA_TYPE,USE_PROXY:YF.USE_PROXY}});var Q9=re(function(J9){Object.defineProperty(J9,"__esModule",{value:!0});J9.reasonPhraseToStatusCode=J9.statusCodeToReasonPhrase=void 0;J9.statusCodeToReasonPhrase={"202":"Accepted","502":"Bad Gateway","400":"Bad Request","409":"Conflict","100":"Continue","201":"Created","417":"Expectation Failed","424":"Failed Dependency","403":"Forbidden","504":"Gateway Timeout","410":"Gone","505":"HTTP Version Not Supported","418":"I'm a teapot","419":"Insufficient Space on Resource","507":"Insufficient Storage","500":"Internal Server Error","411":"Length Required","423":"Locked","420":"Method Failure","405":"Method Not Allowed","301":"Moved Permanently","302":"Moved Temporarily","207":"Multi-Status","300":"Multiple Choices","511":"Network Authentication Required","204":"No Content","203":"Non Authoritative Information","406":"Not Acceptable","404":"Not Found","501":"Not Implemented","304":"Not Modified","200":"OK","206":"Partial Content","402":"Payment Required","308":"Permanent Redirect","412":"Precondition Failed","428":"Precondition Required","102":"Processing","103":"Early Hints","426":"Upgrade Required","407":"Proxy Authentication Required","431":"Request Header Fields Too Large","408":"Request Timeout","413":"Request Entity Too Large","414":"Request-URI Too Long","416":"Requested Range Not Satisfiable","205":"Reset Content","303":"See Other","503":"Service Unavailable","101":"Switching Protocols","307":"Temporary Redirect","429":"Too Many Requests","401":"Unauthorized","451":"Unavailable For Legal Reasons","422":"Unprocessable Entity","415":"Unsupported Media Type","305":"Use Proxy","421":"Misdirected Request"};J9.reasonPhraseToStatusCode={Accepted:202,"Bad Gateway":502,"Bad Request":400,Conflict:409,Continue:100,Created:201,"Expectation Failed":417,"Failed Dependency":424,Forbidden:403,"Gateway Timeout":504,Gone:410,"HTTP Version Not Supported":505,"I'm a teapot":418,"Insufficient Space on Resource":419,"Insufficient Storage":507,"Internal Server Error":500,"Length Required":411,Locked:423,"Method Failure":420,"Method Not Allowed":405,"Moved Permanently":301,"Moved Temporarily":302,"Multi-Status":207,"Multiple Choices":300,"Network Authentication Required":511,"No Content":204,"Non Authoritative Information":203,"Not Acceptable":406,"Not Found":404,"Not Implemented":501,"Not Modified":304,OK:200,"Partial Content":206,"Payment Required":402,"Permanent Redirect":308,"Precondition Failed":412,"Precondition Required":428,Processing:102,"Early Hints":103,"Upgrade Required":426,"Proxy Authentication Required":407,"Request Header Fields Too Large":431,"Request Timeout":408,"Request Entity Too Large":413,"Request-URI Too Long":414,"Requested Range Not Satisfiable":416,"Reset Content":205,"See Other":303,"Service Unavailable":503,"Switching Protocols":101,"Temporary Redirect":307,"Too Many Requests":429,Unauthorized:401,"Unavailable For Legal Reasons":451,"Unprocessable Entity":422,"Unsupported Media Type":415,"Use Proxy":305,"Misdirected Request":421}});var LR=re(function(tq){Object.defineProperty(tq,"__esModule",{value:!0});tq.getStatusText=tq.getStatusCode=tq.getReasonPhrase=void 0;var X9=Q9();function eq(e){var t=X9.statusCodeToReasonPhrase[e.toString()];if(!t)throw Error("Status code does not exist: "+e);return t}tq.getReasonPhrase=eq;function Zhe(e){var t=X9.reasonPhraseToStatusCode[e];if(!t)throw Error("Reason phrase does not exist: "+e);return t}tq.getStatusCode=Zhe;tq.getStatusText=eq});var oq=re(function(nq){Object.defineProperty(nq,"__esModule",{value:!0});nq.StatusCodes=void 0;var Jhe;(function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(Jhe=nq.StatusCodes||(nq.StatusCodes={}))});var aq=re(function(iq){Object.defineProperty(iq,"__esModule",{value:!0});iq.ReasonPhrases=void 0;var Yhe;(function(e){e.ACCEPTED="Accepted",e.BAD_GATEWAY="Bad Gateway",e.BAD_REQUEST="Bad Request",e.CONFLICT="Conflict",e.CONTINUE="Continue",e.CREATED="Created",e.EXPECTATION_FAILED="Expectation Failed",e.FAILED_DEPENDENCY="Failed Dependency",e.FORBIDDEN="Forbidden",e.GATEWAY_TIMEOUT="Gateway Timeout",e.GONE="Gone",e.HTTP_VERSION_NOT_SUPPORTED="HTTP Version Not Supported",e.IM_A_TEAPOT="I'm a teapot",e.INSUFFICIENT_SPACE_ON_RESOURCE="Insufficient Space on Resource",e.INSUFFICIENT_STORAGE="Insufficient Storage",e.INTERNAL_SERVER_ERROR="Internal Server Error",e.LENGTH_REQUIRED="Length Required",e.LOCKED="Locked",e.METHOD_FAILURE="Method Failure",e.METHOD_NOT_ALLOWED="Method Not Allowed",e.MOVED_PERMANENTLY="Moved Permanently",e.MOVED_TEMPORARILY="Moved Temporarily",e.MULTI_STATUS="Multi-Status",e.MULTIPLE_CHOICES="Multiple Choices",e.NETWORK_AUTHENTICATION_REQUIRED="Network Authentication Required",e.NO_CONTENT="No Content",e.NON_AUTHORITATIVE_INFORMATION="Non Authoritative Information",e.NOT_ACCEPTABLE="Not Acceptable",e.NOT_FOUND="Not Found",e.NOT_IMPLEMENTED="Not Implemented",e.NOT_MODIFIED="Not Modified",e.OK="OK",e.PARTIAL_CONTENT="Partial Content",e.PAYMENT_REQUIRED="Payment Required",e.PERMANENT_REDIRECT="Permanent Redirect",e.PRECONDITION_FAILED="Precondition Failed",e.PRECONDITION_REQUIRED="Precondition Required",e.PROCESSING="Processing",e.EARLY_HINTS="Early Hints",e.UPGRADE_REQUIRED="Upgrade Required",e.PROXY_AUTHENTICATION_REQUIRED="Proxy Authentication Required",e.REQUEST_HEADER_FIELDS_TOO_LARGE="Request Header Fields Too Large",e.REQUEST_TIMEOUT="Request Timeout",e.REQUEST_TOO_LONG="Request Entity Too Large",e.REQUEST_URI_TOO_LONG="Request-URI Too Long",e.REQUESTED_RANGE_NOT_SATISFIABLE="Requested Range Not Satisfiable",e.RESET_CONTENT="Reset Content",e.SEE_OTHER="See Other",e.SERVICE_UNAVAILABLE="Service Unavailable",e.SWITCHING_PROTOCOLS="Switching Protocols",e.TEMPORARY_REDIRECT="Temporary Redirect",e.TOO_MANY_REQUESTS="Too Many Requests",e.UNAUTHORIZED="Unauthorized",e.UNAVAILABLE_FOR_LEGAL_REASONS="Unavailable For Legal Reasons",e.UNPROCESSABLE_ENTITY="Unprocessable Entity",e.UNSUPPORTED_MEDIA_TYPE="Unsupported Media Type",e.USE_PROXY="Use Proxy",e.MISDIRECTED_REQUEST="Misdirected Request"})(Yhe=iq.ReasonPhrases||(iq.ReasonPhrases={}))});var X_=re(function(Fr){var Q_=Fr&&Fr.__assign||function(){return Q_=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n))e[n]=t[n]}return e},Q_.apply(this,arguments)},Qhe=Fr&&Fr.__createBinding||(Object.create?function(e,t,r,o){if(o===void 0)o=r;Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,o){if(o===void 0)o=r;e[o]=t[r]}),Xhe=Fr&&Fr.__exportStar||function(e,t){for(var r in e)if(r!=="default"&&!t.hasOwnProperty(r))Qhe(t,e,r)},ege=Fr&&Fr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fr,"__esModule",{value:!0});var tge=ege(UR()),sq=LR(),qR=LR();Object.defineProperty(Fr,"getStatusCode",{enumerable:!0,get:function(){return qR.getStatusCode}});Object.defineProperty(Fr,"getReasonPhrase",{enumerable:!0,get:function(){return qR.getReasonPhrase}});Object.defineProperty(Fr,"getStatusText",{enumerable:!0,get:function(){return qR.getStatusText}});var rge=oq();Object.defineProperty(Fr,"StatusCodes",{enumerable:!0,get:function(){return rge.StatusCodes}});var nge=aq();Object.defineProperty(Fr,"ReasonPhrases",{enumerable:!0,get:function(){return nge.ReasonPhrases}});Xhe(UR(),Fr);Fr.default=Q_(Q_({},tge.default),{getStatusCode:sq.getStatusCode,getStatusText:sq.getStatusText})});function Zt(e){if(typeof e==="string")return{address:e,type:"json-rpc"};return e}var Zo,nw,lq,ow,dq,VR,ZR,WR,gg,iw;var Ri=J(()=>{Zo=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],nw=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],lq=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],ow=[...lq,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],dq=[...lq,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],VR=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],ZR=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],WR=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],gg=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],iw=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}]});function br(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new KR(e.type);return`${e.name}(${yg(e.inputs,{includeName:t})})`}function yg(e,{includeName:t=!1}={}){if(!e)return"";return e.map((r)=>uge(r,{includeName:t})).join(t?", ":",")}function uge(e,{includeName:t}){if(e.type.startsWith("tuple"))return`(${yg(e.components,{includeName:t})})${e.type.slice(5)}`;return e.type+(t&&e.name?` ${e.name}`:"")}var Ea=J(()=>{ur()});function lr(e,{strict:t=!0}={}){if(!e)return!1;if(typeof e!=="string")return!1;return t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function ht(e){if(lr(e,{strict:!1}))return Math.ceil((e.length-2)/2);return e.length}var mo=()=>{};var JR="2.48.8";function pq(e,t){if(t?.(e))return e;if(e&&typeof e==="object"&&"cause"in e&&e.cause!==void 0)return pq(e.cause,t);return t?null:e}var YR,j;var pt=J(()=>{YR={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${JR}`};j=class j extends Error{constructor(e,t={}){let r=(()=>{if(t.cause instanceof j)return t.cause.details;if(t.cause?.message)return t.cause.message;return t.details})(),o=(()=>{if(t.cause instanceof j)return t.cause.docsPath||t.docsPath;return t.docsPath})(),n=YR.getDocsUrl?.({...t,docsPath:o}),i=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...YR.version?[`Version: ${YR.version}`]:[]].join(`
|
|
27
27
|
`);super(i,t.cause?{cause:t.cause}:void 0);Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=JR}walk(e){return pq(this,e)}}});var QR,aw,bg,Wo,XR,e$,t$,r$,sw,xg,n$,o$,cw,$i,vg,i$,a$,s$,Hs,_u,c$,u$,_g,KR;var ur=J(()=>{Ea();mo();pt();QR=class QR extends j{constructor({docsPath:e}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
28
28
|
`),{docsPath:e,name:"AbiConstructorNotFoundError"})}};aw=class aw extends j{constructor({docsPath:e}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
|
29
29
|
`),{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}};bg=class bg extends j{constructor({data:e,params:t,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
@@ -61,7 +61,7 @@ ${wH(m)}`;super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessag
|
|
|
61
61
|
`);super(c,t.cause?{cause:t.cause}:void 0);Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=t.cause,this.details=r,this.docs=i,this.docsOrigin=n,this.docsPath=o,this.shortMessage=e,this.showVersion=a,this.version=s}walk(e){return zH(this,e)}};Object.defineProperty(xe,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${OH()}`}});(()=>{xe.setStaticOptions(xe.defaultStaticOptions)})()});function $p(e,t){if(vo(e)>t)throw new f2({givenSize:vo(e),maxSize:t})}function NH(e,t){if(typeof t==="number"&&t>0&&t>vo(e)-1)throw new Dw({offset:t,position:"start",size:vo(e)})}function MH(e,t,r){if(typeof t==="number"&&typeof r==="number"&&vo(e)!==r-t)throw new Dw({offset:r,position:"end",size:vo(e)})}function d2(e){if(e>=La.zero&&e<=La.nine)return e-La.zero;if(e>=La.A&&e<=La.F)return e-(La.A-10);if(e>=La.a&&e<=La.f)return e-(La.a-10);return}function BH(e,t={}){let{dir:r,size:o=32}=t;if(o===0)return e;if(e.length>o)throw new m2({size:e.length,targetSize:o,type:"Bytes"});let n=new Uint8Array(o);for(let i=0;i<o;i++){let a=r==="right";n[a?i:o-i-1]=e[a?i:e.length-i-1]}return n}function p2(e,t={}){let{dir:r="left"}=t,o=e,n=0;for(let i=0;i<o.length-1;i++)if(o[r==="left"?i:o.length-i-1].toString()==="0")n++;else break;return o=r==="left"?o.slice(n):o.slice(0,o.length-n),o}var La;var DH=J(()=>{Ys();La={zero:48,nine:57,A:65,F:70,a:97,f:102}});function Op(e,t){if(Qt(e)>t)throw new y2({givenSize:Qt(e),maxSize:t})}function UH(e,t){if(typeof t==="number"&&t>0&&t>Qt(e)-1)throw new Uw({offset:t,position:"start",size:Qt(e)})}function LH(e,t,r){if(typeof t==="number"&&typeof r==="number"&&Qt(e)!==r-t)throw new Uw({offset:r,position:"end",size:Qt(e)})}function h2(e,t={}){let{dir:r,size:o=32}=t;if(o===0)return e;let n=e.replace("0x","");if(n.length>o*2)throw new b2({size:Math.ceil(n.length/2),targetSize:o,type:"Hex"});return`0x${n[r==="right"?"padEnd":"padStart"](o*2,"0")}`}function jH(e,t={}){let{dir:r="left"}=t,o=e.replace("0x",""),n=0;for(let i=0;i<o.length-1;i++)if(o[r==="left"?i:o.length-i-1].toString()==="0")n++;else break;if(o=r==="left"?o.slice(n):o.slice(0,o.length-n),o==="0")return"0x";if(r==="right"&&o.length%2===1)return`0x${o}0`;return`0x${o}`}var g2=J(()=>{Pr()});function Qs(e,t,r){return JSON.stringify(e,(o,n)=>{if(typeof t==="function")return t(o,n);if(typeof n==="bigint")return n.toString()+"#__bigint";return n},r)}function lye(e){if(e instanceof Uint8Array)return;if(!e)throw new Dg(e);if(typeof e!=="object")throw new Dg(e);if(!("BYTES_PER_ELEMENT"in e))throw new Dg(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new Dg(e)}function qH(e){if(e instanceof Uint8Array)return e;if(typeof e==="string")return Cp(e);return dye(e)}function dye(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Cp(e,t={}){let{size:r}=t,o=e;if(r)Op(e,r),o=Ni(e,r);let n=o.slice(2);if(n.length%2)n=`0${n}`;let i=n.length/2,a=new Uint8Array(i);for(let s=0,c=0;s<i;s++){let u=d2(n.charCodeAt(c++)),d=d2(n.charCodeAt(c++));if(u===void 0||d===void 0)throw new xe(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);a[s]=u<<4|d}return a}function HH(e,t={}){let{size:r}=t,o=uye.encode(e);if(typeof r==="number")return $p(o,r),pye(o,r);return o}function pye(e,t){return BH(e,{dir:"right",size:t})}function vo(e){return e.length}function GH(e,t,r,o={}){let{strict:n}=o;NH(e,t);let i=e.slice(t,r);if(n)MH(i,t,r);return i}function VH(e,t={}){let{size:r}=t;if(typeof r<"u")$p(e,r);let o=dr(e,t);return v2(o,t)}function ZH(e,t={}){let{size:r}=t,o=e;if(typeof r<"u")$p(o,r),o=x2(o);if(o.length>1||o[0]>1)throw new JH(o);return Boolean(o[0])}function zi(e,t={}){let{size:r}=t;if(typeof r<"u")$p(e,r);let o=dr(e,t);return jw(o,t)}function WH(e,t={}){let{size:r}=t,o=e;if(typeof r<"u")$p(o,r),o=fye(o);return cye.decode(o)}function x2(e){return p2(e,{dir:"left"})}function fye(e){return p2(e,{dir:"right"})}function KH(e){try{return lye(e),!0}catch{return!1}}var cye,uye,JH,Dg,f2,Dw,m2;var Ys=J(()=>{Fn();Pr();DH();g2();cye=new TextDecoder,uye=new TextEncoder;JH=class JH extends xe{constructor(e){super(`Bytes value \`${e}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}};Dg=class Dg extends xe{constructor(e){super(`Value \`${typeof e==="object"?Qs(e):e}\` of type \`${typeof e}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}};f2=class f2 extends xe{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \`${t}\` bytes. Given size: \`${e}\` bytes.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}};Dw=class Dw extends xe{constructor({offset:e,position:t,size:r}){super(`Slice ${t==="start"?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${r}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}};m2=class m2 extends xe{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${t}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}});function gye(e,t={}){let{strict:r=!1}=t;if(!e)throw new _2(e);if(typeof e!=="string")throw new _2(e);if(r){if(!/^0x[0-9a-fA-F]*$/.test(e))throw new w2(e)}if(!e.startsWith("0x"))throw new w2(e)}function tr(...e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}function zp(e){if(e instanceof Uint8Array)return dr(e);if(Array.isArray(e))return dr(new Uint8Array(e));return e}function Fw(e,t={}){let r=`0x${Number(e)}`;if(typeof t.size==="number")return Op(r,t.size),ja(r,t.size);return r}function dr(e,t={}){let r="";for(let n=0;n<e.length;n++)r+=hye[e[n]];let o=`0x${r}`;if(typeof t.size==="number")return Op(o,t.size),Ni(o,t.size);return o}function _t(e,t={}){let{signed:r,size:o}=t,n=BigInt(e),i;if(o)if(r)i=(1n<<BigInt(o)*8n-1n)-1n;else i=2n**(BigInt(o)*8n)-1n;else if(typeof e==="number")i=BigInt(Number.MAX_SAFE_INTEGER);let a=typeof i==="bigint"&&r?-i-1n:0;if(i&&n>i||n<a){let u=typeof e==="bigint"?"n":"";throw new qw({max:i?`${i}${u}`:void 0,min:`${a}${u}`,signed:r,size:o,value:`${e}${u}`})}let c=`0x${(r&&n<0?BigInt.asUintN(o*8,BigInt(n)):n).toString(16)}`;if(o)return ja(c,o);return c}function Np(e,t={}){return dr(mye.encode(e),t)}function ja(e,t){return h2(e,{dir:"left",size:t})}function Ni(e,t){return h2(e,{dir:"right",size:t})}function Xt(e,t,r,o={}){let{strict:n}=o;UH(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;if(n)LH(i,t,r);return i}function Qt(e){return Math.ceil((e.length-2)/2)}function S2(e){return jH(e,{dir:"left"})}function v2(e,t={}){let{signed:r}=t;if(t.size)Op(e,t.size);let o=BigInt(e);if(!r)return o;let n=(e.length-2)/2,i=(1n<<BigInt(n)*8n)-1n,a=i>>1n;if(o<=a)return o;return o-i-1n}function jw(e,t={}){let{signed:r,size:o}=t;if(!r&&!o)return Number(e);return Number(v2(e,t))}function Ug(e,t={}){let{strict:r=!1}=t;try{return gye(e,{strict:r}),!0}catch{return!1}}var mye,hye,qw,_2,w2,y2,Uw,b2;var Pr=J(()=>{Fn();g2();mye=new TextEncoder,hye=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));qw=class qw extends xe{constructor({max:e,min:t,signed:r,size:o,value:n}){super(`Number \`${n}\` is not in safe${o?` ${o*8}-bit`:""}${r?" signed":" unsigned"} integer range ${e?`(\`${t}\` to \`${e}\`)`:`(above \`${t}\`)`}`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}};_2=class _2 extends xe{constructor(e){super(`Value \`${typeof e==="object"?Qs(e):e}\` of type \`${typeof e}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}};w2=class w2 extends xe{constructor(e){super(`Value \`${e}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']});Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}};y2=class y2 extends xe{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \`${t}\` bytes. Given size: \`${e}\` bytes.`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}};Uw=class Uw extends xe{constructor({offset:e,position:t,size:r}){super(`Slice ${t==="start"?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${r}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}};b2=class b2 extends xe{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${t}\`).`);Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}});function YH(e){return{address:e.address,amount:_t(e.amount),index:_t(e.index),validatorIndex:_t(e.validatorIndex)}}var QH=J(()=>{Pr()});function Hw(e){return{...typeof e.baseFeePerGas==="bigint"&&{baseFeePerGas:_t(e.baseFeePerGas)},...typeof e.blobBaseFee==="bigint"&&{blobBaseFee:_t(e.blobBaseFee)},...typeof e.feeRecipient==="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit==="bigint"&&{gasLimit:_t(e.gasLimit)},...typeof e.number==="bigint"&&{number:_t(e.number)},...typeof e.prevRandao==="bigint"&&{prevRandao:_t(e.prevRandao)},...typeof e.time==="bigint"&&{time:_t(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(YH)}}}var T2=J(()=>{Pr();QH()});var eG="0x82ad56cb";var Gw="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",tG="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",rG="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Mp="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033";function Lg(e){let{abi:t,args:r,bytecode:o}=e;if(!r||r.length===0)return o;let n=t.find((a)=>("type"in a)&&a.type==="constructor");if(!n)throw new QR({docsPath:E2});if(!("inputs"in n))throw new aw({docsPath:E2});if(!n.inputs||n.inputs.length===0)throw new aw({docsPath:E2});let i=vn(n.inputs,r);return Qo([o,i])}var E2="/docs/contract/encodeDeployData";var I2=J(()=>{ur();Ra()});var Xs,Mu,jg,Fg,qg,Hg,Gg,Vg,Zg,Wg,Bu,ri;var Du=J(()=>{ap();pt();Xs=class Xs extends j{constructor({cause:e,message:t}={}){let r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}};Object.defineProperty(Xs,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Xs,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});Mu=class Mu extends j{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${xr(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}};Object.defineProperty(Mu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});jg=class jg extends j{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${xr(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}};Object.defineProperty(jg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});Fg=class Fg extends j{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}};Object.defineProperty(Fg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});qg=class qg extends j{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
|
|
62
62
|
`),{cause:e,name:"NonceTooLowError"})}};Object.defineProperty(qg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});Hg=class Hg extends j{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}};Object.defineProperty(Hg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});Gg=class Gg extends j{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
63
63
|
`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}};Object.defineProperty(Gg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});Vg=class Vg extends j{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}};Object.defineProperty(Vg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});Zg=class Zg extends j{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}};Object.defineProperty(Zg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});Wg=class Wg extends j{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}};Object.defineProperty(Wg,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});Bu=class Bu extends j{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${xr(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${xr(r)} gwei`:""}).`].join(`
|
|
64
|
-
`),{cause:e,name:"TipAboveFeeCapError"})}};Object.defineProperty(Bu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});ri=class ri extends j{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}});function ec(e,t){let r=(e.details||"").toLowerCase(),o=e instanceof j?e.walk((n)=>n?.code===Xs.code):e;if(o instanceof j)return new Xs({cause:e,message:o.details});if(Xs.nodeMessage.test(r))return new Xs({cause:e,message:e.details});if(Mu.nodeMessage.test(r))return new Mu({cause:e,maxFeePerGas:t?.maxFeePerGas});if(jg.nodeMessage.test(r))return new jg({cause:e,maxFeePerGas:t?.maxFeePerGas});if(Fg.nodeMessage.test(r))return new Fg({cause:e,nonce:t?.nonce});if(qg.nodeMessage.test(r))return new qg({cause:e,nonce:t?.nonce});if(Hg.nodeMessage.test(r))return new Hg({cause:e,nonce:t?.nonce});if(Gg.nodeMessage.test(r))return new Gg({cause:e});if(Vg.nodeMessage.test(r))return new Vg({cause:e,gas:t?.gas});if(Zg.nodeMessage.test(r))return new Zg({cause:e,gas:t?.gas});if(Wg.nodeMessage.test(r))return new Wg({cause:e});if(Bu.nodeMessage.test(r))return new Bu({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas});return new ri({cause:e})}var Kg=J(()=>{pt();Du()});function Vw(e,{docsPath:t,...r}){let o=(()=>{let n=ec(e,r);if(n instanceof ri)return e;return n})();return new Cg(o,{docsPath:t,...r})}var P2=J(()=>{Ks();Du();Kg()});function tc(e,{format:t}){if(!t)return{};let r={};function o(i){let a=Object.keys(i);for(let s of a){if(s in e)r[s]=e[s];if(i[s]&&typeof i[s]==="object"&&!Array.isArray(i[s]))o(i[s])}}let n=t(e||{});return o(n),r}function Mi(e,t){let r={};if(typeof e.authorizationList<"u")r.authorizationList=xye(e.authorizationList);if(typeof e.accessList<"u")r.accessList=e.accessList;if(typeof e.blobVersionedHashes<"u")r.blobVersionedHashes=e.blobVersionedHashes;if(typeof e.blobs<"u")if(typeof e.blobs[0]!=="string")r.blobs=e.blobs.map((o)=>Tt(o));else r.blobs=e.blobs;if(typeof e.data<"u")r.data=e.data;if(e.account)r.from=e.account.address;if(typeof e.from<"u")r.from=e.from;if(typeof e.gas<"u")r.gas=ge(e.gas);if(typeof e.gasPrice<"u")r.gasPrice=ge(e.gasPrice);if(typeof e.maxFeePerBlobGas<"u")r.maxFeePerBlobGas=ge(e.maxFeePerBlobGas);if(typeof e.maxFeePerGas<"u")r.maxFeePerGas=ge(e.maxFeePerGas);if(typeof e.maxPriorityFeePerGas<"u")r.maxPriorityFeePerGas=ge(e.maxPriorityFeePerGas);if(typeof e.nonce<"u")r.nonce=ge(e.nonce);if(typeof e.to<"u")r.to=e.to;if(typeof e.type<"u")r.type=bye[e.type];if(typeof e.value<"u")r.value=ge(e.value);return r}function xye(e){return e.map((t)=>({address:t.address,r:t.r?ge(BigInt(t.r)):t.r,s:t.s?ge(BigInt(t.s)):t.s,chainId:ge(t.chainId),nonce:ge(t.nonce),...typeof t.yParity<"u"?{yParity:ge(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:ge(t.v)}:{}}))}var bye;var Bp=J(()=>{et();bye={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"}});function Zw(){let e=()=>{return},t=()=>{return};return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function Ww({fn:e,id:t,shouldSplitBatch:r,wait:o=0,sort:n}){let i=async()=>{let d=c();a();let p=d.map(({args:m})=>m);if(p.length===0)return;e(p).then((m)=>{if(n&&Array.isArray(m))m.sort(n);for(let h=0;h<d.length;h++){let{resolve:y}=d[h];y?.([m[h],m])}}).catch((m)=>{for(let h=0;h<d.length;h++){let{reject:y}=d[h];y?.(m)}})},a=()=>k2.delete(t),s=()=>c().map(({args:d})=>d),c=()=>k2.get(t)||[],u=(d)=>k2.set(t,[...c(),d]);return{flush:a,async schedule(d){let{promise:p,resolve:m,reject:h}=Zw();if(r?.([...s(),d]))i();if(c().length>0)return u({args:d,resolve:m,reject:h}),p;return u({args:d,resolve:m,reject:h}),setTimeout(i,o),p}}}var k2;var A2=J(()=>{k2=new Map});function nG(e){if(!e||e.length===0)return;return e.reduce((t,{slot:r,value:o})=>{if(r.length!==66)throw new dw({size:r.length,targetSize:66,type:"hex"});if(o.length!==66)throw new dw({size:o.length,targetSize:66,type:"hex"});return t[r]=o,t},{})}function vye(e){let{balance:t,nonce:r,state:o,stateDiff:n,code:i}=e,a={};if(i!==void 0)a.code=i;if(t!==void 0)a.balance=ge(t);if(r!==void 0)a.nonce=ge(r);if(o!==void 0)a.state=nG(o);if(n!==void 0){if(a.state)throw new Q$;a.stateDiff=nG(n)}return a}function Dp(e){if(!e)return;let t={};for(let{address:r,...o}of e){if(!fr(r,{strict:!1}))throw new bn({address:r});if(t[r])throw new Y$({address:r});t[r]=vye(o)}return t}var Kw=J(()=>{wu();pw();X$();Aa();et()});var NNe,MNe,BNe,DNe,UNe,LNe,jNe,FNe,qNe,HNe,GNe,VNe,ZNe,WNe,KNe,JNe,YNe,QNe,XNe,eMe,tMe,rMe,nMe,oMe,iMe,aMe,sMe,cMe,uMe,lMe,dMe,pMe,fMe,mMe,hMe,gMe,yMe,bMe,xMe,vMe,_Me,wMe,SMe,TMe,EMe,IMe,PMe,kMe,AMe,RMe,$Me,OMe,CMe,zMe,NMe,MMe,BMe,DMe,UMe,LMe,jMe,FMe,qMe,HMe,GMe,VMe,ZMe,WMe,KMe,JMe,YMe,QMe,XMe,e4e,t4e,r4e,n4e,o4e,i4e,a4e,s4e,c4e,u4e,l4e,d4e,p4e,f4e,m4e,h4e,g4e,y4e,b4e,x4e,v4e,_4e,oG;var iG=J(()=>{NNe=2n**(8n-1n)-1n,MNe=2n**(16n-1n)-1n,BNe=2n**(24n-1n)-1n,DNe=2n**(32n-1n)-1n,UNe=2n**(40n-1n)-1n,LNe=2n**(48n-1n)-1n,jNe=2n**(56n-1n)-1n,FNe=2n**(64n-1n)-1n,qNe=2n**(72n-1n)-1n,HNe=2n**(80n-1n)-1n,GNe=2n**(88n-1n)-1n,VNe=2n**(96n-1n)-1n,ZNe=2n**(104n-1n)-1n,WNe=2n**(112n-1n)-1n,KNe=2n**(120n-1n)-1n,JNe=2n**(128n-1n)-1n,YNe=2n**(136n-1n)-1n,QNe=2n**(144n-1n)-1n,XNe=2n**(152n-1n)-1n,eMe=2n**(160n-1n)-1n,tMe=2n**(168n-1n)-1n,rMe=2n**(176n-1n)-1n,nMe=2n**(184n-1n)-1n,oMe=2n**(192n-1n)-1n,iMe=2n**(200n-1n)-1n,aMe=2n**(208n-1n)-1n,sMe=2n**(216n-1n)-1n,cMe=2n**(224n-1n)-1n,uMe=2n**(232n-1n)-1n,lMe=2n**(240n-1n)-1n,dMe=2n**(248n-1n)-1n,pMe=2n**(256n-1n)-1n,fMe=-(2n**(8n-1n)),mMe=-(2n**(16n-1n)),hMe=-(2n**(24n-1n)),gMe=-(2n**(32n-1n)),yMe=-(2n**(40n-1n)),bMe=-(2n**(48n-1n)),xMe=-(2n**(56n-1n)),vMe=-(2n**(64n-1n)),_Me=-(2n**(72n-1n)),wMe=-(2n**(80n-1n)),SMe=-(2n**(88n-1n)),TMe=-(2n**(96n-1n)),EMe=-(2n**(104n-1n)),IMe=-(2n**(112n-1n)),PMe=-(2n**(120n-1n)),kMe=-(2n**(128n-1n)),AMe=-(2n**(136n-1n)),RMe=-(2n**(144n-1n)),$Me=-(2n**(152n-1n)),OMe=-(2n**(160n-1n)),CMe=-(2n**(168n-1n)),zMe=-(2n**(176n-1n)),NMe=-(2n**(184n-1n)),MMe=-(2n**(192n-1n)),BMe=-(2n**(200n-1n)),DMe=-(2n**(208n-1n)),UMe=-(2n**(216n-1n)),LMe=-(2n**(224n-1n)),jMe=-(2n**(232n-1n)),FMe=-(2n**(240n-1n)),qMe=-(2n**(248n-1n)),HMe=-(2n**(256n-1n)),GMe=2n**8n-1n,VMe=2n**16n-1n,ZMe=2n**24n-1n,WMe=2n**32n-1n,KMe=2n**40n-1n,JMe=2n**48n-1n,YMe=2n**56n-1n,QMe=2n**64n-1n,XMe=2n**72n-1n,e4e=2n**80n-1n,t4e=2n**88n-1n,r4e=2n**96n-1n,n4e=2n**104n-1n,o4e=2n**112n-1n,i4e=2n**120n-1n,a4e=2n**128n-1n,s4e=2n**136n-1n,c4e=2n**144n-1n,u4e=2n**152n-1n,l4e=2n**160n-1n,d4e=2n**168n-1n,p4e=2n**176n-1n,f4e=2n**184n-1n,m4e=2n**192n-1n,h4e=2n**200n-1n,g4e=2n**208n-1n,y4e=2n**216n-1n,b4e=2n**224n-1n,x4e=2n**232n-1n,v4e=2n**240n-1n,_4e=2n**248n-1n,oG=2n**256n-1n});function _o(e){let{account:t,maxFeePerGas:r,maxPriorityFeePerGas:o,to:n}=e,i=t?Zt(t):void 0;if(i&&!fr(i.address))throw new bn({address:i.address});if(n&&!fr(n))throw new bn({address:n});if(r&&r>oG)throw new Mu({maxFeePerGas:r});if(o&&r&&o>r)throw new Bu({maxFeePerGas:r,maxPriorityFeePerGas:o})}var Uu=J(()=>{iG();wu();Du();Aa()});var R2,$2,O2;var aG=J(()=>{pt();R2=class R2 extends j{constructor({callbackSelector:e,cause:t,data:r,extraData:o,sender:n,urls:i}){super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],t.metaMessages?.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map((a)=>` ${Ru(a)}`)],` Sender: ${n}`,` Data: ${r}`,` Callback selector: ${e}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}};$2=class $2 extends j{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Ru(t)}`,`Response: ${vt(e)}`],name:"OffchainLookupResponseMalformedError"})}};O2=class O2 extends j{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`],name:"OffchainLookupSenderMismatchError"})}}});function ni(e,t){if(!fr(e,{strict:!1}))throw new bn({address:e});if(!fr(t,{strict:!1}))throw new bn({address:t});return e.toLowerCase()===t.toLowerCase()}var Up=J(()=>{wu();Aa()});var uG={};kn(uG,{ccipRequest:()=>cG,offchainLookup:()=>wye,offchainLookupAbiItem:()=>sG,offchainLookupSignature:()=>_ye});async function wye(e,{blockNumber:t,blockTag:r,data:o,to:n}){let{args:i}=Cw({data:o,abi:[sG]}),[a,s,c,u,d]=i,{ccipRead:p}=e,m=p&&typeof p?.request==="function"?p.request:cG;try{if(!ni(n,a))throw new O2({sender:a,to:n});let h=s.includes(Da)?await u2({data:c,ccipRequest:m}):await m({data:c,sender:a,urls:s}),{data:y}=await wo(e,{blockNumber:t,blockTag:r,data:Vr([u,vn([{type:"bytes"},{type:"bytes"}],[h,d])]),to:n});return y}catch(h){throw new R2({callbackSelector:u,cause:h,data:o,extraData:d,sender:a,urls:s})}}async function cG({data:e,sender:t,urls:r}){let o=Error("An unknown error occurred.");for(let n=0;n<r.length;n++){let i=r[n],a=i.includes("{data}")?"GET":"POST",s=a==="POST"?{data:e,sender:t}:void 0,c=a==="POST"?{"Content-Type":"application/json"}:{};try{let u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(s),headers:c,method:a}),d;if(u.headers.get("Content-Type")?.startsWith("application/json"))d=(await u.json()).data;else d=await u.text();if(!u.ok){o=new ei({body:s,details:d?.error?vt(d.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!lr(d)){o=new $2({result:d,url:i});continue}return d}catch(u){o=new ei({body:s,details:u.message,url:i})}}throw o}var _ye="0x556f1830",sG;var lG=J(()=>{Lu();aG();Ou();W$();Ra();Up();Ng();sG={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]}});async function wo(e,t){let{account:r=e.account,authorizationList:o,batch:n=Boolean(e.batch?.multicall),blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",accessList:s,blobs:c,blockOverrides:u,code:d,data:p,factory:m,factoryData:h,gas:y,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:w,to:_,value:T,stateOverride:k,...O}=t,z=r?Zt(r):void 0;if(d&&(m||h))throw new j("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(d&&_)throw new j("Cannot provide both `code` & `to` as parameters.");let L=d&&p,P=m&&h&&_&&p,F=L||P,G=(()=>{if(L)return dG({code:d,data:p});if(P)return Eye({data:p,factory:m,factoryData:h,to:_});return p})();try{_o(t);let W=(typeof i==="bigint"?ge(i):void 0)||a,H=u?Hw(u):void 0,fe=Dp(k),Te=e.chain?.formatters?.transactionRequest?.format,B=(Te||Mi)({...tc(O,{format:Te}),accessList:s,account:z,authorizationList:o,blobs:c,data:G,gas:y,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:w,to:F?void 0:_,value:T},"call");if(n&&Sye({request:B})&&!fe&&!H)try{return await Tye(e,{...B,blockNumber:i,blockTag:a})}catch(Pe){if(!(Pe instanceof Rw)&&!(Pe instanceof op))throw Pe}let Z=(()=>{let Pe=[B,W];if(fe&&H)return[...Pe,fe,H];if(fe)return[...Pe,fe];if(H)return[...Pe,{},H];return Pe})(),we=await e.request({method:"eth_call",params:Z});if(we==="0x")return{data:void 0};return{data:we}}catch(ue){let W=Iye(ue),{offchainLookup:H,offchainLookupSignature:fe}=await Promise.resolve().then(() => (lG(),uG));if(e.ccipRead!==!1&&W?.slice(0,10)===fe&&_)return{data:await H(e,{data:W,to:_})};if(F&&W?.slice(0,10)==="0x101bb98d")throw new i2({factory:m});throw Vw(ue,{...t,account:z,chain:e.chain})}}function Sye({request:e}){let{data:t,to:r,...o}=e;if(!t)return!1;if(t.startsWith(eG))return!1;if(!r)return!1;if(Object.values(o).filter((n)=>typeof n<"u").length>0)return!1;return!0}async function Tye(e,t){let{batchSize:r=1024,deployless:o=!1,wait:n=0}=typeof e.batch?.multicall==="object"?e.batch.multicall:{},{blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",data:s,to:c}=t,u=(()=>{if(o)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return bo({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Rw})(),p=(typeof i==="bigint"?ge(i):void 0)||a,{schedule:m}=Ww({id:`${e.uid}.${p}`,wait:n,shouldSplitBatch(x){return x.reduce((v,{data:E})=>v+(E.length-2),0)>r*2},fn:async(x)=>{let S=x.map((w)=>({allowFailure:!0,callData:w.data,target:w.to})),v=er({abi:Zo,args:[S],functionName:"aggregate3"}),E=await e.request({method:"eth_call",params:[{...u===null?{data:dG({code:Mp,data:v})}:{to:u,data:v}},p]});return tn({abi:Zo,args:[S],functionName:"aggregate3",data:E||"0x"})}}),[{returnData:h,success:y}]=await m({data:s,to:c});if(!y)throw new Ba({data:h});if(h==="0x")return{data:void 0};return{data:h}}function dG(e){let{code:t,data:r}=e;return Lg({abi:Iw(["constructor(bytes, bytes)"]),bytecode:Gw,args:[t,r]})}function Eye(e){let{data:t,factory:r,factoryData:o,to:n}=e;return Lg({abi:Iw(["constructor(address, bytes, address, bytes)"]),bytecode:tG,args:[n,t,r,o]})}function Iye(e){if(!(e instanceof j))return;let t=e.walk();return typeof t?.data==="object"?t.data?.data:t.data}var Lu=J(()=>{rp();T2();Ri();pt();Z$();Ks();Na();I2();yo();ku();et();P2();Bp();A2();Kw();Uu()});var D2,U2=(e,t,r)=>new D2(e,t).update(r).digest();var EG=J(()=>{fo();D2=class D2 extends pu{constructor(e,t){super();this.finished=!1,this.destroyed=!1,Q3(e);let r=du(t);if(this.iHash=e.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,n=new Uint8Array(o);n.set(r.length>o?e.create().update(r).digest():r);for(let i=0;i<n.length;i++)n[i]^=54;this.iHash.update(n),this.oHash=e.create();for(let i=0;i<n.length;i++)n[i]^=106;this.oHash.update(n),po(n)}update(e){return ya(this),this.iHash.update(e),this}digestInto(e){ya(this),qo(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:r,finished:o,destroyed:n,blockLen:i,outputLen:a}=this;return e=e,e.finished=o,e.destroyed=n,e.blockLen=i,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};U2.create=(e,t)=>new D2(e,t)});function IG(e){if(e.lowS!==void 0)Pi("lowS",e.lowS);if(e.prehash!==void 0)Pi("prehash",e.prehash)}function Cye(e){let t=pg(e);Go(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});let{endo:r,Fp:o,a:n}=t;if(r){if(!o.eql(n,o.ZERO))throw Error("invalid endo: CURVE.a must be 0");if(typeof r!=="object"||typeof r.beta!=="bigint"||typeof r.splitScalar!=="function")throw Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}function L2(e,t){return js(ki(e,t))}function zye(e){let t=Cye(e),{Fp:r}=t,o=Sa(t.n,t.nBitLength),n=t.toBytes||((w,_,T)=>{let k=_.toAffine();return Tr(Uint8Array.from([4]),r.toBytes(k.x),r.toBytes(k.y))}),i=t.fromBytes||((w)=>{let _=w.subarray(1),T=r.fromBytes(_.subarray(0,r.BYTES)),k=r.fromBytes(_.subarray(r.BYTES,2*r.BYTES));return{x:T,y:k}});function a(w){let{a:_,b:T}=t,k=r.sqr(w),O=r.mul(k,w);return r.add(r.add(O,r.mul(w,_)),T)}function s(w,_){let T=r.sqr(_),k=a(w);return r.eql(T,k)}if(!s(t.Gx,t.Gy))throw Error("bad curve params: generator point");let c=r.mul(r.pow(t.a,Yg),j2),u=r.mul(r.sqr(t.b),BigInt(27));if(r.is0(r.add(c,u)))throw Error("bad curve params: a or b");function d(w){return gu(w,zt,t.n)}function p(w){let{allowedPrivateKeyLengths:_,nByteLength:T,wrapPrivateKey:k,n:O}=t;if(_&&typeof w!=="bigint"){if(qd(w))w=js(w);if(typeof w!=="string"||!_.includes(w.length))throw Error("invalid private key");w=w.padStart(T*2,"0")}let z;try{z=typeof w==="bigint"?w:Dn(It("private key",w,T))}catch(L){throw Error("invalid private key, expected hex or "+T+" bytes, got "+typeof w)}if(k)z=yt(z,O);return mn("private key",z,zt,O),z}function m(w){if(!(w instanceof x))throw Error("ProjectivePoint expected")}let h=Gd((w,_)=>{let{px:T,py:k,pz:O}=w;if(r.eql(O,r.ONE))return{x:T,y:k};let z=w.is0();if(_==null)_=z?r.ONE:r.inv(O);let L=r.mul(T,_),P=r.mul(k,_),F=r.mul(O,_);if(z)return{x:r.ZERO,y:r.ZERO};if(!r.eql(F,r.ONE))throw Error("invZ was invalid");return{x:L,y:P}}),y=Gd((w)=>{if(w.is0()){if(t.allowInfinityPoint&&!r.is0(w.py))return;throw Error("bad point: ZERO")}let{x:_,y:T}=w.toAffine();if(!r.isValid(_)||!r.isValid(T))throw Error("bad point: x or y not FE");if(!s(_,T))throw Error("bad point: equation left != right");if(!w.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class x{constructor(w,_,T){if(w==null||!r.isValid(w))throw Error("x required");if(_==null||!r.isValid(_)||r.is0(_))throw Error("y required");if(T==null||!r.isValid(T))throw Error("z required");this.px=w,this.py=_,this.pz=T,Object.freeze(this)}static fromAffine(w){let{x:_,y:T}=w||{};if(!w||!r.isValid(_)||!r.isValid(T))throw Error("invalid affine point");if(w instanceof x)throw Error("projective point not allowed");let k=(O)=>r.eql(O,r.ZERO);if(k(_)&&k(T))return x.ZERO;return new x(_,T,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){let _=wa(r,w.map((T)=>T.pz));return w.map((T,k)=>T.toAffine(_[k])).map(x.fromAffine)}static fromHex(w){let _=x.fromAffine(i(It("pointHex",w)));return _.assertValidity(),_}static fromPrivateKey(w){return x.BASE.multiply(p(w))}static msm(w,_){return V_(x,o,w,_)}_setWindowSize(w){E.setWindowSize(this,w)}assertValidity(){y(this)}hasEvenY(){let{y:w}=this.toAffine();if(r.isOdd)return!r.isOdd(w);throw Error("Field doesn't support isOdd")}equals(w){m(w);let{px:_,py:T,pz:k}=this,{px:O,py:z,pz:L}=w,P=r.eql(r.mul(_,L),r.mul(O,k)),F=r.eql(r.mul(T,L),r.mul(z,k));return P&&F}negate(){return new x(this.px,r.neg(this.py),this.pz)}double(){let{a:w,b:_}=t,T=r.mul(_,Yg),{px:k,py:O,pz:z}=this,L=r.ZERO,P=r.ZERO,F=r.ZERO,G=r.mul(k,k),ue=r.mul(O,O),W=r.mul(z,z),H=r.mul(k,O);return H=r.add(H,H),F=r.mul(k,z),F=r.add(F,F),L=r.mul(w,F),P=r.mul(T,W),P=r.add(L,P),L=r.sub(ue,P),P=r.add(ue,P),P=r.mul(L,P),L=r.mul(H,L),F=r.mul(T,F),W=r.mul(w,W),H=r.sub(G,W),H=r.mul(w,H),H=r.add(H,F),F=r.add(G,G),G=r.add(F,G),G=r.add(G,W),G=r.mul(G,H),P=r.add(P,G),W=r.mul(O,z),W=r.add(W,W),G=r.mul(W,H),L=r.sub(L,G),F=r.mul(W,ue),F=r.add(F,F),F=r.add(F,F),new x(L,P,F)}add(w){m(w);let{px:_,py:T,pz:k}=this,{px:O,py:z,pz:L}=w,P=r.ZERO,F=r.ZERO,G=r.ZERO,ue=t.a,W=r.mul(t.b,Yg),H=r.mul(_,O),fe=r.mul(T,z),Te=r.mul(k,L),C=r.add(_,T),B=r.add(O,z);C=r.mul(C,B),B=r.add(H,fe),C=r.sub(C,B),B=r.add(_,k);let Z=r.add(O,L);return B=r.mul(B,Z),Z=r.add(H,Te),B=r.sub(B,Z),Z=r.add(T,k),P=r.add(z,L),Z=r.mul(Z,P),P=r.add(fe,Te),Z=r.sub(Z,P),G=r.mul(ue,B),P=r.mul(W,Te),G=r.add(P,G),P=r.sub(fe,G),G=r.add(fe,G),F=r.mul(P,G),fe=r.add(H,H),fe=r.add(fe,H),Te=r.mul(ue,Te),B=r.mul(W,B),fe=r.add(fe,Te),Te=r.sub(H,Te),Te=r.mul(ue,Te),B=r.add(B,Te),H=r.mul(fe,B),F=r.add(F,H),H=r.mul(Z,B),P=r.mul(C,P),P=r.sub(P,H),H=r.mul(C,fe),G=r.mul(Z,G),G=r.add(G,H),new x(P,F,G)}subtract(w){return this.add(w.negate())}is0(){return this.equals(x.ZERO)}wNAF(w){return E.wNAFCached(this,w,x.normalizeZ)}multiplyUnsafe(w){let{endo:_,n:T}=t;mn("scalar",w,oi,T);let k=x.ZERO;if(w===oi)return k;if(this.is0()||w===zt)return this;if(!_||E.hasPrecomputes(this))return E.wNAFCachedUnsafe(this,w,x.normalizeZ);let{k1neg:O,k1:z,k2neg:L,k2:P}=_.splitScalar(w),F=k,G=k,ue=this;while(z>oi||P>oi){if(z&zt)F=F.add(ue);if(P&zt)G=G.add(ue);ue=ue.double(),z>>=zt,P>>=zt}if(O)F=F.negate();if(L)G=G.negate();return G=new x(r.mul(G.px,_.beta),G.py,G.pz),F.add(G)}multiply(w){let{endo:_,n:T}=t;mn("scalar",w,zt,T);let k,O;if(_){let{k1neg:z,k1:L,k2neg:P,k2:F}=_.splitScalar(w),{p:G,f:ue}=this.wNAF(L),{p:W,f:H}=this.wNAF(F);G=E.constTimeNegate(z,G),W=E.constTimeNegate(P,W),W=new x(r.mul(W.px,_.beta),W.py,W.pz),k=G.add(W),O=ue.add(H)}else{let{p:z,f:L}=this.wNAF(w);k=z,O=L}return x.normalizeZ([k,O])[0]}multiplyAndAddUnsafe(w,_,T){let k=x.BASE,O=(L,P)=>P===oi||P===zt||!L.equals(k)?L.multiplyUnsafe(P):L.multiply(P),z=O(this,_).add(O(w,T));return z.is0()?void 0:z}toAffine(w){return h(this,w)}isTorsionFree(){let{h:w,isTorsionFree:_}=t;if(w===zt)return!0;if(_)return _(x,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:w,clearCofactor:_}=t;if(w===zt)return this;if(_)return _(x,this);return this.multiplyUnsafe(t.h)}toRawBytes(w=!0){return Pi("isCompressed",w),this.assertValidity(),n(x,this,w)}toHex(w=!0){return Pi("isCompressed",w),js(this.toRawBytes(w))}}x.BASE=new x(t.Gx,t.Gy,r.ONE),x.ZERO=new x(r.ZERO,r.ONE,r.ZERO);let{endo:S,nBitLength:v}=t,E=G_(x,S?Math.ceil(v/2):v);return{CURVE:t,ProjectivePoint:x,normPrivateKeyToScalar:p,weierstrassEquation:a,isWithinCurveOrder:d}}function Nye(e){let t=pg(e);return Go(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function kG(e){let t=Nye(e),{Fp:r,n:o,nByteLength:n,nBitLength:i}=t,a=r.BYTES+1,s=2*r.BYTES+1;function c(H){return yt(H,o)}function u(H){return q_(H,o)}let{ProjectivePoint:d,normPrivateKeyToScalar:p,weierstrassEquation:m,isWithinCurveOrder:h}=zye({...t,toBytes(H,fe,Te){let C=fe.toAffine(),B=r.toBytes(C.x),Z=Tr;if(Pi("isCompressed",Te),Te)return Z(Uint8Array.from([fe.hasEvenY()?2:3]),B);else return Z(Uint8Array.from([4]),B,r.toBytes(C.y))},fromBytes(H){let fe=H.length,Te=H[0],C=H.subarray(1);if(fe===a&&(Te===2||Te===3)){let B=Dn(C);if(!gu(B,zt,r.ORDER))throw Error("Point is not on curve");let Z=m(B),we;try{we=r.sqrt(Z)}catch(De){let Ce=De instanceof Error?": "+De.message:"";throw Error("Point is not on curve"+Ce)}let Pe=(we&zt)===zt;if((Te&1)===1!==Pe)we=r.neg(we);return{x:B,y:we}}else if(fe===s&&Te===4){let B=r.fromBytes(C.subarray(0,r.BYTES)),Z=r.fromBytes(C.subarray(r.BYTES,2*r.BYTES));return{x:B,y:Z}}else{let B=a,Z=s;throw Error("invalid Point, expected length of "+B+", or uncompressed "+Z+", got "+fe)}}});function y(H){let fe=o>>zt;return H>fe}function x(H){return y(H)?c(-H):H}let S=(H,fe,Te)=>Dn(H.slice(fe,Te));class v{constructor(H,fe,Te){if(mn("r",H,zt,o),mn("s",fe,zt,o),this.r=H,this.s=fe,Te!=null)this.recovery=Te;Object.freeze(this)}static fromCompact(H){let fe=n;return H=It("compactSignature",H,fe*2),new v(S(H,0,fe),S(H,fe,2*fe))}static fromDER(H){let{r:fe,s:Te}=Fa.toSig(It("DER",H));return new v(fe,Te)}assertValidity(){}addRecoveryBit(H){return new v(this.r,this.s,H)}recoverPublicKey(H){let{r:fe,s:Te,recovery:C}=this,B=O(It("msgHash",H));if(C==null||![0,1,2,3].includes(C))throw Error("recovery id invalid");let Z=C===2||C===3?fe+t.n:fe;if(Z>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let we=(C&1)===0?"02":"03",Pe=d.fromHex(we+L2(Z,r.BYTES)),je=u(Z),De=c(-B*je),Ce=c(Te*je),V=d.BASE.multiplyAndAddUnsafe(Pe,De,Ce);if(!V)throw Error("point at infinify");return V.assertValidity(),V}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return dg(this.toDERHex())}toDERHex(){return Fa.hexFromSig(this)}toCompactRawBytes(){return dg(this.toCompactHex())}toCompactHex(){let H=n;return L2(this.r,H)+L2(this.s,H)}}let E={isValidPrivateKey(H){try{return p(H),!0}catch(fe){return!1}},normPrivateKeyToScalar:p,randomPrivateKey:()=>{let H=kR(t.n);return $F(t.randomBytes(H),t.n)},precompute(H=8,fe=d.BASE){return fe._setWindowSize(H),fe.multiply(BigInt(3)),fe}};function w(H,fe=!0){return d.fromPrivateKey(H).toRawBytes(fe)}function _(H){if(typeof H==="bigint")return!1;if(H instanceof d)return!0;let Te=It("key",H).length,C=r.BYTES,B=C+1,Z=2*C+1;if(t.allowedPrivateKeyLengths||n===B)return;else return Te===B||Te===Z}function T(H,fe,Te=!0){if(_(H)===!0)throw Error("first arg must be private key");if(_(fe)===!1)throw Error("second arg must be public key");return d.fromHex(fe).multiply(p(H)).toRawBytes(Te)}let k=t.bits2int||function(H){if(H.length>8192)throw Error("input is too large");let fe=Dn(H),Te=H.length*8-i;return Te>0?fe>>BigInt(Te):fe},O=t.bits2int_modN||function(H){return c(k(H))},z=yu(i);function L(H){return mn("num < 2^"+i,H,oi,z),ki(H,n)}function P(H,fe,Te=F){if(["recovered","canonical"].some((be)=>(be in Te)))throw Error("sign() legacy options not supported");let{hash:C,randomBytes:B}=t,{lowS:Z,prehash:we,extraEntropy:Pe}=Te;if(Z==null)Z=!0;if(H=It("msgHash",H),IG(Te),we)H=It("prehashed msgHash",C(H));let je=O(H),De=p(fe),Ce=[L(De),L(je)];if(Pe!=null&&Pe!==!1){let be=Pe===!0?B(r.BYTES):Pe;Ce.push(It("extraEntropy",be))}let V=Tr(...Ce),se=je;function le(be){let ie=k(be);if(!h(ie))return;let Fe=u(ie),Kt=d.BASE.multiply(ie).toAffine(),Ve=c(Kt.x);if(Ve===oi)return;let at=c(Fe*c(se+Ve*De));if(at===oi)return;let pr=(Kt.x===Ve?0:2)|Number(Kt.y&zt),_r=at;if(Z&&y(at))_r=x(at),pr^=1;return new v(Ve,_r,pr)}return{seed:V,k2sig:le}}let F={lowS:t.lowS,prehash:!1},G={lowS:t.lowS,prehash:!1};function ue(H,fe,Te=F){let{seed:C,k2sig:B}=P(H,fe,Te),Z=t;return SF(Z.hash.outputLen,Z.nByteLength,Z.hmac)(C,B)}d.BASE._setWindowSize(8);function W(H,fe,Te,C=G){let B=H;fe=It("msgHash",fe),Te=It("publicKey",Te);let{lowS:Z,prehash:we,format:Pe}=C;if(IG(C),"strict"in C)throw Error("options.strict was renamed to lowS");if(Pe!==void 0&&Pe!=="compact"&&Pe!=="der")throw Error("format must be compact or der");let je=typeof B==="string"||qd(B),De=!je&&!Pe&&typeof B==="object"&&B!==null&&typeof B.r==="bigint"&&typeof B.s==="bigint";if(!je&&!De)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");let Ce=void 0,V;try{if(De)Ce=new v(B.r,B.s);if(je){try{if(Pe!=="compact")Ce=v.fromDER(B)}catch(pr){if(!(pr instanceof Fa.Err))throw pr}if(!Ce&&Pe!=="der")Ce=v.fromCompact(B)}V=d.fromHex(Te)}catch(pr){return!1}if(!Ce)return!1;if(Z&&Ce.hasHighS())return!1;if(we)fe=t.hash(fe);let{r:se,s:le}=Ce,be=O(fe),ie=u(le),Fe=c(be*ie),Kt=c(se*ie),Ve=d.BASE.multiplyAndAddUnsafe(V,Fe,Kt)?.toAffine();if(!Ve)return!1;return c(Ve.x)===se}return{CURVE:t,getPublicKey:w,getSharedSecret:T,sign:ue,verify:W,ProjectivePoint:d,Signature:v,utils:E}}function Mye(e,t){let r=e.ORDER,o=oi;for(let y=r-zt;y%nc===oi;y/=nc)o+=zt;let n=o,i=nc<<n-zt-zt,a=i*nc,s=(r-zt)/a,c=(s-zt)/nc,u=a-zt,d=i,p=e.pow(t,s),m=e.pow(t,(s+zt)/nc),h=(y,x)=>{let S=p,v=e.pow(x,u),E=e.sqr(v);E=e.mul(E,x);let w=e.mul(y,E);w=e.pow(w,c),w=e.mul(w,v),v=e.mul(w,x),E=e.mul(w,y);let _=e.mul(E,v);w=e.pow(_,d);let T=e.eql(w,e.ONE);v=e.mul(E,m),w=e.mul(_,S),E=e.cmov(v,E,T),_=e.cmov(w,_,T);for(let k=n;k>zt;k--){let O=k-nc;O=nc<<O-zt;let z=e.pow(_,O),L=e.eql(z,e.ONE);v=e.mul(E,S),S=e.mul(S,S),z=e.mul(_,S),E=e.cmov(v,E,L),_=e.cmov(z,_,L)}return{isValid:T,value:E}};if(e.ORDER%j2===Yg){let y=(e.ORDER-Yg)/j2,x=e.sqrt(e.neg(t));h=(S,v)=>{let E=e.sqr(v),w=e.mul(S,v);E=e.mul(E,w);let _=e.pow(E,y);_=e.mul(_,w);let T=e.mul(_,x),k=e.mul(e.sqr(_),v),O=e.eql(k,S),z=e.cmov(T,_,O);return{isValid:O,value:z}}}return h}function AG(e,t){if(H_(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw Error("mapToCurveSimpleSWU: invalid opts");let r=Mye(e,t.Z);if(!e.isOdd)throw Error("Fp.isOdd is not implemented!");return(o)=>{let n,i,a,s,c,u,d,p;n=e.sqr(o),n=e.mul(n,t.Z),i=e.sqr(n),i=e.add(i,n),a=e.add(i,e.ONE),a=e.mul(a,t.B),s=e.cmov(t.Z,e.neg(i),!e.eql(i,e.ZERO)),s=e.mul(s,t.A),i=e.sqr(a),u=e.sqr(s),c=e.mul(u,t.A),i=e.add(i,c),i=e.mul(i,a),u=e.mul(u,s),c=e.mul(u,t.B),i=e.add(i,c),d=e.mul(n,a);let{isValid:m,value:h}=r(i,u);p=e.mul(n,o),p=e.mul(p,h),d=e.cmov(d,a,m),p=e.cmov(p,h,m);let y=e.isOdd(o)===e.isOdd(p);p=e.cmov(e.neg(p),p,y);let x=wa(e,[s],!0)[0];return d=e.mul(d,x),{x:d,y:p}}}var PG,Fa,oi,zt,nc,Yg,j2;var F2=J(()=>{zR();vu();bu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */PG=class PG extends Error{constructor(e=""){super(e)}};Fa={Err:PG,_tlv:{encode:(e,t)=>{let{Err:r}=Fa;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let o=t.length/2,n=lg(o);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let i=o>127?lg(n.length/2|128):"";return lg(e)+i+n+t},decode(e,t){let{Err:r}=Fa,o=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[o++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[o++],i=!!(n&128),a=0;if(!i)a=n;else{let c=n&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(o,o+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let d of u)a=a<<8|d;if(o+=c,a<128)throw new r("tlv.decode(long): not minimal encoding")}let s=t.subarray(o,o+a);if(s.length!==a)throw new r("tlv.decode: wrong value length");return{v:s,l:t.subarray(o+a)}}},_int:{encode(e){let{Err:t}=Fa;if(e<oi)throw new t("integer: negative integers are not allowed");let r=lg(e);if(Number.parseInt(r[0],16)&8)r="00"+r;if(r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=Fa;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Dn(e)}},toSig(e){let{Err:t,_int:r,_tlv:o}=Fa,n=It("signature",e),{v:i,l:a}=o.decode(48,n);if(a.length)throw new t("invalid signature: left bytes after parsing");let{v:s,l:c}=o.decode(2,i),{v:u,l:d}=o.decode(2,c);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(s),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=Fa,o=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s)),i=o+n;return t.encode(48,i)}};oi=BigInt(0),zt=BigInt(1),nc=BigInt(2),Yg=BigInt(3),j2=BigInt(4)});function Bye(e){return{hash:e,hmac:(t,...r)=>U2(e,t,bR(...r)),randomBytes:Fd}}function RG(e,t){let r=(o)=>kG({...e,...Bye(o)});return{...r(t),create:r}}var $G=J(()=>{EG();fo();F2();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */});var J2={};kn(J2,{encodeToCurve:()=>Gye,hashToCurve:()=>Hye,schnorr:()=>jye,secp256k1:()=>Sn,secp256k1_hasher:()=>K2});function zG(e){let t=ey,r=BigInt(3),o=BigInt(6),n=BigInt(11),i=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,d=u*u*e%t,p=Yt(d,r,t)*d%t,m=Yt(p,r,t)*d%t,h=Yt(m,n1,t)*u%t,y=Yt(h,n,t)*h%t,x=Yt(y,i,t)*y%t,S=Yt(x,s,t)*x%t,v=Yt(S,c,t)*S%t,E=Yt(v,s,t)*x%t,w=Yt(E,r,t)*d%t,_=Yt(w,a,t)*y%t,T=Yt(_,o,t)*u%t,k=Yt(T,n1,t);if(!oc.eql(oc.sqr(k),e))throw Error("Cannot find square root");return k}function o1(e,...t){let r=CG[e];if(r===void 0){let o=xa(Uint8Array.from(e,(n)=>n.charCodeAt(0)));r=Tr(o,o),CG[e]=r}return xa(Tr(r,...t))}function G2(e){let t=Sn.utils.normPrivateKeyToScalar(e),r=W2.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:Xg(-t),bytes:Z2(r)}}function NG(e){mn("x",e,Qg,ey);let t=q2(e*e),r=q2(t*e+BigInt(7)),o=zG(r);if(o%n1!==V2)o=q2(-o);let n=new W2(e,o,Qg);return n.assertValidity(),n}function MG(...e){return Xg(Lp(o1("BIP0340/challenge",...e)))}function Uye(e){return G2(e).bytes}function Lye(e,t,r=Fd(32)){let o=It("message",e),{bytes:n,scalar:i}=G2(t),a=It("auxRand",r,32),s=H2(i^Lp(o1("BIP0340/aux",a))),c=o1("BIP0340/nonce",s,n,o),u=Xg(Lp(c));if(u===V2)throw Error("sign failed: k is zero");let{bytes:d,scalar:p}=G2(u),m=MG(d,n,o),h=new Uint8Array(64);if(h.set(d,0),h.set(H2(Xg(p+m*i)),32),!BG(h,o,n))throw Error("sign: Invalid signature produced");return h}function BG(e,t,r){let o=It("signature",e,64),n=It("message",t),i=It("publicKey",r,32);try{let a=NG(Lp(i)),s=Lp(o.subarray(0,32));if(!gu(s,Qg,ey))return!1;let c=Lp(o.subarray(32,64));if(!gu(c,Qg,r1))return!1;let u=MG(H2(s),Z2(a),n),d=Dye(a,c,Xg(-u));if(!d||!d.hasEvenY()||d.toAffine().x!==s)return!1;return!0}catch(a){return!1}}var ey,r1,V2,Qg,n1,OG=(e,t)=>(e+t/n1)/t,oc,Sn,CG,Z2=(e)=>e.toRawBytes(!0).slice(1),H2=(e)=>ki(e,32),q2=(e)=>yt(e,ey),Xg=(e)=>yt(e,r1),W2,Dye=(e,t,r)=>W2.BASE.multiplyAndAddUnsafe(e,t,r),Lp,jye,Fye,qye,K2,Hye,Gye;var ic=J(()=>{ug();fo();$G();jF();vu();bu();F2();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ey=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),r1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),V2=BigInt(0),Qg=BigInt(1),n1=BigInt(2);oc=Sa(ey,void 0,void 0,{sqrt:zG}),Sn=RG({a:V2,b:BigInt(7),Fp:oc,n:r1,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:(e)=>{let t=r1,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),o=-Qg*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,a=BigInt("0x100000000000000000000000000000000"),s=OG(i*e,t),c=OG(-o*e,t),u=yt(e-s*r-c*n,t),d=yt(-s*o-c*i,t),p=u>a,m=d>a;if(p)u=t-u;if(m)d=t-d;if(u>a||d>a)throw Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:p,k1:u,k2neg:m,k2:d}}}},xa),CG={};W2=(()=>Sn.ProjectivePoint)();Lp=Dn;jye=(()=>({getPublicKey:Uye,sign:Lye,verify:BG,utils:{randomPrivateKey:Sn.utils.randomPrivateKey,lift_x:NG,pointToBytes:Z2,numberToBytesBE:ki,bytesToNumberBE:Dn,taggedHash:o1,mod:yt}}))(),Fye=(()=>UF(oc,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((e)=>e.map((t)=>BigInt(t)))))(),qye=(()=>AG(oc,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:oc.create(BigInt("-11"))}))(),K2=(()=>LF(Sn.ProjectivePoint,(e)=>{let{x:t,y:r}=qye(oc.create(e[0]));return Fye(t,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:oc.ORDER,m:1,k:128,expand:"xmd",hash:xa}))(),Hye=(()=>K2.hashToCurve)(),Gye=(()=>K2.encodeToCurve)()});import{webcrypto as Lve}from"node:crypto";import KX from"node:http";import JX from"node:https";import Sl from"node:zlib";import IN,{PassThrough as PN,pipeline as Tl}from"node:stream";import{Buffer as _b}from"node:buffer";function SX(e){if(!/^data:/i.test(e))throw TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');e=e.replace(/\r?\n/g,"");let t=e.indexOf(",");if(t===-1||t<=4)throw TypeError("malformed data: URI");let r=e.substring(5,t).split(";"),o="",n=!1,i=r[0]||"text/plain",a=i;for(let d=1;d<r.length;d++)if(r[d]==="base64")n=!0;else if(r[d]){if(a+=`;${r[d]}`,r[d].indexOf("charset=")===0)o=r[d].substring(8)}if(!r[0]&&!o.length)a+=";charset=US-ASCII",o="US-ASCII";let s=n?"base64":"ascii",c=unescape(e.substring(t+1)),u=Buffer.from(c,s);return u.type=i,u.typeFull=a,u.charset=o,u}var Vz=SX;Yf();fb();import as,{PassThrough as pN}from"node:stream";import{types as fN,deprecate as GT,promisify as LX}from"node:util";import{Buffer as ro}from"node:buffer";class os extends Error{constructor(e,t){super(e);Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}class Gn extends os{constructor(e,t,r){super(e,t);if(r)this.code=this.errno=r.code,this.erroredSysCall=r.syscall}}var mb=Symbol.toStringTag,FT=(e)=>typeof e==="object"&&typeof e.append==="function"&&typeof e.delete==="function"&&typeof e.get==="function"&&typeof e.getAll==="function"&&typeof e.has==="function"&&typeof e.set==="function"&&typeof e.sort==="function"&&e[mb]==="URLSearchParams",Xf=(e)=>e&&typeof e==="object"&&typeof e.arrayBuffer==="function"&&typeof e.type==="string"&&typeof e.stream==="function"&&typeof e.constructor==="function"&&/^(Blob|File)$/.test(e[mb]),tN=(e)=>typeof e==="object"&&(e[mb]==="AbortSignal"||e[mb]==="EventTarget"),rN=(e,t)=>{let r=new URL(t).hostname,o=new URL(e).hostname;return r===o||r.endsWith(`.${o}`)},nN=(e,t)=>{let r=new URL(t).protocol,o=new URL(e).protocol;return r===o};var jX=LX(as.pipeline),An=Symbol("Body internals");class Xi{constructor(e,{size:t=0}={}){let r=null;if(e===null)e=null;else if(FT(e))e=ro.from(e.toString());else if(Xf(e));else if(ro.isBuffer(e));else if(fN.isAnyArrayBuffer(e))e=ro.from(e);else if(ArrayBuffer.isView(e))e=ro.from(e.buffer,e.byteOffset,e.byteLength);else if(e instanceof as);else if(e instanceof Oc)e=eN(e),r=e.type.split("=")[1];else e=ro.from(String(e));let o=e;if(ro.isBuffer(e))o=as.Readable.from(e);else if(Xf(e))o=as.Readable.from(e.stream());if(this[An]={body:e,stream:o,boundary:r,disturbed:!1,error:null},this.size=t,e instanceof as)e.on("error",(n)=>{let i=n instanceof os?n:new Gn(`Invalid response body while trying to fetch ${this.url}: ${n.message}`,"system",n);this[An].error=i})}get body(){return this[An].stream}get bodyUsed(){return this[An].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:r}=await HT(this);return e.slice(t,t+r)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let r=new Oc,o=new URLSearchParams(await this.text());for(let[n,i]of o)r.append(n,i);return r}let{toFormData:t}=await Promise.resolve().then(() => (dN(),lN));return t(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[An].body&&this[An].body.type||"",t=await this.arrayBuffer();return new Qi([t],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await HT(this);return new TextDecoder().decode(e)}buffer(){return HT(this)}}Xi.prototype.buffer=GT(Xi.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Xi.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:GT(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function HT(e){if(e[An].disturbed)throw TypeError(`body used already for: ${e.url}`);if(e[An].disturbed=!0,e[An].error)throw e[An].error;let{body:t}=e;if(t===null)return ro.alloc(0);if(!(t instanceof as))return ro.alloc(0);let r=[],o=0;try{for await(let n of t){if(e.size>0&&o+n.length>e.size){let i=new Gn(`content size at ${e.url} over limit: ${e.size}`,"max-size");throw t.destroy(i),i}o+=n.length,r.push(n)}}catch(n){throw n instanceof os?n:new Gn(`Invalid response body while trying to fetch ${e.url}: ${n.message}`,"system",n)}if(t.readableEnded===!0||t._readableState.ended===!0)try{if(r.every((n)=>typeof n==="string"))return ro.from(r.join(""));return ro.concat(r,o)}catch(n){throw new Gn(`Could not create Buffer from response body for ${e.url}: ${n.message}`,"system",n)}else throw new Gn(`Premature close of server response while trying to fetch ${e.url}`)}var _l=(e,t)=>{let r,o,{body:n}=e[An];if(e.bodyUsed)throw Error("cannot clone body after it is used");if(n instanceof as&&typeof n.getBoundary!=="function")r=new pN({highWaterMark:t}),o=new pN({highWaterMark:t}),n.pipe(r),n.pipe(o),e[An].stream=r,n=o;return n},FX=GT((e)=>e.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),yb=(e,t)=>{if(e===null)return null;if(typeof e==="string")return"text/plain;charset=UTF-8";if(FT(e))return"application/x-www-form-urlencoded;charset=UTF-8";if(Xf(e))return e.type||null;if(ro.isBuffer(e)||fN.isAnyArrayBuffer(e)||ArrayBuffer.isView(e))return null;if(e instanceof Oc)return`multipart/form-data; boundary=${t[An].boundary}`;if(e&&typeof e.getBoundary==="function")return`multipart/form-data;boundary=${FX(e)}`;if(e instanceof as)return null;return"text/plain;charset=UTF-8"},mN=(e)=>{let{body:t}=e[An];if(t===null)return 0;if(Xf(t))return t.size;if(ro.isBuffer(t))return t.length;if(t&&typeof t.getLengthSync==="function")return t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null;return null},hN=async(e,{body:t})=>{if(t===null)e.end();else await jX(t,e)};import{types as gN}from"node:util";import xb from"node:http";var bb=typeof xb.validateHeaderName==="function"?xb.validateHeaderName:(e)=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),t}},VT=typeof xb.validateHeaderValue==="function"?xb.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let r=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}};class an extends URLSearchParams{constructor(e){let t=[];if(e instanceof an){let r=e.raw();for(let[o,n]of Object.entries(r))t.push(...n.map((i)=>[o,i]))}else if(e==null);else if(typeof e==="object"&&!gN.isBoxedPrimitive(e)){let r=e[Symbol.iterator];if(r==null)t.push(...Object.entries(e));else{if(typeof r!=="function")throw TypeError("Header pairs must be iterable");t=[...e].map((o)=>{if(typeof o!=="object"||gN.isBoxedPrimitive(o))throw TypeError("Each header pair must be an iterable object");return[...o]}).map((o)=>{if(o.length!==2)throw TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");t=t.length>0?t.map(([r,o])=>(bb(r),VT(r,String(o)),[String(r).toLowerCase(),String(o)])):void 0;super(t);return new Proxy(this,{get(r,o,n){switch(o){case"append":case"set":return(i,a)=>(bb(i),VT(i,String(a)),URLSearchParams.prototype[o].call(r,String(i).toLowerCase(),String(a)));case"delete":case"has":case"getAll":return(i)=>(bb(i),URLSearchParams.prototype[o].call(r,String(i).toLowerCase()));case"keys":return()=>(r.sort(),new Set(URLSearchParams.prototype.keys.call(r)).keys());default:return Reflect.get(r,o,n)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let t=this.getAll(e);if(t.length===0)return null;let r=t.join(", ");if(/^content-encoding$/i.test(e))r=r.toLowerCase();return r}forEach(e,t=void 0){for(let r of this.keys())Reflect.apply(e,t,[this.get(r),r,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,t)=>(e[t]=this.getAll(t),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,t)=>{let r=this.getAll(t);if(t==="host")e[t]=r[0];else e[t]=r.length>1?r:r[0];return e},{})}}Object.defineProperties(an.prototype,["get","entries","forEach","values"].reduce((e,t)=>(e[t]={enumerable:!0},e),{}));function yN(e=[]){return new an(e.reduce((t,r,o,n)=>{if(o%2===0)t.push(n.slice(o,o+2));return t},[]).filter(([t,r])=>{try{return bb(t),VT(t,String(r)),!0}catch{return!1}}))}var qX=new Set([301,302,303,307,308]),vb=(e)=>qX.has(e);var Ro=Symbol("Response internals");class Cr extends Xi{constructor(e=null,t={}){super(e,t);let r=t.status!=null?t.status:200,o=new an(t.headers);if(e!==null&&!o.has("Content-Type")){let n=yb(e,this);if(n)o.append("Content-Type",n)}this[Ro]={type:"default",url:t.url,status:r,statusText:t.statusText||"",headers:o,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[Ro].type}get url(){return this[Ro].url||""}get status(){return this[Ro].status}get ok(){return this[Ro].status>=200&&this[Ro].status<300}get redirected(){return this[Ro].counter>0}get statusText(){return this[Ro].statusText}get headers(){return this[Ro].headers}get highWaterMark(){return this[Ro].highWaterMark}clone(){return new Cr(_l(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,t=302){if(!vb(t))throw RangeError('Failed to execute "redirect" on "response": Invalid status code');return new Cr(null,{headers:{location:new URL(e).toString()},status:t})}static error(){let e=new Cr(null,{status:0,statusText:""});return e[Ro].type="error",e}static json(e=void 0,t={}){let r=JSON.stringify(e);if(r===void 0)throw TypeError("data is not JSON serializable");let o=new an(t&&t.headers);if(!o.has("content-type"))o.set("content-type","application/json");return new Cr(r,{...t,headers:o})}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(Cr.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});import{format as VX}from"node:url";import{deprecate as ZX}from"node:util";var bN=(e)=>{if(e.search)return e.search;let t=e.href.length-1,r=e.hash||(e.href[t]==="#"?"#":"");return e.href[t-r.length]==="?"?"?":""};import{isIP as HX}from"node:net";function xN(e,t=!1){if(e==null)return"no-referrer";if(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))return"no-referrer";if(e.username="",e.password="",e.hash="",t)e.pathname="",e.search="";return e}var vN=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),_N="strict-origin-when-cross-origin";function wN(e){if(!vN.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}function GX(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,""),r=HX(t);if(r===4&&/^127\./.test(t))return!0;if(r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t))return!0;if(e.host==="localhost"||e.host.endsWith(".localhost"))return!1;if(e.protocol==="file:")return!0;return!1}function wl(e){if(/^about:(blank|srcdoc)$/.test(e))return!0;if(e.protocol==="data:")return!0;if(/^(blob|filesystem):$/.test(e.protocol))return!0;return GX(e)}function SN(e,{referrerURLCallback:t,referrerOriginCallback:r}={}){if(e.referrer==="no-referrer"||e.referrerPolicy==="")return null;let o=e.referrerPolicy;if(e.referrer==="about:client")return"no-referrer";let n=e.referrer,i=xN(n),a=xN(n,!0);if(i.toString().length>4096)i=a;if(t)i=t(i);if(r)a=r(a);let s=new URL(e.url);switch(o){case"no-referrer":return"no-referrer";case"origin":return a;case"unsafe-url":return i;case"strict-origin":if(wl(i)&&!wl(s))return"no-referrer";return a.toString();case"strict-origin-when-cross-origin":if(i.origin===s.origin)return i;if(wl(i)&&!wl(s))return"no-referrer";return a;case"same-origin":if(i.origin===s.origin)return i;return"no-referrer";case"origin-when-cross-origin":if(i.origin===s.origin)return i;return a;case"no-referrer-when-downgrade":if(wl(i)&&!wl(s))return"no-referrer";return i;default:throw TypeError(`Invalid referrerPolicy: ${o}`)}}function TN(e){let t=(e.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let o of t)if(o&&vN.has(o))r=o;return r}var wr=Symbol("Request internals"),tm=(e)=>typeof e==="object"&&typeof e[wr]==="object",WX=ZX(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");class ea extends Xi{constructor(e,t={}){let r;if(tm(e))r=new URL(e.url);else r=new URL(e),e={};if(r.username!==""||r.password!=="")throw TypeError(`${r} is an url with embedded credentials.`);let o=t.method||e.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o))o=o.toUpperCase();if(!tm(t)&&"data"in t)WX();if((t.body!=null||tm(e)&&e.body!==null)&&(o==="GET"||o==="HEAD"))throw TypeError("Request with GET/HEAD method cannot have body");let n=t.body?t.body:tm(e)&&e.body!==null?_l(e):null;super(n,{size:t.size||e.size||0});let i=new an(t.headers||e.headers||{});if(n!==null&&!i.has("Content-Type")){let c=yb(n,this);if(c)i.set("Content-Type",c)}let a=tm(e)?e.signal:null;if("signal"in t)a=t.signal;if(a!=null&&!tN(a))throw TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let s=t.referrer==null?e.referrer:t.referrer;if(s==="")s="no-referrer";else if(s){let c=new URL(s);s=/^about:(\/\/)?client$/.test(c)?"client":c}else s=void 0;this[wr]={method:o,redirect:t.redirect||e.redirect||"follow",headers:i,parsedURL:r,signal:a,referrer:s},this.follow=t.follow===void 0?e.follow===void 0?20:e.follow:t.follow,this.compress=t.compress===void 0?e.compress===void 0?!0:e.compress:t.compress,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent,this.highWaterMark=t.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||e.referrerPolicy||""}get method(){return this[wr].method}get url(){return VX(this[wr].parsedURL)}get headers(){return this[wr].headers}get redirect(){return this[wr].redirect}get signal(){return this[wr].signal}get referrer(){if(this[wr].referrer==="no-referrer")return"";if(this[wr].referrer==="client")return"about:client";if(this[wr].referrer)return this[wr].referrer.toString();return}get referrerPolicy(){return this[wr].referrerPolicy}set referrerPolicy(e){this[wr].referrerPolicy=wN(e)}clone(){return new ea(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(ea.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var EN=(e)=>{let{parsedURL:t}=e[wr],r=new an(e[wr].headers);if(!r.has("Accept"))r.set("Accept","*/*");let o=null;if(e.body===null&&/^(post|put)$/i.test(e.method))o="0";if(e.body!==null){let s=mN(e);if(typeof s==="number"&&!Number.isNaN(s))o=String(s)}if(o)r.set("Content-Length",o);if(e.referrerPolicy==="")e.referrerPolicy=_N;if(e.referrer&&e.referrer!=="no-referrer")e[wr].referrer=SN(e);else e[wr].referrer="no-referrer";if(e[wr].referrer instanceof URL)r.set("Referer",e.referrer);if(!r.has("User-Agent"))r.set("User-Agent","node-fetch");if(e.compress&&!r.has("Accept-Encoding"))r.set("Accept-Encoding","gzip, deflate, br");let{agent:n}=e;if(typeof n==="function")n=n(t);let i=bN(t),a={path:t.pathname+i,method:e.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:n};return{parsedURL:t,options:a}};class ZT extends os{constructor(e,t="aborted"){super(e,t)}}fb();qT();var YX=new Set(["data:","http:","https:"]);async function wb(e,t){return new Promise((r,o)=>{let n=new ea(e,t),{parsedURL:i,options:a}=EN(n);if(!YX.has(i.protocol))throw TypeError(`node-fetch cannot load ${e}. URL scheme "${i.protocol.replace(/:$/,"")}" is not supported.`);if(i.protocol==="data:"){let y=Vz(n.url),x=new Cr(y,{headers:{"Content-Type":y.typeFull}});r(x);return}let s=(i.protocol==="https:"?JX:KX).request,{signal:c}=n,u=null,d=()=>{let y=new ZT("The operation was aborted.");if(o(y),n.body&&n.body instanceof IN.Readable)n.body.destroy(y);if(!u||!u.body)return;u.body.emit("error",y)};if(c&&c.aborted){d();return}let p=()=>{d(),h()},m=s(i.toString(),a);if(c)c.addEventListener("abort",p);let h=()=>{if(m.abort(),c)c.removeEventListener("abort",p)};if(m.on("error",(y)=>{o(new Gn(`request to ${n.url} failed, reason: ${y.message}`,"system",y)),h()}),QX(m,(y)=>{if(u&&u.body)u.body.destroy(y)}),process.version<"v14")m.on("socket",(y)=>{let x;y.prependListener("end",()=>{x=y._eventsCount}),y.prependListener("close",(S)=>{if(u&&x<y._eventsCount&&!S){let v=Error("Premature close");v.code="ERR_STREAM_PREMATURE_CLOSE",u.body.emit("error",v)}})});m.on("response",(y)=>{m.setTimeout(0);let x=yN(y.rawHeaders);if(vb(y.statusCode)){let _=x.get("Location"),T=null;try{T=_===null?null:new URL(_,n.url)}catch{if(n.redirect!=="manual"){o(new Gn(`uri requested responds with an invalid redirect URL: ${_}`,"invalid-redirect")),h();return}}switch(n.redirect){case"error":o(new Gn(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),h();return;case"manual":break;case"follow":{if(T===null)break;if(n.counter>=n.follow){o(new Gn(`maximum redirect reached at: ${n.url}`,"max-redirect")),h();return}let k={headers:new an(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:_l(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!rN(n.url,T)||!nN(n.url,T))for(let z of["authorization","www-authenticate","cookie","cookie2"])k.headers.delete(z);if(y.statusCode!==303&&n.body&&t.body instanceof IN.Readable){o(new Gn("Cannot follow redirect with body being a readable stream","unsupported-redirect")),h();return}if(y.statusCode===303||(y.statusCode===301||y.statusCode===302)&&n.method==="POST")k.method="GET",k.body=void 0,k.headers.delete("content-length");let O=TN(x);if(O)k.referrerPolicy=O;r(wb(new ea(T,k))),h();return}default:return o(TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}if(c)y.once("end",()=>{c.removeEventListener("abort",p)});let S=Tl(y,new PN,(_)=>{if(_)o(_)});if(process.version<"v12.10")y.on("aborted",p);let v={url:n.url,status:y.statusCode,statusText:y.statusMessage,headers:x,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},E=x.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||E===null||y.statusCode===204||y.statusCode===304){u=new Cr(S,v),r(u);return}let w={flush:Sl.Z_SYNC_FLUSH,finishFlush:Sl.Z_SYNC_FLUSH};if(E==="gzip"||E==="x-gzip"){S=Tl(S,Sl.createGunzip(w),(_)=>{if(_)o(_)}),u=new Cr(S,v),r(u);return}if(E==="deflate"||E==="x-deflate"){let _=Tl(y,new PN,(T)=>{if(T)o(T)});_.once("data",(T)=>{if((T[0]&15)===8)S=Tl(S,Sl.createInflate(),(k)=>{if(k)o(k)});else S=Tl(S,Sl.createInflateRaw(),(k)=>{if(k)o(k)});u=new Cr(S,v),r(u)}),_.once("end",()=>{if(!u)u=new Cr(S,v),r(u)});return}if(E==="br"){S=Tl(S,Sl.createBrotliDecompress(),(_)=>{if(_)o(_)}),u=new Cr(S,v),r(u);return}u=new Cr(S,v),r(u)}),hN(m,n).catch(o)})}function QX(e,t){let r=_b.from(`0\r
|
|
64
|
+
`),{cause:e,name:"TipAboveFeeCapError"})}};Object.defineProperty(Bu,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});ri=class ri extends j{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}});function ec(e,t){let r=(e.details||"").toLowerCase(),o=e instanceof j?e.walk((n)=>n?.code===Xs.code):e;if(o instanceof j)return new Xs({cause:e,message:o.details});if(Xs.nodeMessage.test(r))return new Xs({cause:e,message:e.details});if(Mu.nodeMessage.test(r))return new Mu({cause:e,maxFeePerGas:t?.maxFeePerGas});if(jg.nodeMessage.test(r))return new jg({cause:e,maxFeePerGas:t?.maxFeePerGas});if(Fg.nodeMessage.test(r))return new Fg({cause:e,nonce:t?.nonce});if(qg.nodeMessage.test(r))return new qg({cause:e,nonce:t?.nonce});if(Hg.nodeMessage.test(r))return new Hg({cause:e,nonce:t?.nonce});if(Gg.nodeMessage.test(r))return new Gg({cause:e});if(Vg.nodeMessage.test(r))return new Vg({cause:e,gas:t?.gas});if(Zg.nodeMessage.test(r))return new Zg({cause:e,gas:t?.gas});if(Wg.nodeMessage.test(r))return new Wg({cause:e});if(Bu.nodeMessage.test(r))return new Bu({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas});return new ri({cause:e})}var Kg=J(()=>{pt();Du()});function Vw(e,{docsPath:t,...r}){let o=(()=>{let n=ec(e,r);if(n instanceof ri)return e;return n})();return new Cg(o,{docsPath:t,...r})}var P2=J(()=>{Ks();Du();Kg()});function tc(e,{format:t}){if(!t)return{};let r={};function o(i){let a=Object.keys(i);for(let s of a){if(s in e)r[s]=e[s];if(i[s]&&typeof i[s]==="object"&&!Array.isArray(i[s]))o(i[s])}}let n=t(e||{});return o(n),r}function Mi(e,t){let r={};if(typeof e.authorizationList<"u")r.authorizationList=xye(e.authorizationList);if(typeof e.accessList<"u")r.accessList=e.accessList;if(typeof e.blobVersionedHashes<"u")r.blobVersionedHashes=e.blobVersionedHashes;if(typeof e.blobs<"u")if(typeof e.blobs[0]!=="string")r.blobs=e.blobs.map((o)=>Tt(o));else r.blobs=e.blobs;if(typeof e.data<"u")r.data=e.data;if(e.account)r.from=e.account.address;if(typeof e.from<"u")r.from=e.from;if(typeof e.gas<"u")r.gas=ge(e.gas);if(typeof e.gasPrice<"u")r.gasPrice=ge(e.gasPrice);if(typeof e.maxFeePerBlobGas<"u")r.maxFeePerBlobGas=ge(e.maxFeePerBlobGas);if(typeof e.maxFeePerGas<"u")r.maxFeePerGas=ge(e.maxFeePerGas);if(typeof e.maxPriorityFeePerGas<"u")r.maxPriorityFeePerGas=ge(e.maxPriorityFeePerGas);if(typeof e.nonce<"u")r.nonce=ge(e.nonce);if(typeof e.to<"u")r.to=e.to;if(typeof e.type<"u")r.type=bye[e.type];if(typeof e.value<"u")r.value=ge(e.value);return r}function xye(e){return e.map((t)=>({address:t.address,r:t.r?ge(BigInt(t.r)):t.r,s:t.s?ge(BigInt(t.s)):t.s,chainId:ge(t.chainId),nonce:ge(t.nonce),...typeof t.yParity<"u"?{yParity:ge(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:ge(t.v)}:{}}))}var bye;var Bp=J(()=>{et();bye={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"}});function Zw(){let e=()=>{return},t=()=>{return};return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function Ww({fn:e,id:t,shouldSplitBatch:r,wait:o=0,sort:n}){let i=async()=>{let d=c();a();let p=d.map(({args:m})=>m);if(p.length===0)return;e(p).then((m)=>{if(n&&Array.isArray(m))m.sort(n);for(let h=0;h<d.length;h++){let{resolve:y}=d[h];y?.([m[h],m])}}).catch((m)=>{for(let h=0;h<d.length;h++){let{reject:y}=d[h];y?.(m)}})},a=()=>k2.delete(t),s=()=>c().map(({args:d})=>d),c=()=>k2.get(t)||[],u=(d)=>k2.set(t,[...c(),d]);return{flush:a,async schedule(d){let{promise:p,resolve:m,reject:h}=Zw();if(r?.([...s(),d]))i();if(c().length>0)return u({args:d,resolve:m,reject:h}),p;return u({args:d,resolve:m,reject:h}),setTimeout(i,o),p}}}var k2;var A2=J(()=>{k2=new Map});function nG(e){if(!e||e.length===0)return;return e.reduce((t,{slot:r,value:o})=>{if(r.length!==66)throw new dw({size:r.length,targetSize:66,type:"hex"});if(o.length!==66)throw new dw({size:o.length,targetSize:66,type:"hex"});return t[r]=o,t},{})}function vye(e){let{balance:t,nonce:r,state:o,stateDiff:n,code:i}=e,a={};if(i!==void 0)a.code=i;if(t!==void 0)a.balance=ge(t);if(r!==void 0)a.nonce=ge(r);if(o!==void 0)a.state=nG(o);if(n!==void 0){if(a.state)throw new Q$;a.stateDiff=nG(n)}return a}function Dp(e){if(!e)return;let t={};for(let{address:r,...o}of e){if(!fr(r,{strict:!1}))throw new bn({address:r});if(t[r])throw new Y$({address:r});t[r]=vye(o)}return t}var Kw=J(()=>{wu();pw();X$();Aa();et()});var NNe,MNe,BNe,DNe,UNe,LNe,jNe,FNe,qNe,HNe,GNe,VNe,ZNe,WNe,KNe,JNe,YNe,QNe,XNe,eMe,tMe,rMe,nMe,oMe,iMe,aMe,sMe,cMe,uMe,lMe,dMe,pMe,fMe,mMe,hMe,gMe,yMe,bMe,xMe,vMe,_Me,wMe,SMe,TMe,EMe,IMe,PMe,kMe,AMe,RMe,$Me,OMe,CMe,zMe,NMe,MMe,BMe,DMe,UMe,LMe,jMe,FMe,qMe,HMe,GMe,VMe,ZMe,WMe,KMe,JMe,YMe,QMe,XMe,e4e,t4e,r4e,n4e,o4e,i4e,a4e,s4e,c4e,u4e,l4e,d4e,p4e,f4e,m4e,h4e,g4e,y4e,b4e,x4e,v4e,_4e,oG;var iG=J(()=>{NNe=2n**(8n-1n)-1n,MNe=2n**(16n-1n)-1n,BNe=2n**(24n-1n)-1n,DNe=2n**(32n-1n)-1n,UNe=2n**(40n-1n)-1n,LNe=2n**(48n-1n)-1n,jNe=2n**(56n-1n)-1n,FNe=2n**(64n-1n)-1n,qNe=2n**(72n-1n)-1n,HNe=2n**(80n-1n)-1n,GNe=2n**(88n-1n)-1n,VNe=2n**(96n-1n)-1n,ZNe=2n**(104n-1n)-1n,WNe=2n**(112n-1n)-1n,KNe=2n**(120n-1n)-1n,JNe=2n**(128n-1n)-1n,YNe=2n**(136n-1n)-1n,QNe=2n**(144n-1n)-1n,XNe=2n**(152n-1n)-1n,eMe=2n**(160n-1n)-1n,tMe=2n**(168n-1n)-1n,rMe=2n**(176n-1n)-1n,nMe=2n**(184n-1n)-1n,oMe=2n**(192n-1n)-1n,iMe=2n**(200n-1n)-1n,aMe=2n**(208n-1n)-1n,sMe=2n**(216n-1n)-1n,cMe=2n**(224n-1n)-1n,uMe=2n**(232n-1n)-1n,lMe=2n**(240n-1n)-1n,dMe=2n**(248n-1n)-1n,pMe=2n**(256n-1n)-1n,fMe=-(2n**(8n-1n)),mMe=-(2n**(16n-1n)),hMe=-(2n**(24n-1n)),gMe=-(2n**(32n-1n)),yMe=-(2n**(40n-1n)),bMe=-(2n**(48n-1n)),xMe=-(2n**(56n-1n)),vMe=-(2n**(64n-1n)),_Me=-(2n**(72n-1n)),wMe=-(2n**(80n-1n)),SMe=-(2n**(88n-1n)),TMe=-(2n**(96n-1n)),EMe=-(2n**(104n-1n)),IMe=-(2n**(112n-1n)),PMe=-(2n**(120n-1n)),kMe=-(2n**(128n-1n)),AMe=-(2n**(136n-1n)),RMe=-(2n**(144n-1n)),$Me=-(2n**(152n-1n)),OMe=-(2n**(160n-1n)),CMe=-(2n**(168n-1n)),zMe=-(2n**(176n-1n)),NMe=-(2n**(184n-1n)),MMe=-(2n**(192n-1n)),BMe=-(2n**(200n-1n)),DMe=-(2n**(208n-1n)),UMe=-(2n**(216n-1n)),LMe=-(2n**(224n-1n)),jMe=-(2n**(232n-1n)),FMe=-(2n**(240n-1n)),qMe=-(2n**(248n-1n)),HMe=-(2n**(256n-1n)),GMe=2n**8n-1n,VMe=2n**16n-1n,ZMe=2n**24n-1n,WMe=2n**32n-1n,KMe=2n**40n-1n,JMe=2n**48n-1n,YMe=2n**56n-1n,QMe=2n**64n-1n,XMe=2n**72n-1n,e4e=2n**80n-1n,t4e=2n**88n-1n,r4e=2n**96n-1n,n4e=2n**104n-1n,o4e=2n**112n-1n,i4e=2n**120n-1n,a4e=2n**128n-1n,s4e=2n**136n-1n,c4e=2n**144n-1n,u4e=2n**152n-1n,l4e=2n**160n-1n,d4e=2n**168n-1n,p4e=2n**176n-1n,f4e=2n**184n-1n,m4e=2n**192n-1n,h4e=2n**200n-1n,g4e=2n**208n-1n,y4e=2n**216n-1n,b4e=2n**224n-1n,x4e=2n**232n-1n,v4e=2n**240n-1n,_4e=2n**248n-1n,oG=2n**256n-1n});function _o(e){let{account:t,maxFeePerGas:r,maxPriorityFeePerGas:o,to:n}=e,i=t?Zt(t):void 0;if(i&&!fr(i.address))throw new bn({address:i.address});if(n&&!fr(n))throw new bn({address:n});if(r&&r>oG)throw new Mu({maxFeePerGas:r});if(o&&r&&o>r)throw new Bu({maxFeePerGas:r,maxPriorityFeePerGas:o})}var Uu=J(()=>{iG();wu();Du();Aa()});var R2,$2,O2;var aG=J(()=>{pt();R2=class R2 extends j{constructor({callbackSelector:e,cause:t,data:r,extraData:o,sender:n,urls:i}){super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],t.metaMessages?.length?"":[],"Offchain Gateway Call:",i&&[" Gateway URL(s):",...i.map((a)=>` ${Ru(a)}`)],` Sender: ${n}`,` Data: ${r}`,` Callback selector: ${e}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}};$2=class $2 extends j{constructor({result:e,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${Ru(t)}`,`Response: ${vt(e)}`],name:"OffchainLookupResponseMalformedError"})}};O2=class O2 extends j{constructor({sender:e,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${e}`],name:"OffchainLookupSenderMismatchError"})}}});function ni(e,t){if(!fr(e,{strict:!1}))throw new bn({address:e});if(!fr(t,{strict:!1}))throw new bn({address:t});return e.toLowerCase()===t.toLowerCase()}var Up=J(()=>{wu();Aa()});var uG={};kn(uG,{ccipRequest:()=>cG,offchainLookup:()=>wye,offchainLookupAbiItem:()=>sG,offchainLookupSignature:()=>_ye});async function wye(e,{blockNumber:t,blockTag:r,data:o,to:n}){let{args:i}=Cw({data:o,abi:[sG]}),[a,s,c,u,d]=i,{ccipRead:p}=e,m=p&&typeof p?.request==="function"?p.request:cG;try{if(!ni(n,a))throw new O2({sender:a,to:n});let h=s.includes(Da)?await u2({data:c,ccipRequest:m}):await m({data:c,sender:a,urls:s}),{data:y}=await wo(e,{blockNumber:t,blockTag:r,data:Vr([u,vn([{type:"bytes"},{type:"bytes"}],[h,d])]),to:n});return y}catch(h){throw new R2({callbackSelector:u,cause:h,data:o,extraData:d,sender:a,urls:s})}}async function cG({data:e,sender:t,urls:r}){let o=Error("An unknown error occurred.");for(let n=0;n<r.length;n++){let i=r[n],a=i.includes("{data}")?"GET":"POST",s=a==="POST"?{data:e,sender:t}:void 0,c=a==="POST"?{"Content-Type":"application/json"}:{};try{let u=await fetch(i.replace("{sender}",t.toLowerCase()).replace("{data}",e),{body:JSON.stringify(s),headers:c,method:a}),d;if(u.headers.get("Content-Type")?.startsWith("application/json"))d=(await u.json()).data;else d=await u.text();if(!u.ok){o=new ei({body:s,details:d?.error?vt(d.error):u.statusText,headers:u.headers,status:u.status,url:i});continue}if(!lr(d)){o=new $2({result:d,url:i});continue}return d}catch(u){o=new ei({body:s,details:u.message,url:i})}}throw o}var _ye="0x556f1830",sG;var lG=J(()=>{Lu();aG();Ou();W$();Ra();Up();Ng();sG={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]}});async function wo(e,t){let{account:r=e.account,authorizationList:o,batch:n=Boolean(e.batch?.multicall),blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",accessList:s,blobs:c,blockOverrides:u,code:d,data:p,factory:m,factoryData:h,gas:y,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:w,to:_,value:T,stateOverride:k,...O}=t,z=r?Zt(r):void 0;if(d&&(m||h))throw new j("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(d&&_)throw new j("Cannot provide both `code` & `to` as parameters.");let L=d&&p,P=m&&h&&_&&p,F=L||P,G=(()=>{if(L)return dG({code:d,data:p});if(P)return Eye({data:p,factory:m,factoryData:h,to:_});return p})();try{_o(t);let W=(typeof i==="bigint"?ge(i):void 0)||a,H=u?Hw(u):void 0,fe=Dp(k),Te=e.chain?.formatters?.transactionRequest?.format,B=(Te||Mi)({...tc(O,{format:Te}),accessList:s,account:z,authorizationList:o,blobs:c,data:G,gas:y,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:w,to:F?void 0:_,value:T},"call");if(n&&Sye({request:B})&&!fe&&!H)try{return await Tye(e,{...B,blockNumber:i,blockTag:a})}catch(Pe){if(!(Pe instanceof Rw)&&!(Pe instanceof op))throw Pe}let Z=(()=>{let Pe=[B,W];if(fe&&H)return[...Pe,fe,H];if(fe)return[...Pe,fe];if(H)return[...Pe,{},H];return Pe})(),we=await e.request({method:"eth_call",params:Z});if(we==="0x")return{data:void 0};return{data:we}}catch(ue){let W=Iye(ue),{offchainLookup:H,offchainLookupSignature:fe}=await Promise.resolve().then(() => (lG(),uG));if(e.ccipRead!==!1&&W?.slice(0,10)===fe&&_)return{data:await H(e,{data:W,to:_})};if(F&&W?.slice(0,10)==="0x101bb98d")throw new i2({factory:m});throw Vw(ue,{...t,account:z,chain:e.chain})}}function Sye({request:e}){let{data:t,to:r,...o}=e;if(!t)return!1;if(t.startsWith(eG))return!1;if(!r)return!1;if(Object.values(o).filter((n)=>typeof n<"u").length>0)return!1;return!0}async function Tye(e,t){let{batchSize:r=1024,deployless:o=!1,wait:n=0}=typeof e.batch?.multicall==="object"?e.batch.multicall:{},{blockNumber:i,blockTag:a=e.experimental_blockTag??"latest",data:s,to:c}=t,u=(()=>{if(o)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return bo({blockNumber:i,chain:e.chain,contract:"multicall3"});throw new Rw})(),p=(typeof i==="bigint"?ge(i):void 0)||a,{schedule:m}=Ww({id:`${e.uid}.${p}`,wait:n,shouldSplitBatch(x){return x.reduce((v,{data:E})=>v+(E.length-2),0)>r*2},fn:async(x)=>{let S=x.map((w)=>({allowFailure:!0,callData:w.data,target:w.to})),v=er({abi:Zo,args:[S],functionName:"aggregate3"}),E=await e.request({method:"eth_call",params:[{...u===null?{data:dG({code:Mp,data:v})}:{to:u,data:v}},p]});return tn({abi:Zo,args:[S],functionName:"aggregate3",data:E||"0x"})}}),[{returnData:h,success:y}]=await m({data:s,to:c});if(!y)throw new Ba({data:h});if(h==="0x")return{data:void 0};return{data:h}}function dG(e){let{code:t,data:r}=e;return Lg({abi:Iw(["constructor(bytes, bytes)"]),bytecode:Gw,args:[t,r]})}function Eye(e){let{data:t,factory:r,factoryData:o,to:n}=e;return Lg({abi:Iw(["constructor(address, bytes, address, bytes)"]),bytecode:tG,args:[n,t,r,o]})}function Iye(e){if(!(e instanceof j))return;let t=e.walk();return typeof t?.data==="object"?t.data?.data:t.data}var Lu=J(()=>{rp();T2();Ri();pt();Z$();Ks();Na();I2();yo();ku();et();P2();Bp();A2();Kw();Uu()});var D2,U2=(e,t,r)=>new D2(e,t).update(r).digest();var EG=J(()=>{fo();D2=class D2 extends pu{constructor(e,t){super();this.finished=!1,this.destroyed=!1,Q3(e);let r=du(t);if(this.iHash=e.create(),typeof this.iHash.update!=="function")throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,n=new Uint8Array(o);n.set(r.length>o?e.create().update(r).digest():r);for(let i=0;i<n.length;i++)n[i]^=54;this.iHash.update(n),this.oHash=e.create();for(let i=0;i<n.length;i++)n[i]^=106;this.oHash.update(n),po(n)}update(e){return ya(this),this.iHash.update(e),this}digestInto(e){ya(this),qo(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:r,finished:o,destroyed:n,blockLen:i,outputLen:a}=this;return e=e,e.finished=o,e.destroyed=n,e.blockLen=i,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};U2.create=(e,t)=>new D2(e,t)});function IG(e){if(e.lowS!==void 0)Pi("lowS",e.lowS);if(e.prehash!==void 0)Pi("prehash",e.prehash)}function Cye(e){let t=pg(e);Go(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});let{endo:r,Fp:o,a:n}=t;if(r){if(!o.eql(n,o.ZERO))throw Error("invalid endo: CURVE.a must be 0");if(typeof r!=="object"||typeof r.beta!=="bigint"||typeof r.splitScalar!=="function")throw Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}function L2(e,t){return js(ki(e,t))}function zye(e){let t=Cye(e),{Fp:r}=t,o=Sa(t.n,t.nBitLength),n=t.toBytes||((w,_,T)=>{let k=_.toAffine();return Tr(Uint8Array.from([4]),r.toBytes(k.x),r.toBytes(k.y))}),i=t.fromBytes||((w)=>{let _=w.subarray(1),T=r.fromBytes(_.subarray(0,r.BYTES)),k=r.fromBytes(_.subarray(r.BYTES,2*r.BYTES));return{x:T,y:k}});function a(w){let{a:_,b:T}=t,k=r.sqr(w),O=r.mul(k,w);return r.add(r.add(O,r.mul(w,_)),T)}function s(w,_){let T=r.sqr(_),k=a(w);return r.eql(T,k)}if(!s(t.Gx,t.Gy))throw Error("bad curve params: generator point");let c=r.mul(r.pow(t.a,Yg),j2),u=r.mul(r.sqr(t.b),BigInt(27));if(r.is0(r.add(c,u)))throw Error("bad curve params: a or b");function d(w){return gu(w,zt,t.n)}function p(w){let{allowedPrivateKeyLengths:_,nByteLength:T,wrapPrivateKey:k,n:O}=t;if(_&&typeof w!=="bigint"){if(qd(w))w=js(w);if(typeof w!=="string"||!_.includes(w.length))throw Error("invalid private key");w=w.padStart(T*2,"0")}let z;try{z=typeof w==="bigint"?w:Dn(It("private key",w,T))}catch(L){throw Error("invalid private key, expected hex or "+T+" bytes, got "+typeof w)}if(k)z=xt(z,O);return mn("private key",z,zt,O),z}function m(w){if(!(w instanceof x))throw Error("ProjectivePoint expected")}let h=Gd((w,_)=>{let{px:T,py:k,pz:O}=w;if(r.eql(O,r.ONE))return{x:T,y:k};let z=w.is0();if(_==null)_=z?r.ONE:r.inv(O);let L=r.mul(T,_),P=r.mul(k,_),F=r.mul(O,_);if(z)return{x:r.ZERO,y:r.ZERO};if(!r.eql(F,r.ONE))throw Error("invZ was invalid");return{x:L,y:P}}),y=Gd((w)=>{if(w.is0()){if(t.allowInfinityPoint&&!r.is0(w.py))return;throw Error("bad point: ZERO")}let{x:_,y:T}=w.toAffine();if(!r.isValid(_)||!r.isValid(T))throw Error("bad point: x or y not FE");if(!s(_,T))throw Error("bad point: equation left != right");if(!w.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class x{constructor(w,_,T){if(w==null||!r.isValid(w))throw Error("x required");if(_==null||!r.isValid(_)||r.is0(_))throw Error("y required");if(T==null||!r.isValid(T))throw Error("z required");this.px=w,this.py=_,this.pz=T,Object.freeze(this)}static fromAffine(w){let{x:_,y:T}=w||{};if(!w||!r.isValid(_)||!r.isValid(T))throw Error("invalid affine point");if(w instanceof x)throw Error("projective point not allowed");let k=(O)=>r.eql(O,r.ZERO);if(k(_)&&k(T))return x.ZERO;return new x(_,T,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){let _=wa(r,w.map((T)=>T.pz));return w.map((T,k)=>T.toAffine(_[k])).map(x.fromAffine)}static fromHex(w){let _=x.fromAffine(i(It("pointHex",w)));return _.assertValidity(),_}static fromPrivateKey(w){return x.BASE.multiply(p(w))}static msm(w,_){return V_(x,o,w,_)}_setWindowSize(w){E.setWindowSize(this,w)}assertValidity(){y(this)}hasEvenY(){let{y:w}=this.toAffine();if(r.isOdd)return!r.isOdd(w);throw Error("Field doesn't support isOdd")}equals(w){m(w);let{px:_,py:T,pz:k}=this,{px:O,py:z,pz:L}=w,P=r.eql(r.mul(_,L),r.mul(O,k)),F=r.eql(r.mul(T,L),r.mul(z,k));return P&&F}negate(){return new x(this.px,r.neg(this.py),this.pz)}double(){let{a:w,b:_}=t,T=r.mul(_,Yg),{px:k,py:O,pz:z}=this,L=r.ZERO,P=r.ZERO,F=r.ZERO,G=r.mul(k,k),ue=r.mul(O,O),W=r.mul(z,z),H=r.mul(k,O);return H=r.add(H,H),F=r.mul(k,z),F=r.add(F,F),L=r.mul(w,F),P=r.mul(T,W),P=r.add(L,P),L=r.sub(ue,P),P=r.add(ue,P),P=r.mul(L,P),L=r.mul(H,L),F=r.mul(T,F),W=r.mul(w,W),H=r.sub(G,W),H=r.mul(w,H),H=r.add(H,F),F=r.add(G,G),G=r.add(F,G),G=r.add(G,W),G=r.mul(G,H),P=r.add(P,G),W=r.mul(O,z),W=r.add(W,W),G=r.mul(W,H),L=r.sub(L,G),F=r.mul(W,ue),F=r.add(F,F),F=r.add(F,F),new x(L,P,F)}add(w){m(w);let{px:_,py:T,pz:k}=this,{px:O,py:z,pz:L}=w,P=r.ZERO,F=r.ZERO,G=r.ZERO,ue=t.a,W=r.mul(t.b,Yg),H=r.mul(_,O),fe=r.mul(T,z),Te=r.mul(k,L),C=r.add(_,T),B=r.add(O,z);C=r.mul(C,B),B=r.add(H,fe),C=r.sub(C,B),B=r.add(_,k);let Z=r.add(O,L);return B=r.mul(B,Z),Z=r.add(H,Te),B=r.sub(B,Z),Z=r.add(T,k),P=r.add(z,L),Z=r.mul(Z,P),P=r.add(fe,Te),Z=r.sub(Z,P),G=r.mul(ue,B),P=r.mul(W,Te),G=r.add(P,G),P=r.sub(fe,G),G=r.add(fe,G),F=r.mul(P,G),fe=r.add(H,H),fe=r.add(fe,H),Te=r.mul(ue,Te),B=r.mul(W,B),fe=r.add(fe,Te),Te=r.sub(H,Te),Te=r.mul(ue,Te),B=r.add(B,Te),H=r.mul(fe,B),F=r.add(F,H),H=r.mul(Z,B),P=r.mul(C,P),P=r.sub(P,H),H=r.mul(C,fe),G=r.mul(Z,G),G=r.add(G,H),new x(P,F,G)}subtract(w){return this.add(w.negate())}is0(){return this.equals(x.ZERO)}wNAF(w){return E.wNAFCached(this,w,x.normalizeZ)}multiplyUnsafe(w){let{endo:_,n:T}=t;mn("scalar",w,oi,T);let k=x.ZERO;if(w===oi)return k;if(this.is0()||w===zt)return this;if(!_||E.hasPrecomputes(this))return E.wNAFCachedUnsafe(this,w,x.normalizeZ);let{k1neg:O,k1:z,k2neg:L,k2:P}=_.splitScalar(w),F=k,G=k,ue=this;while(z>oi||P>oi){if(z&zt)F=F.add(ue);if(P&zt)G=G.add(ue);ue=ue.double(),z>>=zt,P>>=zt}if(O)F=F.negate();if(L)G=G.negate();return G=new x(r.mul(G.px,_.beta),G.py,G.pz),F.add(G)}multiply(w){let{endo:_,n:T}=t;mn("scalar",w,zt,T);let k,O;if(_){let{k1neg:z,k1:L,k2neg:P,k2:F}=_.splitScalar(w),{p:G,f:ue}=this.wNAF(L),{p:W,f:H}=this.wNAF(F);G=E.constTimeNegate(z,G),W=E.constTimeNegate(P,W),W=new x(r.mul(W.px,_.beta),W.py,W.pz),k=G.add(W),O=ue.add(H)}else{let{p:z,f:L}=this.wNAF(w);k=z,O=L}return x.normalizeZ([k,O])[0]}multiplyAndAddUnsafe(w,_,T){let k=x.BASE,O=(L,P)=>P===oi||P===zt||!L.equals(k)?L.multiplyUnsafe(P):L.multiply(P),z=O(this,_).add(O(w,T));return z.is0()?void 0:z}toAffine(w){return h(this,w)}isTorsionFree(){let{h:w,isTorsionFree:_}=t;if(w===zt)return!0;if(_)return _(x,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:w,clearCofactor:_}=t;if(w===zt)return this;if(_)return _(x,this);return this.multiplyUnsafe(t.h)}toRawBytes(w=!0){return Pi("isCompressed",w),this.assertValidity(),n(x,this,w)}toHex(w=!0){return Pi("isCompressed",w),js(this.toRawBytes(w))}}x.BASE=new x(t.Gx,t.Gy,r.ONE),x.ZERO=new x(r.ZERO,r.ONE,r.ZERO);let{endo:S,nBitLength:v}=t,E=G_(x,S?Math.ceil(v/2):v);return{CURVE:t,ProjectivePoint:x,normPrivateKeyToScalar:p,weierstrassEquation:a,isWithinCurveOrder:d}}function Nye(e){let t=pg(e);return Go(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function kG(e){let t=Nye(e),{Fp:r,n:o,nByteLength:n,nBitLength:i}=t,a=r.BYTES+1,s=2*r.BYTES+1;function c(H){return xt(H,o)}function u(H){return q_(H,o)}let{ProjectivePoint:d,normPrivateKeyToScalar:p,weierstrassEquation:m,isWithinCurveOrder:h}=zye({...t,toBytes(H,fe,Te){let C=fe.toAffine(),B=r.toBytes(C.x),Z=Tr;if(Pi("isCompressed",Te),Te)return Z(Uint8Array.from([fe.hasEvenY()?2:3]),B);else return Z(Uint8Array.from([4]),B,r.toBytes(C.y))},fromBytes(H){let fe=H.length,Te=H[0],C=H.subarray(1);if(fe===a&&(Te===2||Te===3)){let B=Dn(C);if(!gu(B,zt,r.ORDER))throw Error("Point is not on curve");let Z=m(B),we;try{we=r.sqrt(Z)}catch(De){let Ce=De instanceof Error?": "+De.message:"";throw Error("Point is not on curve"+Ce)}let Pe=(we&zt)===zt;if((Te&1)===1!==Pe)we=r.neg(we);return{x:B,y:we}}else if(fe===s&&Te===4){let B=r.fromBytes(C.subarray(0,r.BYTES)),Z=r.fromBytes(C.subarray(r.BYTES,2*r.BYTES));return{x:B,y:Z}}else{let B=a,Z=s;throw Error("invalid Point, expected length of "+B+", or uncompressed "+Z+", got "+fe)}}});function y(H){let fe=o>>zt;return H>fe}function x(H){return y(H)?c(-H):H}let S=(H,fe,Te)=>Dn(H.slice(fe,Te));class v{constructor(H,fe,Te){if(mn("r",H,zt,o),mn("s",fe,zt,o),this.r=H,this.s=fe,Te!=null)this.recovery=Te;Object.freeze(this)}static fromCompact(H){let fe=n;return H=It("compactSignature",H,fe*2),new v(S(H,0,fe),S(H,fe,2*fe))}static fromDER(H){let{r:fe,s:Te}=Fa.toSig(It("DER",H));return new v(fe,Te)}assertValidity(){}addRecoveryBit(H){return new v(this.r,this.s,H)}recoverPublicKey(H){let{r:fe,s:Te,recovery:C}=this,B=O(It("msgHash",H));if(C==null||![0,1,2,3].includes(C))throw Error("recovery id invalid");let Z=C===2||C===3?fe+t.n:fe;if(Z>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let we=(C&1)===0?"02":"03",Pe=d.fromHex(we+L2(Z,r.BYTES)),je=u(Z),De=c(-B*je),Ce=c(Te*je),V=d.BASE.multiplyAndAddUnsafe(Pe,De,Ce);if(!V)throw Error("point at infinify");return V.assertValidity(),V}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return dg(this.toDERHex())}toDERHex(){return Fa.hexFromSig(this)}toCompactRawBytes(){return dg(this.toCompactHex())}toCompactHex(){let H=n;return L2(this.r,H)+L2(this.s,H)}}let E={isValidPrivateKey(H){try{return p(H),!0}catch(fe){return!1}},normPrivateKeyToScalar:p,randomPrivateKey:()=>{let H=kR(t.n);return $F(t.randomBytes(H),t.n)},precompute(H=8,fe=d.BASE){return fe._setWindowSize(H),fe.multiply(BigInt(3)),fe}};function w(H,fe=!0){return d.fromPrivateKey(H).toRawBytes(fe)}function _(H){if(typeof H==="bigint")return!1;if(H instanceof d)return!0;let Te=It("key",H).length,C=r.BYTES,B=C+1,Z=2*C+1;if(t.allowedPrivateKeyLengths||n===B)return;else return Te===B||Te===Z}function T(H,fe,Te=!0){if(_(H)===!0)throw Error("first arg must be private key");if(_(fe)===!1)throw Error("second arg must be public key");return d.fromHex(fe).multiply(p(H)).toRawBytes(Te)}let k=t.bits2int||function(H){if(H.length>8192)throw Error("input is too large");let fe=Dn(H),Te=H.length*8-i;return Te>0?fe>>BigInt(Te):fe},O=t.bits2int_modN||function(H){return c(k(H))},z=yu(i);function L(H){return mn("num < 2^"+i,H,oi,z),ki(H,n)}function P(H,fe,Te=F){if(["recovered","canonical"].some((be)=>(be in Te)))throw Error("sign() legacy options not supported");let{hash:C,randomBytes:B}=t,{lowS:Z,prehash:we,extraEntropy:Pe}=Te;if(Z==null)Z=!0;if(H=It("msgHash",H),IG(Te),we)H=It("prehashed msgHash",C(H));let je=O(H),De=p(fe),Ce=[L(De),L(je)];if(Pe!=null&&Pe!==!1){let be=Pe===!0?B(r.BYTES):Pe;Ce.push(It("extraEntropy",be))}let V=Tr(...Ce),se=je;function le(be){let ie=k(be);if(!h(ie))return;let Fe=u(ie),Kt=d.BASE.multiply(ie).toAffine(),Ve=c(Kt.x);if(Ve===oi)return;let at=c(Fe*c(se+Ve*De));if(at===oi)return;let pr=(Kt.x===Ve?0:2)|Number(Kt.y&zt),_r=at;if(Z&&y(at))_r=x(at),pr^=1;return new v(Ve,_r,pr)}return{seed:V,k2sig:le}}let F={lowS:t.lowS,prehash:!1},G={lowS:t.lowS,prehash:!1};function ue(H,fe,Te=F){let{seed:C,k2sig:B}=P(H,fe,Te),Z=t;return SF(Z.hash.outputLen,Z.nByteLength,Z.hmac)(C,B)}d.BASE._setWindowSize(8);function W(H,fe,Te,C=G){let B=H;fe=It("msgHash",fe),Te=It("publicKey",Te);let{lowS:Z,prehash:we,format:Pe}=C;if(IG(C),"strict"in C)throw Error("options.strict was renamed to lowS");if(Pe!==void 0&&Pe!=="compact"&&Pe!=="der")throw Error("format must be compact or der");let je=typeof B==="string"||qd(B),De=!je&&!Pe&&typeof B==="object"&&B!==null&&typeof B.r==="bigint"&&typeof B.s==="bigint";if(!je&&!De)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");let Ce=void 0,V;try{if(De)Ce=new v(B.r,B.s);if(je){try{if(Pe!=="compact")Ce=v.fromDER(B)}catch(pr){if(!(pr instanceof Fa.Err))throw pr}if(!Ce&&Pe!=="der")Ce=v.fromCompact(B)}V=d.fromHex(Te)}catch(pr){return!1}if(!Ce)return!1;if(Z&&Ce.hasHighS())return!1;if(we)fe=t.hash(fe);let{r:se,s:le}=Ce,be=O(fe),ie=u(le),Fe=c(be*ie),Kt=c(se*ie),Ve=d.BASE.multiplyAndAddUnsafe(V,Fe,Kt)?.toAffine();if(!Ve)return!1;return c(Ve.x)===se}return{CURVE:t,getPublicKey:w,getSharedSecret:T,sign:ue,verify:W,ProjectivePoint:d,Signature:v,utils:E}}function Mye(e,t){let r=e.ORDER,o=oi;for(let y=r-zt;y%nc===oi;y/=nc)o+=zt;let n=o,i=nc<<n-zt-zt,a=i*nc,s=(r-zt)/a,c=(s-zt)/nc,u=a-zt,d=i,p=e.pow(t,s),m=e.pow(t,(s+zt)/nc),h=(y,x)=>{let S=p,v=e.pow(x,u),E=e.sqr(v);E=e.mul(E,x);let w=e.mul(y,E);w=e.pow(w,c),w=e.mul(w,v),v=e.mul(w,x),E=e.mul(w,y);let _=e.mul(E,v);w=e.pow(_,d);let T=e.eql(w,e.ONE);v=e.mul(E,m),w=e.mul(_,S),E=e.cmov(v,E,T),_=e.cmov(w,_,T);for(let k=n;k>zt;k--){let O=k-nc;O=nc<<O-zt;let z=e.pow(_,O),L=e.eql(z,e.ONE);v=e.mul(E,S),S=e.mul(S,S),z=e.mul(_,S),E=e.cmov(v,E,L),_=e.cmov(z,_,L)}return{isValid:T,value:E}};if(e.ORDER%j2===Yg){let y=(e.ORDER-Yg)/j2,x=e.sqrt(e.neg(t));h=(S,v)=>{let E=e.sqr(v),w=e.mul(S,v);E=e.mul(E,w);let _=e.pow(E,y);_=e.mul(_,w);let T=e.mul(_,x),k=e.mul(e.sqr(_),v),O=e.eql(k,S),z=e.cmov(T,_,O);return{isValid:O,value:z}}}return h}function AG(e,t){if(H_(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw Error("mapToCurveSimpleSWU: invalid opts");let r=Mye(e,t.Z);if(!e.isOdd)throw Error("Fp.isOdd is not implemented!");return(o)=>{let n,i,a,s,c,u,d,p;n=e.sqr(o),n=e.mul(n,t.Z),i=e.sqr(n),i=e.add(i,n),a=e.add(i,e.ONE),a=e.mul(a,t.B),s=e.cmov(t.Z,e.neg(i),!e.eql(i,e.ZERO)),s=e.mul(s,t.A),i=e.sqr(a),u=e.sqr(s),c=e.mul(u,t.A),i=e.add(i,c),i=e.mul(i,a),u=e.mul(u,s),c=e.mul(u,t.B),i=e.add(i,c),d=e.mul(n,a);let{isValid:m,value:h}=r(i,u);p=e.mul(n,o),p=e.mul(p,h),d=e.cmov(d,a,m),p=e.cmov(p,h,m);let y=e.isOdd(o)===e.isOdd(p);p=e.cmov(e.neg(p),p,y);let x=wa(e,[s],!0)[0];return d=e.mul(d,x),{x:d,y:p}}}var PG,Fa,oi,zt,nc,Yg,j2;var F2=J(()=>{zR();vu();bu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */PG=class PG extends Error{constructor(e=""){super(e)}};Fa={Err:PG,_tlv:{encode:(e,t)=>{let{Err:r}=Fa;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length&1)throw new r("tlv.encode: unpadded data");let o=t.length/2,n=lg(o);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let i=o>127?lg(n.length/2|128):"";return lg(e)+i+n+t},decode(e,t){let{Err:r}=Fa,o=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[o++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[o++],i=!!(n&128),a=0;if(!i)a=n;else{let c=n&127;if(!c)throw new r("tlv.decode(long): indefinite length not supported");if(c>4)throw new r("tlv.decode(long): byte length is too big");let u=t.subarray(o,o+c);if(u.length!==c)throw new r("tlv.decode: length bytes not complete");if(u[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let d of u)a=a<<8|d;if(o+=c,a<128)throw new r("tlv.decode(long): not minimal encoding")}let s=t.subarray(o,o+a);if(s.length!==a)throw new r("tlv.decode: wrong value length");return{v:s,l:t.subarray(o+a)}}},_int:{encode(e){let{Err:t}=Fa;if(e<oi)throw new t("integer: negative integers are not allowed");let r=lg(e);if(Number.parseInt(r[0],16)&8)r="00"+r;if(r.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=Fa;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Dn(e)}},toSig(e){let{Err:t,_int:r,_tlv:o}=Fa,n=It("signature",e),{v:i,l:a}=o.decode(48,n);if(a.length)throw new t("invalid signature: left bytes after parsing");let{v:s,l:c}=o.decode(2,i),{v:u,l:d}=o.decode(2,c);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(s),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=Fa,o=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s)),i=o+n;return t.encode(48,i)}};oi=BigInt(0),zt=BigInt(1),nc=BigInt(2),Yg=BigInt(3),j2=BigInt(4)});function Bye(e){return{hash:e,hmac:(t,...r)=>U2(e,t,bR(...r)),randomBytes:Fd}}function RG(e,t){let r=(o)=>kG({...e,...Bye(o)});return{...r(t),create:r}}var $G=J(()=>{EG();fo();F2();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */});var J2={};kn(J2,{encodeToCurve:()=>Gye,hashToCurve:()=>Hye,schnorr:()=>jye,secp256k1:()=>Sn,secp256k1_hasher:()=>K2});function zG(e){let t=ey,r=BigInt(3),o=BigInt(6),n=BigInt(11),i=BigInt(22),a=BigInt(23),s=BigInt(44),c=BigInt(88),u=e*e*e%t,d=u*u*e%t,p=Yt(d,r,t)*d%t,m=Yt(p,r,t)*d%t,h=Yt(m,n1,t)*u%t,y=Yt(h,n,t)*h%t,x=Yt(y,i,t)*y%t,S=Yt(x,s,t)*x%t,v=Yt(S,c,t)*S%t,E=Yt(v,s,t)*x%t,w=Yt(E,r,t)*d%t,_=Yt(w,a,t)*y%t,T=Yt(_,o,t)*u%t,k=Yt(T,n1,t);if(!oc.eql(oc.sqr(k),e))throw Error("Cannot find square root");return k}function o1(e,...t){let r=CG[e];if(r===void 0){let o=xa(Uint8Array.from(e,(n)=>n.charCodeAt(0)));r=Tr(o,o),CG[e]=r}return xa(Tr(r,...t))}function G2(e){let t=Sn.utils.normPrivateKeyToScalar(e),r=W2.fromPrivateKey(t);return{scalar:r.hasEvenY()?t:Xg(-t),bytes:Z2(r)}}function NG(e){mn("x",e,Qg,ey);let t=q2(e*e),r=q2(t*e+BigInt(7)),o=zG(r);if(o%n1!==V2)o=q2(-o);let n=new W2(e,o,Qg);return n.assertValidity(),n}function MG(...e){return Xg(Lp(o1("BIP0340/challenge",...e)))}function Uye(e){return G2(e).bytes}function Lye(e,t,r=Fd(32)){let o=It("message",e),{bytes:n,scalar:i}=G2(t),a=It("auxRand",r,32),s=H2(i^Lp(o1("BIP0340/aux",a))),c=o1("BIP0340/nonce",s,n,o),u=Xg(Lp(c));if(u===V2)throw Error("sign failed: k is zero");let{bytes:d,scalar:p}=G2(u),m=MG(d,n,o),h=new Uint8Array(64);if(h.set(d,0),h.set(H2(Xg(p+m*i)),32),!BG(h,o,n))throw Error("sign: Invalid signature produced");return h}function BG(e,t,r){let o=It("signature",e,64),n=It("message",t),i=It("publicKey",r,32);try{let a=NG(Lp(i)),s=Lp(o.subarray(0,32));if(!gu(s,Qg,ey))return!1;let c=Lp(o.subarray(32,64));if(!gu(c,Qg,r1))return!1;let u=MG(H2(s),Z2(a),n),d=Dye(a,c,Xg(-u));if(!d||!d.hasEvenY()||d.toAffine().x!==s)return!1;return!0}catch(a){return!1}}var ey,r1,V2,Qg,n1,OG=(e,t)=>(e+t/n1)/t,oc,Sn,CG,Z2=(e)=>e.toRawBytes(!0).slice(1),H2=(e)=>ki(e,32),q2=(e)=>xt(e,ey),Xg=(e)=>xt(e,r1),W2,Dye=(e,t,r)=>W2.BASE.multiplyAndAddUnsafe(e,t,r),Lp,jye,Fye,qye,K2,Hye,Gye;var ic=J(()=>{ug();fo();$G();jF();vu();bu();F2();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ey=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),r1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),V2=BigInt(0),Qg=BigInt(1),n1=BigInt(2);oc=Sa(ey,void 0,void 0,{sqrt:zG}),Sn=RG({a:V2,b:BigInt(7),Fp:oc,n:r1,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:(e)=>{let t=r1,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),o=-Qg*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,a=BigInt("0x100000000000000000000000000000000"),s=OG(i*e,t),c=OG(-o*e,t),u=xt(e-s*r-c*n,t),d=xt(-s*o-c*i,t),p=u>a,m=d>a;if(p)u=t-u;if(m)d=t-d;if(u>a||d>a)throw Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:p,k1:u,k2neg:m,k2:d}}}},xa),CG={};W2=(()=>Sn.ProjectivePoint)();Lp=Dn;jye=(()=>({getPublicKey:Uye,sign:Lye,verify:BG,utils:{randomPrivateKey:Sn.utils.randomPrivateKey,lift_x:NG,pointToBytes:Z2,numberToBytesBE:ki,bytesToNumberBE:Dn,taggedHash:o1,mod:xt}}))(),Fye=(()=>UF(oc,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((e)=>e.map((t)=>BigInt(t)))))(),qye=(()=>AG(oc,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:oc.create(BigInt("-11"))}))(),K2=(()=>LF(Sn.ProjectivePoint,(e)=>{let{x:t,y:r}=qye(oc.create(e[0]));return Fye(t,r)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:oc.ORDER,m:1,k:128,expand:"xmd",hash:xa}))(),Hye=(()=>K2.hashToCurve)(),Gye=(()=>K2.encodeToCurve)()});import{webcrypto as Lve}from"node:crypto";import KX from"node:http";import JX from"node:https";import Sl from"node:zlib";import IN,{PassThrough as PN,pipeline as Tl}from"node:stream";import{Buffer as _b}from"node:buffer";function SX(e){if(!/^data:/i.test(e))throw TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');e=e.replace(/\r?\n/g,"");let t=e.indexOf(",");if(t===-1||t<=4)throw TypeError("malformed data: URI");let r=e.substring(5,t).split(";"),o="",n=!1,i=r[0]||"text/plain",a=i;for(let d=1;d<r.length;d++)if(r[d]==="base64")n=!0;else if(r[d]){if(a+=`;${r[d]}`,r[d].indexOf("charset=")===0)o=r[d].substring(8)}if(!r[0]&&!o.length)a+=";charset=US-ASCII",o="US-ASCII";let s=n?"base64":"ascii",c=unescape(e.substring(t+1)),u=Buffer.from(c,s);return u.type=i,u.typeFull=a,u.charset=o,u}var Vz=SX;Yf();fb();import as,{PassThrough as pN}from"node:stream";import{types as fN,deprecate as GT,promisify as LX}from"node:util";import{Buffer as ro}from"node:buffer";class os extends Error{constructor(e,t){super(e);Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}class Gn extends os{constructor(e,t,r){super(e,t);if(r)this.code=this.errno=r.code,this.erroredSysCall=r.syscall}}var mb=Symbol.toStringTag,FT=(e)=>typeof e==="object"&&typeof e.append==="function"&&typeof e.delete==="function"&&typeof e.get==="function"&&typeof e.getAll==="function"&&typeof e.has==="function"&&typeof e.set==="function"&&typeof e.sort==="function"&&e[mb]==="URLSearchParams",Xf=(e)=>e&&typeof e==="object"&&typeof e.arrayBuffer==="function"&&typeof e.type==="string"&&typeof e.stream==="function"&&typeof e.constructor==="function"&&/^(Blob|File)$/.test(e[mb]),tN=(e)=>typeof e==="object"&&(e[mb]==="AbortSignal"||e[mb]==="EventTarget"),rN=(e,t)=>{let r=new URL(t).hostname,o=new URL(e).hostname;return r===o||r.endsWith(`.${o}`)},nN=(e,t)=>{let r=new URL(t).protocol,o=new URL(e).protocol;return r===o};var jX=LX(as.pipeline),An=Symbol("Body internals");class Xi{constructor(e,{size:t=0}={}){let r=null;if(e===null)e=null;else if(FT(e))e=ro.from(e.toString());else if(Xf(e));else if(ro.isBuffer(e));else if(fN.isAnyArrayBuffer(e))e=ro.from(e);else if(ArrayBuffer.isView(e))e=ro.from(e.buffer,e.byteOffset,e.byteLength);else if(e instanceof as);else if(e instanceof Oc)e=eN(e),r=e.type.split("=")[1];else e=ro.from(String(e));let o=e;if(ro.isBuffer(e))o=as.Readable.from(e);else if(Xf(e))o=as.Readable.from(e.stream());if(this[An]={body:e,stream:o,boundary:r,disturbed:!1,error:null},this.size=t,e instanceof as)e.on("error",(n)=>{let i=n instanceof os?n:new Gn(`Invalid response body while trying to fetch ${this.url}: ${n.message}`,"system",n);this[An].error=i})}get body(){return this[An].stream}get bodyUsed(){return this[An].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:r}=await HT(this);return e.slice(t,t+r)}async formData(){let e=this.headers.get("content-type");if(e.startsWith("application/x-www-form-urlencoded")){let r=new Oc,o=new URLSearchParams(await this.text());for(let[n,i]of o)r.append(n,i);return r}let{toFormData:t}=await Promise.resolve().then(() => (dN(),lN));return t(this.body,e)}async blob(){let e=this.headers&&this.headers.get("content-type")||this[An].body&&this[An].body.type||"",t=await this.arrayBuffer();return new Qi([t],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await HT(this);return new TextDecoder().decode(e)}buffer(){return HT(this)}}Xi.prototype.buffer=GT(Xi.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(Xi.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:GT(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});async function HT(e){if(e[An].disturbed)throw TypeError(`body used already for: ${e.url}`);if(e[An].disturbed=!0,e[An].error)throw e[An].error;let{body:t}=e;if(t===null)return ro.alloc(0);if(!(t instanceof as))return ro.alloc(0);let r=[],o=0;try{for await(let n of t){if(e.size>0&&o+n.length>e.size){let i=new Gn(`content size at ${e.url} over limit: ${e.size}`,"max-size");throw t.destroy(i),i}o+=n.length,r.push(n)}}catch(n){throw n instanceof os?n:new Gn(`Invalid response body while trying to fetch ${e.url}: ${n.message}`,"system",n)}if(t.readableEnded===!0||t._readableState.ended===!0)try{if(r.every((n)=>typeof n==="string"))return ro.from(r.join(""));return ro.concat(r,o)}catch(n){throw new Gn(`Could not create Buffer from response body for ${e.url}: ${n.message}`,"system",n)}else throw new Gn(`Premature close of server response while trying to fetch ${e.url}`)}var _l=(e,t)=>{let r,o,{body:n}=e[An];if(e.bodyUsed)throw Error("cannot clone body after it is used");if(n instanceof as&&typeof n.getBoundary!=="function")r=new pN({highWaterMark:t}),o=new pN({highWaterMark:t}),n.pipe(r),n.pipe(o),e[An].stream=r,n=o;return n},FX=GT((e)=>e.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167"),yb=(e,t)=>{if(e===null)return null;if(typeof e==="string")return"text/plain;charset=UTF-8";if(FT(e))return"application/x-www-form-urlencoded;charset=UTF-8";if(Xf(e))return e.type||null;if(ro.isBuffer(e)||fN.isAnyArrayBuffer(e)||ArrayBuffer.isView(e))return null;if(e instanceof Oc)return`multipart/form-data; boundary=${t[An].boundary}`;if(e&&typeof e.getBoundary==="function")return`multipart/form-data;boundary=${FX(e)}`;if(e instanceof as)return null;return"text/plain;charset=UTF-8"},mN=(e)=>{let{body:t}=e[An];if(t===null)return 0;if(Xf(t))return t.size;if(ro.isBuffer(t))return t.length;if(t&&typeof t.getLengthSync==="function")return t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null;return null},hN=async(e,{body:t})=>{if(t===null)e.end();else await jX(t,e)};import{types as gN}from"node:util";import xb from"node:http";var bb=typeof xb.validateHeaderName==="function"?xb.validateHeaderName:(e)=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),t}},VT=typeof xb.validateHeaderValue==="function"?xb.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let r=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(r,"code",{value:"ERR_INVALID_CHAR"}),r}};class an extends URLSearchParams{constructor(e){let t=[];if(e instanceof an){let r=e.raw();for(let[o,n]of Object.entries(r))t.push(...n.map((i)=>[o,i]))}else if(e==null);else if(typeof e==="object"&&!gN.isBoxedPrimitive(e)){let r=e[Symbol.iterator];if(r==null)t.push(...Object.entries(e));else{if(typeof r!=="function")throw TypeError("Header pairs must be iterable");t=[...e].map((o)=>{if(typeof o!=="object"||gN.isBoxedPrimitive(o))throw TypeError("Each header pair must be an iterable object");return[...o]}).map((o)=>{if(o.length!==2)throw TypeError("Each header pair must be a name/value tuple");return[...o]})}}else throw TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");t=t.length>0?t.map(([r,o])=>(bb(r),VT(r,String(o)),[String(r).toLowerCase(),String(o)])):void 0;super(t);return new Proxy(this,{get(r,o,n){switch(o){case"append":case"set":return(i,a)=>(bb(i),VT(i,String(a)),URLSearchParams.prototype[o].call(r,String(i).toLowerCase(),String(a)));case"delete":case"has":case"getAll":return(i)=>(bb(i),URLSearchParams.prototype[o].call(r,String(i).toLowerCase()));case"keys":return()=>(r.sort(),new Set(URLSearchParams.prototype.keys.call(r)).keys());default:return Reflect.get(r,o,n)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let t=this.getAll(e);if(t.length===0)return null;let r=t.join(", ");if(/^content-encoding$/i.test(e))r=r.toLowerCase();return r}forEach(e,t=void 0){for(let r of this.keys())Reflect.apply(e,t,[this.get(r),r,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((e,t)=>(e[t]=this.getAll(t),e),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((e,t)=>{let r=this.getAll(t);if(t==="host")e[t]=r[0];else e[t]=r.length>1?r:r[0];return e},{})}}Object.defineProperties(an.prototype,["get","entries","forEach","values"].reduce((e,t)=>(e[t]={enumerable:!0},e),{}));function yN(e=[]){return new an(e.reduce((t,r,o,n)=>{if(o%2===0)t.push(n.slice(o,o+2));return t},[]).filter(([t,r])=>{try{return bb(t),VT(t,String(r)),!0}catch{return!1}}))}var qX=new Set([301,302,303,307,308]),vb=(e)=>qX.has(e);var Ro=Symbol("Response internals");class Cr extends Xi{constructor(e=null,t={}){super(e,t);let r=t.status!=null?t.status:200,o=new an(t.headers);if(e!==null&&!o.has("Content-Type")){let n=yb(e,this);if(n)o.append("Content-Type",n)}this[Ro]={type:"default",url:t.url,status:r,statusText:t.statusText||"",headers:o,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[Ro].type}get url(){return this[Ro].url||""}get status(){return this[Ro].status}get ok(){return this[Ro].status>=200&&this[Ro].status<300}get redirected(){return this[Ro].counter>0}get statusText(){return this[Ro].statusText}get headers(){return this[Ro].headers}get highWaterMark(){return this[Ro].highWaterMark}clone(){return new Cr(_l(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(e,t=302){if(!vb(t))throw RangeError('Failed to execute "redirect" on "response": Invalid status code');return new Cr(null,{headers:{location:new URL(e).toString()},status:t})}static error(){let e=new Cr(null,{status:0,statusText:""});return e[Ro].type="error",e}static json(e=void 0,t={}){let r=JSON.stringify(e);if(r===void 0)throw TypeError("data is not JSON serializable");let o=new an(t&&t.headers);if(!o.has("content-type"))o.set("content-type","application/json");return new Cr(r,{...t,headers:o})}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(Cr.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});import{format as VX}from"node:url";import{deprecate as ZX}from"node:util";var bN=(e)=>{if(e.search)return e.search;let t=e.href.length-1,r=e.hash||(e.href[t]==="#"?"#":"");return e.href[t-r.length]==="?"?"?":""};import{isIP as HX}from"node:net";function xN(e,t=!1){if(e==null)return"no-referrer";if(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))return"no-referrer";if(e.username="",e.password="",e.hash="",t)e.pathname="",e.search="";return e}var vN=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"]),_N="strict-origin-when-cross-origin";function wN(e){if(!vN.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}function GX(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,""),r=HX(t);if(r===4&&/^127\./.test(t))return!0;if(r===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t))return!0;if(e.host==="localhost"||e.host.endsWith(".localhost"))return!1;if(e.protocol==="file:")return!0;return!1}function wl(e){if(/^about:(blank|srcdoc)$/.test(e))return!0;if(e.protocol==="data:")return!0;if(/^(blob|filesystem):$/.test(e.protocol))return!0;return GX(e)}function SN(e,{referrerURLCallback:t,referrerOriginCallback:r}={}){if(e.referrer==="no-referrer"||e.referrerPolicy==="")return null;let o=e.referrerPolicy;if(e.referrer==="about:client")return"no-referrer";let n=e.referrer,i=xN(n),a=xN(n,!0);if(i.toString().length>4096)i=a;if(t)i=t(i);if(r)a=r(a);let s=new URL(e.url);switch(o){case"no-referrer":return"no-referrer";case"origin":return a;case"unsafe-url":return i;case"strict-origin":if(wl(i)&&!wl(s))return"no-referrer";return a.toString();case"strict-origin-when-cross-origin":if(i.origin===s.origin)return i;if(wl(i)&&!wl(s))return"no-referrer";return a;case"same-origin":if(i.origin===s.origin)return i;return"no-referrer";case"origin-when-cross-origin":if(i.origin===s.origin)return i;return a;case"no-referrer-when-downgrade":if(wl(i)&&!wl(s))return"no-referrer";return i;default:throw TypeError(`Invalid referrerPolicy: ${o}`)}}function TN(e){let t=(e.get("referrer-policy")||"").split(/[,\s]+/),r="";for(let o of t)if(o&&vN.has(o))r=o;return r}var wr=Symbol("Request internals"),tm=(e)=>typeof e==="object"&&typeof e[wr]==="object",WX=ZX(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");class ea extends Xi{constructor(e,t={}){let r;if(tm(e))r=new URL(e.url);else r=new URL(e),e={};if(r.username!==""||r.password!=="")throw TypeError(`${r} is an url with embedded credentials.`);let o=t.method||e.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(o))o=o.toUpperCase();if(!tm(t)&&"data"in t)WX();if((t.body!=null||tm(e)&&e.body!==null)&&(o==="GET"||o==="HEAD"))throw TypeError("Request with GET/HEAD method cannot have body");let n=t.body?t.body:tm(e)&&e.body!==null?_l(e):null;super(n,{size:t.size||e.size||0});let i=new an(t.headers||e.headers||{});if(n!==null&&!i.has("Content-Type")){let c=yb(n,this);if(c)i.set("Content-Type",c)}let a=tm(e)?e.signal:null;if("signal"in t)a=t.signal;if(a!=null&&!tN(a))throw TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let s=t.referrer==null?e.referrer:t.referrer;if(s==="")s="no-referrer";else if(s){let c=new URL(s);s=/^about:(\/\/)?client$/.test(c)?"client":c}else s=void 0;this[wr]={method:o,redirect:t.redirect||e.redirect||"follow",headers:i,parsedURL:r,signal:a,referrer:s},this.follow=t.follow===void 0?e.follow===void 0?20:e.follow:t.follow,this.compress=t.compress===void 0?e.compress===void 0?!0:e.compress:t.compress,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent,this.highWaterMark=t.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||e.referrerPolicy||""}get method(){return this[wr].method}get url(){return VX(this[wr].parsedURL)}get headers(){return this[wr].headers}get redirect(){return this[wr].redirect}get signal(){return this[wr].signal}get referrer(){if(this[wr].referrer==="no-referrer")return"";if(this[wr].referrer==="client")return"about:client";if(this[wr].referrer)return this[wr].referrer.toString();return}get referrerPolicy(){return this[wr].referrerPolicy}set referrerPolicy(e){this[wr].referrerPolicy=wN(e)}clone(){return new ea(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(ea.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}});var EN=(e)=>{let{parsedURL:t}=e[wr],r=new an(e[wr].headers);if(!r.has("Accept"))r.set("Accept","*/*");let o=null;if(e.body===null&&/^(post|put)$/i.test(e.method))o="0";if(e.body!==null){let s=mN(e);if(typeof s==="number"&&!Number.isNaN(s))o=String(s)}if(o)r.set("Content-Length",o);if(e.referrerPolicy==="")e.referrerPolicy=_N;if(e.referrer&&e.referrer!=="no-referrer")e[wr].referrer=SN(e);else e[wr].referrer="no-referrer";if(e[wr].referrer instanceof URL)r.set("Referer",e.referrer);if(!r.has("User-Agent"))r.set("User-Agent","node-fetch");if(e.compress&&!r.has("Accept-Encoding"))r.set("Accept-Encoding","gzip, deflate, br");let{agent:n}=e;if(typeof n==="function")n=n(t);let i=bN(t),a={path:t.pathname+i,method:e.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:n};return{parsedURL:t,options:a}};class ZT extends os{constructor(e,t="aborted"){super(e,t)}}fb();qT();var YX=new Set(["data:","http:","https:"]);async function wb(e,t){return new Promise((r,o)=>{let n=new ea(e,t),{parsedURL:i,options:a}=EN(n);if(!YX.has(i.protocol))throw TypeError(`node-fetch cannot load ${e}. URL scheme "${i.protocol.replace(/:$/,"")}" is not supported.`);if(i.protocol==="data:"){let y=Vz(n.url),x=new Cr(y,{headers:{"Content-Type":y.typeFull}});r(x);return}let s=(i.protocol==="https:"?JX:KX).request,{signal:c}=n,u=null,d=()=>{let y=new ZT("The operation was aborted.");if(o(y),n.body&&n.body instanceof IN.Readable)n.body.destroy(y);if(!u||!u.body)return;u.body.emit("error",y)};if(c&&c.aborted){d();return}let p=()=>{d(),h()},m=s(i.toString(),a);if(c)c.addEventListener("abort",p);let h=()=>{if(m.abort(),c)c.removeEventListener("abort",p)};if(m.on("error",(y)=>{o(new Gn(`request to ${n.url} failed, reason: ${y.message}`,"system",y)),h()}),QX(m,(y)=>{if(u&&u.body)u.body.destroy(y)}),process.version<"v14")m.on("socket",(y)=>{let x;y.prependListener("end",()=>{x=y._eventsCount}),y.prependListener("close",(S)=>{if(u&&x<y._eventsCount&&!S){let v=Error("Premature close");v.code="ERR_STREAM_PREMATURE_CLOSE",u.body.emit("error",v)}})});m.on("response",(y)=>{m.setTimeout(0);let x=yN(y.rawHeaders);if(vb(y.statusCode)){let _=x.get("Location"),T=null;try{T=_===null?null:new URL(_,n.url)}catch{if(n.redirect!=="manual"){o(new Gn(`uri requested responds with an invalid redirect URL: ${_}`,"invalid-redirect")),h();return}}switch(n.redirect){case"error":o(new Gn(`uri requested responds with a redirect, redirect mode is set to error: ${n.url}`,"no-redirect")),h();return;case"manual":break;case"follow":{if(T===null)break;if(n.counter>=n.follow){o(new Gn(`maximum redirect reached at: ${n.url}`,"max-redirect")),h();return}let k={headers:new an(n.headers),follow:n.follow,counter:n.counter+1,agent:n.agent,compress:n.compress,method:n.method,body:_l(n),signal:n.signal,size:n.size,referrer:n.referrer,referrerPolicy:n.referrerPolicy};if(!rN(n.url,T)||!nN(n.url,T))for(let z of["authorization","www-authenticate","cookie","cookie2"])k.headers.delete(z);if(y.statusCode!==303&&n.body&&t.body instanceof IN.Readable){o(new Gn("Cannot follow redirect with body being a readable stream","unsupported-redirect")),h();return}if(y.statusCode===303||(y.statusCode===301||y.statusCode===302)&&n.method==="POST")k.method="GET",k.body=void 0,k.headers.delete("content-length");let O=TN(x);if(O)k.referrerPolicy=O;r(wb(new ea(T,k))),h();return}default:return o(TypeError(`Redirect option '${n.redirect}' is not a valid value of RequestRedirect`))}}if(c)y.once("end",()=>{c.removeEventListener("abort",p)});let S=Tl(y,new PN,(_)=>{if(_)o(_)});if(process.version<"v12.10")y.on("aborted",p);let v={url:n.url,status:y.statusCode,statusText:y.statusMessage,headers:x,size:n.size,counter:n.counter,highWaterMark:n.highWaterMark},E=x.get("Content-Encoding");if(!n.compress||n.method==="HEAD"||E===null||y.statusCode===204||y.statusCode===304){u=new Cr(S,v),r(u);return}let w={flush:Sl.Z_SYNC_FLUSH,finishFlush:Sl.Z_SYNC_FLUSH};if(E==="gzip"||E==="x-gzip"){S=Tl(S,Sl.createGunzip(w),(_)=>{if(_)o(_)}),u=new Cr(S,v),r(u);return}if(E==="deflate"||E==="x-deflate"){let _=Tl(y,new PN,(T)=>{if(T)o(T)});_.once("data",(T)=>{if((T[0]&15)===8)S=Tl(S,Sl.createInflate(),(k)=>{if(k)o(k)});else S=Tl(S,Sl.createInflateRaw(),(k)=>{if(k)o(k)});u=new Cr(S,v),r(u)}),_.once("end",()=>{if(!u)u=new Cr(S,v),r(u)});return}if(E==="br"){S=Tl(S,Sl.createBrotliDecompress(),(_)=>{if(_)o(_)}),u=new Cr(S,v),r(u);return}u=new Cr(S,v),r(u)}),hN(m,n).catch(o)})}function QX(e,t){let r=_b.from(`0\r
|
|
65
65
|
\r
|
|
66
66
|
`),o=!1,n=!1,i;e.on("response",(a)=>{let{headers:s}=a;o=s["transfer-encoding"]==="chunked"&&!s["content-length"]}),e.on("socket",(a)=>{let s=()=>{if(o&&!n){let u=Error("Premature close");u.code="ERR_STREAM_PREMATURE_CLOSE",t(u)}},c=(u)=>{if(n=_b.compare(u.slice(-5),r)===0,!n&&i)n=_b.compare(i.slice(-3),r.slice(0,3))===0&&_b.compare(u.slice(-2),r.slice(3))===0;i=u};a.prependListener("close",s),a.on("data",c),e.on("close",()=>{a.removeListener("close",s),a.removeListener("data",c)})})}var xte=on(wM(),1),vte=on(Rb(),1),_te=on(Pl(),1),wte=on(XT(),1),Ste=on(tE(),1),Tte=on(sE(),1),cE=on(zb(),1),Ete=on(kM(),1);var ct;(function(e){e.assertEqual=(n)=>{};function t(n){}e.assertIs=t;function r(n){throw Error()}e.assertNever=r,e.arrayToEnum=(n)=>{let i={};for(let a of n)i[a]=a;return i},e.getValidEnumValues=(n)=>{let i=e.objectKeys(n).filter((s)=>typeof n[n[s]]!=="number"),a={};for(let s of i)a[s]=n[s];return e.objectValues(a)},e.objectValues=(n)=>e.objectKeys(n).map(function(i){return n[i]}),e.objectKeys=typeof Object.keys==="function"?(n)=>Object.keys(n):(n)=>{let i=[];for(let a in n)if(Object.prototype.hasOwnProperty.call(n,a))i.push(a);return i},e.find=(n,i)=>{for(let a of n)if(i(a))return a;return},e.isInteger=typeof Number.isInteger==="function"?(n)=>Number.isInteger(n):(n)=>typeof n==="number"&&Number.isFinite(n)&&Math.floor(n)===n;function o(n,i=" | "){return n.map((a)=>typeof a==="string"?`'${a}'`:a).join(i)}e.joinValues=o,e.jsonStringifyReplacer=(n,i)=>{if(typeof i==="bigint")return i.toString();return i}})(ct||(ct={}));var AM;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(AM||(AM={}));var de=ct.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),oa=(e)=>{switch(typeof e){case"undefined":return de.undefined;case"string":return de.string;case"number":return Number.isNaN(e)?de.nan:de.number;case"boolean":return de.boolean;case"function":return de.function;case"bigint":return de.bigint;case"symbol":return de.symbol;case"object":if(Array.isArray(e))return de.array;if(e===null)return de.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return de.promise;if(typeof Map<"u"&&e instanceof Map)return de.map;if(typeof Set<"u"&&e instanceof Set)return de.set;if(typeof Date<"u"&&e instanceof Date)return de.date;return de.object;default:return de.unknown}};var te=ct.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"]);class Zn extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},r={_errors:[]},o=(n)=>{for(let i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let a=r,s=0;while(s<i.path.length){let c=i.path[s];if(s!==i.path.length-1)a[c]=a[c]||{_errors:[]};else a[c]=a[c]||{_errors:[]},a[c]._errors.push(t(i));a=a[c],s++}}};return o(this),r}static assert(e){if(!(e instanceof Zn))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ct.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t=Object.create(null),r=[];for(let o of this.issues)if(o.path.length>0){let n=o.path[0];t[n]=t[n]||[],t[n].push(e(o))}else r.push(e(o));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}Zn.create=(e)=>new Zn(e);var Ite=(e,t)=>{let r;switch(e.code){case te.invalid_type:if(e.received===de.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case te.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ct.jsonStringifyReplacer)}`;break;case te.unrecognized_keys:r=`Unrecognized key(s) in object: ${ct.joinValues(e.keys,", ")}`;break;case te.invalid_union:r="Invalid input";break;case te.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ct.joinValues(e.options)}`;break;case te.invalid_enum_value:r=`Invalid enum value. Expected ${ct.joinValues(e.options)}, received '${e.received}'`;break;case te.invalid_arguments:r="Invalid function arguments";break;case te.invalid_return_type:r="Invalid function return type";break;case te.invalid_date:r="Invalid date";break;case te.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else ct.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case te.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case te.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case te.custom:r="Invalid input";break;case te.invalid_intersection_types:r="Intersection results could not be merged";break;case te.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case te.not_finite:r="Number must be finite";break;default:r=t.defaultError,ct.assertNever(e)}return{message:r}},ds=Ite;var Pte=ds;function um(){return Pte}var Mb=(e)=>{let{data:t,path:r,errorMaps:o,issueData:n}=e,i=[...r,...n.path||[]],a={...n,path:i};if(n.message!==void 0)return{...n,path:i,message:n.message};let s="",c=o.filter((u)=>!!u).slice().reverse();for(let u of c)s=u(a,{data:t,defaultError:s}).message;return{...n,path:i,message:s}};function me(e,t){let r=um(),o=Mb({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===ds?void 0:ds].filter((n)=>!!n)});e.common.issues.push(o)}class Yr{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let o of t){if(o.status==="aborted")return Me;if(o.status==="dirty")e.dirty();r.push(o.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let o of t){let n=await o.key,i=await o.value;r.push({key:n,value:i})}return Yr.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let o of t){let{key:n,value:i}=o;if(n.status==="aborted")return Me;if(i.status==="aborted")return Me;if(n.status==="dirty")e.dirty();if(i.status==="dirty")e.dirty();if(n.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet))r[n.value]=i.value}return{status:e.value,value:r}}}var Me=Object.freeze({status:"aborted"}),Cl=(e)=>({status:"dirty",value:e}),sn=(e)=>({status:"valid",value:e}),uE=(e)=>e.status==="aborted",lE=(e)=>e.status==="dirty",Dc=(e)=>e.status==="valid",lm=(e)=>typeof Promise<"u"&&e instanceof Promise;var Se;(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(Se||(Se={}));class Oo{constructor(e,t,r,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=o}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var RM=(e,t)=>{if(Dc(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Zn(e.common.issues);return this._error=r,this._error}}}};function Ke(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:o,description:n}=e;if(t&&(r||o))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:n};return{errorMap:(a,s)=>{let{message:c}=e;if(a.code==="invalid_enum_value")return{message:c??s.defaultError};if(typeof s.data>"u")return{message:c??o??s.defaultError};if(a.code!=="invalid_type")return{message:s.defaultError};return{message:c??r??s.defaultError}},description:n}}class ot{get description(){return this._def.description}_getType(e){return oa(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:oa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Yr,ctx:{common:e.parent.common,data:e.data,parsedType:oa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(lm(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oa(e)},o=this._parseSync({data:e,path:r.path,parent:r});return RM(r,o)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oa(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Dc(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>Dc(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oa(e)},o=this._parse({data:e,path:r.path,parent:r}),n=await(lm(o)?o:Promise.resolve(o));return RM(r,n)}refine(e,t){let r=(o)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(o);else return t};return this._refinement((o,n)=>{let i=e(o),a=()=>n.addIssue({code:te.custom,...r(o)});if(typeof Promise<"u"&&i instanceof Promise)return i.then((s)=>{if(!s)return a(),!1;else return!0});if(!i)return a(),!1;else return!0})}refinement(e,t){return this._refinement((r,o)=>{if(!e(r))return o.addIssue(typeof t==="function"?t(r,o):t),!1;else return!0})}_refinement(e){return new yi({schema:this,typeName:ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return gi.create(this,this._def)}nullable(){return ps.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return hi.create(this)}promise(){return Dl.create(this,this._def)}or(e){return hm.create([this,e],this._def)}and(e){return gm.create(this,e,this._def)}transform(e){return new yi({...Ke(this._def),schema:this,typeName:ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new vm({...Ke(this._def),innerType:this,defaultValue:t,typeName:ne.ZodDefault})}brand(){return new mE({typeName:ne.ZodBranded,type:this,...Ke(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new _m({...Ke(this._def),innerType:this,catchValue:t,typeName:ne.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Hb.create(this,e)}readonly(){return wm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var kte=/^c[^\s-]{8,}$/i,Ate=/^[0-9a-z]+$/,Rte=/^[0-9A-HJKMNP-TV-Z]{26}$/i,$te=/^[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,Ote=/^[a-z0-9_-]{21}$/i,Cte=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zte=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Nte=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mte="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dE,Bte=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Dte=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ute=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Lte=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jte=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Fte=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$M="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",qte=new RegExp(`^${$M}$`);function OM(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function Hte(e){return new RegExp(`^${OM(e)}$`)}function Gte(e){let t=`${$M}T${OM(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function Vte(e,t){if((t==="v4"||!t)&&Bte.test(e))return!0;if((t==="v6"||!t)&&Ute.test(e))return!0;return!1}function Zte(e,t){if(!Cte.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let o=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(o));if(typeof n!=="object"||n===null)return!1;if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&n.alg!==t)return!1;return!0}catch{return!1}}function Wte(e,t){if((t==="v4"||!t)&&Dte.test(e))return!0;if((t==="v6"||!t)&&Lte.test(e))return!0;return!1}class aa extends ot{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==de.string){let n=this._getOrReturnCtx(e);return me(n,{code:te.invalid_type,expected:de.string,received:n.parsedType}),Me}let r=new Yr,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.length<n.value)o=this._getOrReturnCtx(e,o),me(o,{code:te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="max"){if(e.data.length>n.value)o=this._getOrReturnCtx(e,o),me(o,{code:te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty()}else if(n.kind==="length"){let i=e.data.length>n.value,a=e.data.length<n.value;if(i||a){if(o=this._getOrReturnCtx(e,o),i)me(o,{code:te.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});else if(a)me(o,{code:te.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message});r.dirty()}}else if(n.kind==="email"){if(!Nte.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"email",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="emoji"){if(!dE)dE=new RegExp(Mte,"u");if(!dE.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"emoji",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="uuid"){if(!$te.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"uuid",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="nanoid"){if(!Ote.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"nanoid",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid"){if(!kte.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"cuid",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cuid2"){if(!Ate.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"cuid2",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ulid"){if(!Rte.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"ulid",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="url")try{new URL(e.data)}catch{o=this._getOrReturnCtx(e,o),me(o,{validation:"url",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="regex"){if(n.regex.lastIndex=0,!n.regex.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"regex",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="trim")e.data=e.data.trim();else if(n.kind==="includes"){if(!e.data.includes(n.value,n.position))o=this._getOrReturnCtx(e,o),me(o,{code:te.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()}else if(n.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(n.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(n.kind==="startsWith"){if(!e.data.startsWith(n.value))o=this._getOrReturnCtx(e,o),me(o,{code:te.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="endsWith"){if(!e.data.endsWith(n.value))o=this._getOrReturnCtx(e,o),me(o,{code:te.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()}else if(n.kind==="datetime"){if(!Gte(n).test(e.data))o=this._getOrReturnCtx(e,o),me(o,{code:te.invalid_string,validation:"datetime",message:n.message}),r.dirty()}else if(n.kind==="date"){if(!qte.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{code:te.invalid_string,validation:"date",message:n.message}),r.dirty()}else if(n.kind==="time"){if(!Hte(n).test(e.data))o=this._getOrReturnCtx(e,o),me(o,{code:te.invalid_string,validation:"time",message:n.message}),r.dirty()}else if(n.kind==="duration"){if(!zte.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"duration",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="ip"){if(!Vte(e.data,n.version))o=this._getOrReturnCtx(e,o),me(o,{validation:"ip",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="jwt"){if(!Zte(e.data,n.alg))o=this._getOrReturnCtx(e,o),me(o,{validation:"jwt",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="cidr"){if(!Wte(e.data,n.version))o=this._getOrReturnCtx(e,o),me(o,{validation:"cidr",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64"){if(!jte.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"base64",code:te.invalid_string,message:n.message}),r.dirty()}else if(n.kind==="base64url"){if(!Fte.test(e.data))o=this._getOrReturnCtx(e,o),me(o,{validation:"base64url",code:te.invalid_string,message:n.message}),r.dirty()}else ct.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((o)=>e.test(o),{validation:t,code:te.invalid_string,...Se.errToObj(r)})}_addCheck(e){return new aa({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Se.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Se.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Se.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Se.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Se.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Se.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Se.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Se.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Se.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Se.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Se.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Se.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Se.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Se.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Se.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Se.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Se.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Se.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Se.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Se.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Se.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Se.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Se.errToObj(t)})}nonempty(e){return this.min(1,Se.errToObj(e))}trim(){return new aa({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new aa({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new aa({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}aa.create=(e)=>new aa({checks:[],typeName:ne.ZodString,coerce:e?.coerce??!1,...Ke(e)});function Kte(e,t){let r=(e.toString().split(".")[1]||"").length,o=(t.toString().split(".")[1]||"").length,n=r>o?r:o,i=Number.parseInt(e.toFixed(n).replace(".","")),a=Number.parseInt(t.toFixed(n).replace(".",""));return i%a/10**n}class Nl extends ot{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);if(this._getType(e)!==de.number){let n=this._getOrReturnCtx(e);return me(n,{code:te.invalid_type,expected:de.number,received:n.parsedType}),Me}let r=void 0,o=new Yr;for(let n of this._def.checks)if(n.kind==="int"){if(!ct.isInteger(e.data))r=this._getOrReturnCtx(e,r),me(r,{code:te.invalid_type,expected:"integer",received:"float",message:n.message}),o.dirty()}else if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),me(r,{code:te.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),me(r,{code:te.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(Kte(e.data,n.value)!==0)r=this._getOrReturnCtx(e,r),me(r,{code:te.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else if(n.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),me(r,{code:te.not_finite,message:n.message}),o.dirty()}else ct.assertNever(n);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Se.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Se.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Se.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Se.toString(t))}setLimit(e,t,r,o){return new Nl({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Se.toString(o)}]})}_addCheck(e){return new Nl({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Se.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Se.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Se.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Se.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Se.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Se.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Se.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Se.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Se.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&ct.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}}Nl.create=(e)=>new Nl({checks:[],typeName:ne.ZodNumber,coerce:e?.coerce||!1,...Ke(e)});class Ml extends ot{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==de.bigint)return this._getInvalidInput(e);let r=void 0,o=new Yr;for(let n of this._def.checks)if(n.kind==="min"){if(n.inclusive?e.data<n.value:e.data<=n.value)r=this._getOrReturnCtx(e,r),me(r,{code:te.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="max"){if(n.inclusive?e.data>n.value:e.data>=n.value)r=this._getOrReturnCtx(e,r),me(r,{code:te.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),o.dirty()}else if(n.kind==="multipleOf"){if(e.data%n.value!==BigInt(0))r=this._getOrReturnCtx(e,r),me(r,{code:te.not_multiple_of,multipleOf:n.value,message:n.message}),o.dirty()}else ct.assertNever(n);return{status:o.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return me(t,{code:te.invalid_type,expected:de.bigint,received:t.parsedType}),Me}gte(e,t){return this.setLimit("min",e,!0,Se.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Se.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Se.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Se.toString(t))}setLimit(e,t,r,o){return new Ml({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Se.toString(o)}]})}_addCheck(e){return new Ml({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Se.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Se.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Se.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Se.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Se.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}}Ml.create=(e)=>new Ml({checks:[],typeName:ne.ZodBigInt,coerce:e?.coerce??!1,...Ke(e)});class Bb extends ot{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==de.boolean){let r=this._getOrReturnCtx(e);return me(r,{code:te.invalid_type,expected:de.boolean,received:r.parsedType}),Me}return sn(e.data)}}Bb.create=(e)=>new Bb({typeName:ne.ZodBoolean,coerce:e?.coerce||!1,...Ke(e)});class pm extends ot{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==de.date){let n=this._getOrReturnCtx(e);return me(n,{code:te.invalid_type,expected:de.date,received:n.parsedType}),Me}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return me(n,{code:te.invalid_date}),Me}let r=new Yr,o=void 0;for(let n of this._def.checks)if(n.kind==="min"){if(e.data.getTime()<n.value)o=this._getOrReturnCtx(e,o),me(o,{code:te.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()}else if(n.kind==="max"){if(e.data.getTime()>n.value)o=this._getOrReturnCtx(e,o),me(o,{code:te.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()}else ct.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pm({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Se.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Se.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}}pm.create=(e)=>new pm({checks:[],coerce:e?.coerce||!1,typeName:ne.ZodDate,...Ke(e)});class Db extends ot{_parse(e){if(this._getType(e)!==de.symbol){let r=this._getOrReturnCtx(e);return me(r,{code:te.invalid_type,expected:de.symbol,received:r.parsedType}),Me}return sn(e.data)}}Db.create=(e)=>new Db({typeName:ne.ZodSymbol,...Ke(e)});class fm extends ot{_parse(e){if(this._getType(e)!==de.undefined){let r=this._getOrReturnCtx(e);return me(r,{code:te.invalid_type,expected:de.undefined,received:r.parsedType}),Me}return sn(e.data)}}fm.create=(e)=>new fm({typeName:ne.ZodUndefined,...Ke(e)});class mm extends ot{_parse(e){if(this._getType(e)!==de.null){let r=this._getOrReturnCtx(e);return me(r,{code:te.invalid_type,expected:de.null,received:r.parsedType}),Me}return sn(e.data)}}mm.create=(e)=>new mm({typeName:ne.ZodNull,...Ke(e)});class Ub extends ot{constructor(){super(...arguments);this._any=!0}_parse(e){return sn(e.data)}}Ub.create=(e)=>new Ub({typeName:ne.ZodAny,...Ke(e)});class Uc extends ot{constructor(){super(...arguments);this._unknown=!0}_parse(e){return sn(e.data)}}Uc.create=(e)=>new Uc({typeName:ne.ZodUnknown,...Ke(e)});class sa extends ot{_parse(e){let t=this._getOrReturnCtx(e);return me(t,{code:te.invalid_type,expected:de.never,received:t.parsedType}),Me}}sa.create=(e)=>new sa({typeName:ne.ZodNever,...Ke(e)});class Lb extends ot{_parse(e){if(this._getType(e)!==de.undefined){let r=this._getOrReturnCtx(e);return me(r,{code:te.invalid_type,expected:de.void,received:r.parsedType}),Me}return sn(e.data)}}Lb.create=(e)=>new Lb({typeName:ne.ZodVoid,...Ke(e)});class hi extends ot{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),o=this._def;if(t.parsedType!==de.array)return me(t,{code:te.invalid_type,expected:de.array,received:t.parsedType}),Me;if(o.exactLength!==null){let i=t.data.length>o.exactLength.value,a=t.data.length<o.exactLength.value;if(i||a)me(t,{code:i?te.too_big:te.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),r.dirty()}if(o.minLength!==null){if(t.data.length<o.minLength.value)me(t,{code:te.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),r.dirty()}if(o.maxLength!==null){if(t.data.length>o.maxLength.value)me(t,{code:te.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((i,a)=>o.type._parseAsync(new Oo(t,i,t.path,a)))).then((i)=>Yr.mergeArray(r,i));let n=[...t.data].map((i,a)=>o.type._parseSync(new Oo(t,i,t.path,a)));return Yr.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new hi({...this._def,minLength:{value:e,message:Se.toString(t)}})}max(e,t){return new hi({...this._def,maxLength:{value:e,message:Se.toString(t)}})}length(e,t){return new hi({...this._def,exactLength:{value:e,message:Se.toString(t)}})}nonempty(e){return this.min(1,e)}}hi.create=(e,t)=>new hi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ne.ZodArray,...Ke(t)});function zl(e){if(e instanceof nr){let t={};for(let r in e.shape){let o=e.shape[r];t[r]=gi.create(zl(o))}return new nr({...e._def,shape:()=>t})}else if(e instanceof hi)return new hi({...e._def,type:zl(e.element)});else if(e instanceof gi)return gi.create(zl(e.unwrap()));else if(e instanceof ps)return ps.create(zl(e.unwrap()));else if(e instanceof ca)return ca.create(e.items.map((t)=>zl(t)));else return e}class nr extends ot{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(),t=ct.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==de.object){let c=this._getOrReturnCtx(e);return me(c,{code:te.invalid_type,expected:de.object,received:c.parsedType}),Me}let{status:r,ctx:o}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof sa&&this._def.unknownKeys==="strip")){for(let c in o.data)if(!i.includes(c))a.push(c)}let s=[];for(let c of i){let u=n[c],d=o.data[c];s.push({key:{status:"valid",value:c},value:u._parse(new Oo(o,d,o.path,c)),alwaysSet:c in o.data})}if(this._def.catchall instanceof sa){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of a)s.push({key:{status:"valid",value:u},value:{status:"valid",value:o.data[u]}});else if(c==="strict"){if(a.length>0)me(o,{code:te.unrecognized_keys,keys:a}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of a){let d=o.data[u];s.push({key:{status:"valid",value:u},value:c._parse(new Oo(o,d,o.path,u)),alwaysSet:u in o.data})}}if(o.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of s){let d=await u.key,p=await u.value;c.push({key:d,value:p,alwaysSet:u.alwaysSet})}return c}).then((c)=>Yr.mergeObjectSync(r,c));else return Yr.mergeObjectSync(r,s)}get shape(){return this._def.shape()}strict(e){return Se.errToObj,new nr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let o=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:Se.errToObj(e).message??o};return{message:o}}}:{}})}strip(){return new nr({...this._def,unknownKeys:"strip"})}passthrough(){return new nr({...this._def,unknownKeys:"passthrough"})}extend(e){return new nr({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new nr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ne.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new nr({...this._def,catchall:e})}pick(e){let t={};for(let r of ct.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new nr({...this._def,shape:()=>t})}omit(e){let t={};for(let r of ct.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new nr({...this._def,shape:()=>t})}deepPartial(){return zl(this)}partial(e){let t={};for(let r of ct.objectKeys(this.shape)){let o=this.shape[r];if(e&&!e[r])t[r]=o;else t[r]=o.optional()}return new nr({...this._def,shape:()=>t})}required(e){let t={};for(let r of ct.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];while(n instanceof gi)n=n._def.innerType;t[r]=n}return new nr({...this._def,shape:()=>t})}keyof(){return CM(ct.objectKeys(this.shape))}}nr.create=(e,t)=>new nr({shape:()=>e,unknownKeys:"strip",catchall:sa.create(),typeName:ne.ZodObject,...Ke(t)});nr.strictCreate=(e,t)=>new nr({shape:()=>e,unknownKeys:"strict",catchall:sa.create(),typeName:ne.ZodObject,...Ke(t)});nr.lazycreate=(e,t)=>new nr({shape:e,unknownKeys:"strip",catchall:sa.create(),typeName:ne.ZodObject,...Ke(t)});class hm extends ot{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function o(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 t.common.issues.push(...a.ctx.common.issues),a.result;let i=n.map((a)=>new Zn(a.ctx.common.issues));return me(t,{code:te.invalid_union,unionErrors:i}),Me}if(t.common.async)return Promise.all(r.map(async(n)=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(o);else{let n=void 0,i=[];for(let s of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=s._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!n)n={result:u,ctx:c};if(c.common.issues.length)i.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let a=i.map((s)=>new Zn(s));return me(t,{code:te.invalid_union,unionErrors:a}),Me}}get options(){return this._def.options}}hm.create=(e,t)=>new hm({options:e,typeName:ne.ZodUnion,...Ke(t)});var ia=(e)=>{if(e instanceof ym)return ia(e.schema);else if(e instanceof yi)return ia(e.innerType());else if(e instanceof bm)return[e.value];else if(e instanceof Lc)return e.options;else if(e instanceof xm)return ct.objectValues(e.enum);else if(e instanceof vm)return ia(e._def.innerType);else if(e instanceof fm)return[void 0];else if(e instanceof mm)return[null];else if(e instanceof gi)return[void 0,...ia(e.unwrap())];else if(e instanceof ps)return[null,...ia(e.unwrap())];else if(e instanceof mE)return ia(e.unwrap());else if(e instanceof wm)return ia(e.unwrap());else if(e instanceof _m)return ia(e._def.innerType);else return[]};class fE extends ot{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==de.object)return me(t,{code:te.invalid_type,expected:de.object,received:t.parsedType}),Me;let r=this.discriminator,o=t.data[r],n=this.optionsMap.get(o);if(!n)return me(t,{code:te.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Me;if(t.common.async)return n._parseAsync({data:t.data,path:t.path,parent:t});else return n._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let o=new Map;for(let n of t){let i=ia(n.shape[e]);if(!i.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,n)}}return new fE({typeName:ne.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...Ke(r)})}}function pE(e,t){let r=oa(e),o=oa(t);if(e===t)return{valid:!0,data:e};else if(r===de.object&&o===de.object){let n=ct.objectKeys(t),i=ct.objectKeys(e).filter((s)=>n.indexOf(s)!==-1),a={...e,...t};for(let s of i){let c=pE(e[s],t[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(r===de.array&&o===de.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let i=0;i<e.length;i++){let a=e[i],s=t[i],c=pE(a,s);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else if(r===de.date&&o===de.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}class gm extends ot{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=(n,i)=>{if(uE(n)||uE(i))return Me;let a=pE(n.value,i.value);if(!a.valid)return me(r,{code:te.invalid_intersection_types}),Me;if(lE(n)||lE(i))t.dirty();return{status:t.value,value:a.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,i])=>o(n,i));else return o(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}gm.create=(e,t,r)=>new gm({left:e,right:t,typeName:ne.ZodIntersection,...Ke(r)});class ca extends ot{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==de.array)return me(r,{code:te.invalid_type,expected:de.array,received:r.parsedType}),Me;if(r.data.length<this._def.items.length)return me(r,{code:te.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Me;if(!this._def.rest&&r.data.length>this._def.items.length)me(r,{code:te.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let n=[...r.data].map((i,a)=>{let s=this._def.items[a]||this._def.rest;if(!s)return null;return s._parse(new Oo(r,i,r.path,a))}).filter((i)=>!!i);if(r.common.async)return Promise.all(n).then((i)=>Yr.mergeArray(t,i));else return Yr.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ca({...this._def,rest:e})}}ca.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ca({items:e,typeName:ne.ZodTuple,rest:null,...Ke(t)})};class jb extends ot{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==de.object)return me(r,{code:te.invalid_type,expected:de.object,received:r.parsedType}),Me;let o=[],n=this._def.keyType,i=this._def.valueType;for(let a in r.data)o.push({key:n._parse(new Oo(r,a,r.path,a)),value:i._parse(new Oo(r,r.data[a],r.path,a)),alwaysSet:a in r.data});if(r.common.async)return Yr.mergeObjectAsync(t,o);else return Yr.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof ot)return new jb({keyType:e,valueType:t,typeName:ne.ZodRecord,...Ke(r)});return new jb({keyType:aa.create(),valueType:e,typeName:ne.ZodRecord,...Ke(t)})}}class Fb extends ot{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==de.map)return me(r,{code:te.invalid_type,expected:de.map,received:r.parsedType}),Me;let o=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([a,s],c)=>({key:o._parse(new Oo(r,a,r.path,[c,"key"])),value:n._parse(new Oo(r,s,r.path,[c,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let s of i){let c=await s.key,u=await s.value;if(c.status==="aborted"||u.status==="aborted")return Me;if(c.status==="dirty"||u.status==="dirty")t.dirty();a.set(c.value,u.value)}return{status:t.value,value:a}})}else{let a=new Map;for(let s of i){let{key:c,value:u}=s;if(c.status==="aborted"||u.status==="aborted")return Me;if(c.status==="dirty"||u.status==="dirty")t.dirty();a.set(c.value,u.value)}return{status:t.value,value:a}}}}Fb.create=(e,t,r)=>new Fb({valueType:t,keyType:e,typeName:ne.ZodMap,...Ke(r)});class Bl extends ot{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==de.set)return me(r,{code:te.invalid_type,expected:de.set,received:r.parsedType}),Me;let o=this._def;if(o.minSize!==null){if(r.data.size<o.minSize.value)me(r,{code:te.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),t.dirty()}if(o.maxSize!==null){if(r.data.size>o.maxSize.value)me(r,{code:te.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty()}let n=this._def.valueType;function i(s){let c=new Set;for(let u of s){if(u.status==="aborted")return Me;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let a=[...r.data.values()].map((s,c)=>n._parse(new Oo(r,s,r.path,c)));if(r.common.async)return Promise.all(a).then((s)=>i(s));else return i(a)}min(e,t){return new Bl({...this._def,minSize:{value:e,message:Se.toString(t)}})}max(e,t){return new Bl({...this._def,maxSize:{value:e,message:Se.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Bl.create=(e,t)=>new Bl({valueType:e,minSize:null,maxSize:null,typeName:ne.ZodSet,...Ke(t)});class dm extends ot{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==de.function)return me(t,{code:te.invalid_type,expected:de.function,received:t.parsedType}),Me;function r(a,s){return Mb({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,um(),ds].filter((c)=>!!c),issueData:{code:te.invalid_arguments,argumentsError:s}})}function o(a,s){return Mb({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,um(),ds].filter((c)=>!!c),issueData:{code:te.invalid_return_type,returnTypeError:s}})}let n={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Dl){let a=this;return sn(async function(...s){let c=new Zn([]),u=await a._def.args.parseAsync(s,n).catch((m)=>{throw c.addIssue(r(s,m)),c}),d=await Reflect.apply(i,this,u);return await a._def.returns._def.type.parseAsync(d,n).catch((m)=>{throw c.addIssue(o(d,m)),c})})}else{let a=this;return sn(function(...s){let c=a._def.args.safeParse(s,n);if(!c.success)throw new Zn([r(s,c.error)]);let u=Reflect.apply(i,this,c.data),d=a._def.returns.safeParse(u,n);if(!d.success)throw new Zn([o(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new dm({...this._def,args:ca.create(e).rest(Uc.create())})}returns(e){return new dm({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new dm({args:e?e:ca.create([]).rest(Uc.create()),returns:t||Uc.create(),typeName:ne.ZodFunction,...Ke(r)})}}class ym extends ot{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ym.create=(e,t)=>new ym({getter:e,typeName:ne.ZodLazy,...Ke(t)});class bm extends ot{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return me(t,{received:t.data,code:te.invalid_literal,expected:this._def.value}),Me}return{status:"valid",value:e.data}}get value(){return this._def.value}}bm.create=(e,t)=>new bm({value:e,typeName:ne.ZodLiteral,...Ke(t)});function CM(e,t){return new Lc({values:e,typeName:ne.ZodEnum,...Ke(t)})}class Lc extends ot{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return me(t,{expected:ct.joinValues(r),received:t.parsedType,code:te.invalid_type}),Me}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return me(t,{received:t.data,code:te.invalid_enum_value,options:r}),Me}return sn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Lc.create(e,{...this._def,...t})}exclude(e,t=this._def){return Lc.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}}Lc.create=CM;class xm extends ot{_parse(e){let t=ct.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==de.string&&r.parsedType!==de.number){let o=ct.objectValues(t);return me(r,{expected:ct.joinValues(o),received:r.parsedType,code:te.invalid_type}),Me}if(!this._cache)this._cache=new Set(ct.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let o=ct.objectValues(t);return me(r,{received:r.data,code:te.invalid_enum_value,options:o}),Me}return sn(e.data)}get enum(){return this._def.values}}xm.create=(e,t)=>new xm({values:e,typeName:ne.ZodNativeEnum,...Ke(t)});class Dl extends ot{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==de.promise&&t.common.async===!1)return me(t,{code:te.invalid_type,expected:de.promise,received:t.parsedType}),Me;let r=t.parsedType===de.promise?t.data:Promise.resolve(t.data);return sn(r.then((o)=>this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Dl.create=(e,t)=>new Dl({type:e,typeName:ne.ZodPromise,...Ke(t)});class yi extends ot{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),o=this._def.effect||null,n={addIssue:(i)=>{if(me(r,i),i.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),o.type==="preprocess"){let i=o.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async(a)=>{if(t.value==="aborted")return Me;let s=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});if(s.status==="aborted")return Me;if(s.status==="dirty")return Cl(s.value);if(t.value==="dirty")return Cl(s.value);return s});else{if(t.value==="aborted")return Me;let a=this._def.schema._parseSync({data:i,path:r.path,parent:r});if(a.status==="aborted")return Me;if(a.status==="dirty")return Cl(a.value);if(t.value==="dirty")return Cl(a.value);return a}}if(o.type==="refinement"){let i=(a)=>{let s=o.refinement(a,n);if(r.common.async)return Promise.resolve(s);if(s instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(a.status==="aborted")return Me;if(a.status==="dirty")t.dirty();return i(a.value),{status:t.value,value:a.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((a)=>{if(a.status==="aborted")return Me;if(a.status==="dirty")t.dirty();return i(a.value).then(()=>({status:t.value,value:a.value}))})}if(o.type==="transform")if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Dc(i))return Me;let a=o.transform(i.value,n);if(a instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(!Dc(i))return Me;return Promise.resolve(o.transform(i.value,n)).then((a)=>({status:t.value,value:a}))});ct.assertNever(o)}}yi.create=(e,t,r)=>new yi({schema:e,typeName:ne.ZodEffects,effect:t,...Ke(r)});yi.createWithPreprocess=(e,t,r)=>new yi({schema:t,effect:{type:"preprocess",transform:e},typeName:ne.ZodEffects,...Ke(r)});class gi extends ot{_parse(e){if(this._getType(e)===de.undefined)return sn(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}gi.create=(e,t)=>new gi({innerType:e,typeName:ne.ZodOptional,...Ke(t)});class ps extends ot{_parse(e){if(this._getType(e)===de.null)return sn(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ps.create=(e,t)=>new ps({innerType:e,typeName:ne.ZodNullable,...Ke(t)});class vm extends ot{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===de.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}vm.create=(e,t)=>new vm({innerType:e,typeName:ne.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...Ke(t)});class _m extends ot{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(lm(o))return o.then((n)=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Zn(r.common.issues)},input:r.data})}));else return{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Zn(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}_m.create=(e,t)=>new _m({innerType:e,typeName:ne.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...Ke(t)});class qb extends ot{_parse(e){if(this._getType(e)!==de.nan){let r=this._getOrReturnCtx(e);return me(r,{code:te.invalid_type,expected:de.nan,received:r.parsedType}),Me}return{status:"valid",value:e.data}}}qb.create=(e)=>new qb({typeName:ne.ZodNaN,...Ke(e)});var Vwe=Symbol("zod_brand");class mE extends ot{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Hb extends ot{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return Me;if(n.status==="dirty")return t.dirty(),Cl(n.value);else return this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();else{let o=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(o.status==="aborted")return Me;if(o.status==="dirty")return t.dirty(),{status:"dirty",value:o.value};else return this._def.out._parseSync({data:o.value,path:r.path,parent:r})}}static create(e,t){return new Hb({in:e,out:t,typeName:ne.ZodPipeline})}}class wm extends ot{_parse(e){let t=this._def.innerType._parse(e),r=(o)=>{if(Dc(o))o.value=Object.freeze(o.value);return o};return lm(t)?t.then((o)=>r(o)):r(t)}unwrap(){return this._def.innerType}}wm.create=(e,t)=>new wm({innerType:e,typeName:ne.ZodReadonly,...Ke(t)});var Zwe={object:nr.lazycreate},ne;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ne||(ne={}));var Wwe=aa.create,Kwe=Nl.create,Jwe=qb.create,Ywe=Ml.create,Qwe=Bb.create,Xwe=pm.create,e1e=Db.create,t1e=fm.create,r1e=mm.create,n1e=Ub.create,o1e=Uc.create,i1e=sa.create,a1e=Lb.create,s1e=hi.create,zM=nr.create,c1e=nr.strictCreate,u1e=hm.create,l1e=fE.create,d1e=gm.create,p1e=ca.create,f1e=jb.create,m1e=Fb.create,h1e=Bl.create,g1e=dm.create,y1e=ym.create,b1e=bm.create,x1e=Lc.create,v1e=xm.create,_1e=Dl.create,w1e=yi.create,S1e=gi.create,T1e=ps.create,E1e=yi.createWithPreprocess,I1e=Hb.create;var zo={};kn(zo,{$ZodAny:()=>M0,$ZodArray:()=>j0,$ZodAsyncError:()=>bi,$ZodBase64:()=>I0,$ZodBase64URL:()=>P0,$ZodBigInt:()=>Mm,$ZodBigIntFormat:()=>O0,$ZodBoolean:()=>Zl,$ZodCIDRv4:()=>T0,$ZodCIDRv6:()=>E0,$ZodCUID:()=>g0,$ZodCUID2:()=>y0,$ZodCatch:()=>ix,$ZodCheck:()=>Rt,$ZodCheckBigIntFormat:()=>iI,$ZodCheckEndsWith:()=>yI,$ZodCheckGreaterThan:()=>o0,$ZodCheckIncludes:()=>hI,$ZodCheckLengthEquals:()=>dI,$ZodCheckLessThan:()=>n0,$ZodCheckLowerCase:()=>fI,$ZodCheckMaxLength:()=>uI,$ZodCheckMaxSize:()=>aI,$ZodCheckMimeType:()=>xI,$ZodCheckMinLength:()=>lI,$ZodCheckMinSize:()=>sI,$ZodCheckMultipleOf:()=>nI,$ZodCheckNumberFormat:()=>oI,$ZodCheckOverwrite:()=>vI,$ZodCheckProperty:()=>bI,$ZodCheckRegex:()=>pI,$ZodCheckSizeEquals:()=>cI,$ZodCheckStartsWith:()=>gI,$ZodCheckStringFormat:()=>Vl,$ZodCheckUpperCase:()=>mI,$ZodCodec:()=>Kl,$ZodCustom:()=>px,$ZodCustomStringFormat:()=>R0,$ZodDate:()=>L0,$ZodDefault:()=>tx,$ZodDiscriminatedUnion:()=>H0,$ZodE164:()=>k0,$ZodEmail:()=>p0,$ZodEmoji:()=>m0,$ZodEncodeError:()=>Fc,$ZodEnum:()=>K0,$ZodError:()=>Am,$ZodExactOptional:()=>X0,$ZodFile:()=>Y0,$ZodFunction:()=>ux,$ZodGUID:()=>l0,$ZodIPv4:()=>_0,$ZodIPv6:()=>w0,$ZodISODate:()=>TI,$ZodISODateTime:()=>SI,$ZodISODuration:()=>II,$ZodISOTime:()=>EI,$ZodIntersection:()=>G0,$ZodJWT:()=>A0,$ZodKSUID:()=>v0,$ZodLazy:()=>dx,$ZodLiteral:()=>J0,$ZodMAC:()=>S0,$ZodMap:()=>Z0,$ZodNaN:()=>ax,$ZodNanoID:()=>h0,$ZodNever:()=>D0,$ZodNonOptional:()=>nx,$ZodNull:()=>N0,$ZodNullable:()=>ex,$ZodNumber:()=>Nm,$ZodNumberFormat:()=>$0,$ZodObject:()=>F0,$ZodObjectJIT:()=>kI,$ZodOptional:()=>Dm,$ZodPipe:()=>Um,$ZodPrefault:()=>rx,$ZodPreprocess:()=>AI,$ZodPromise:()=>lx,$ZodReadonly:()=>sx,$ZodRealError:()=>$n,$ZodRecord:()=>V0,$ZodRegistry:()=>PP,$ZodSet:()=>W0,$ZodString:()=>xs,$ZodStringFormat:()=>Pt,$ZodSuccess:()=>ox,$ZodSymbol:()=>C0,$ZodTemplateLiteral:()=>cx,$ZodTransform:()=>Q0,$ZodTuple:()=>Bm,$ZodType:()=>Ue,$ZodULID:()=>b0,$ZodURL:()=>f0,$ZodUUID:()=>d0,$ZodUndefined:()=>z0,$ZodUnion:()=>Wl,$ZodUnknown:()=>B0,$ZodVoid:()=>U0,$ZodXID:()=>x0,$ZodXor:()=>q0,$brand:()=>gE,$constructor:()=>R,$input:()=>IP,$output:()=>EP,Doc:()=>i0,JSONSchema:()=>O4,JSONSchemaGenerator:()=>Sk,NEVER:()=>hE,TimePrecision:()=>AP,_any:()=>Ax,_array:()=>DP,_base64:()=>ah,_base64url:()=>sh,_bigint:()=>Sx,_boolean:()=>wx,_catch:()=>ooe,_check:()=>$4,_cidrv4:()=>oh,_cidrv6:()=>ih,_coercedBigint:()=>MP,_coercedBoolean:()=>NP,_coercedDate:()=>BP,_coercedNumber:()=>zP,_coercedString:()=>kP,_cuid:()=>Ym,_cuid2:()=>Qm,_custom:()=>jx,_date:()=>Cx,_decode:()=>Kb,_decodeAsync:()=>Yb,_default:()=>toe,_discriminatedUnion:()=>qne,_e164:()=>ch,_email:()=>Hm,_emoji:()=>Km,_encode:()=>Wb,_encodeAsync:()=>Jb,_endsWith:()=>id,_enum:()=>Kne,_file:()=>Lx,_float32:()=>bx,_float64:()=>xx,_gt:()=>vi,_gte:()=>un,_guid:()=>Ql,_includes:()=>nd,_int:()=>yx,_int32:()=>vx,_int64:()=>Tx,_intersection:()=>Hne,_ipv4:()=>rh,_ipv6:()=>nh,_isoDate:()=>$P,_isoDateTime:()=>RP,_isoDuration:()=>CP,_isoTime:()=>OP,_jwt:()=>uh,_ksuid:()=>th,_lazy:()=>coe,_length:()=>Kc,_literal:()=>Yne,_lowercase:()=>td,_lt:()=>xi,_lte:()=>Wn,_mac:()=>hx,_map:()=>Zne,_max:()=>Wn,_maxLength:()=>Wc,_maxSize:()=>_s,_mime:()=>ad,_min:()=>un,_minLength:()=>la,_minSize:()=>_i,_multipleOf:()=>vs,_nan:()=>zx,_nanoid:()=>Jm,_nativeEnum:()=>Jne,_negative:()=>Mx,_never:()=>$x,_nonnegative:()=>Dx,_nonoptional:()=>roe,_nonpositive:()=>Bx,_normalize:()=>sd,_null:()=>kx,_nullable:()=>eoe,_number:()=>gx,_optional:()=>Xne,_overwrite:()=>Co,_parse:()=>Fl,_parseAsync:()=>ql,_pipe:()=>ioe,_positive:()=>Nx,_promise:()=>uoe,_property:()=>Ux,_readonly:()=>aoe,_record:()=>Vne,_refine:()=>Fx,_regex:()=>ed,_safeDecode:()=>Xb,_safeDecodeAsync:()=>t0,_safeEncode:()=>Qb,_safeEncodeAsync:()=>e0,_safeParse:()=>Hl,_safeParseAsync:()=>Gl,_set:()=>Wne,_size:()=>Zc,_slugify:()=>dd,_startsWith:()=>od,_string:()=>mx,_stringFormat:()=>Jc,_stringbool:()=>Vx,_success:()=>noe,_superRefine:()=>qx,_symbol:()=>Ix,_templateLiteral:()=>soe,_toLowerCase:()=>ud,_toUpperCase:()=>ld,_transform:()=>Qne,_trim:()=>cd,_tuple:()=>Gne,_uint32:()=>_x,_uint64:()=>Ex,_ulid:()=>Xm,_undefined:()=>Px,_union:()=>jne,_unknown:()=>Rx,_uppercase:()=>rd,_url:()=>Xl,_uuid:()=>Gm,_uuidv4:()=>Vm,_uuidv6:()=>Zm,_uuidv7:()=>Wm,_void:()=>Ox,_xid:()=>eh,_xor:()=>Fne,clone:()=>zr,config:()=>or,createStandardJSONSchemaMethod:()=>pd,createToJSONSchemaMethod:()=>UP,decode:()=>KM,decodeAsync:()=>YM,describe:()=>Hx,encode:()=>WM,encodeAsync:()=>JM,extractDefs:()=>Ss,finalize:()=>Ts,flattenError:()=>Rm,formatError:()=>$m,globalConfig:()=>jc,globalRegistry:()=>Nr,initializeContext:()=>ws,isValidBase64:()=>PI,isValidBase64URL:()=>w4,isValidJWT:()=>S4,locales:()=>Yl,meta:()=>Gx,parse:()=>Hc,parseAsync:()=>Gc,prettifyError:()=>PE,process:()=>Et,regexes:()=>On,registry:()=>fx,safeDecode:()=>XM,safeDecodeAsync:()=>t4,safeEncode:()=>QM,safeEncodeAsync:()=>e4,safeParse:()=>ys,safeParseAsync:()=>bs,toDotPath:()=>ZM,toJSONSchema:()=>Yc,treeifyError:()=>IE,util:()=>ee,version:()=>_I});var NM,hE=Object.freeze({status:"aborted"});function R(e,t,r){function o(s,c){if(!s._zod)Object.defineProperty(s,"_zod",{value:{def:c,constr:a,traits:new Set},enumerable:!1});if(s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,c);let u=a.prototype,d=Object.keys(u);for(let p=0;p<d.length;p++){let m=d[p];if(!(m in s))s[m]=u[m].bind(s)}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function a(s){var c;let u=r?.Parent?new i:this;o(u,s),(c=u._zod).deferred??(c.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(a,"init",{value:o}),Object.defineProperty(a,Symbol.hasInstance,{value:(s)=>{if(r?.Parent&&s instanceof r.Parent)return!0;return s?._zod?.traits?.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}var gE=Symbol("zod_brand");class bi extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Fc extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(NM=globalThis).__zod_globalConfig??(NM.__zod_globalConfig={});var jc=globalThis.__zod_globalConfig;function or(e){if(e)Object.assign(jc,e);return jc}var ee={};kn(ee,{BIGINT_FORMAT_RANGES:()=>TE,Class:()=>GM,NUMBER_FORMAT_RANGES:()=>SE,aborted:()=>gs,allowsEval:()=>vE,assert:()=>ere,assertEqual:()=>Jte,assertIs:()=>Qte,assertNever:()=>Xte,assertNotEqual:()=>Yte,assignProp:()=>ms,base64ToUint8Array:()=>qM,base64urlToUint8Array:()=>dre,cached:()=>Ll,captureStackTrace:()=>Vb,cleanEnum:()=>lre,cleanRegex:()=>Em,clone:()=>zr,cloneDef:()=>rre,createTransparentProxy:()=>cre,defineLazy:()=>Ye,esc:()=>Gb,escapeRegex:()=>oo,explicitlyAborted:()=>EE,extend:()=>UM,finalizeIssue:()=>cn,floatSafeRemainder:()=>bE,getElementAtPath:()=>nre,getEnumValues:()=>Tm,getLengthableOrigin:()=>km,getParsedType:()=>sre,getSizableOrigin:()=>Pm,hexToUint8Array:()=>fre,isObject:()=>qc,isPlainObject:()=>hs,issue:()=>jl,joinValues:()=>N,jsonStringifyReplacer:()=>Ul,merge:()=>ure,mergeDefs:()=>ua,normalizeParams:()=>oe,nullish:()=>fs,numKeys:()=>are,objectClone:()=>tre,omit:()=>DM,optionalKeys:()=>wE,parsedType:()=>Q,partial:()=>jM,pick:()=>BM,prefixIssues:()=>Rn,primitiveTypes:()=>_E,promiseAllObject:()=>ore,propertyKeyTypes:()=>Im,randomString:()=>ire,required:()=>FM,safeExtend:()=>LM,shallowClone:()=>Zb,slugify:()=>xE,stringifyPrimitive:()=>Y,uint8ArrayToBase64:()=>HM,uint8ArrayToBase64url:()=>pre,uint8ArrayToHex:()=>mre,unwrapMessage:()=>Sm});function Jte(e){return e}function Yte(e){return e}function Qte(e){}function Xte(e){throw Error("Unexpected value in exhaustive check")}function ere(e){}function Tm(e){let t=Object.values(e).filter((o)=>typeof o==="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function N(e,t="|"){return e.map((r)=>Y(r)).join(t)}function Ul(e,t){if(typeof t==="bigint")return t.toString();return t}function Ll(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw Error("cached value already set")}}}function fs(e){return e===null||e===void 0}function Em(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function bE(e,t){let r=e/t,o=Math.round(r),n=Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-o)<n)return 0;return r-o}var MM=Symbol("evaluating");function Ye(e,t,r){let o=void 0;Object.defineProperty(e,t,{get(){if(o===MM)return;if(o===void 0)o=MM,o=r();return o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function tre(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ms(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ua(...e){let t={};for(let r of e){let o=Object.getOwnPropertyDescriptors(r);Object.assign(t,o)}return Object.defineProperties({},t)}function rre(e){return ua(e._zod.def)}function nre(e,t){if(!t)return e;return t.reduce((r,o)=>r?.[o],e)}function ore(e){let t=Object.keys(e),r=t.map((o)=>e[o]);return Promise.all(r).then((o)=>{let n={};for(let i=0;i<t.length;i++)n[t[i]]=o[i];return n})}function ire(e=10){let r="";for(let o=0;o<e;o++)r+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return r}function Gb(e){return JSON.stringify(e)}function xE(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Vb="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function qc(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var vE=Ll(()=>{if(jc.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function hs(e){if(qc(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(qc(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Zb(e){if(hs(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function are(e){let t=0;for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r))t++;return t}var sre=(e)=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(e))return"array";if(e===null)return"null";if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return"promise";if(typeof Map<"u"&&e instanceof Map)return"map";if(typeof Set<"u"&&e instanceof Set)return"set";if(typeof Date<"u"&&e instanceof Date)return"date";if(typeof File<"u"&&e instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${t}`)}},Im=new Set(["string","number","symbol"]),_E=new Set(["string","number","bigint","boolean","symbol","undefined"]);function oo(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function zr(e,t,r){let o=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)o._zod.parent=e;return o}function oe(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function cre(e){let t;return new Proxy({},{get(r,o,n){return t??(t=e()),Reflect.get(t,o,n)},set(r,o,n,i){return t??(t=e()),Reflect.set(t,o,n,i)},has(r,o){return t??(t=e()),Reflect.has(t,o)},deleteProperty(r,o){return t??(t=e()),Reflect.deleteProperty(t,o)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,o){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,o)},defineProperty(r,o,n){return t??(t=e()),Reflect.defineProperty(t,o,n)}})}function Y(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function wE(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var SE={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},TE={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function BM(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=ua(e._zod.def,{get shape(){let a={};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);if(!t[s])continue;a[s]=r.shape[s]}return ms(this,"shape",a),a},checks:[]});return zr(e,i)}function DM(e,t){let r=e._zod.def,o=r.checks;if(o&&o.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=ua(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let s in t){if(!(s in r.shape))throw Error(`Unrecognized key: "${s}"`);if(!t[s])continue;delete a[s]}return ms(this,"shape",a),a},checks:[]});return zr(e,i)}function UM(e,t){if(!hs(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=ua(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return ms(this,"shape",i),i}});return zr(e,n)}function LM(e,t){if(!hs(t))throw Error("Invalid input to safeExtend: expected a plain object");let r=ua(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return ms(this,"shape",o),o}});return zr(e,r)}function ure(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r=ua(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t._zod.def.shape};return ms(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return zr(e,r)}function jM(e,t,r){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let a=ua(t._zod.def,{get shape(){let s=t._zod.def.shape,c={...s};if(r)for(let u in r){if(!(u in s))throw Error(`Unrecognized key: "${u}"`);if(!r[u])continue;c[u]=e?new e({type:"optional",innerType:s[u]}):s[u]}else for(let u in s)c[u]=e?new e({type:"optional",innerType:s[u]}):s[u];return ms(this,"shape",c),c},checks:[]});return zr(t,a)}function FM(e,t,r){let o=ua(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(r)for(let a in r){if(!(a in i))throw Error(`Unrecognized key: "${a}"`);if(!r[a])continue;i[a]=new e({type:"nonoptional",innerType:n[a]})}else for(let a in n)i[a]=new e({type:"nonoptional",innerType:n[a]});return ms(this,"shape",i),i}});return zr(t,o)}function gs(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function EE(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function Rn(e,t){return t.map((r)=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function Sm(e){return typeof e==="string"?e:e?.message}function cn(e,t,r){let o=e.message?e.message:Sm(e.inst?._zod.def?.error?.(e))??Sm(t?.error?.(e))??Sm(r.customError?.(e))??Sm(r.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:a,...s}=e;if(s.path??(s.path=[]),s.message=o,t?.reportInput)s.input=a;return s}function Pm(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}function km(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Q(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function jl(...e){let[t,r,o]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:o};return{...t}}function lre(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map((t)=>t[1])}function qM(e){let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o++)r[o]=t.charCodeAt(o);return r}function HM(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function dre(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return qM(t+r)}function pre(e){return HM(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function fre(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let o=0;o<t.length;o+=2)r[o/2]=Number.parseInt(t.slice(o,o+2),16);return r}function mre(e){return Array.from(e).map((t)=>t.toString(16).padStart(2,"0")).join("")}class GM{constructor(...e){}}var VM=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ul,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Am=R("$ZodError",VM),$n=R("$ZodError",VM,{Parent:Error});function Rm(e,t=(r)=>r.message){let r={},o=[];for(let n of e.issues)if(n.path.length>0)r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n));else o.push(t(n));return{formErrors:o,fieldErrors:r}}function $m(e,t=(r)=>r.message){let r={_errors:[]},o=(n,i=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((s)=>o({issues:s},[...i,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...i,...a.path]);else{let s=[...i,...a.path];if(s.length===0)r._errors.push(t(a));else{let c=r,u=0;while(u<s.length){let d=s[u];if(u!==s.length-1)c[d]=c[d]||{_errors:[]};else c[d]=c[d]||{_errors:[]},c[d]._errors.push(t(a));c=c[d],u++}}}};return o(e),r}function IE(e,t=(r)=>r.message){let r={errors:[]},o=(n,i=[])=>{var a,s;for(let c of n.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map((u)=>o({issues:u},[...i,...c.path]));else if(c.code==="invalid_key")o({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")o({issues:c.issues},[...i,...c.path]);else{let u=[...i,...c.path];if(u.length===0){r.errors.push(t(c));continue}let d=r,p=0;while(p<u.length){let m=u[p],h=p===u.length-1;if(typeof m==="string")d.properties??(d.properties={}),(a=d.properties)[m]??(a[m]={errors:[]}),d=d.properties[m];else d.items??(d.items=[]),(s=d.items)[m]??(s[m]={errors:[]}),d=d.items[m];if(h)d.errors.push(t(c));p++}}};return o(e),r}function ZM(e){let t=[],r=e.map((o)=>typeof o==="object"?o.key:o);for(let o of r)if(typeof o==="number")t.push(`[${o}]`);else if(typeof o==="symbol")t.push(`[${JSON.stringify(String(o))}]`);else if(/[^\w$]/.test(o))t.push(`[${JSON.stringify(o)}]`);else{if(t.length)t.push(".");t.push(o)}return t.join("")}function PE(e){let t=[],r=[...e.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)if(t.push(`✖ ${o.message}`),o.path?.length)t.push(` → at ${ZM(o.path)}`);return t.join(`
|
|
67
67
|
`)}var Fl=(e)=>(t,r,o,n)=>{let i=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)throw new bi;if(a.issues.length){let s=new(n?.Err??e)(a.issues.map((c)=>cn(c,i,or())));throw Vb(s,n?.callee),s}return a.value},Hc=Fl($n),ql=(e)=>async(t,r,o,n)=>{let i=o?{...o,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let s=new(n?.Err??e)(a.issues.map((c)=>cn(c,i,or())));throw Vb(s,n?.callee),s}return a.value},Gc=ql($n),Hl=(e)=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)throw new bi;return i.issues.length?{success:!1,error:new(e??Am)(i.issues.map((a)=>cn(a,n,or())))}:{success:!0,data:i.value}},ys=Hl($n),Gl=(e)=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((a)=>cn(a,n,or())))}:{success:!0,data:i.value}},bs=Gl($n),Wb=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Fl(e)(t,r,n)},WM=Wb($n),Kb=(e)=>(t,r,o)=>Fl(e)(t,r,o),KM=Kb($n),Jb=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return ql(e)(t,r,n)},JM=Jb($n),Yb=(e)=>async(t,r,o)=>ql(e)(t,r,o),YM=Yb($n),Qb=(e)=>(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Hl(e)(t,r,n)},QM=Qb($n),Xb=(e)=>(t,r,o)=>Hl(e)(t,r,o),XM=Xb($n),e0=(e)=>async(t,r,o)=>{let n=o?{...o,direction:"backward"}:{direction:"backward"};return Gl(e)(t,r,n)},e4=e0($n),t0=(e)=>async(t,r,o)=>Gl(e)(t,r,o),t4=t0($n);var On={};kn(On,{base64:()=>qE,base64url:()=>r0,bigint:()=>JE,boolean:()=>QE,browserEmail:()=>Sre,cidrv4:()=>jE,cidrv6:()=>FE,cuid:()=>kE,cuid2:()=>AE,date:()=>VE,datetime:()=>WE,domain:()=>Ire,duration:()=>zE,e164:()=>GE,email:()=>ME,emoji:()=>BE,extendedDuration:()=>gre,guid:()=>NE,hex:()=>Pre,hostname:()=>Ere,html5Email:()=>vre,httpProtocol:()=>HE,idnEmail:()=>wre,integer:()=>YE,ipv4:()=>DE,ipv6:()=>UE,ksuid:()=>OE,lowercase:()=>tI,mac:()=>LE,md5_base64:()=>Are,md5_base64url:()=>Rre,md5_hex:()=>kre,nanoid:()=>CE,null:()=>XE,number:()=>Om,rfc5322Email:()=>_re,sha1_base64:()=>Ore,sha1_base64url:()=>Cre,sha1_hex:()=>$re,sha256_base64:()=>Nre,sha256_base64url:()=>Mre,sha256_hex:()=>zre,sha384_base64:()=>Dre,sha384_base64url:()=>Ure,sha384_hex:()=>Bre,sha512_base64:()=>jre,sha512_base64url:()=>Fre,sha512_hex:()=>Lre,string:()=>KE,time:()=>ZE,ulid:()=>RE,undefined:()=>eI,unicodeEmail:()=>r4,uppercase:()=>rI,uuid:()=>Vc,uuid4:()=>yre,uuid6:()=>bre,uuid7:()=>xre,xid:()=>$E});var kE=/^[cC][0-9a-z]{6,}$/,AE=/^[0-9a-z]+$/,RE=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$E=/^[0-9a-vA-V]{20}$/,OE=/^[A-Za-z0-9]{27}$/,CE=/^[a-zA-Z0-9_-]{21}$/,zE=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gre=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,NE=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Vc=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},yre=Vc(4),bre=Vc(6),xre=Vc(7),ME=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vre=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,_re=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,r4=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,wre=r4,Sre=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Tre="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function BE(){return new RegExp(Tre,"u")}var DE=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,UE=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,LE=(e)=>{let t=oo(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},jE=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,FE=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qE=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,r0=/^[A-Za-z0-9_-]*$/,Ere=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Ire=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,HE=/^https?$/,GE=/^\+[1-9]\d{6,14}$/,n4="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",VE=new RegExp(`^${n4}$`);function o4(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function ZE(e){return new RegExp(`^${o4(e)}$`)}function WE(e){let t=o4({precision:e.precision}),r=["Z"];if(e.local)r.push("");if(e.offset)r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let o=`${t}(?:${r.join("|")})`;return new RegExp(`^${n4}T(?:${o})$`)}var KE=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},JE=/^-?\d+n?$/,YE=/^-?\d+$/,Om=/^-?\d+(?:\.\d+)?$/,QE=/^(?:true|false)$/i,XE=/^null$/i;var eI=/^undefined$/i;var tI=/^[^A-Z]*$/,rI=/^[^a-z]*$/,Pre=/^[0-9a-fA-F]*$/;function Cm(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function zm(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var kre=/^[0-9a-fA-F]{32}$/,Are=Cm(22,"=="),Rre=zm(22),$re=/^[0-9a-fA-F]{40}$/,Ore=Cm(27,"="),Cre=zm(27),zre=/^[0-9a-fA-F]{64}$/,Nre=Cm(43,"="),Mre=zm(43),Bre=/^[0-9a-fA-F]{96}$/,Dre=Cm(64,""),Ure=zm(64),Lre=/^[0-9a-fA-F]{128}$/,jre=Cm(86,"=="),Fre=zm(86);var Rt=R("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),a4={number:"number",bigint:"bigint",object:"date"},n0=R("$ZodCheckLessThan",(e,t)=>{Rt.init(e,t);let r=a4[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value<=t.value:o.value<t.value)return;o.issues.push({origin:r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),o0=R("$ZodCheckGreaterThan",(e,t)=>{Rt.init(e,t);let r=a4[typeof t.value];e._zod.onattach.push((o)=>{let n=o._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(o)=>{if(t.inclusive?o.value>=t.value:o.value>t.value)return;o.issues.push({origin:r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nI=R("$ZodCheckMultipleOf",(e,t)=>{Rt.init(e,t),e._zod.onattach.push((r)=>{var o;(o=r._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?r.value%t.value===BigInt(0):bE(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),oI=R("$ZodCheckNumberFormat",(e,t)=>{Rt.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),o=r?"int":"number",[n,i]=SE[t.format];e._zod.onattach.push((a)=>{let s=a._zod.bag;if(s.format=t.format,s.minimum=n,s.maximum=i,r)s.pattern=YE}),e._zod.check=(a)=>{let s=a.value;if(r){if(!Number.isInteger(s)){a.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){if(s>0)a.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});else a.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}if(s<n)a.issues.push({origin:"number",input:s,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(s>i)a.issues.push({origin:"number",input:s,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),iI=R("$ZodCheckBigIntFormat",(e,t)=>{Rt.init(e,t);let[r,o]=TE[t.format];e._zod.onattach.push((n)=>{let i=n._zod.bag;i.format=t.format,i.minimum=r,i.maximum=o}),e._zod.check=(n)=>{let i=n.value;if(i<r)n.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort});if(i>o)n.issues.push({origin:"bigint",input:i,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),aI=R("$ZodCheckMaxSize",(e,t)=>{var r;Rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!fs(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.size<=t.maximum)return;o.issues.push({origin:Pm(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),sI=R("$ZodCheckMinSize",(e,t)=>{var r;Rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!fs(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.size>=t.minimum)return;o.issues.push({origin:Pm(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),cI=R("$ZodCheckSizeEquals",(e,t)=>{var r;Rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!fs(n)&&n.size!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=(o)=>{let n=o.value,i=n.size;if(i===t.size)return;let a=i>t.size;o.issues.push({origin:Pm(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),uI=R("$ZodCheckMaxLength",(e,t)=>{var r;Rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!fs(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)o._zod.bag.maximum=t.maximum}),e._zod.check=(o)=>{let n=o.value;if(n.length<=t.maximum)return;let a=km(n);o.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),lI=R("$ZodCheckMinLength",(e,t)=>{var r;Rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!fs(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)o._zod.bag.minimum=t.minimum}),e._zod.check=(o)=>{let n=o.value;if(n.length>=t.minimum)return;let a=km(n);o.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),dI=R("$ZodCheckLengthEquals",(e,t)=>{var r;Rt.init(e,t),(r=e._zod.def).when??(r.when=(o)=>{let n=o.value;return!fs(n)&&n.length!==void 0}),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(o)=>{let n=o.value,i=n.length;if(i===t.length)return;let a=km(n),s=i>t.length;o.issues.push({origin:a,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),Vl=R("$ZodCheckStringFormat",(e,t)=>{var r,o;if(Rt.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(r=e._zod).check??(r.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(o=e._zod).check??(o.check=()=>{})}),pI=R("$ZodCheckRegex",(e,t)=>{Vl.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),fI=R("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=tI),Vl.init(e,t)}),mI=R("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=rI),Vl.init(e,t)}),hI=R("$ZodCheckIncludes",(e,t)=>{Rt.init(e,t);let r=oo(t.includes),o=new RegExp(typeof t.position==="number"?`^.{${t.position}}${r}`:r);t.pattern=o,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),gI=R("$ZodCheckStartsWith",(e,t)=>{Rt.init(e,t);let r=new RegExp(`^${oo(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.startsWith(t.prefix))return;o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),yI=R("$ZodCheckEndsWith",(e,t)=>{Rt.init(e,t);let r=new RegExp(`.*${oo(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push((o)=>{let n=o._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(r)}),e._zod.check=(o)=>{if(o.value.endsWith(t.suffix))return;o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}});function i4(e,t,r){if(e.issues.length)t.issues.push(...Rn(r,e.issues))}var bI=R("$ZodCheckProperty",(e,t)=>{Rt.init(e,t),e._zod.check=(r)=>{let o=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(o instanceof Promise)return o.then((n)=>i4(n,r,t.property));i4(o,r,t.property);return}}),xI=R("$ZodCheckMimeType",(e,t)=>{Rt.init(e,t);let r=new Set(t.mime);e._zod.onattach.push((o)=>{o._zod.bag.mime=t.mime}),e._zod.check=(o)=>{if(r.has(o.value.type))return;o.issues.push({code:"invalid_value",values:t.mime,input:o.value.type,inst:e,continue:!t.abort})}}),vI=R("$ZodCheckOverwrite",(e,t)=>{Rt.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class i0{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
@@ -127,13 +127,13 @@ ${wH(m)}`;super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessag
|
|
|
127
127
|
|
|
128
128
|
`)}h.write("payload.value = newResult;"),h.write("return payload;");let E=h.compile();return(w,_)=>E(m,w,_)},i,a=qc,s=!jc.jitless,u=s&&vE.value,d=t.catchall,p;e._zod.parse=(m,h)=>{p??(p=o.value);let y=m.value;if(!a(y))return m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m;if(s&&u&&h?.async===!1&&h.jitless!==!0){if(!i)i=n(t.shape);if(m=i(m,h),!d)return m;return E4([],y,m,h,p,e)}return r(m,h)}});function u4(e,t,r,o){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!gs(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((a)=>cn(a,o,or())))}),t}var Wl=R("$ZodUnion",(e,t)=>{Ue.init(e,t),Ye(e._zod,"optin",()=>t.options.some((o)=>o._zod.optin==="optional")?"optional":void 0),Ye(e._zod,"optout",()=>t.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),Ye(e._zod,"values",()=>{if(t.options.every((o)=>o._zod.values))return new Set(t.options.flatMap((o)=>Array.from(o._zod.values)));return}),Ye(e._zod,"pattern",()=>{if(t.options.every((o)=>o._zod.pattern)){let o=t.options.map((n)=>n._zod.pattern);return new RegExp(`^(${o.map((n)=>Em(n.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,a=[];for(let s of t.options){let c=s._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)a.push(c),i=!0;else{if(c.issues.length===0)return c;a.push(c)}}if(!i)return u4(a,o,e,n);return Promise.all(a).then((s)=>u4(s,o,e,n))}});function l4(e,t,r,o){let n=e.filter((i)=>i.issues.length===0);if(n.length===1)return t.value=n[0].value,t;if(n.length===0)t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((a)=>cn(a,o,or())))});else t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1});return t}var q0=R("$ZodXor",(e,t)=>{Wl.init(e,t),t.inclusive=!1;let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(o,n)=>{if(r)return r(o,n);let i=!1,a=[];for(let s of t.options){let c=s._zod.run({value:o.value,issues:[]},n);if(c instanceof Promise)a.push(c),i=!0;else a.push(c)}if(!i)return l4(a,o,e,n);return Promise.all(a).then((s)=>l4(s,o,e,n))}}),H0=R("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Wl.init(e,t);let r=e._zod.parse;Ye(e._zod,"propValues",()=>{let n={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[s,c]of Object.entries(a)){if(!n[s])n[s]=new Set;for(let u of c)n[s].add(u)}}return n});let o=Ll(()=>{let n=t.options,i=new Map;for(let a of n){let s=a._zod.propValues?.[t.discriminator];if(!s||s.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let c of s){if(i.has(c))throw Error(`Duplicate discriminator value "${String(c)}"`);i.set(c,a)}}return i});e._zod.parse=(n,i)=>{let a=n.value;if(!qc(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;let s=o.value.get(a?.[t.discriminator]);if(s)return s._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return r(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(o.value.keys()),input:a,path:[t.discriminator],inst:e}),n}}),G0=R("$ZodIntersection",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{let n=r.value,i=t.left._zod.run({value:n,issues:[]},o),a=t.right._zod.run({value:n,issues:[]},o);if(i instanceof Promise||a instanceof Promise)return Promise.all([i,a]).then(([c,u])=>d4(r,c,u));return d4(r,i,a)}});function wI(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(hs(e)&&hs(t)){let r=Object.keys(t),o=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),n={...e,...t};for(let i of o){let a=wI(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let o=0;o<e.length;o++){let n=e[o],i=t[o],a=wI(n,i);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function d4(e,t,r){let o=new Map,n;for(let s of t.issues)if(s.code==="unrecognized_keys"){n??(n=s);for(let c of s.keys){if(!o.has(c))o.set(c,{});o.get(c).l=!0}}else e.issues.push(s);for(let s of r.issues)if(s.code==="unrecognized_keys")for(let c of s.keys){if(!o.has(c))o.set(c,{});o.get(c).r=!0}else e.issues.push(s);let i=[...o].filter(([,s])=>s.l&&s.r).map(([s])=>s);if(i.length&&n)e.issues.push({...n,keys:i});if(gs(e))return e;let a=wI(t.value,r.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Bm=R("$ZodTuple",(e,t)=>{Ue.init(e,t);let r=t.items;e._zod.parse=(o,n)=>{let i=o.value;if(!Array.isArray(i))return o.issues.push({input:i,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=[];let a=[],s=p4(r,"optin"),c=p4(r,"optout");if(!t.rest){if(i.length<s)return o.issues.push({code:"too_small",minimum:s,inclusive:!0,input:i,inst:e,origin:"array"}),o;if(i.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:i,inst:e,origin:"array"})}let u=Array(r.length);for(let d=0;d<r.length;d++){let p=r[d]._zod.run({value:i[d],issues:[]},n);if(p instanceof Promise)a.push(p.then((m)=>{u[d]=m}));else u[d]=p}if(t.rest){let d=r.length-1,p=i.slice(r.length);for(let m of p){d++;let h=t.rest._zod.run({value:m,issues:[]},n);if(h instanceof Promise)a.push(h.then((y)=>f4(y,o,d)));else f4(h,o,d)}}if(a.length)return Promise.all(a).then(()=>m4(u,o,r,i,c));return m4(u,o,r,i,c)}});function p4(e,t){for(let r=e.length-1;r>=0;r--)if(e[r]._zod[t]!=="optional")return r+1;return 0}function f4(e,t,r){if(e.issues.length)t.issues.push(...Rn(r,e.issues));t.value[r]=e.value}function m4(e,t,r,o,n){for(let i=0;i<r.length;i++){let a=e[i],s=i<o.length;if(a.issues.length){if(!s&&i>=n){t.value.length=i;break}t.issues.push(...Rn(i,a.issues))}t.value[i]=a.value}for(let i=t.value.length-1;i>=o.length;i--)if(r[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var V0=R("$ZodRecord",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!hs(n))return r.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let s=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){s.add(typeof u==="number"?u.toString():u);let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((h)=>cn(h,o,or())),input:u,path:[u],inst:e});continue}let p=d.value,m=t.valueType._zod.run({value:n[u],issues:[]},o);if(m instanceof Promise)i.push(m.then((h)=>{if(h.issues.length)r.issues.push(...Rn(u,h.issues));r.value[p]=h.value}));else{if(m.issues.length)r.issues.push(...Rn(u,m.issues));r.value[p]=m.value}}let c;for(let u in n)if(!s.has(u))c=c??[],c.push(u);if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:c})}else{r.value={};for(let s of Reflect.ownKeys(n)){if(s==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,s))continue;let c=t.keyType._zod.run({value:s,issues:[]},o);if(c instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof s==="string"&&Om.test(s)&&c.issues.length){let p=t.keyType._zod.run({value:Number(s),issues:[]},o);if(p instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(p.issues.length===0)c=p}if(c.issues.length){if(t.mode==="loose")r.value[s]=n[s];else r.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map((p)=>cn(p,o,or())),input:s,path:[s],inst:e});continue}let d=t.valueType._zod.run({value:n[s],issues:[]},o);if(d instanceof Promise)i.push(d.then((p)=>{if(p.issues.length)r.issues.push(...Rn(s,p.issues));r.value[c.value]=p.value}));else{if(d.issues.length)r.issues.push(...Rn(s,d.issues));r.value[c.value]=d.value}}}if(i.length)return Promise.all(i).then(()=>r);return r}}),Z0=R("$ZodMap",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),r;let i=[];r.value=new Map;for(let[a,s]of n){let c=t.keyType._zod.run({value:a,issues:[]},o),u=t.valueType._zod.run({value:s,issues:[]},o);if(c instanceof Promise||u instanceof Promise)i.push(Promise.all([c,u]).then(([d,p])=>{h4(d,p,r,a,n,e,o)}));else h4(c,u,r,a,n,e,o)}if(i.length)return Promise.all(i).then(()=>r);return r}});function h4(e,t,r,o,n,i,a){if(e.issues.length)if(Im.has(typeof o))r.issues.push(...Rn(o,e.issues));else r.issues.push({code:"invalid_key",origin:"map",input:n,inst:i,issues:e.issues.map((s)=>cn(s,a,or()))});if(t.issues.length)if(Im.has(typeof o))r.issues.push(...Rn(o,t.issues));else r.issues.push({origin:"map",code:"invalid_element",input:n,inst:i,key:o,issues:t.issues.map((s)=>cn(s,a,or()))});r.value.set(e.value,t.value)}var W0=R("$ZodSet",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!(n instanceof Set))return r.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),r;let i=[];r.value=new Set;for(let a of n){let s=t.valueType._zod.run({value:a,issues:[]},o);if(s instanceof Promise)i.push(s.then((c)=>g4(c,r)));else g4(s,r)}if(i.length)return Promise.all(i).then(()=>r);return r}});function g4(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var K0=R("$ZodEnum",(e,t)=>{Ue.init(e,t);let r=Tm(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter((n)=>Im.has(typeof n)).map((n)=>typeof n==="string"?oo(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;if(o.has(a))return n;return n.issues.push({code:"invalid_value",values:r,input:a,inst:e}),n}}),J0=R("$ZodLiteral",(e,t)=>{if(Ue.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map((o)=>typeof o==="string"?oo(o):o?oo(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,n)=>{let i=o.value;if(r.has(i))return o;return o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),Y0=R("$ZodFile",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(n instanceof File)return r;return r.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),r}}),Q0=R("$ZodTransform",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Fc(e.constructor.name);let n=t.transform(r.value,r);if(o.async)return(n instanceof Promise?n:Promise.resolve(n)).then((a)=>(r.value=a,r.fallback=!0,r));if(n instanceof Promise)throw new bi;return r.value=n,r.fallback=!0,r}});function y4(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Dm=R("$ZodOptional",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ye(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Em(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,i=t.innerType._zod.run(r,o);if(i instanceof Promise)return i.then((a)=>y4(a,n));return y4(i,n)}if(r.value===void 0)return r;return t.innerType._zod.run(r,o)}}),X0=R("$ZodExactOptional",(e,t)=>{Dm.init(e,t),Ye(e._zod,"values",()=>t.innerType._zod.values),Ye(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,o)=>t.innerType._zod.run(r,o)}),ex=R("$ZodNullable",(e,t)=>{Ue.init(e,t),Ye(e._zod,"optin",()=>t.innerType._zod.optin),Ye(e._zod,"optout",()=>t.innerType._zod.optout),Ye(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${Em(r.source)}|null)$`):void 0}),Ye(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,o)=>{if(r.value===null)return r;return t.innerType._zod.run(r,o)}}),tx=R("$ZodDefault",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",Ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>b4(i,t));return b4(n,t)}});function b4(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var rx=R("$ZodPrefault",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",Ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,o)}}),nx=R("$ZodNonOptional",(e,t)=>{Ue.init(e,t),Ye(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,o)=>{let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>x4(i,e));return x4(n,e)}});function x4(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var ox=R("$ZodSuccess",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Fc("ZodSuccess");let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>(r.value=i.issues.length===0,r));return r.value=n.issues.length===0,r}}),ix=R("$ZodCatch",(e,t)=>{Ue.init(e,t),e._zod.optin="optional",Ye(e._zod,"optout",()=>t.innerType._zod.optout),Ye(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>{if(r.value=i.value,i.issues.length)r.value=t.catchValue({...r,error:{issues:i.issues.map((a)=>cn(a,o,or()))},input:r.value}),r.issues=[],r.fallback=!0;return r});if(r.value=n.value,n.issues.length)r.value=t.catchValue({...r,error:{issues:n.issues.map((i)=>cn(i,o,or()))},input:r.value}),r.issues=[],r.fallback=!0;return r}}),ax=R("$ZodNaN",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>{if(typeof r.value!=="number"||!Number.isNaN(r.value))return r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r;return r}}),Um=R("$ZodPipe",(e,t)=>{Ue.init(e,t),Ye(e._zod,"values",()=>t.in._zod.values),Ye(e._zod,"optin",()=>t.in._zod.optin),Ye(e._zod,"optout",()=>t.out._zod.optout),Ye(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if(o.direction==="backward"){let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((a)=>a0(a,t.in,o));return a0(i,t.in,o)}let n=t.in._zod.run(r,o);if(n instanceof Promise)return n.then((i)=>a0(i,t.out,o));return a0(n,t.out,o)}});function a0(e,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}var Kl=R("$ZodCodec",(e,t)=>{Ue.init(e,t),Ye(e._zod,"values",()=>t.in._zod.values),Ye(e._zod,"optin",()=>t.in._zod.optin),Ye(e._zod,"optout",()=>t.out._zod.optout),Ye(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,o)=>{if((o.direction||"forward")==="forward"){let i=t.in._zod.run(r,o);if(i instanceof Promise)return i.then((a)=>s0(a,t,o));return s0(i,t,o)}else{let i=t.out._zod.run(r,o);if(i instanceof Promise)return i.then((a)=>s0(a,t,o));return s0(i,t,o)}}});function s0(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let n=t.transform(e.value,e);if(n instanceof Promise)return n.then((i)=>c0(e,i,t.out,r));return c0(e,n,t.out,r)}else{let n=t.reverseTransform(e.value,e);if(n instanceof Promise)return n.then((i)=>c0(e,i,t.in,r));return c0(e,n,t.in,r)}}function c0(e,t,r,o){if(e.issues.length)return e.aborted=!0,e;return r._zod.run({value:t,issues:e.issues},o)}var AI=R("$ZodPreprocess",(e,t)=>{Um.init(e,t)}),sx=R("$ZodReadonly",(e,t)=>{Ue.init(e,t),Ye(e._zod,"propValues",()=>t.innerType._zod.propValues),Ye(e._zod,"values",()=>t.innerType._zod.values),Ye(e._zod,"optin",()=>t.innerType?._zod?.optin),Ye(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);let n=t.innerType._zod.run(r,o);if(n instanceof Promise)return n.then(v4);return v4(n)}});function v4(e){return e.value=Object.freeze(e.value),e}var cx=R("$ZodTemplateLiteral",(e,t)=>{Ue.init(e,t);let r=[];for(let o of t.parts)if(typeof o==="object"&&o!==null){if(!o._zod.pattern)throw Error(`Invalid template literal part, no pattern found: ${[...o._zod.traits].shift()}`);let n=o._zod.pattern instanceof RegExp?o._zod.pattern.source:o._zod.pattern;if(!n)throw Error(`Invalid template literal part: ${o._zod.traits}`);let i=n.startsWith("^")?1:0,a=n.endsWith("$")?n.length-1:n.length;r.push(n.slice(i,a))}else if(o===null||_E.has(typeof o))r.push(oo(`${o}`));else throw Error(`Invalid template literal part: ${o}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(o,n)=>{if(typeof o.value!=="string")return o.issues.push({input:o.value,inst:e,expected:"string",code:"invalid_type"}),o;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(o.value))return o.issues.push({input:o.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),o;return o}}),ux=R("$ZodFunction",(e,t)=>(Ue.init(e,t),e._def=t,e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return function(...o){let n=e._def.input?Hc(e._def.input,o):o,i=Reflect.apply(r,this,n);if(e._def.output)return Hc(e._def.output,i);return i}},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return async function(...o){let n=e._def.input?await Gc(e._def.input,o):o,i=await Reflect.apply(r,this,n);if(e._def.output)return await Gc(e._def.output,i);return i}},e._zod.parse=(r,o)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let o=e.constructor;if(Array.isArray(r[0]))return new o({type:"function",input:new Bm({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new o({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),lx=R("$ZodPromise",(e,t)=>{Ue.init(e,t),e._zod.parse=(r,o)=>Promise.resolve(r.value).then((n)=>t.innerType._zod.run({value:n,issues:[]},o))}),dx=R("$ZodLazy",(e,t)=>{Ue.init(e,t),Ye(e._zod,"innerType",()=>{let r=t;if(!r._cachedInner)r._cachedInner=t.getter();return r._cachedInner}),Ye(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Ye(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Ye(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Ye(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,o)=>e._zod.innerType._zod.run(r,o)}),px=R("$ZodCustom",(e,t)=>{Rt.init(e,t),Ue.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=(r)=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then((i)=>_4(i,r,o,e));_4(n,r,o,e);return}});function _4(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};if(o._zod.def.params)n.params=o._zod.def.params;t.issues.push(jl(n))}}var Yl={};kn(Yl,{ar:()=>RI,az:()=>$I,be:()=>OI,bg:()=>CI,ca:()=>zI,cs:()=>NI,da:()=>MI,de:()=>BI,el:()=>DI,en:()=>Lm,eo:()=>UI,es:()=>LI,fa:()=>jI,fi:()=>FI,fr:()=>qI,frCA:()=>HI,he:()=>GI,hr:()=>VI,hu:()=>ZI,hy:()=>WI,id:()=>KI,is:()=>JI,it:()=>YI,ja:()=>QI,ka:()=>XI,kh:()=>eP,km:()=>jm,ko:()=>tP,lt:()=>rP,mk:()=>nP,ms:()=>oP,nl:()=>iP,no:()=>aP,ota:()=>sP,pl:()=>uP,ps:()=>cP,pt:()=>lP,ro:()=>dP,ru:()=>pP,sl:()=>fP,sv:()=>mP,ta:()=>hP,th:()=>gP,tr:()=>yP,ua:()=>bP,uk:()=>qm,ur:()=>xP,uz:()=>vP,vi:()=>_P,yo:()=>TP,zhCN:()=>wP,zhTW:()=>SP});var Hre=()=>{let e={string:{unit:"حرف",verb:"أن يحوي"},file:{unit:"بايت",verb:"أن يحوي"},array:{unit:"عنصر",verb:"أن يحوي"},set:{unit:"عنصر",verb:"أن يحوي"}};function t(n){return e[n]??null}let r={regex:"مدخل",email:"بريد إلكتروني",url:"رابط",emoji:"إيموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاريخ ووقت بمعيار ISO",date:"تاريخ بمعيار ISO",time:"وقت بمعيار ISO",duration:"مدة بمعيار ISO",ipv4:"عنوان IPv4",ipv6:"عنوان IPv6",cidrv4:"مدى عناوين بصيغة IPv4",cidrv6:"مدى عناوين بصيغة IPv6",base64:"نَص بترميز base64-encoded",base64url:"نَص بترميز base64url-encoded",json_string:"نَص على هيئة JSON",e164:"رقم هاتف بمعيار E.164",jwt:"JWT",template_literal:"مدخل"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`مدخلات غير مقبولة: يفترض إدخال instanceof ${n.expected}، ولكن تم إدخال ${s}`;return`مدخلات غير مقبولة: يفترض إدخال ${i}، ولكن تم إدخال ${s}`}case"invalid_value":if(n.values.length===1)return`مدخلات غير مقبولة: يفترض إدخال ${Y(n.values[0])}`;return`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return` أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()} ${a.unit??"عنصر"}`;return`أكبر من اللازم: يفترض أن تكون ${n.origin??"القيمة"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()} ${a.unit}`;return`أصغر من اللازم: يفترض لـ ${n.origin} أن يكون ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`نَص غير مقبول: يجب أن يبدأ بـ "${n.prefix}"`;if(i.format==="ends_with")return`نَص غير مقبول: يجب أن ينتهي بـ "${i.suffix}"`;if(i.format==="includes")return`نَص غير مقبول: يجب أن يتضمَّن "${i.includes}"`;if(i.format==="regex")return`نَص غير مقبول: يجب أن يطابق النمط ${i.pattern}`;return`${r[i.format]??n.format} غير مقبول`}case"not_multiple_of":return`رقم غير مقبول: يجب أن يكون من مضاعفات ${n.divisor}`;case"unrecognized_keys":return`معرف${n.keys.length>1?"ات":""} غريب${n.keys.length>1?"ة":""}: ${N(n.keys,"، ")}`;case"invalid_key":return`معرف غير مقبول في ${n.origin}`;case"invalid_union":return"مدخل غير مقبول";case"invalid_element":return`مدخل غير مقبول في ${n.origin}`;default:return"مدخل غير مقبول"}}};function RI(){return{localeError:Hre()}}var Gre=()=>{let e={string:{unit:"simvol",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"element",verb:"olmalıdır"},set:{unit:"element",verb:"olmalıdır"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Yanlış dəyər: gözlənilən instanceof ${n.expected}, daxil olan ${s}`;return`Yanlış dəyər: gözlənilən ${i}, daxil olan ${s}`}case"invalid_value":if(n.values.length===1)return`Yanlış dəyər: gözlənilən ${Y(n.values[0])}`;return`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()} ${a.unit??"element"}`;return`Çox böyük: gözlənilən ${n.origin??"dəyər"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`;return`Çox kiçik: gözlənilən ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Yanlış mətn: "${i.prefix}" ilə başlamalıdır`;if(i.format==="ends_with")return`Yanlış mətn: "${i.suffix}" ilə bitməlidir`;if(i.format==="includes")return`Yanlış mətn: "${i.includes}" daxil olmalıdır`;if(i.format==="regex")return`Yanlış mətn: ${i.pattern} şablonuna uyğun olmalıdır`;return`Yanlış ${r[i.format]??n.format}`}case"not_multiple_of":return`Yanlış ədəd: ${n.divisor} ilə bölünə bilən olmalıdır`;case"unrecognized_keys":return`Tanınmayan açar${n.keys.length>1?"lar":""}: ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} daxilində yanlış açar`;case"invalid_union":return"Yanlış dəyər";case"invalid_element":return`${n.origin} daxilində yanlış dəyər`;default:return"Yanlış dəyər"}}};function $I(){return{localeError:Gre()}}function I4(e,t,r,o){let n=Math.abs(e),i=n%10,a=n%100;if(a>=11&&a<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}var Vre=()=>{let e={string:{unit:{one:"сімвал",few:"сімвалы",many:"сімвалаў"},verb:"мець"},array:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},set:{unit:{one:"элемент",few:"элементы",many:"элементаў"},verb:"мець"},file:{unit:{one:"байт",few:"байты",many:"байтаў"},verb:"мець"}};function t(n){return e[n]??null}let r={regex:"увод",email:"email адрас",url:"URL",emoji:"эмодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата і час",date:"ISO дата",time:"ISO час",duration:"ISO працягласць",ipv4:"IPv4 адрас",ipv6:"IPv6 адрас",cidrv4:"IPv4 дыяпазон",cidrv6:"IPv6 дыяпазон",base64:"радок у фармаце base64",base64url:"радок у фармаце base64url",json_string:"JSON радок",e164:"нумар E.164",jwt:"JWT",template_literal:"увод"},o={nan:"NaN",number:"лік",array:"масіў"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Няправільны ўвод: чакаўся instanceof ${n.expected}, атрымана ${s}`;return`Няправільны ўвод: чакаўся ${i}, атрымана ${s}`}case"invalid_value":if(n.values.length===1)return`Няправільны ўвод: чакалася ${Y(n.values[0])}`;return`Няправільны варыянт: чакаўся адзін з ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let s=Number(n.maximum),c=I4(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна ${a.verb} ${i}${n.maximum.toString()} ${c}`}return`Занадта вялікі: чакалася, што ${n.origin??"значэнне"} павінна быць ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let s=Number(n.minimum),c=I4(s,a.unit.one,a.unit.few,a.unit.many);return`Занадта малы: чакалася, што ${n.origin} павінна ${a.verb} ${i}${n.minimum.toString()} ${c}`}return`Занадта малы: чакалася, што ${n.origin} павінна быць ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Няправільны радок: павінен пачынацца з "${i.prefix}"`;if(i.format==="ends_with")return`Няправільны радок: павінен заканчвацца на "${i.suffix}"`;if(i.format==="includes")return`Няправільны радок: павінен змяшчаць "${i.includes}"`;if(i.format==="regex")return`Няправільны радок: павінен адпавядаць шаблону ${i.pattern}`;return`Няправільны ${r[i.format]??n.format}`}case"not_multiple_of":return`Няправільны лік: павінен быць кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспазнаны ${n.keys.length>1?"ключы":"ключ"}: ${N(n.keys,", ")}`;case"invalid_key":return`Няправільны ключ у ${n.origin}`;case"invalid_union":return"Няправільны ўвод";case"invalid_element":return`Няправільнае значэнне ў ${n.origin}`;default:return"Няправільны ўвод"}}};function OI(){return{localeError:Vre()}}var Zre=()=>{let e={string:{unit:"символа",verb:"да съдържа"},file:{unit:"байта",verb:"да съдържа"},array:{unit:"елемента",verb:"да съдържа"},set:{unit:"елемента",verb:"да съдържа"}};function t(n){return e[n]??null}let r={regex:"вход",email:"имейл адрес",url:"URL",emoji:"емоджи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO време",date:"ISO дата",time:"ISO време",duration:"ISO продължителност",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"base64-кодиран низ",base64url:"base64url-кодиран низ",json_string:"JSON низ",e164:"E.164 номер",jwt:"JWT",template_literal:"вход"},o={nan:"NaN",number:"число",array:"масив"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Невалиден вход: очакван instanceof ${n.expected}, получен ${s}`;return`Невалиден вход: очакван ${i}, получен ${s}`}case"invalid_value":if(n.values.length===1)return`Невалиден вход: очакван ${Y(n.values[0])}`;return`Невалидна опция: очаквано едно от ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Твърде голямо: очаква се ${n.origin??"стойност"} да съдържа ${i}${n.maximum.toString()} ${a.unit??"елемента"}`;return`Твърде голямо: очаква се ${n.origin??"стойност"} да бъде ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Твърде малко: очаква се ${n.origin} да съдържа ${i}${n.minimum.toString()} ${a.unit}`;return`Твърде малко: очаква се ${n.origin} да бъде ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Невалиден низ: трябва да започва с "${i.prefix}"`;if(i.format==="ends_with")return`Невалиден низ: трябва да завършва с "${i.suffix}"`;if(i.format==="includes")return`Невалиден низ: трябва да включва "${i.includes}"`;if(i.format==="regex")return`Невалиден низ: трябва да съвпада с ${i.pattern}`;let a="Невалиден";if(i.format==="emoji")a="Невалидно";if(i.format==="datetime")a="Невалидно";if(i.format==="date")a="Невалидна";if(i.format==="time")a="Невалидно";if(i.format==="duration")a="Невалидна";return`${a} ${r[i.format]??n.format}`}case"not_multiple_of":return`Невалидно число: трябва да бъде кратно на ${n.divisor}`;case"unrecognized_keys":return`Неразпознат${n.keys.length>1?"и":""} ключ${n.keys.length>1?"ове":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Невалиден ключ в ${n.origin}`;case"invalid_union":return"Невалиден вход";case"invalid_element":return`Невалидна стойност в ${n.origin}`;default:return"Невалиден вход"}}};function CI(){return{localeError:Zre()}}var Wre=()=>{let e={string:{unit:"caràcters",verb:"contenir"},file:{unit:"bytes",verb:"contenir"},array:{unit:"elements",verb:"contenir"},set:{unit:"elements",verb:"contenir"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"adreça electrònica",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i hora ISO",date:"data ISO",time:"hora ISO",duration:"durada ISO",ipv4:"adreça IPv4",ipv6:"adreça IPv6",cidrv4:"rang IPv4",cidrv6:"rang IPv6",base64:"cadena codificada en base64",base64url:"cadena codificada en base64url",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Tipus invàlid: s'esperava instanceof ${n.expected}, s'ha rebut ${s}`;return`Tipus invàlid: s'esperava ${i}, s'ha rebut ${s}`}case"invalid_value":if(n.values.length===1)return`Valor invàlid: s'esperava ${Y(n.values[0])}`;return`Opció invàlida: s'esperava una de ${N(n.values," o ")}`;case"too_big":{let i=n.inclusive?"com a màxim":"menys de",a=t(n.origin);if(a)return`Massa gran: s'esperava que ${n.origin??"el valor"} contingués ${i} ${n.maximum.toString()} ${a.unit??"elements"}`;return`Massa gran: s'esperava que ${n.origin??"el valor"} fos ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"com a mínim":"més de",a=t(n.origin);if(a)return`Massa petit: s'esperava que ${n.origin} contingués ${i} ${n.minimum.toString()} ${a.unit}`;return`Massa petit: s'esperava que ${n.origin} fos ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Format invàlid: ha de començar amb "${i.prefix}"`;if(i.format==="ends_with")return`Format invàlid: ha d'acabar amb "${i.suffix}"`;if(i.format==="includes")return`Format invàlid: ha d'incloure "${i.includes}"`;if(i.format==="regex")return`Format invàlid: ha de coincidir amb el patró ${i.pattern}`;return`Format invàlid per a ${r[i.format]??n.format}`}case"not_multiple_of":return`Número invàlid: ha de ser múltiple de ${n.divisor}`;case"unrecognized_keys":return`Clau${n.keys.length>1?"s":""} no reconeguda${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Clau invàlida a ${n.origin}`;case"invalid_union":return"Entrada invàlida";case"invalid_element":return`Element invàlid a ${n.origin}`;default:return"Entrada invàlida"}}};function zI(){return{localeError:Wre()}}var Kre=()=>{let e={string:{unit:"znaků",verb:"mít"},file:{unit:"bajtů",verb:"mít"},array:{unit:"prvků",verb:"mít"},set:{unit:"prvků",verb:"mít"}};function t(n){return e[n]??null}let r={regex:"regulární výraz",email:"e-mailová adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"datum a čas ve formátu ISO",date:"datum ve formátu ISO",time:"čas ve formátu ISO",duration:"doba trvání ISO",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"rozsah IPv4",cidrv6:"rozsah IPv6",base64:"řetězec zakódovaný ve formátu base64",base64url:"řetězec zakódovaný ve formátu base64url",json_string:"řetězec ve formátu JSON",e164:"číslo E.164",jwt:"JWT",template_literal:"vstup"},o={nan:"NaN",number:"číslo",string:"řetězec",function:"funkce",array:"pole"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Neplatný vstup: očekáváno instanceof ${n.expected}, obdrženo ${s}`;return`Neplatný vstup: očekáváno ${i}, obdrženo ${s}`}case"invalid_value":if(n.values.length===1)return`Neplatný vstup: očekáváno ${Y(n.values[0])}`;return`Neplatná možnost: očekávána jedna z hodnot ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí mít ${i}${n.maximum.toString()} ${a.unit??"prvků"}`;return`Hodnota je příliš velká: ${n.origin??"hodnota"} musí být ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí mít ${i}${n.minimum.toString()} ${a.unit??"prvků"}`;return`Hodnota je příliš malá: ${n.origin??"hodnota"} musí být ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neplatný řetězec: musí začínat na "${i.prefix}"`;if(i.format==="ends_with")return`Neplatný řetězec: musí končit na "${i.suffix}"`;if(i.format==="includes")return`Neplatný řetězec: musí obsahovat "${i.includes}"`;if(i.format==="regex")return`Neplatný řetězec: musí odpovídat vzoru ${i.pattern}`;return`Neplatný formát ${r[i.format]??n.format}`}case"not_multiple_of":return`Neplatné číslo: musí být násobkem ${n.divisor}`;case"unrecognized_keys":return`Neznámé klíče: ${N(n.keys,", ")}`;case"invalid_key":return`Neplatný klíč v ${n.origin}`;case"invalid_union":return"Neplatný vstup";case"invalid_element":return`Neplatná hodnota v ${n.origin}`;default:return"Neplatný vstup"}}};function NI(){return{localeError:Kre()}}var Jre=()=>{let e={string:{unit:"tegn",verb:"havde"},file:{unit:"bytes",verb:"havde"},array:{unit:"elementer",verb:"indeholdt"},set:{unit:"elementer",verb:"indeholdt"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-mailadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslæt",date:"ISO-dato",time:"ISO-klokkeslæt",duration:"ISO-varighed",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodet streng",base64url:"base64url-kodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",string:"streng",number:"tal",boolean:"boolean",array:"liste",object:"objekt",set:"sæt",file:"fil"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Ugyldigt input: forventede instanceof ${n.expected}, fik ${s}`;return`Ugyldigt input: forventede ${i}, fik ${s}`}case"invalid_value":if(n.values.length===1)return`Ugyldig værdi: forventede ${Y(n.values[0])}`;return`Ugyldigt valg: forventede en af følgende ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=o[n.origin]??n.origin;if(a)return`For stor: forventede ${s??"value"} ${a.verb} ${i} ${n.maximum.toString()} ${a.unit??"elementer"}`;return`For stor: forventede ${s??"value"} havde ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=o[n.origin]??n.origin;if(a)return`For lille: forventede ${s} ${a.verb} ${i} ${n.minimum.toString()} ${a.unit}`;return`For lille: forventede ${s} havde ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ugyldig streng: skal starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: skal ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: skal indeholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: skal matche mønsteret ${i.pattern}`;return`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldigt tal: skal være deleligt med ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukendte nøgler":"Ukendt nøgle"}: ${N(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøgle i ${n.origin}`;case"invalid_union":return"Ugyldigt input: matcher ingen af de tilladte typer";case"invalid_element":return`Ugyldig værdi i ${n.origin}`;default:return"Ugyldigt input"}}};function MI(){return{localeError:Jre()}}var Yre=()=>{let e={string:{unit:"Zeichen",verb:"zu haben"},file:{unit:"Bytes",verb:"zu haben"},array:{unit:"Elemente",verb:"zu haben"},set:{unit:"Elemente",verb:"zu haben"}};function t(n){return e[n]??null}let r={regex:"Eingabe",email:"E-Mail-Adresse",url:"URL",emoji:"Emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-Datum und -Uhrzeit",date:"ISO-Datum",time:"ISO-Uhrzeit",duration:"ISO-Dauer",ipv4:"IPv4-Adresse",ipv6:"IPv6-Adresse",cidrv4:"IPv4-Bereich",cidrv6:"IPv6-Bereich",base64:"Base64-codierter String",base64url:"Base64-URL-codierter String",json_string:"JSON-String",e164:"E.164-Nummer",jwt:"JWT",template_literal:"Eingabe"},o={nan:"NaN",number:"Zahl",array:"Array"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Ungültige Eingabe: erwartet instanceof ${n.expected}, erhalten ${s}`;return`Ungültige Eingabe: erwartet ${i}, erhalten ${s}`}case"invalid_value":if(n.values.length===1)return`Ungültige Eingabe: erwartet ${Y(n.values[0])}`;return`Ungültige Option: erwartet eine von ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ${a.unit??"Elemente"} hat`;return`Zu groß: erwartet, dass ${n.origin??"Wert"} ${i}${n.maximum.toString()} ist`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ${a.unit} hat`;return`Zu klein: erwartet, dass ${n.origin} ${i}${n.minimum.toString()} ist`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ungültiger String: muss mit "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ungültiger String: muss mit "${i.suffix}" enden`;if(i.format==="includes")return`Ungültiger String: muss "${i.includes}" enthalten`;if(i.format==="regex")return`Ungültiger String: muss dem Muster ${i.pattern} entsprechen`;return`Ungültig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ungültige Zahl: muss ein Vielfaches von ${n.divisor} sein`;case"unrecognized_keys":return`${n.keys.length>1?"Unbekannte Schlüssel":"Unbekannter Schlüssel"}: ${N(n.keys,", ")}`;case"invalid_key":return`Ungültiger Schlüssel in ${n.origin}`;case"invalid_union":return"Ungültige Eingabe";case"invalid_element":return`Ungültiger Wert in ${n.origin}`;default:return"Ungültige Eingabe"}}};function BI(){return{localeError:Yre()}}var Qre=()=>{let e={string:{unit:"χαρακτήρες",verb:"να έχει"},file:{unit:"bytes",verb:"να έχει"},array:{unit:"στοιχεία",verb:"να έχει"},set:{unit:"στοιχεία",verb:"να έχει"},map:{unit:"καταχωρήσεις",verb:"να έχει"}};function t(n){return e[n]??null}let r={regex:"είσοδος",email:"διεύθυνση email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ημερομηνία και ώρα",date:"ISO ημερομηνία",time:"ISO ώρα",duration:"ISO διάρκεια",ipv4:"διεύθυνση IPv4",ipv6:"διεύθυνση IPv6",mac:"διεύθυνση MAC",cidrv4:"εύρος IPv4",cidrv6:"εύρος IPv6",base64:"συμβολοσειρά κωδικοποιημένη σε base64",base64url:"συμβολοσειρά κωδικοποιημένη σε base64url",json_string:"συμβολοσειρά JSON",e164:"αριθμός E.164",jwt:"JWT",template_literal:"είσοδος"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(typeof n.expected==="string"&&/^[A-Z]/.test(n.expected))return`Μη έγκυρη είσοδος: αναμενόταν instanceof ${n.expected}, λήφθηκε ${s}`;return`Μη έγκυρη είσοδος: αναμενόταν ${i}, λήφθηκε ${s}`}case"invalid_value":if(n.values.length===1)return`Μη έγκυρη είσοδος: αναμενόταν ${Y(n.values[0])}`;return`Μη έγκυρη επιλογή: αναμενόταν ένα από ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Πολύ μεγάλο: αναμενόταν ${n.origin??"τιμή"} να έχει ${i}${n.maximum.toString()} ${a.unit??"στοιχεία"}`;return`Πολύ μεγάλο: αναμενόταν ${n.origin??"τιμή"} να είναι ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Πολύ μικρό: αναμενόταν ${n.origin} να έχει ${i}${n.minimum.toString()} ${a.unit}`;return`Πολύ μικρό: αναμενόταν ${n.origin} να είναι ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Μη έγκυρη συμβολοσειρά: πρέπει να ξεκινά με "${i.prefix}"`;if(i.format==="ends_with")return`Μη έγκυρη συμβολοσειρά: πρέπει να τελειώνει με "${i.suffix}"`;if(i.format==="includes")return`Μη έγκυρη συμβολοσειρά: πρέπει να περιέχει "${i.includes}"`;if(i.format==="regex")return`Μη έγκυρη συμβολοσειρά: πρέπει να ταιριάζει με το μοτίβο ${i.pattern}`;return`Μη έγκυρο: ${r[i.format]??n.format}`}case"not_multiple_of":return`Μη έγκυρος αριθμός: πρέπει να είναι πολλαπλάσιο του ${n.divisor}`;case"unrecognized_keys":return`Άγνωστ${n.keys.length>1?"α":"ο"} κλειδ${n.keys.length>1?"ιά":"ί"}: ${N(n.keys,", ")}`;case"invalid_key":return`Μη έγκυρο κλειδί στο ${n.origin}`;case"invalid_union":return"Μη έγκυρη είσοδος";case"invalid_element":return`Μη έγκυρη τιμή στο ${n.origin}`;default:return"Μη έγκυρη είσοδος"}}};function DI(){return{localeError:Qre()}}var Xre=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;return`Invalid input: expected ${i}, received ${s}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${Y(n.values[0])}`;return`Invalid option: expected one of ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${a.unit}`;return`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0)return`Invalid discriminator value. Expected ${n.options.map((a)=>`'${a}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Lm(){return{localeError:Xre()}}var ene=()=>{let e={string:{unit:"karaktrojn",verb:"havi"},file:{unit:"bajtojn",verb:"havi"},array:{unit:"elementojn",verb:"havi"},set:{unit:"elementojn",verb:"havi"}};function t(n){return e[n]??null}let r={regex:"enigo",email:"retadreso",url:"URL",emoji:"emoĝio",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datotempo",date:"ISO-dato",time:"ISO-tempo",duration:"ISO-daŭro",ipv4:"IPv4-adreso",ipv6:"IPv6-adreso",cidrv4:"IPv4-rango",cidrv6:"IPv6-rango",base64:"64-ume kodita karaktraro",base64url:"URL-64-ume kodita karaktraro",json_string:"JSON-karaktraro",e164:"E.164-nombro",jwt:"JWT",template_literal:"enigo"},o={nan:"NaN",number:"nombro",array:"tabelo",null:"senvalora"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Nevalida enigo: atendiĝis instanceof ${n.expected}, riceviĝis ${s}`;return`Nevalida enigo: atendiĝis ${i}, riceviĝis ${s}`}case"invalid_value":if(n.values.length===1)return`Nevalida enigo: atendiĝis ${Y(n.values[0])}`;return`Nevalida opcio: atendiĝis unu el ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()} ${a.unit??"elementojn"}`;return`Tro granda: atendiĝis ke ${n.origin??"valoro"} havu ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Tro malgranda: atendiĝis ke ${n.origin} havu ${i}${n.minimum.toString()} ${a.unit}`;return`Tro malgranda: atendiĝis ke ${n.origin} estu ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Nevalida karaktraro: devas komenciĝi per "${i.prefix}"`;if(i.format==="ends_with")return`Nevalida karaktraro: devas finiĝi per "${i.suffix}"`;if(i.format==="includes")return`Nevalida karaktraro: devas inkluzivi "${i.includes}"`;if(i.format==="regex")return`Nevalida karaktraro: devas kongrui kun la modelo ${i.pattern}`;return`Nevalida ${r[i.format]??n.format}`}case"not_multiple_of":return`Nevalida nombro: devas esti oblo de ${n.divisor}`;case"unrecognized_keys":return`Nekonata${n.keys.length>1?"j":""} ŝlosilo${n.keys.length>1?"j":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Nevalida ŝlosilo en ${n.origin}`;case"invalid_union":return"Nevalida enigo";case"invalid_element":return`Nevalida valoro en ${n.origin}`;default:return"Nevalida enigo"}}};function UI(){return{localeError:ene()}}var tne=()=>{let e={string:{unit:"caracteres",verb:"tener"},file:{unit:"bytes",verb:"tener"},array:{unit:"elementos",verb:"tener"},set:{unit:"elementos",verb:"tener"}};function t(n){return e[n]??null}let r={regex:"entrada",email:"dirección de correo electrónico",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"fecha y hora ISO",date:"fecha ISO",time:"hora ISO",duration:"duración ISO",ipv4:"dirección IPv4",ipv6:"dirección IPv6",cidrv4:"rango IPv4",cidrv6:"rango IPv6",base64:"cadena codificada en base64",base64url:"URL codificada en base64",json_string:"cadena JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",string:"texto",number:"número",boolean:"booleano",array:"arreglo",object:"objeto",set:"conjunto",file:"archivo",date:"fecha",bigint:"número grande",symbol:"símbolo",undefined:"indefinido",null:"nulo",function:"función",map:"mapa",record:"registro",tuple:"tupla",enum:"enumeración",union:"unión",literal:"literal",promise:"promesa",void:"vacío",never:"nunca",unknown:"desconocido",any:"cualquiera"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Entrada inválida: se esperaba instanceof ${n.expected}, recibido ${s}`;return`Entrada inválida: se esperaba ${i}, recibido ${s}`}case"invalid_value":if(n.values.length===1)return`Entrada inválida: se esperaba ${Y(n.values[0])}`;return`Opción inválida: se esperaba una de ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=o[n.origin]??n.origin;if(a)return`Demasiado grande: se esperaba que ${s??"valor"} tuviera ${i}${n.maximum.toString()} ${a.unit??"elementos"}`;return`Demasiado grande: se esperaba que ${s??"valor"} fuera ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=o[n.origin]??n.origin;if(a)return`Demasiado pequeño: se esperaba que ${s} tuviera ${i}${n.minimum.toString()} ${a.unit}`;return`Demasiado pequeño: se esperaba que ${s} fuera ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Cadena inválida: debe comenzar con "${i.prefix}"`;if(i.format==="ends_with")return`Cadena inválida: debe terminar en "${i.suffix}"`;if(i.format==="includes")return`Cadena inválida: debe incluir "${i.includes}"`;if(i.format==="regex")return`Cadena inválida: debe coincidir con el patrón ${i.pattern}`;return`Inválido ${r[i.format]??n.format}`}case"not_multiple_of":return`Número inválido: debe ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Llave${n.keys.length>1?"s":""} desconocida${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Llave inválida en ${o[n.origin]??n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido en ${o[n.origin]??n.origin}`;default:return"Entrada inválida"}}};function LI(){return{localeError:tne()}}var rne=()=>{let e={string:{unit:"کاراکتر",verb:"داشته باشد"},file:{unit:"بایت",verb:"داشته باشد"},array:{unit:"آیتم",verb:"داشته باشد"},set:{unit:"آیتم",verb:"داشته باشد"}};function t(n){return e[n]??null}let r={regex:"ورودی",email:"آدرس ایمیل",url:"URL",emoji:"ایموجی",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"تاریخ و زمان ایزو",date:"تاریخ ایزو",time:"زمان ایزو",duration:"مدت زمان ایزو",ipv4:"IPv4 آدرس",ipv6:"IPv6 آدرس",cidrv4:"IPv4 دامنه",cidrv6:"IPv6 دامنه",base64:"base64-encoded رشته",base64url:"base64url-encoded رشته",json_string:"JSON رشته",e164:"E.164 عدد",jwt:"JWT",template_literal:"ورودی"},o={nan:"NaN",number:"عدد",array:"آرایه"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`ورودی نامعتبر: میبایست instanceof ${n.expected} میبود، ${s} دریافت شد`;return`ورودی نامعتبر: میبایست ${i} میبود، ${s} دریافت شد`}case"invalid_value":if(n.values.length===1)return`ورودی نامعتبر: میبایست ${Y(n.values[0])} میبود`;return`گزینه نامعتبر: میبایست یکی از ${N(n.values,"|")} میبود`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} ${a.unit??"عنصر"} باشد`;return`خیلی بزرگ: ${n.origin??"مقدار"} باید ${i}${n.maximum.toString()} باشد`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} ${a.unit} باشد`;return`خیلی کوچک: ${n.origin} باید ${i}${n.minimum.toString()} باشد`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`رشته نامعتبر: باید با "${i.prefix}" شروع شود`;if(i.format==="ends_with")return`رشته نامعتبر: باید با "${i.suffix}" تمام شود`;if(i.format==="includes")return`رشته نامعتبر: باید شامل "${i.includes}" باشد`;if(i.format==="regex")return`رشته نامعتبر: باید با الگوی ${i.pattern} مطابقت داشته باشد`;return`${r[i.format]??n.format} نامعتبر`}case"not_multiple_of":return`عدد نامعتبر: باید مضرب ${n.divisor} باشد`;case"unrecognized_keys":return`کلید${n.keys.length>1?"های":""} ناشناس: ${N(n.keys,", ")}`;case"invalid_key":return`کلید ناشناس در ${n.origin}`;case"invalid_union":return"ورودی نامعتبر";case"invalid_element":return`مقدار نامعتبر در ${n.origin}`;default:return"ورودی نامعتبر"}}};function jI(){return{localeError:rne()}}var nne=()=>{let e={string:{unit:"merkkiä",subject:"merkkijonon"},file:{unit:"tavua",subject:"tiedoston"},array:{unit:"alkiota",subject:"listan"},set:{unit:"alkiota",subject:"joukon"},number:{unit:"",subject:"luvun"},bigint:{unit:"",subject:"suuren kokonaisluvun"},int:{unit:"",subject:"kokonaisluvun"},date:{unit:"",subject:"päivämäärän"}};function t(n){return e[n]??null}let r={regex:"säännöllinen lauseke",email:"sähköpostiosoite",url:"URL-osoite",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-aikaleima",date:"ISO-päivämäärä",time:"ISO-aika",duration:"ISO-kesto",ipv4:"IPv4-osoite",ipv6:"IPv6-osoite",cidrv4:"IPv4-alue",cidrv6:"IPv6-alue",base64:"base64-koodattu merkkijono",base64url:"base64url-koodattu merkkijono",json_string:"JSON-merkkijono",e164:"E.164-luku",jwt:"JWT",template_literal:"templaattimerkkijono"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Virheellinen tyyppi: odotettiin instanceof ${n.expected}, oli ${s}`;return`Virheellinen tyyppi: odotettiin ${i}, oli ${s}`}case"invalid_value":if(n.values.length===1)return`Virheellinen syöte: täytyy olla ${Y(n.values[0])}`;return`Virheellinen valinta: täytyy olla yksi seuraavista: ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Liian suuri: ${a.subject} täytyy olla ${i}${n.maximum.toString()} ${a.unit}`.trim();return`Liian suuri: arvon täytyy olla ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Liian pieni: ${a.subject} täytyy olla ${i}${n.minimum.toString()} ${a.unit}`.trim();return`Liian pieni: arvon täytyy olla ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Virheellinen syöte: täytyy alkaa "${i.prefix}"`;if(i.format==="ends_with")return`Virheellinen syöte: täytyy loppua "${i.suffix}"`;if(i.format==="includes")return`Virheellinen syöte: täytyy sisältää "${i.includes}"`;if(i.format==="regex")return`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${i.pattern}`;return`Virheellinen ${r[i.format]??n.format}`}case"not_multiple_of":return`Virheellinen luku: täytyy olla luvun ${n.divisor} monikerta`;case"unrecognized_keys":return`${n.keys.length>1?"Tuntemattomat avaimet":"Tuntematon avain"}: ${N(n.keys,", ")}`;case"invalid_key":return"Virheellinen avain tietueessa";case"invalid_union":return"Virheellinen unioni";case"invalid_element":return"Virheellinen arvo joukossa";default:return"Virheellinen syöte"}}};function FI(){return{localeError:nne()}}var one=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"entrée",email:"adresse e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date et heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},o={string:"chaîne",number:"nombre",int:"entier",boolean:"booléen",bigint:"grand entier",symbol:"symbole",undefined:"indéfini",null:"null",never:"jamais",void:"vide",date:"date",array:"tableau",object:"objet",tuple:"tuple",record:"enregistrement",map:"carte",set:"ensemble",file:"fichier",nonoptional:"non-optionnel",nan:"NaN",function:"fonction"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Entrée invalide : instanceof ${n.expected} attendu, ${s} reçu`;return`Entrée invalide : ${i} attendu, ${s} reçu`}case"invalid_value":if(n.values.length===1)return`Entrée invalide : ${Y(n.values[0])} attendu`;return`Option invalide : une valeur parmi ${N(n.values,"|")} attendue`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Trop grand : ${o[n.origin]??"valeur"} doit ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"élément(s)"}`;return`Trop grand : ${o[n.origin]??"valeur"} doit être ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Trop petit : ${o[n.origin]??"valeur"} doit ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`;return`Trop petit : ${o[n.origin]??"valeur"} doit être ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au modèle ${i.pattern}`;return`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${N(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function qI(){return{localeError:one()}}var ine=()=>{let e={string:{unit:"caractères",verb:"avoir"},file:{unit:"octets",verb:"avoir"},array:{unit:"éléments",verb:"avoir"},set:{unit:"éléments",verb:"avoir"}};function t(n){return e[n]??null}let r={regex:"entrée",email:"adresse courriel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"date-heure ISO",date:"date ISO",time:"heure ISO",duration:"durée ISO",ipv4:"adresse IPv4",ipv6:"adresse IPv6",cidrv4:"plage IPv4",cidrv6:"plage IPv6",base64:"chaîne encodée en base64",base64url:"chaîne encodée en base64url",json_string:"chaîne JSON",e164:"numéro E.164",jwt:"JWT",template_literal:"entrée"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Entrée invalide : attendu instanceof ${n.expected}, reçu ${s}`;return`Entrée invalide : attendu ${i}, reçu ${s}`}case"invalid_value":if(n.values.length===1)return`Entrée invalide : attendu ${Y(n.values[0])}`;return`Option invalide : attendu l'une des valeurs suivantes ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"≤":"<",a=t(n.origin);if(a)return`Trop grand : attendu que ${n.origin??"la valeur"} ait ${i}${n.maximum.toString()} ${a.unit}`;return`Trop grand : attendu que ${n.origin??"la valeur"} soit ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"≥":">",a=t(n.origin);if(a)return`Trop petit : attendu que ${n.origin} ait ${i}${n.minimum.toString()} ${a.unit}`;return`Trop petit : attendu que ${n.origin} soit ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chaîne invalide : doit commencer par "${i.prefix}"`;if(i.format==="ends_with")return`Chaîne invalide : doit se terminer par "${i.suffix}"`;if(i.format==="includes")return`Chaîne invalide : doit inclure "${i.includes}"`;if(i.format==="regex")return`Chaîne invalide : doit correspondre au motif ${i.pattern}`;return`${r[i.format]??n.format} invalide`}case"not_multiple_of":return`Nombre invalide : doit être un multiple de ${n.divisor}`;case"unrecognized_keys":return`Clé${n.keys.length>1?"s":""} non reconnue${n.keys.length>1?"s":""} : ${N(n.keys,", ")}`;case"invalid_key":return`Clé invalide dans ${n.origin}`;case"invalid_union":return"Entrée invalide";case"invalid_element":return`Valeur invalide dans ${n.origin}`;default:return"Entrée invalide"}}};function HI(){return{localeError:ine()}}var ane=()=>{let e={string:{label:"מחרוזת",gender:"f"},number:{label:"מספר",gender:"m"},boolean:{label:"ערך בוליאני",gender:"m"},bigint:{label:"BigInt",gender:"m"},date:{label:"תאריך",gender:"m"},array:{label:"מערך",gender:"m"},object:{label:"אובייקט",gender:"m"},null:{label:"ערך ריק (null)",gender:"m"},undefined:{label:"ערך לא מוגדר (undefined)",gender:"m"},symbol:{label:"סימבול (Symbol)",gender:"m"},function:{label:"פונקציה",gender:"f"},map:{label:"מפה (Map)",gender:"f"},set:{label:"קבוצה (Set)",gender:"f"},file:{label:"קובץ",gender:"m"},promise:{label:"Promise",gender:"m"},NaN:{label:"NaN",gender:"m"},unknown:{label:"ערך לא ידוע",gender:"m"},value:{label:"ערך",gender:"m"}},t={string:{unit:"תווים",shortLabel:"קצר",longLabel:"ארוך"},file:{unit:"בייטים",shortLabel:"קטן",longLabel:"גדול"},array:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},set:{unit:"פריטים",shortLabel:"קטן",longLabel:"גדול"},number:{unit:"",shortLabel:"קטן",longLabel:"גדול"}},r=(u)=>u?e[u]:void 0,o=(u)=>{let d=r(u);if(d)return d.label;return u??e.unknown.label},n=(u)=>`ה${o(u)}`,i=(u)=>(r(u)?.gender??"m")==="f"?"צריכה להיות":"צריך להיות",a=(u)=>{if(!u)return null;return t[u]??null},s={regex:{label:"קלט",gender:"m"},email:{label:"כתובת אימייל",gender:"f"},url:{label:"כתובת רשת",gender:"f"},emoji:{label:"אימוג'י",gender:"m"},uuid:{label:"UUID",gender:"m"},nanoid:{label:"nanoid",gender:"m"},guid:{label:"GUID",gender:"m"},cuid:{label:"cuid",gender:"m"},cuid2:{label:"cuid2",gender:"m"},ulid:{label:"ULID",gender:"m"},xid:{label:"XID",gender:"m"},ksuid:{label:"KSUID",gender:"m"},datetime:{label:"תאריך וזמן ISO",gender:"m"},date:{label:"תאריך ISO",gender:"m"},time:{label:"זמן ISO",gender:"m"},duration:{label:"משך זמן ISO",gender:"m"},ipv4:{label:"כתובת IPv4",gender:"f"},ipv6:{label:"כתובת IPv6",gender:"f"},cidrv4:{label:"טווח IPv4",gender:"m"},cidrv6:{label:"טווח IPv6",gender:"m"},base64:{label:"מחרוזת בבסיס 64",gender:"f"},base64url:{label:"מחרוזת בבסיס 64 לכתובות רשת",gender:"f"},json_string:{label:"מחרוזת JSON",gender:"f"},e164:{label:"מספר E.164",gender:"m"},jwt:{label:"JWT",gender:"m"},ends_with:{label:"קלט",gender:"m"},includes:{label:"קלט",gender:"m"},lowercase:{label:"קלט",gender:"m"},starts_with:{label:"קלט",gender:"m"},uppercase:{label:"קלט",gender:"m"}},c={nan:"NaN"};return(u)=>{switch(u.code){case"invalid_type":{let d=u.expected,p=c[d??""]??o(d),m=Q(u.input),h=c[m]??e[m]?.label??m;if(/^[A-Z]/.test(u.expected))return`קלט לא תקין: צריך להיות instanceof ${u.expected}, התקבל ${h}`;return`קלט לא תקין: צריך להיות ${p}, התקבל ${h}`}case"invalid_value":{if(u.values.length===1)return`ערך לא תקין: הערך חייב להיות ${Y(u.values[0])}`;let d=u.values.map((h)=>Y(h));if(u.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${d[0]} או ${d[1]}`;let p=d[d.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${d.slice(0,-1).join(", ")} או ${p}`}case"too_big":{let d=a(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${d?.longLabel??"ארוך"} מדי: ${p} צריכה להכיל ${u.maximum.toString()} ${d?.unit??""} ${u.inclusive?"או פחות":"לכל היותר"}`.trim();if(u.origin==="number"){let y=u.inclusive?`קטן או שווה ל-${u.maximum}`:`קטן מ-${u.maximum}`;return`גדול מדי: ${p} צריך להיות ${y}`}if(u.origin==="array"||u.origin==="set"){let y=u.origin==="set"?"צריכה":"צריך",x=u.inclusive?`${u.maximum} ${d?.unit??""} או פחות`:`פחות מ-${u.maximum} ${d?.unit??""}`;return`גדול מדי: ${p} ${y} להכיל ${x}`.trim()}let m=u.inclusive?"<=":"<",h=i(u.origin??"value");if(d?.unit)return`${d.longLabel} מדי: ${p} ${h} ${m}${u.maximum.toString()} ${d.unit}`;return`${d?.longLabel??"גדול"} מדי: ${p} ${h} ${m}${u.maximum.toString()}`}case"too_small":{let d=a(u.origin),p=n(u.origin??"value");if(u.origin==="string")return`${d?.shortLabel??"קצר"} מדי: ${p} צריכה להכיל ${u.minimum.toString()} ${d?.unit??""} ${u.inclusive?"או יותר":"לפחות"}`.trim();if(u.origin==="number"){let y=u.inclusive?`גדול או שווה ל-${u.minimum}`:`גדול מ-${u.minimum}`;return`קטן מדי: ${p} צריך להיות ${y}`}if(u.origin==="array"||u.origin==="set"){let y=u.origin==="set"?"צריכה":"צריך";if(u.minimum===1&&u.inclusive){let S=u.origin==="set"?"לפחות פריט אחד":"לפחות פריט אחד";return`קטן מדי: ${p} ${y} להכיל ${S}`}let x=u.inclusive?`${u.minimum} ${d?.unit??""} או יותר`:`יותר מ-${u.minimum} ${d?.unit??""}`;return`קטן מדי: ${p} ${y} להכיל ${x}`.trim()}let m=u.inclusive?">=":">",h=i(u.origin??"value");if(d?.unit)return`${d.shortLabel} מדי: ${p} ${h} ${m}${u.minimum.toString()} ${d.unit}`;return`${d?.shortLabel??"קטן"} מדי: ${p} ${h} ${m}${u.minimum.toString()}`}case"invalid_format":{let d=u;if(d.format==="starts_with")return`המחרוזת חייבת להתחיל ב "${d.prefix}"`;if(d.format==="ends_with")return`המחרוזת חייבת להסתיים ב "${d.suffix}"`;if(d.format==="includes")return`המחרוזת חייבת לכלול "${d.includes}"`;if(d.format==="regex")return`המחרוזת חייבת להתאים לתבנית ${d.pattern}`;let p=s[d.format],m=p?.label??d.format,y=(p?.gender??"m")==="f"?"תקינה":"תקין";return`${m} לא ${y}`}case"not_multiple_of":return`מספר לא תקין: חייב להיות מכפלה של ${u.divisor}`;case"unrecognized_keys":return`מפתח${u.keys.length>1?"ות":""} לא מזוה${u.keys.length>1?"ים":"ה"}: ${N(u.keys,", ")}`;case"invalid_key":return"שדה לא תקין באובייקט";case"invalid_union":return"קלט לא תקין";case"invalid_element":return`ערך לא תקין ב${n(u.origin??"array")}`;default:return"קלט לא תקין"}}};function GI(){return{localeError:ane()}}var sne=()=>{let e={string:{unit:"znakova",verb:"imati"},file:{unit:"bajtova",verb:"imati"},array:{unit:"stavki",verb:"imati"},set:{unit:"stavki",verb:"imati"}};function t(n){return e[n]??null}let r={regex:"unos",email:"email adresa",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum i vrijeme",date:"ISO datum",time:"ISO vrijeme",duration:"ISO trajanje",ipv4:"IPv4 adresa",ipv6:"IPv6 adresa",cidrv4:"IPv4 raspon",cidrv6:"IPv6 raspon",base64:"base64 kodirani tekst",base64url:"base64url kodirani tekst",json_string:"JSON tekst",e164:"E.164 broj",jwt:"JWT",template_literal:"unos"},o={nan:"NaN",string:"tekst",number:"broj",boolean:"boolean",array:"niz",object:"objekt",set:"skup",file:"datoteka",date:"datum",bigint:"bigint",symbol:"simbol",undefined:"undefined",null:"null",function:"funkcija",map:"mapa"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Neispravan unos: očekuje se instanceof ${n.expected}, a primljeno je ${s}`;return`Neispravan unos: očekuje se ${i}, a primljeno je ${s}`}case"invalid_value":if(n.values.length===1)return`Neispravna vrijednost: očekivano ${Y(n.values[0])}`;return`Neispravna opcija: očekivano jedno od ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=o[n.origin]??n.origin;if(a)return`Preveliko: očekivano da ${s??"vrijednost"} ima ${i}${n.maximum.toString()} ${a.unit??"elemenata"}`;return`Preveliko: očekivano da ${s??"vrijednost"} bude ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=o[n.origin]??n.origin;if(a)return`Premalo: očekivano da ${s} ima ${i}${n.minimum.toString()} ${a.unit}`;return`Premalo: očekivano da ${s} bude ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neispravan tekst: mora započinjati s "${i.prefix}"`;if(i.format==="ends_with")return`Neispravan tekst: mora završavati s "${i.suffix}"`;if(i.format==="includes")return`Neispravan tekst: mora sadržavati "${i.includes}"`;if(i.format==="regex")return`Neispravan tekst: mora odgovarati uzorku ${i.pattern}`;return`Neispravna ${r[i.format]??n.format}`}case"not_multiple_of":return`Neispravan broj: mora biti višekratnik od ${n.divisor}`;case"unrecognized_keys":return`Neprepoznat${n.keys.length>1?"i ključevi":" ključ"}: ${N(n.keys,", ")}`;case"invalid_key":return`Neispravan ključ u ${o[n.origin]??n.origin}`;case"invalid_union":return"Neispravan unos";case"invalid_element":return`Neispravna vrijednost u ${o[n.origin]??n.origin}`;default:return"Neispravan unos"}}};function VI(){return{localeError:sne()}}var cne=()=>{let e={string:{unit:"karakter",verb:"legyen"},file:{unit:"byte",verb:"legyen"},array:{unit:"elem",verb:"legyen"},set:{unit:"elem",verb:"legyen"}};function t(n){return e[n]??null}let r={regex:"bemenet",email:"email cím",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO időbélyeg",date:"ISO dátum",time:"ISO idő",duration:"ISO időintervallum",ipv4:"IPv4 cím",ipv6:"IPv6 cím",cidrv4:"IPv4 tartomány",cidrv6:"IPv6 tartomány",base64:"base64-kódolt string",base64url:"base64url-kódolt string",json_string:"JSON string",e164:"E.164 szám",jwt:"JWT",template_literal:"bemenet"},o={nan:"NaN",number:"szám",array:"tömb"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Érvénytelen bemenet: a várt érték instanceof ${n.expected}, a kapott érték ${s}`;return`Érvénytelen bemenet: a várt érték ${i}, a kapott érték ${s}`}case"invalid_value":if(n.values.length===1)return`Érvénytelen bemenet: a várt érték ${Y(n.values[0])}`;return`Érvénytelen opció: valamelyik érték várt ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Túl nagy: ${n.origin??"érték"} mérete túl nagy ${i}${n.maximum.toString()} ${a.unit??"elem"}`;return`Túl nagy: a bemeneti érték ${n.origin??"érték"} túl nagy: ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Túl kicsi: a bemeneti érték ${n.origin} mérete túl kicsi ${i}${n.minimum.toString()} ${a.unit}`;return`Túl kicsi: a bemeneti érték ${n.origin} túl kicsi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Érvénytelen string: "${i.prefix}" értékkel kell kezdődnie`;if(i.format==="ends_with")return`Érvénytelen string: "${i.suffix}" értékkel kell végződnie`;if(i.format==="includes")return`Érvénytelen string: "${i.includes}" értéket kell tartalmaznia`;if(i.format==="regex")return`Érvénytelen string: ${i.pattern} mintának kell megfelelnie`;return`Érvénytelen ${r[i.format]??n.format}`}case"not_multiple_of":return`Érvénytelen szám: ${n.divisor} többszörösének kell lennie`;case"unrecognized_keys":return`Ismeretlen kulcs${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Érvénytelen kulcs ${n.origin}`;case"invalid_union":return"Érvénytelen bemenet";case"invalid_element":return`Érvénytelen érték: ${n.origin}`;default:return"Érvénytelen bemenet"}}};function ZI(){return{localeError:cne()}}function P4(e,t,r){return Math.abs(e)===1?t:r}function Jl(e){if(!e)return"";let t=["ա","ե","ը","ի","ո","ու","օ"],r=e[e.length-1];return e+(t.includes(r)?"ն":"ը")}var une=()=>{let e={string:{unit:{one:"նշան",many:"նշաններ"},verb:"ունենալ"},file:{unit:{one:"բայթ",many:"բայթեր"},verb:"ունենալ"},array:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"},set:{unit:{one:"տարր",many:"տարրեր"},verb:"ունենալ"}};function t(n){return e[n]??null}let r={regex:"մուտք",email:"էլ. հասցե",url:"URL",emoji:"էմոջի",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO ամսաթիվ և ժամ",date:"ISO ամսաթիվ",time:"ISO ժամ",duration:"ISO տևողություն",ipv4:"IPv4 հասցե",ipv6:"IPv6 հասցե",cidrv4:"IPv4 միջակայք",cidrv6:"IPv6 միջակայք",base64:"base64 ձևաչափով տող",base64url:"base64url ձևաչափով տող",json_string:"JSON տող",e164:"E.164 համար",jwt:"JWT",template_literal:"մուտք"},o={nan:"NaN",number:"թիվ",array:"զանգված"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Սխալ մուտքագրում․ սպասվում էր instanceof ${n.expected}, ստացվել է ${s}`;return`Սխալ մուտքագրում․ սպասվում էր ${i}, ստացվել է ${s}`}case"invalid_value":if(n.values.length===1)return`Սխալ մուտքագրում․ սպասվում էր ${Y(n.values[1])}`;return`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let s=Number(n.maximum),c=P4(s,a.unit.one,a.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${Jl(n.origin??"արժեք")} կունենա ${i}${n.maximum.toString()} ${c}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${Jl(n.origin??"արժեք")} լինի ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let s=Number(n.minimum),c=P4(s,a.unit.one,a.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${Jl(n.origin)} կունենա ${i}${n.minimum.toString()} ${c}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${Jl(n.origin)} լինի ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Սխալ տող․ պետք է սկսվի "${i.prefix}"-ով`;if(i.format==="ends_with")return`Սխալ տող․ պետք է ավարտվի "${i.suffix}"-ով`;if(i.format==="includes")return`Սխալ տող․ պետք է պարունակի "${i.includes}"`;if(i.format==="regex")return`Սխալ տող․ պետք է համապատասխանի ${i.pattern} ձևաչափին`;return`Սխալ ${r[i.format]??n.format}`}case"not_multiple_of":return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${n.divisor}-ի`;case"unrecognized_keys":return`Չճանաչված բանալի${n.keys.length>1?"ներ":""}. ${N(n.keys,", ")}`;case"invalid_key":return`Սխալ բանալի ${Jl(n.origin)}-ում`;case"invalid_union":return"Սխալ մուտքագրում";case"invalid_element":return`Սխալ արժեք ${Jl(n.origin)}-ում`;default:return"Սխալ մուտքագրում"}}};function WI(){return{localeError:une()}}var lne=()=>{let e={string:{unit:"karakter",verb:"memiliki"},file:{unit:"byte",verb:"memiliki"},array:{unit:"item",verb:"memiliki"},set:{unit:"item",verb:"memiliki"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tanggal dan waktu format ISO",date:"tanggal format ISO",time:"jam format ISO",duration:"durasi format ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"rentang alamat IPv4",cidrv6:"rentang alamat IPv6",base64:"string dengan enkode base64",base64url:"string dengan enkode base64url",json_string:"string JSON",e164:"angka E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Input tidak valid: diharapkan instanceof ${n.expected}, diterima ${s}`;return`Input tidak valid: diharapkan ${i}, diterima ${s}`}case"invalid_value":if(n.values.length===1)return`Input tidak valid: diharapkan ${Y(n.values[0])}`;return`Pilihan tidak valid: diharapkan salah satu dari ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Terlalu besar: diharapkan ${n.origin??"value"} memiliki ${i}${n.maximum.toString()} ${a.unit??"elemen"}`;return`Terlalu besar: diharapkan ${n.origin??"value"} menjadi ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Terlalu kecil: diharapkan ${n.origin} memiliki ${i}${n.minimum.toString()} ${a.unit}`;return`Terlalu kecil: diharapkan ${n.origin} menjadi ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak valid: harus dimulai dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak valid: harus berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak valid: harus menyertakan "${i.includes}"`;if(i.format==="regex")return`String tidak valid: harus sesuai pola ${i.pattern}`;return`${r[i.format]??n.format} tidak valid`}case"not_multiple_of":return`Angka tidak valid: harus kelipatan dari ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali ${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Kunci tidak valid di ${n.origin}`;case"invalid_union":return"Input tidak valid";case"invalid_element":return`Nilai tidak valid di ${n.origin}`;default:return"Input tidak valid"}}};function KI(){return{localeError:lne()}}var dne=()=>{let e={string:{unit:"stafi",verb:"að hafa"},file:{unit:"bæti",verb:"að hafa"},array:{unit:"hluti",verb:"að hafa"},set:{unit:"hluti",verb:"að hafa"}};function t(n){return e[n]??null}let r={regex:"gildi",email:"netfang",url:"vefslóð",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dagsetning og tími",date:"ISO dagsetning",time:"ISO tími",duration:"ISO tímalengd",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded strengur",base64url:"base64url-encoded strengur",json_string:"JSON strengur",e164:"E.164 tölugildi",jwt:"JWT",template_literal:"gildi"},o={nan:"NaN",number:"númer",array:"fylki"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Rangt gildi: Þú slóst inn ${s} þar sem á að vera instanceof ${n.expected}`;return`Rangt gildi: Þú slóst inn ${s} þar sem á að vera ${i}`}case"invalid_value":if(n.values.length===1)return`Rangt gildi: gert ráð fyrir ${Y(n.values[0])}`;return`Ógilt val: má vera eitt af eftirfarandi ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Of stórt: gert er ráð fyrir að ${n.origin??"gildi"} hafi ${i}${n.maximum.toString()} ${a.unit??"hluti"}`;return`Of stórt: gert er ráð fyrir að ${n.origin??"gildi"} sé ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Of lítið: gert er ráð fyrir að ${n.origin} hafi ${i}${n.minimum.toString()} ${a.unit}`;return`Of lítið: gert er ráð fyrir að ${n.origin} sé ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ógildur strengur: verður að byrja á "${i.prefix}"`;if(i.format==="ends_with")return`Ógildur strengur: verður að enda á "${i.suffix}"`;if(i.format==="includes")return`Ógildur strengur: verður að innihalda "${i.includes}"`;if(i.format==="regex")return`Ógildur strengur: verður að fylgja mynstri ${i.pattern}`;return`Rangt ${r[i.format]??n.format}`}case"not_multiple_of":return`Röng tala: verður að vera margfeldi af ${n.divisor}`;case"unrecognized_keys":return`Óþekkt ${n.keys.length>1?"ir lyklar":"ur lykill"}: ${N(n.keys,", ")}`;case"invalid_key":return`Rangur lykill í ${n.origin}`;case"invalid_union":return"Rangt gildi";case"invalid_element":return`Rangt gildi í ${n.origin}`;default:return"Rangt gildi"}}};function JI(){return{localeError:dne()}}var pne=()=>{let e={string:{unit:"caratteri",verb:"avere"},file:{unit:"byte",verb:"avere"},array:{unit:"elementi",verb:"avere"},set:{unit:"elementi",verb:"avere"}};function t(n){return e[n]??null}let r={regex:"input",email:"indirizzo email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e ora ISO",date:"data ISO",time:"ora ISO",duration:"durata ISO",ipv4:"indirizzo IPv4",ipv6:"indirizzo IPv6",cidrv4:"intervallo IPv4",cidrv6:"intervallo IPv6",base64:"stringa codificata in base64",base64url:"URL codificata in base64",json_string:"stringa JSON",e164:"numero E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"numero",array:"vettore"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Input non valido: atteso instanceof ${n.expected}, ricevuto ${s}`;return`Input non valido: atteso ${i}, ricevuto ${s}`}case"invalid_value":if(n.values.length===1)return`Input non valido: atteso ${Y(n.values[0])}`;return`Opzione non valida: atteso uno tra ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Troppo grande: ${n.origin??"valore"} deve avere ${i}${n.maximum.toString()} ${a.unit??"elementi"}`;return`Troppo grande: ${n.origin??"valore"} deve essere ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Troppo piccolo: ${n.origin} deve avere ${i}${n.minimum.toString()} ${a.unit}`;return`Troppo piccolo: ${n.origin} deve essere ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Stringa non valida: deve iniziare con "${i.prefix}"`;if(i.format==="ends_with")return`Stringa non valida: deve terminare con "${i.suffix}"`;if(i.format==="includes")return`Stringa non valida: deve includere "${i.includes}"`;if(i.format==="regex")return`Stringa non valida: deve corrispondere al pattern ${i.pattern}`;return`Input non valido: ${r[i.format]??n.format}`}case"not_multiple_of":return`Numero non valido: deve essere un multiplo di ${n.divisor}`;case"unrecognized_keys":return`Chiav${n.keys.length>1?"i":"e"} non riconosciut${n.keys.length>1?"e":"a"}: ${N(n.keys,", ")}`;case"invalid_key":return`Chiave non valida in ${n.origin}`;case"invalid_union":return"Input non valido";case"invalid_element":return`Valore non valido in ${n.origin}`;default:return"Input non valido"}}};function YI(){return{localeError:pne()}}var fne=()=>{let e={string:{unit:"文字",verb:"である"},file:{unit:"バイト",verb:"である"},array:{unit:"要素",verb:"である"},set:{unit:"要素",verb:"である"}};function t(n){return e[n]??null}let r={regex:"入力値",email:"メールアドレス",url:"URL",emoji:"絵文字",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日時",date:"ISO日付",time:"ISO時刻",duration:"ISO期間",ipv4:"IPv4アドレス",ipv6:"IPv6アドレス",cidrv4:"IPv4範囲",cidrv6:"IPv6範囲",base64:"base64エンコード文字列",base64url:"base64urlエンコード文字列",json_string:"JSON文字列",e164:"E.164番号",jwt:"JWT",template_literal:"入力値"},o={nan:"NaN",number:"数値",array:"配列"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`無効な入力: instanceof ${n.expected}が期待されましたが、${s}が入力されました`;return`無効な入力: ${i}が期待されましたが、${s}が入力されました`}case"invalid_value":if(n.values.length===1)return`無効な入力: ${Y(n.values[0])}が期待されました`;return`無効な選択: ${N(n.values,"、")}のいずれかである必要があります`;case"too_big":{let i=n.inclusive?"以下である":"より小さい",a=t(n.origin);if(a)return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${a.unit??"要素"}${i}必要があります`;return`大きすぎる値: ${n.origin??"値"}は${n.maximum.toString()}${i}必要があります`}case"too_small":{let i=n.inclusive?"以上である":"より大きい",a=t(n.origin);if(a)return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${a.unit}${i}必要があります`;return`小さすぎる値: ${n.origin}は${n.minimum.toString()}${i}必要があります`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`無効な文字列: "${i.prefix}"で始まる必要があります`;if(i.format==="ends_with")return`無効な文字列: "${i.suffix}"で終わる必要があります`;if(i.format==="includes")return`無効な文字列: "${i.includes}"を含む必要があります`;if(i.format==="regex")return`無効な文字列: パターン${i.pattern}に一致する必要があります`;return`無効な${r[i.format]??n.format}`}case"not_multiple_of":return`無効な数値: ${n.divisor}の倍数である必要があります`;case"unrecognized_keys":return`認識されていないキー${n.keys.length>1?"群":""}: ${N(n.keys,"、")}`;case"invalid_key":return`${n.origin}内の無効なキー`;case"invalid_union":return"無効な入力";case"invalid_element":return`${n.origin}内の無効な値`;default:return"無効な入力"}}};function QI(){return{localeError:fne()}}var mne=()=>{let e={string:{unit:"სიმბოლო",verb:"უნდა შეიცავდეს"},file:{unit:"ბაიტი",verb:"უნდა შეიცავდეს"},array:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"},set:{unit:"ელემენტი",verb:"უნდა შეიცავდეს"}};function t(n){return e[n]??null}let r={regex:"შეყვანა",email:"ელ-ფოსტის მისამართი",url:"URL",emoji:"ემოჯი",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"თარიღი-დრო",date:"თარიღი",time:"დრო",duration:"ხანგრძლივობა",ipv4:"IPv4 მისამართი",ipv6:"IPv6 მისამართი",cidrv4:"IPv4 დიაპაზონი",cidrv6:"IPv6 დიაპაზონი",base64:"base64-კოდირებული ველი",base64url:"base64url-კოდირებული ველი",json_string:"JSON ველი",e164:"E.164 ნომერი",jwt:"JWT",template_literal:"შეყვანა"},o={nan:"NaN",number:"რიცხვი",string:"ველი",boolean:"ბულეანი",function:"ფუნქცია",array:"მასივი"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`არასწორი შეყვანა: მოსალოდნელი instanceof ${n.expected}, მიღებული ${s}`;return`არასწორი შეყვანა: მოსალოდნელი ${i}, მიღებული ${s}`}case"invalid_value":if(n.values.length===1)return`არასწორი შეყვანა: მოსალოდნელი ${Y(n.values[0])}`;return`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${N(n.values,"|")}-დან`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit}`;return`ზედმეტად დიდი: მოსალოდნელი ${n.origin??"მნიშვნელობა"} იყოს ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`ზედმეტად პატარა: მოსალოდნელი ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`;return`ზედმეტად პატარა: მოსალოდნელი ${n.origin} იყოს ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`არასწორი ველი: უნდა იწყებოდეს "${i.prefix}"-ით`;if(i.format==="ends_with")return`არასწორი ველი: უნდა მთავრდებოდეს "${i.suffix}"-ით`;if(i.format==="includes")return`არასწორი ველი: უნდა შეიცავდეს "${i.includes}"-ს`;if(i.format==="regex")return`არასწორი ველი: უნდა შეესაბამებოდეს შაბლონს ${i.pattern}`;return`არასწორი ${r[i.format]??n.format}`}case"not_multiple_of":return`არასწორი რიცხვი: უნდა იყოს ${n.divisor}-ის ჯერადი`;case"unrecognized_keys":return`უცნობი გასაღებ${n.keys.length>1?"ები":"ი"}: ${N(n.keys,", ")}`;case"invalid_key":return`არასწორი გასაღები ${n.origin}-ში`;case"invalid_union":return"არასწორი შეყვანა";case"invalid_element":return`არასწორი მნიშვნელობა ${n.origin}-ში`;default:return"არასწორი შეყვანა"}}};function XI(){return{localeError:mne()}}var hne=()=>{let e={string:{unit:"តួអក្សរ",verb:"គួរមាន"},file:{unit:"បៃ",verb:"គួរមាន"},array:{unit:"ធាតុ",verb:"គួរមាន"},set:{unit:"ធាតុ",verb:"គួរមាន"}};function t(n){return e[n]??null}let r={regex:"ទិន្នន័យបញ្ចូល",email:"អាសយដ្ឋានអ៊ីមែល",url:"URL",emoji:"សញ្ញាអារម្មណ៍",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"កាលបរិច្ឆេទ និងម៉ោង ISO",date:"កាលបរិច្ឆេទ ISO",time:"ម៉ោង ISO",duration:"រយៈពេល ISO",ipv4:"អាសយដ្ឋាន IPv4",ipv6:"អាសយដ្ឋាន IPv6",cidrv4:"ដែនអាសយដ្ឋាន IPv4",cidrv6:"ដែនអាសយដ្ឋាន IPv6",base64:"ខ្សែអក្សរអ៊ិកូដ base64",base64url:"ខ្សែអក្សរអ៊ិកូដ base64url",json_string:"ខ្សែអក្សរ JSON",e164:"លេខ E.164",jwt:"JWT",template_literal:"ទិន្នន័យបញ្ចូល"},o={nan:"NaN",number:"លេខ",array:"អារេ (Array)",null:"គ្មានតម្លៃ (null)"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${n.expected} ប៉ុន្តែទទួលបាន ${s}`;return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${i} ប៉ុន្តែទទួលបាន ${s}`}case"invalid_value":if(n.values.length===1)return`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${Y(n.values[0])}`;return`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()} ${a.unit??"ធាតុ"}`;return`ធំពេក៖ ត្រូវការ ${n.origin??"តម្លៃ"} ${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()} ${a.unit}`;return`តូចពេក៖ ត្រូវការ ${n.origin} ${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${i.prefix}"`;if(i.format==="ends_with")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${i.suffix}"`;if(i.format==="includes")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${i.includes}"`;if(i.format==="regex")return`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${i.pattern}`;return`មិនត្រឹមត្រូវ៖ ${r[i.format]??n.format}`}case"not_multiple_of":return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${n.divisor}`;case"unrecognized_keys":return`រកឃើញសោមិនស្គាល់៖ ${N(n.keys,", ")}`;case"invalid_key":return`សោមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;case"invalid_union":return"ទិន្នន័យមិនត្រឹមត្រូវ";case"invalid_element":return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${n.origin}`;default:return"ទិន្នន័យមិនត្រឹមត្រូវ"}}};function jm(){return{localeError:hne()}}function eP(){return jm()}var gne=()=>{let e={string:{unit:"문자",verb:"to have"},file:{unit:"바이트",verb:"to have"},array:{unit:"개",verb:"to have"},set:{unit:"개",verb:"to have"}};function t(n){return e[n]??null}let r={regex:"입력",email:"이메일 주소",url:"URL",emoji:"이모지",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 날짜시간",date:"ISO 날짜",time:"ISO 시간",duration:"ISO 기간",ipv4:"IPv4 주소",ipv6:"IPv6 주소",cidrv4:"IPv4 범위",cidrv6:"IPv6 범위",base64:"base64 인코딩 문자열",base64url:"base64url 인코딩 문자열",json_string:"JSON 문자열",e164:"E.164 번호",jwt:"JWT",template_literal:"입력"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`잘못된 입력: 예상 타입은 instanceof ${n.expected}, 받은 타입은 ${s}입니다`;return`잘못된 입력: 예상 타입은 ${i}, 받은 타입은 ${s}입니다`}case"invalid_value":if(n.values.length===1)return`잘못된 입력: 값은 ${Y(n.values[0])} 이어야 합니다`;return`잘못된 옵션: ${N(n.values,"또는 ")} 중 하나여야 합니다`;case"too_big":{let i=n.inclusive?"이하":"미만",a=i==="미만"?"이어야 합니다":"여야 합니다",s=t(n.origin),c=s?.unit??"요소";if(s)return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()}${c} ${i}${a}`;return`${n.origin??"값"}이 너무 큽니다: ${n.maximum.toString()} ${i}${a}`}case"too_small":{let i=n.inclusive?"이상":"초과",a=i==="이상"?"이어야 합니다":"여야 합니다",s=t(n.origin),c=s?.unit??"요소";if(s)return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()}${c} ${i}${a}`;return`${n.origin??"값"}이 너무 작습니다: ${n.minimum.toString()} ${i}${a}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`잘못된 문자열: "${i.prefix}"(으)로 시작해야 합니다`;if(i.format==="ends_with")return`잘못된 문자열: "${i.suffix}"(으)로 끝나야 합니다`;if(i.format==="includes")return`잘못된 문자열: "${i.includes}"을(를) 포함해야 합니다`;if(i.format==="regex")return`잘못된 문자열: 정규식 ${i.pattern} 패턴과 일치해야 합니다`;return`잘못된 ${r[i.format]??n.format}`}case"not_multiple_of":return`잘못된 숫자: ${n.divisor}의 배수여야 합니다`;case"unrecognized_keys":return`인식할 수 없는 키: ${N(n.keys,", ")}`;case"invalid_key":return`잘못된 키: ${n.origin}`;case"invalid_union":return"잘못된 입력";case"invalid_element":return`잘못된 값: ${n.origin}`;default:return"잘못된 입력"}}};function tP(){return{localeError:gne()}}var Fm=(e)=>e.charAt(0).toUpperCase()+e.slice(1);function k4(e){let t=Math.abs(e),r=t%10,o=t%100;if(o>=11&&o<=19||r===0)return"many";if(r===1)return"one";return"few"}var yne=()=>{let e={string:{unit:{one:"simbolis",few:"simboliai",many:"simbolių"},verb:{smaller:{inclusive:"turi būti ne ilgesnė kaip",notInclusive:"turi būti trumpesnė kaip"},bigger:{inclusive:"turi būti ne trumpesnė kaip",notInclusive:"turi būti ilgesnė kaip"}}},file:{unit:{one:"baitas",few:"baitai",many:"baitų"},verb:{smaller:{inclusive:"turi būti ne didesnis kaip",notInclusive:"turi būti mažesnis kaip"},bigger:{inclusive:"turi būti ne mažesnis kaip",notInclusive:"turi būti didesnis kaip"}}},array:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}},set:{unit:{one:"elementą",few:"elementus",many:"elementų"},verb:{smaller:{inclusive:"turi turėti ne daugiau kaip",notInclusive:"turi turėti mažiau kaip"},bigger:{inclusive:"turi turėti ne mažiau kaip",notInclusive:"turi turėti daugiau kaip"}}}};function t(n,i,a,s){let c=e[n]??null;if(c===null)return c;return{unit:c.unit[i],verb:c.verb[s][a?"inclusive":"notInclusive"]}}let r={regex:"įvestis",email:"el. pašto adresas",url:"URL",emoji:"jaustukas",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO data ir laikas",date:"ISO data",time:"ISO laikas",duration:"ISO trukmė",ipv4:"IPv4 adresas",ipv6:"IPv6 adresas",cidrv4:"IPv4 tinklo prefiksas (CIDR)",cidrv6:"IPv6 tinklo prefiksas (CIDR)",base64:"base64 užkoduota eilutė",base64url:"base64url užkoduota eilutė",json_string:"JSON eilutė",e164:"E.164 numeris",jwt:"JWT",template_literal:"įvestis"},o={nan:"NaN",number:"skaičius",bigint:"sveikasis skaičius",string:"eilutė",boolean:"loginė reikšmė",undefined:"neapibrėžta reikšmė",function:"funkcija",symbol:"simbolis",array:"masyvas",object:"objektas",null:"nulinė reikšmė"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Gautas tipas ${s}, o tikėtasi - instanceof ${n.expected}`;return`Gautas tipas ${s}, o tikėtasi - ${i}`}case"invalid_value":if(n.values.length===1)return`Privalo būti ${Y(n.values[0])}`;return`Privalo būti vienas iš ${N(n.values,"|")} pasirinkimų`;case"too_big":{let i=o[n.origin]??n.origin,a=t(n.origin,k4(Number(n.maximum)),n.inclusive??!1,"smaller");if(a?.verb)return`${Fm(i??n.origin??"reikšmė")} ${a.verb} ${n.maximum.toString()} ${a.unit??"elementų"}`;let s=n.inclusive?"ne didesnis kaip":"mažesnis kaip";return`${Fm(i??n.origin??"reikšmė")} turi būti ${s} ${n.maximum.toString()} ${a?.unit}`}case"too_small":{let i=o[n.origin]??n.origin,a=t(n.origin,k4(Number(n.minimum)),n.inclusive??!1,"bigger");if(a?.verb)return`${Fm(i??n.origin??"reikšmė")} ${a.verb} ${n.minimum.toString()} ${a.unit??"elementų"}`;let s=n.inclusive?"ne mažesnis kaip":"didesnis kaip";return`${Fm(i??n.origin??"reikšmė")} turi būti ${s} ${n.minimum.toString()} ${a?.unit}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Eilutė privalo prasidėti "${i.prefix}"`;if(i.format==="ends_with")return`Eilutė privalo pasibaigti "${i.suffix}"`;if(i.format==="includes")return`Eilutė privalo įtraukti "${i.includes}"`;if(i.format==="regex")return`Eilutė privalo atitikti ${i.pattern}`;return`Neteisingas ${r[i.format]??n.format}`}case"not_multiple_of":return`Skaičius privalo būti ${n.divisor} kartotinis.`;case"unrecognized_keys":return`Neatpažint${n.keys.length>1?"i":"as"} rakt${n.keys.length>1?"ai":"as"}: ${N(n.keys,", ")}`;case"invalid_key":return"Rastas klaidingas raktas";case"invalid_union":return"Klaidinga įvestis";case"invalid_element":{let i=o[n.origin]??n.origin;return`${Fm(i??n.origin??"reikšmė")} turi klaidingą įvestį`}default:return"Klaidinga įvestis"}}};function rP(){return{localeError:yne()}}var bne=()=>{let e={string:{unit:"знаци",verb:"да имаат"},file:{unit:"бајти",verb:"да имаат"},array:{unit:"ставки",verb:"да имаат"},set:{unit:"ставки",verb:"да имаат"}};function t(n){return e[n]??null}let r={regex:"внес",email:"адреса на е-пошта",url:"URL",emoji:"емоџи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO датум и време",date:"ISO датум",time:"ISO време",duration:"ISO времетраење",ipv4:"IPv4 адреса",ipv6:"IPv6 адреса",cidrv4:"IPv4 опсег",cidrv6:"IPv6 опсег",base64:"base64-енкодирана низа",base64url:"base64url-енкодирана низа",json_string:"JSON низа",e164:"E.164 број",jwt:"JWT",template_literal:"внес"},o={nan:"NaN",number:"број",array:"низа"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Грешен внес: се очекува instanceof ${n.expected}, примено ${s}`;return`Грешен внес: се очекува ${i}, примено ${s}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${Y(n.values[0])}`;return`Грешана опција: се очекува една ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Премногу голем: се очекува ${n.origin??"вредноста"} да има ${i}${n.maximum.toString()} ${a.unit??"елементи"}`;return`Премногу голем: се очекува ${n.origin??"вредноста"} да биде ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Премногу мал: се очекува ${n.origin} да има ${i}${n.minimum.toString()} ${a.unit}`;return`Премногу мал: се очекува ${n.origin} да биде ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неважечка низа: мора да започнува со "${i.prefix}"`;if(i.format==="ends_with")return`Неважечка низа: мора да завршува со "${i.suffix}"`;if(i.format==="includes")return`Неважечка низа: мора да вклучува "${i.includes}"`;if(i.format==="regex")return`Неважечка низа: мора да одгоара на патернот ${i.pattern}`;return`Invalid ${r[i.format]??n.format}`}case"not_multiple_of":return`Грешен број: мора да биде делив со ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Непрепознаени клучеви":"Непрепознаен клуч"}: ${N(n.keys,", ")}`;case"invalid_key":return`Грешен клуч во ${n.origin}`;case"invalid_union":return"Грешен внес";case"invalid_element":return`Грешна вредност во ${n.origin}`;default:return"Грешен внес"}}};function nP(){return{localeError:bne()}}var xne=()=>{let e={string:{unit:"aksara",verb:"mempunyai"},file:{unit:"bait",verb:"mempunyai"},array:{unit:"elemen",verb:"mempunyai"},set:{unit:"elemen",verb:"mempunyai"}};function t(n){return e[n]??null}let r={regex:"input",email:"alamat e-mel",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"tarikh masa ISO",date:"tarikh ISO",time:"masa ISO",duration:"tempoh ISO",ipv4:"alamat IPv4",ipv6:"alamat IPv6",cidrv4:"julat IPv4",cidrv6:"julat IPv6",base64:"string dikodkan base64",base64url:"string dikodkan base64url",json_string:"string JSON",e164:"nombor E.164",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"nombor"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Input tidak sah: dijangka instanceof ${n.expected}, diterima ${s}`;return`Input tidak sah: dijangka ${i}, diterima ${s}`}case"invalid_value":if(n.values.length===1)return`Input tidak sah: dijangka ${Y(n.values[0])}`;return`Pilihan tidak sah: dijangka salah satu daripada ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Terlalu besar: dijangka ${n.origin??"nilai"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elemen"}`;return`Terlalu besar: dijangka ${n.origin??"nilai"} adalah ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Terlalu kecil: dijangka ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`;return`Terlalu kecil: dijangka ${n.origin} adalah ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`String tidak sah: mesti bermula dengan "${i.prefix}"`;if(i.format==="ends_with")return`String tidak sah: mesti berakhir dengan "${i.suffix}"`;if(i.format==="includes")return`String tidak sah: mesti mengandungi "${i.includes}"`;if(i.format==="regex")return`String tidak sah: mesti sepadan dengan corak ${i.pattern}`;return`${r[i.format]??n.format} tidak sah`}case"not_multiple_of":return`Nombor tidak sah: perlu gandaan ${n.divisor}`;case"unrecognized_keys":return`Kunci tidak dikenali: ${N(n.keys,", ")}`;case"invalid_key":return`Kunci tidak sah dalam ${n.origin}`;case"invalid_union":return"Input tidak sah";case"invalid_element":return`Nilai tidak sah dalam ${n.origin}`;default:return"Input tidak sah"}}};function oP(){return{localeError:xne()}}var vne=()=>{let e={string:{unit:"tekens",verb:"heeft"},file:{unit:"bytes",verb:"heeft"},array:{unit:"elementen",verb:"heeft"},set:{unit:"elementen",verb:"heeft"}};function t(n){return e[n]??null}let r={regex:"invoer",email:"emailadres",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum en tijd",date:"ISO datum",time:"ISO tijd",duration:"ISO duur",ipv4:"IPv4-adres",ipv6:"IPv6-adres",cidrv4:"IPv4-bereik",cidrv6:"IPv6-bereik",base64:"base64-gecodeerde tekst",base64url:"base64 URL-gecodeerde tekst",json_string:"JSON string",e164:"E.164-nummer",jwt:"JWT",template_literal:"invoer"},o={nan:"NaN",number:"getal"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Ongeldige invoer: verwacht instanceof ${n.expected}, ontving ${s}`;return`Ongeldige invoer: verwacht ${i}, ontving ${s}`}case"invalid_value":if(n.values.length===1)return`Ongeldige invoer: verwacht ${Y(n.values[0])}`;return`Ongeldige optie: verwacht één van ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin),s=n.origin==="date"?"laat":n.origin==="string"?"lang":"groot";if(a)return`Te ${s}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} ${a.unit??"elementen"} ${a.verb}`;return`Te ${s}: verwacht dat ${n.origin??"waarde"} ${i}${n.maximum.toString()} is`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin),s=n.origin==="date"?"vroeg":n.origin==="string"?"kort":"klein";if(a)return`Te ${s}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ${a.verb}`;return`Te ${s}: verwacht dat ${n.origin} ${i}${n.minimum.toString()} is`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ongeldige tekst: moet met "${i.prefix}" beginnen`;if(i.format==="ends_with")return`Ongeldige tekst: moet op "${i.suffix}" eindigen`;if(i.format==="includes")return`Ongeldige tekst: moet "${i.includes}" bevatten`;if(i.format==="regex")return`Ongeldige tekst: moet overeenkomen met patroon ${i.pattern}`;return`Ongeldig: ${r[i.format]??n.format}`}case"not_multiple_of":return`Ongeldig getal: moet een veelvoud van ${n.divisor} zijn`;case"unrecognized_keys":return`Onbekende key${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Ongeldige key in ${n.origin}`;case"invalid_union":return"Ongeldige invoer";case"invalid_element":return`Ongeldige waarde in ${n.origin}`;default:return"Ongeldige invoer"}}};function iP(){return{localeError:vne()}}var _ne=()=>{let e={string:{unit:"tegn",verb:"å ha"},file:{unit:"bytes",verb:"å ha"},array:{unit:"elementer",verb:"å inneholde"},set:{unit:"elementer",verb:"å inneholde"}};function t(n){return e[n]??null}let r={regex:"input",email:"e-postadresse",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO dato- og klokkeslett",date:"ISO-dato",time:"ISO-klokkeslett",duration:"ISO-varighet",ipv4:"IPv4-område",ipv6:"IPv6-område",cidrv4:"IPv4-spekter",cidrv6:"IPv6-spekter",base64:"base64-enkodet streng",base64url:"base64url-enkodet streng",json_string:"JSON-streng",e164:"E.164-nummer",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"tall",array:"liste"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Ugyldig input: forventet instanceof ${n.expected}, fikk ${s}`;return`Ugyldig input: forventet ${i}, fikk ${s}`}case"invalid_value":if(n.values.length===1)return`Ugyldig verdi: forventet ${Y(n.values[0])}`;return`Ugyldig valg: forventet en av ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()} ${a.unit??"elementer"}`;return`For stor(t): forventet ${n.origin??"value"} til å ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()} ${a.unit}`;return`For lite(n): forventet ${n.origin} til å ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ugyldig streng: må starte med "${i.prefix}"`;if(i.format==="ends_with")return`Ugyldig streng: må ende med "${i.suffix}"`;if(i.format==="includes")return`Ugyldig streng: må inneholde "${i.includes}"`;if(i.format==="regex")return`Ugyldig streng: må matche mønsteret ${i.pattern}`;return`Ugyldig ${r[i.format]??n.format}`}case"not_multiple_of":return`Ugyldig tall: må være et multiplum av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Ukjente nøkler":"Ukjent nøkkel"}: ${N(n.keys,", ")}`;case"invalid_key":return`Ugyldig nøkkel i ${n.origin}`;case"invalid_union":return"Ugyldig input";case"invalid_element":return`Ugyldig verdi i ${n.origin}`;default:return"Ugyldig input"}}};function aP(){return{localeError:_ne()}}var wne=()=>{let e={string:{unit:"harf",verb:"olmalıdır"},file:{unit:"bayt",verb:"olmalıdır"},array:{unit:"unsur",verb:"olmalıdır"},set:{unit:"unsur",verb:"olmalıdır"}};function t(n){return e[n]??null}let r={regex:"giren",email:"epostagâh",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO hengâmı",date:"ISO tarihi",time:"ISO zamanı",duration:"ISO müddeti",ipv4:"IPv4 nişânı",ipv6:"IPv6 nişânı",cidrv4:"IPv4 menzili",cidrv6:"IPv6 menzili",base64:"base64-şifreli metin",base64url:"base64url-şifreli metin",json_string:"JSON metin",e164:"E.164 sayısı",jwt:"JWT",template_literal:"giren"},o={nan:"NaN",number:"numara",array:"saf",null:"gayb"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Fâsit giren: umulan instanceof ${n.expected}, alınan ${s}`;return`Fâsit giren: umulan ${i}, alınan ${s}`}case"invalid_value":if(n.values.length===1)return`Fâsit giren: umulan ${Y(n.values[0])}`;return`Fâsit tercih: mûteberler ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} ${a.unit??"elements"} sahip olmalıydı.`;return`Fazla büyük: ${n.origin??"value"}, ${i}${n.maximum.toString()} olmalıydı.`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} ${a.unit} sahip olmalıydı.`;return`Fazla küçük: ${n.origin}, ${i}${n.minimum.toString()} olmalıydı.`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Fâsit metin: "${i.prefix}" ile başlamalı.`;if(i.format==="ends_with")return`Fâsit metin: "${i.suffix}" ile bitmeli.`;if(i.format==="includes")return`Fâsit metin: "${i.includes}" ihtivâ etmeli.`;if(i.format==="regex")return`Fâsit metin: ${i.pattern} nakşına uymalı.`;return`Fâsit ${r[i.format]??n.format}`}case"not_multiple_of":return`Fâsit sayı: ${n.divisor} katı olmalıydı.`;case"unrecognized_keys":return`Tanınmayan anahtar ${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} için tanınmayan anahtar var.`;case"invalid_union":return"Giren tanınamadı.";case"invalid_element":return`${n.origin} için tanınmayan kıymet var.`;default:return"Kıymet tanınamadı."}}};function sP(){return{localeError:wne()}}var Sne=()=>{let e={string:{unit:"توکي",verb:"ولري"},file:{unit:"بایټس",verb:"ولري"},array:{unit:"توکي",verb:"ولري"},set:{unit:"توکي",verb:"ولري"}};function t(n){return e[n]??null}let r={regex:"ورودي",email:"بریښنالیک",url:"یو آر ال",emoji:"ایموجي",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"نیټه او وخت",date:"نېټه",time:"وخت",duration:"موده",ipv4:"د IPv4 پته",ipv6:"د IPv6 پته",cidrv4:"د IPv4 ساحه",cidrv6:"د IPv6 ساحه",base64:"base64-encoded متن",base64url:"base64url-encoded متن",json_string:"JSON متن",e164:"د E.164 شمېره",jwt:"JWT",template_literal:"ورودي"},o={nan:"NaN",number:"عدد",array:"ارې"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`ناسم ورودي: باید instanceof ${n.expected} وای, مګر ${s} ترلاسه شو`;return`ناسم ورودي: باید ${i} وای, مګر ${s} ترلاسه شو`}case"invalid_value":if(n.values.length===1)return`ناسم ورودي: باید ${Y(n.values[0])} وای`;return`ناسم انتخاب: باید یو له ${N(n.values,"|")} څخه وای`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} ${a.unit??"عنصرونه"} ولري`;return`ډیر لوی: ${n.origin??"ارزښت"} باید ${i}${n.maximum.toString()} وي`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} ${a.unit} ولري`;return`ډیر کوچنی: ${n.origin} باید ${i}${n.minimum.toString()} وي`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`ناسم متن: باید د "${i.prefix}" سره پیل شي`;if(i.format==="ends_with")return`ناسم متن: باید د "${i.suffix}" سره پای ته ورسيږي`;if(i.format==="includes")return`ناسم متن: باید "${i.includes}" ولري`;if(i.format==="regex")return`ناسم متن: باید د ${i.pattern} سره مطابقت ولري`;return`${r[i.format]??n.format} ناسم دی`}case"not_multiple_of":return`ناسم عدد: باید د ${n.divisor} مضرب وي`;case"unrecognized_keys":return`ناسم ${n.keys.length>1?"کلیډونه":"کلیډ"}: ${N(n.keys,", ")}`;case"invalid_key":return`ناسم کلیډ په ${n.origin} کې`;case"invalid_union":return"ناسمه ورودي";case"invalid_element":return`ناسم عنصر په ${n.origin} کې`;default:return"ناسمه ورودي"}}};function cP(){return{localeError:Sne()}}var Tne=()=>{let e={string:{unit:"znaków",verb:"mieć"},file:{unit:"bajtów",verb:"mieć"},array:{unit:"elementów",verb:"mieć"},set:{unit:"elementów",verb:"mieć"}};function t(n){return e[n]??null}let r={regex:"wyrażenie",email:"adres email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data i godzina w formacie ISO",date:"data w formacie ISO",time:"godzina w formacie ISO",duration:"czas trwania ISO",ipv4:"adres IPv4",ipv6:"adres IPv6",cidrv4:"zakres IPv4",cidrv6:"zakres IPv6",base64:"ciąg znaków zakodowany w formacie base64",base64url:"ciąg znaków zakodowany w formacie base64url",json_string:"ciąg znaków w formacie JSON",e164:"liczba E.164",jwt:"JWT",template_literal:"wejście"},o={nan:"NaN",number:"liczba",array:"tablica"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${n.expected}, otrzymano ${s}`;return`Nieprawidłowe dane wejściowe: oczekiwano ${i}, otrzymano ${s}`}case"invalid_value":if(n.values.length===1)return`Nieprawidłowe dane wejściowe: oczekiwano ${Y(n.values[0])}`;return`Nieprawidłowa opcja: oczekiwano jednej z wartości ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Za duża wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.maximum.toString()} ${a.unit??"elementów"}`;return`Zbyt duż(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Za mała wartość: oczekiwano, że ${n.origin??"wartość"} będzie mieć ${i}${n.minimum.toString()} ${a.unit??"elementów"}`;return`Zbyt mał(y/a/e): oczekiwano, że ${n.origin??"wartość"} będzie wynosić ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Nieprawidłowy ciąg znaków: musi zaczynać się od "${i.prefix}"`;if(i.format==="ends_with")return`Nieprawidłowy ciąg znaków: musi kończyć się na "${i.suffix}"`;if(i.format==="includes")return`Nieprawidłowy ciąg znaków: musi zawierać "${i.includes}"`;if(i.format==="regex")return`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${i.pattern}`;return`Nieprawidłow(y/a/e) ${r[i.format]??n.format}`}case"not_multiple_of":return`Nieprawidłowa liczba: musi być wielokrotnością ${n.divisor}`;case"unrecognized_keys":return`Nierozpoznane klucze${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Nieprawidłowy klucz w ${n.origin}`;case"invalid_union":return"Nieprawidłowe dane wejściowe";case"invalid_element":return`Nieprawidłowa wartość w ${n.origin}`;default:return"Nieprawidłowe dane wejściowe"}}};function uP(){return{localeError:Tne()}}var Ene=()=>{let e={string:{unit:"caracteres",verb:"ter"},file:{unit:"bytes",verb:"ter"},array:{unit:"itens",verb:"ter"},set:{unit:"itens",verb:"ter"}};function t(n){return e[n]??null}let r={regex:"padrão",email:"endereço de e-mail",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"data e hora ISO",date:"data ISO",time:"hora ISO",duration:"duração ISO",ipv4:"endereço IPv4",ipv6:"endereço IPv6",cidrv4:"faixa de IPv4",cidrv6:"faixa de IPv6",base64:"texto codificado em base64",base64url:"URL codificada em base64",json_string:"texto JSON",e164:"número E.164",jwt:"JWT",template_literal:"entrada"},o={nan:"NaN",number:"número",null:"nulo"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Tipo inválido: esperado instanceof ${n.expected}, recebido ${s}`;return`Tipo inválido: esperado ${i}, recebido ${s}`}case"invalid_value":if(n.values.length===1)return`Entrada inválida: esperado ${Y(n.values[0])}`;return`Opção inválida: esperada uma das ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Muito grande: esperado que ${n.origin??"valor"} tivesse ${i}${n.maximum.toString()} ${a.unit??"elementos"}`;return`Muito grande: esperado que ${n.origin??"valor"} fosse ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Muito pequeno: esperado que ${n.origin} tivesse ${i}${n.minimum.toString()} ${a.unit}`;return`Muito pequeno: esperado que ${n.origin} fosse ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Texto inválido: deve começar com "${i.prefix}"`;if(i.format==="ends_with")return`Texto inválido: deve terminar com "${i.suffix}"`;if(i.format==="includes")return`Texto inválido: deve incluir "${i.includes}"`;if(i.format==="regex")return`Texto inválido: deve corresponder ao padrão ${i.pattern}`;return`${r[i.format]??n.format} inválido`}case"not_multiple_of":return`Número inválido: deve ser múltiplo de ${n.divisor}`;case"unrecognized_keys":return`Chave${n.keys.length>1?"s":""} desconhecida${n.keys.length>1?"s":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Chave inválida em ${n.origin}`;case"invalid_union":return"Entrada inválida";case"invalid_element":return`Valor inválido em ${n.origin}`;default:return"Campo inválido"}}};function lP(){return{localeError:Ene()}}var Ine=()=>{let e={string:{unit:"caractere",verb:"să aibă"},file:{unit:"octeți",verb:"să aibă"},array:{unit:"elemente",verb:"să aibă"},set:{unit:"elemente",verb:"să aibă"},map:{unit:"intrări",verb:"să aibă"}};function t(n){return e[n]??null}let r={regex:"intrare",email:"adresă de email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"dată și oră ISO",date:"dată ISO",time:"oră ISO",duration:"durată ISO",ipv4:"adresă IPv4",ipv6:"adresă IPv6",mac:"adresă MAC",cidrv4:"interval IPv4",cidrv6:"interval IPv6",base64:"șir codat base64",base64url:"șir codat base64url",json_string:"șir JSON",e164:"număr E.164",jwt:"JWT",template_literal:"intrare"},o={nan:"NaN",string:"șir",number:"număr",boolean:"boolean",function:"funcție",array:"matrice",object:"obiect",undefined:"nedefinit",symbol:"simbol",bigint:"număr mare",void:"void",never:"never",map:"hartă",set:"set"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;return`Intrare invalidă: așteptat ${i}, primit ${s}`}case"invalid_value":if(n.values.length===1)return`Intrare invalidă: așteptat ${Y(n.values[0])}`;return`Opțiune invalidă: așteptat una dintre ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Prea mare: așteptat ca ${n.origin??"valoarea"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"elemente"}`;return`Prea mare: așteptat ca ${n.origin??"valoarea"} să fie ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Prea mic: așteptat ca ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`;return`Prea mic: așteptat ca ${n.origin} să fie ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Șir invalid: trebuie să înceapă cu "${i.prefix}"`;if(i.format==="ends_with")return`Șir invalid: trebuie să se termine cu "${i.suffix}"`;if(i.format==="includes")return`Șir invalid: trebuie să includă "${i.includes}"`;if(i.format==="regex")return`Șir invalid: trebuie să se potrivească cu modelul ${i.pattern}`;return`Format invalid: ${r[i.format]??n.format}`}case"not_multiple_of":return`Număr invalid: trebuie să fie multiplu de ${n.divisor}`;case"unrecognized_keys":return`Chei nerecunoscute: ${N(n.keys,", ")}`;case"invalid_key":return`Cheie invalidă în ${n.origin}`;case"invalid_union":return"Intrare invalidă";case"invalid_element":return`Valoare invalidă în ${n.origin}`;default:return"Intrare invalidă"}}};function dP(){return{localeError:Ine()}}function A4(e,t,r,o){let n=Math.abs(e),i=n%10,a=n%100;if(a>=11&&a<=19)return o;if(i===1)return t;if(i>=2&&i<=4)return r;return o}var Pne=()=>{let e={string:{unit:{one:"символ",few:"символа",many:"символов"},verb:"иметь"},file:{unit:{one:"байт",few:"байта",many:"байт"},verb:"иметь"},array:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"},set:{unit:{one:"элемент",few:"элемента",many:"элементов"},verb:"иметь"}};function t(n){return e[n]??null}let r={regex:"ввод",email:"email адрес",url:"URL",emoji:"эмодзи",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO дата и время",date:"ISO дата",time:"ISO время",duration:"ISO длительность",ipv4:"IPv4 адрес",ipv6:"IPv6 адрес",cidrv4:"IPv4 диапазон",cidrv6:"IPv6 диапазон",base64:"строка в формате base64",base64url:"строка в формате base64url",json_string:"JSON строка",e164:"номер E.164",jwt:"JWT",template_literal:"ввод"},o={nan:"NaN",number:"число",array:"массив"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Неверный ввод: ожидалось instanceof ${n.expected}, получено ${s}`;return`Неверный ввод: ожидалось ${i}, получено ${s}`}case"invalid_value":if(n.values.length===1)return`Неверный ввод: ожидалось ${Y(n.values[0])}`;return`Неверный вариант: ожидалось одно из ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a){let s=Number(n.maximum),c=A4(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет иметь ${i}${n.maximum.toString()} ${c}`}return`Слишком большое значение: ожидалось, что ${n.origin??"значение"} будет ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a){let s=Number(n.minimum),c=A4(s,a.unit.one,a.unit.few,a.unit.many);return`Слишком маленькое значение: ожидалось, что ${n.origin} будет иметь ${i}${n.minimum.toString()} ${c}`}return`Слишком маленькое значение: ожидалось, что ${n.origin} будет ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неверная строка: должна начинаться с "${i.prefix}"`;if(i.format==="ends_with")return`Неверная строка: должна заканчиваться на "${i.suffix}"`;if(i.format==="includes")return`Неверная строка: должна содержать "${i.includes}"`;if(i.format==="regex")return`Неверная строка: должна соответствовать шаблону ${i.pattern}`;return`Неверный ${r[i.format]??n.format}`}case"not_multiple_of":return`Неверное число: должно быть кратным ${n.divisor}`;case"unrecognized_keys":return`Нераспознанн${n.keys.length>1?"ые":"ый"} ключ${n.keys.length>1?"и":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Неверный ключ в ${n.origin}`;case"invalid_union":return"Неверные входные данные";case"invalid_element":return`Неверное значение в ${n.origin}`;default:return"Неверные входные данные"}}};function pP(){return{localeError:Pne()}}var kne=()=>{let e={string:{unit:"znakov",verb:"imeti"},file:{unit:"bajtov",verb:"imeti"},array:{unit:"elementov",verb:"imeti"},set:{unit:"elementov",verb:"imeti"}};function t(n){return e[n]??null}let r={regex:"vnos",email:"e-poštni naslov",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datum in čas",date:"ISO datum",time:"ISO čas",duration:"ISO trajanje",ipv4:"IPv4 naslov",ipv6:"IPv6 naslov",cidrv4:"obseg IPv4",cidrv6:"obseg IPv6",base64:"base64 kodiran niz",base64url:"base64url kodiran niz",json_string:"JSON niz",e164:"E.164 številka",jwt:"JWT",template_literal:"vnos"},o={nan:"NaN",number:"število",array:"tabela"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Neveljaven vnos: pričakovano instanceof ${n.expected}, prejeto ${s}`;return`Neveljaven vnos: pričakovano ${i}, prejeto ${s}`}case"invalid_value":if(n.values.length===1)return`Neveljaven vnos: pričakovano ${Y(n.values[0])}`;return`Neveljavna možnost: pričakovano eno izmed ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} imelo ${i}${n.maximum.toString()} ${a.unit??"elementov"}`;return`Preveliko: pričakovano, da bo ${n.origin??"vrednost"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Premajhno: pričakovano, da bo ${n.origin} imelo ${i}${n.minimum.toString()} ${a.unit}`;return`Premajhno: pričakovano, da bo ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Neveljaven niz: mora se začeti z "${i.prefix}"`;if(i.format==="ends_with")return`Neveljaven niz: mora se končati z "${i.suffix}"`;if(i.format==="includes")return`Neveljaven niz: mora vsebovati "${i.includes}"`;if(i.format==="regex")return`Neveljaven niz: mora ustrezati vzorcu ${i.pattern}`;return`Neveljaven ${r[i.format]??n.format}`}case"not_multiple_of":return`Neveljavno število: mora biti večkratnik ${n.divisor}`;case"unrecognized_keys":return`Neprepoznan${n.keys.length>1?"i ključi":" ključ"}: ${N(n.keys,", ")}`;case"invalid_key":return`Neveljaven ključ v ${n.origin}`;case"invalid_union":return"Neveljaven vnos";case"invalid_element":return`Neveljavna vrednost v ${n.origin}`;default:return"Neveljaven vnos"}}};function fP(){return{localeError:kne()}}var Ane=()=>{let e={string:{unit:"tecken",verb:"att ha"},file:{unit:"bytes",verb:"att ha"},array:{unit:"objekt",verb:"att innehålla"},set:{unit:"objekt",verb:"att innehålla"}};function t(n){return e[n]??null}let r={regex:"reguljärt uttryck",email:"e-postadress",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO-datum och tid",date:"ISO-datum",time:"ISO-tid",duration:"ISO-varaktighet",ipv4:"IPv4-intervall",ipv6:"IPv6-intervall",cidrv4:"IPv4-spektrum",cidrv6:"IPv6-spektrum",base64:"base64-kodad sträng",base64url:"base64url-kodad sträng",json_string:"JSON-sträng",e164:"E.164-nummer",jwt:"JWT",template_literal:"mall-literal"},o={nan:"NaN",number:"antal",array:"lista"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Ogiltig inmatning: förväntat instanceof ${n.expected}, fick ${s}`;return`Ogiltig inmatning: förväntat ${i}, fick ${s}`}case"invalid_value":if(n.values.length===1)return`Ogiltig inmatning: förväntat ${Y(n.values[0])}`;return`Ogiltigt val: förväntade en av ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`För stor(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()} ${a.unit??"element"}`;return`För stor(t): förväntat ${n.origin??"värdet"} att ha ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()} ${a.unit}`;return`För lite(t): förväntade ${n.origin??"värdet"} att ha ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ogiltig sträng: måste börja med "${i.prefix}"`;if(i.format==="ends_with")return`Ogiltig sträng: måste sluta med "${i.suffix}"`;if(i.format==="includes")return`Ogiltig sträng: måste innehålla "${i.includes}"`;if(i.format==="regex")return`Ogiltig sträng: måste matcha mönstret "${i.pattern}"`;return`Ogiltig(t) ${r[i.format]??n.format}`}case"not_multiple_of":return`Ogiltigt tal: måste vara en multipel av ${n.divisor}`;case"unrecognized_keys":return`${n.keys.length>1?"Okända nycklar":"Okänd nyckel"}: ${N(n.keys,", ")}`;case"invalid_key":return`Ogiltig nyckel i ${n.origin??"värdet"}`;case"invalid_union":return"Ogiltig input";case"invalid_element":return`Ogiltigt värde i ${n.origin??"värdet"}`;default:return"Ogiltig input"}}};function mP(){return{localeError:Ane()}}var Rne=()=>{let e={string:{unit:"எழுத்துக்கள்",verb:"கொண்டிருக்க வேண்டும்"},file:{unit:"பைட்டுகள்",verb:"கொண்டிருக்க வேண்டும்"},array:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"},set:{unit:"உறுப்புகள்",verb:"கொண்டிருக்க வேண்டும்"}};function t(n){return e[n]??null}let r={regex:"உள்ளீடு",email:"மின்னஞ்சல் முகவரி",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO தேதி நேரம்",date:"ISO தேதி",time:"ISO நேரம்",duration:"ISO கால அளவு",ipv4:"IPv4 முகவரி",ipv6:"IPv6 முகவரி",cidrv4:"IPv4 வரம்பு",cidrv6:"IPv6 வரம்பு",base64:"base64-encoded சரம்",base64url:"base64url-encoded சரம்",json_string:"JSON சரம்",e164:"E.164 எண்",jwt:"JWT",template_literal:"input"},o={nan:"NaN",number:"எண்",array:"அணி",null:"வெறுமை"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${n.expected}, பெறப்பட்டது ${s}`;return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${i}, பெறப்பட்டது ${s}`}case"invalid_value":if(n.values.length===1)return`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${Y(n.values[0])}`;return`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${N(n.values,"|")} இல் ஒன்று`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ${a.unit??"உறுப்புகள்"} ஆக இருக்க வேண்டும்`;return`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${n.origin??"மதிப்பு"} ${i}${n.maximum.toString()} ஆக இருக்க வேண்டும்`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ஆக இருக்க வேண்டும்`;return`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${n.origin} ${i}${n.minimum.toString()} ஆக இருக்க வேண்டும்`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`தவறான சரம்: "${i.prefix}" இல் தொடங்க வேண்டும்`;if(i.format==="ends_with")return`தவறான சரம்: "${i.suffix}" இல் முடிவடைய வேண்டும்`;if(i.format==="includes")return`தவறான சரம்: "${i.includes}" ஐ உள்ளடக்க வேண்டும்`;if(i.format==="regex")return`தவறான சரம்: ${i.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;return`தவறான ${r[i.format]??n.format}`}case"not_multiple_of":return`தவறான எண்: ${n.divisor} இன் பலமாக இருக்க வேண்டும்`;case"unrecognized_keys":return`அடையாளம் தெரியாத விசை${n.keys.length>1?"கள்":""}: ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} இல் தவறான விசை`;case"invalid_union":return"தவறான உள்ளீடு";case"invalid_element":return`${n.origin} இல் தவறான மதிப்பு`;default:return"தவறான உள்ளீடு"}}};function hP(){return{localeError:Rne()}}var $ne=()=>{let e={string:{unit:"ตัวอักษร",verb:"ควรมี"},file:{unit:"ไบต์",verb:"ควรมี"},array:{unit:"รายการ",verb:"ควรมี"},set:{unit:"รายการ",verb:"ควรมี"}};function t(n){return e[n]??null}let r={regex:"ข้อมูลที่ป้อน",email:"ที่อยู่อีเมล",url:"URL",emoji:"อิโมจิ",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"วันที่เวลาแบบ ISO",date:"วันที่แบบ ISO",time:"เวลาแบบ ISO",duration:"ช่วงเวลาแบบ ISO",ipv4:"ที่อยู่ IPv4",ipv6:"ที่อยู่ IPv6",cidrv4:"ช่วง IP แบบ IPv4",cidrv6:"ช่วง IP แบบ IPv6",base64:"ข้อความแบบ Base64",base64url:"ข้อความแบบ Base64 สำหรับ URL",json_string:"ข้อความแบบ JSON",e164:"เบอร์โทรศัพท์ระหว่างประเทศ (E.164)",jwt:"โทเคน JWT",template_literal:"ข้อมูลที่ป้อน"},o={nan:"NaN",number:"ตัวเลข",array:"อาร์เรย์ (Array)",null:"ไม่มีค่า (null)"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${n.expected} แต่ได้รับ ${s}`;return`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${i} แต่ได้รับ ${s}`}case"invalid_value":if(n.values.length===1)return`ค่าไม่ถูกต้อง: ควรเป็น ${Y(n.values[0])}`;return`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"ไม่เกิน":"น้อยกว่า",a=t(n.origin);if(a)return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()} ${a.unit??"รายการ"}`;return`เกินกำหนด: ${n.origin??"ค่า"} ควรมี${i} ${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?"อย่างน้อย":"มากกว่า",a=t(n.origin);if(a)return`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()} ${a.unit}`;return`น้อยกว่ากำหนด: ${n.origin} ควรมี${i} ${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${i.prefix}"`;if(i.format==="ends_with")return`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${i.suffix}"`;if(i.format==="includes")return`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${i.includes}" อยู่ในข้อความ`;if(i.format==="regex")return`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${i.pattern}`;return`รูปแบบไม่ถูกต้อง: ${r[i.format]??n.format}`}case"not_multiple_of":return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${n.divisor} ได้ลงตัว`;case"unrecognized_keys":return`พบคีย์ที่ไม่รู้จัก: ${N(n.keys,", ")}`;case"invalid_key":return`คีย์ไม่ถูกต้องใน ${n.origin}`;case"invalid_union":return"ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้";case"invalid_element":return`ข้อมูลไม่ถูกต้องใน ${n.origin}`;default:return"ข้อมูลไม่ถูกต้อง"}}};function gP(){return{localeError:$ne()}}var One=()=>{let e={string:{unit:"karakter",verb:"olmalı"},file:{unit:"bayt",verb:"olmalı"},array:{unit:"öğe",verb:"olmalı"},set:{unit:"öğe",verb:"olmalı"}};function t(n){return e[n]??null}let r={regex:"girdi",email:"e-posta adresi",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO tarih ve saat",date:"ISO tarih",time:"ISO saat",duration:"ISO süre",ipv4:"IPv4 adresi",ipv6:"IPv6 adresi",cidrv4:"IPv4 aralığı",cidrv6:"IPv6 aralığı",base64:"base64 ile şifrelenmiş metin",base64url:"base64url ile şifrelenmiş metin",json_string:"JSON dizesi",e164:"E.164 sayısı",jwt:"JWT",template_literal:"Şablon dizesi"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Geçersiz değer: beklenen instanceof ${n.expected}, alınan ${s}`;return`Geçersiz değer: beklenen ${i}, alınan ${s}`}case"invalid_value":if(n.values.length===1)return`Geçersiz değer: beklenen ${Y(n.values[0])}`;return`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Çok büyük: beklenen ${n.origin??"değer"} ${i}${n.maximum.toString()} ${a.unit??"öğe"}`;return`Çok büyük: beklenen ${n.origin??"değer"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Çok küçük: beklenen ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`;return`Çok küçük: beklenen ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Geçersiz metin: "${i.prefix}" ile başlamalı`;if(i.format==="ends_with")return`Geçersiz metin: "${i.suffix}" ile bitmeli`;if(i.format==="includes")return`Geçersiz metin: "${i.includes}" içermeli`;if(i.format==="regex")return`Geçersiz metin: ${i.pattern} desenine uymalı`;return`Geçersiz ${r[i.format]??n.format}`}case"not_multiple_of":return`Geçersiz sayı: ${n.divisor} ile tam bölünebilmeli`;case"unrecognized_keys":return`Tanınmayan anahtar${n.keys.length>1?"lar":""}: ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} içinde geçersiz anahtar`;case"invalid_union":return"Geçersiz değer";case"invalid_element":return`${n.origin} içinde geçersiz değer`;default:return"Geçersiz değer"}}};function yP(){return{localeError:One()}}var Cne=()=>{let e={string:{unit:"символів",verb:"матиме"},file:{unit:"байтів",verb:"матиме"},array:{unit:"елементів",verb:"матиме"},set:{unit:"елементів",verb:"матиме"}};function t(n){return e[n]??null}let r={regex:"вхідні дані",email:"адреса електронної пошти",url:"URL",emoji:"емодзі",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"дата та час ISO",date:"дата ISO",time:"час ISO",duration:"тривалість ISO",ipv4:"адреса IPv4",ipv6:"адреса IPv6",cidrv4:"діапазон IPv4",cidrv6:"діапазон IPv6",base64:"рядок у кодуванні base64",base64url:"рядок у кодуванні base64url",json_string:"рядок JSON",e164:"номер E.164",jwt:"JWT",template_literal:"вхідні дані"},o={nan:"NaN",number:"число",array:"масив"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Неправильні вхідні дані: очікується instanceof ${n.expected}, отримано ${s}`;return`Неправильні вхідні дані: очікується ${i}, отримано ${s}`}case"invalid_value":if(n.values.length===1)return`Неправильні вхідні дані: очікується ${Y(n.values[0])}`;return`Неправильна опція: очікується одне з ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Занадто велике: очікується, що ${n.origin??"значення"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"елементів"}`;return`Занадто велике: очікується, що ${n.origin??"значення"} буде ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Занадто мале: очікується, що ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`;return`Занадто мале: очікується, що ${n.origin} буде ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Неправильний рядок: повинен починатися з "${i.prefix}"`;if(i.format==="ends_with")return`Неправильний рядок: повинен закінчуватися на "${i.suffix}"`;if(i.format==="includes")return`Неправильний рядок: повинен містити "${i.includes}"`;if(i.format==="regex")return`Неправильний рядок: повинен відповідати шаблону ${i.pattern}`;return`Неправильний ${r[i.format]??n.format}`}case"not_multiple_of":return`Неправильне число: повинно бути кратним ${n.divisor}`;case"unrecognized_keys":return`Нерозпізнаний ключ${n.keys.length>1?"і":""}: ${N(n.keys,", ")}`;case"invalid_key":return`Неправильний ключ у ${n.origin}`;case"invalid_union":return"Неправильні вхідні дані";case"invalid_element":return`Неправильне значення у ${n.origin}`;default:return"Неправильні вхідні дані"}}};function qm(){return{localeError:Cne()}}function bP(){return qm()}var zne=()=>{let e={string:{unit:"حروف",verb:"ہونا"},file:{unit:"بائٹس",verb:"ہونا"},array:{unit:"آئٹمز",verb:"ہونا"},set:{unit:"آئٹمز",verb:"ہونا"}};function t(n){return e[n]??null}let r={regex:"ان پٹ",email:"ای میل ایڈریس",url:"یو آر ایل",emoji:"ایموجی",uuid:"یو یو آئی ڈی",uuidv4:"یو یو آئی ڈی وی 4",uuidv6:"یو یو آئی ڈی وی 6",nanoid:"نینو آئی ڈی",guid:"جی یو آئی ڈی",cuid:"سی یو آئی ڈی",cuid2:"سی یو آئی ڈی 2",ulid:"یو ایل آئی ڈی",xid:"ایکس آئی ڈی",ksuid:"کے ایس یو آئی ڈی",datetime:"آئی ایس او ڈیٹ ٹائم",date:"آئی ایس او تاریخ",time:"آئی ایس او وقت",duration:"آئی ایس او مدت",ipv4:"آئی پی وی 4 ایڈریس",ipv6:"آئی پی وی 6 ایڈریس",cidrv4:"آئی پی وی 4 رینج",cidrv6:"آئی پی وی 6 رینج",base64:"بیس 64 ان کوڈڈ سٹرنگ",base64url:"بیس 64 یو آر ایل ان کوڈڈ سٹرنگ",json_string:"جے ایس او این سٹرنگ",e164:"ای 164 نمبر",jwt:"جے ڈبلیو ٹی",template_literal:"ان پٹ"},o={nan:"NaN",number:"نمبر",array:"آرے",null:"نل"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`غلط ان پٹ: instanceof ${n.expected} متوقع تھا، ${s} موصول ہوا`;return`غلط ان پٹ: ${i} متوقع تھا، ${s} موصول ہوا`}case"invalid_value":if(n.values.length===1)return`غلط ان پٹ: ${Y(n.values[0])} متوقع تھا`;return`غلط آپشن: ${N(n.values,"|")} میں سے ایک متوقع تھا`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`بہت بڑا: ${n.origin??"ویلیو"} کے ${i}${n.maximum.toString()} ${a.unit??"عناصر"} ہونے متوقع تھے`;return`بہت بڑا: ${n.origin??"ویلیو"} کا ${i}${n.maximum.toString()} ہونا متوقع تھا`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`بہت چھوٹا: ${n.origin} کے ${i}${n.minimum.toString()} ${a.unit} ہونے متوقع تھے`;return`بہت چھوٹا: ${n.origin} کا ${i}${n.minimum.toString()} ہونا متوقع تھا`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`غلط سٹرنگ: "${i.prefix}" سے شروع ہونا چاہیے`;if(i.format==="ends_with")return`غلط سٹرنگ: "${i.suffix}" پر ختم ہونا چاہیے`;if(i.format==="includes")return`غلط سٹرنگ: "${i.includes}" شامل ہونا چاہیے`;if(i.format==="regex")return`غلط سٹرنگ: پیٹرن ${i.pattern} سے میچ ہونا چاہیے`;return`غلط ${r[i.format]??n.format}`}case"not_multiple_of":return`غلط نمبر: ${n.divisor} کا مضاعف ہونا چاہیے`;case"unrecognized_keys":return`غیر تسلیم شدہ کی${n.keys.length>1?"ز":""}: ${N(n.keys,"، ")}`;case"invalid_key":return`${n.origin} میں غلط کی`;case"invalid_union":return"غلط ان پٹ";case"invalid_element":return`${n.origin} میں غلط ویلیو`;default:return"غلط ان پٹ"}}};function xP(){return{localeError:zne()}}var Nne=()=>{let e={string:{unit:"belgi",verb:"bo‘lishi kerak"},file:{unit:"bayt",verb:"bo‘lishi kerak"},array:{unit:"element",verb:"bo‘lishi kerak"},set:{unit:"element",verb:"bo‘lishi kerak"},map:{unit:"yozuv",verb:"bo‘lishi kerak"}};function t(n){return e[n]??null}let r={regex:"kirish",email:"elektron pochta manzili",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO sana va vaqti",date:"ISO sana",time:"ISO vaqt",duration:"ISO davomiylik",ipv4:"IPv4 manzil",ipv6:"IPv6 manzil",mac:"MAC manzil",cidrv4:"IPv4 diapazon",cidrv6:"IPv6 diapazon",base64:"base64 kodlangan satr",base64url:"base64url kodlangan satr",json_string:"JSON satr",e164:"E.164 raqam",jwt:"JWT",template_literal:"kirish"},o={nan:"NaN",number:"raqam",array:"massiv"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Noto‘g‘ri kirish: kutilgan instanceof ${n.expected}, qabul qilingan ${s}`;return`Noto‘g‘ri kirish: kutilgan ${i}, qabul qilingan ${s}`}case"invalid_value":if(n.values.length===1)return`Noto‘g‘ri kirish: kutilgan ${Y(n.values[0])}`;return`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()} ${a.unit} ${a.verb}`;return`Juda katta: kutilgan ${n.origin??"qiymat"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()} ${a.unit} ${a.verb}`;return`Juda kichik: kutilgan ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Noto‘g‘ri satr: "${i.prefix}" bilan boshlanishi kerak`;if(i.format==="ends_with")return`Noto‘g‘ri satr: "${i.suffix}" bilan tugashi kerak`;if(i.format==="includes")return`Noto‘g‘ri satr: "${i.includes}" ni o‘z ichiga olishi kerak`;if(i.format==="regex")return`Noto‘g‘ri satr: ${i.pattern} shabloniga mos kelishi kerak`;return`Noto‘g‘ri ${r[i.format]??n.format}`}case"not_multiple_of":return`Noto‘g‘ri raqam: ${n.divisor} ning karralisi bo‘lishi kerak`;case"unrecognized_keys":return`Noma’lum kalit${n.keys.length>1?"lar":""}: ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} dagi kalit noto‘g‘ri`;case"invalid_union":return"Noto‘g‘ri kirish";case"invalid_element":return`${n.origin} da noto‘g‘ri qiymat`;default:return"Noto‘g‘ri kirish"}}};function vP(){return{localeError:Nne()}}var Mne=()=>{let e={string:{unit:"ký tự",verb:"có"},file:{unit:"byte",verb:"có"},array:{unit:"phần tử",verb:"có"},set:{unit:"phần tử",verb:"có"}};function t(n){return e[n]??null}let r={regex:"đầu vào",email:"địa chỉ email",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ngày giờ ISO",date:"ngày ISO",time:"giờ ISO",duration:"khoảng thời gian ISO",ipv4:"địa chỉ IPv4",ipv6:"địa chỉ IPv6",cidrv4:"dải IPv4",cidrv6:"dải IPv6",base64:"chuỗi mã hóa base64",base64url:"chuỗi mã hóa base64url",json_string:"chuỗi JSON",e164:"số E.164",jwt:"JWT",template_literal:"đầu vào"},o={nan:"NaN",number:"số",array:"mảng"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Đầu vào không hợp lệ: mong đợi instanceof ${n.expected}, nhận được ${s}`;return`Đầu vào không hợp lệ: mong đợi ${i}, nhận được ${s}`}case"invalid_value":if(n.values.length===1)return`Đầu vào không hợp lệ: mong đợi ${Y(n.values[0])}`;return`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${a.verb} ${i}${n.maximum.toString()} ${a.unit??"phần tử"}`;return`Quá lớn: mong đợi ${n.origin??"giá trị"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Quá nhỏ: mong đợi ${n.origin} ${a.verb} ${i}${n.minimum.toString()} ${a.unit}`;return`Quá nhỏ: mong đợi ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Chuỗi không hợp lệ: phải bắt đầu bằng "${i.prefix}"`;if(i.format==="ends_with")return`Chuỗi không hợp lệ: phải kết thúc bằng "${i.suffix}"`;if(i.format==="includes")return`Chuỗi không hợp lệ: phải bao gồm "${i.includes}"`;if(i.format==="regex")return`Chuỗi không hợp lệ: phải khớp với mẫu ${i.pattern}`;return`${r[i.format]??n.format} không hợp lệ`}case"not_multiple_of":return`Số không hợp lệ: phải là bội số của ${n.divisor}`;case"unrecognized_keys":return`Khóa không được nhận dạng: ${N(n.keys,", ")}`;case"invalid_key":return`Khóa không hợp lệ trong ${n.origin}`;case"invalid_union":return"Đầu vào không hợp lệ";case"invalid_element":return`Giá trị không hợp lệ trong ${n.origin}`;default:return"Đầu vào không hợp lệ"}}};function _P(){return{localeError:Mne()}}var Bne=()=>{let e={string:{unit:"字符",verb:"包含"},file:{unit:"字节",verb:"包含"},array:{unit:"项",verb:"包含"},set:{unit:"项",verb:"包含"}};function t(n){return e[n]??null}let r={regex:"输入",email:"电子邮件",url:"URL",emoji:"表情符号",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO日期时间",date:"ISO日期",time:"ISO时间",duration:"ISO时长",ipv4:"IPv4地址",ipv6:"IPv6地址",cidrv4:"IPv4网段",cidrv6:"IPv6网段",base64:"base64编码字符串",base64url:"base64url编码字符串",json_string:"JSON字符串",e164:"E.164号码",jwt:"JWT",template_literal:"输入"},o={nan:"NaN",number:"数字",array:"数组",null:"空值(null)"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`无效输入:期望 instanceof ${n.expected},实际接收 ${s}`;return`无效输入:期望 ${i},实际接收 ${s}`}case"invalid_value":if(n.values.length===1)return`无效输入:期望 ${Y(n.values[0])}`;return`无效选项:期望以下之一 ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()} ${a.unit??"个元素"}`;return`数值过大:期望 ${n.origin??"值"} ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()} ${a.unit}`;return`数值过小:期望 ${n.origin} ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`无效字符串:必须以 "${i.prefix}" 开头`;if(i.format==="ends_with")return`无效字符串:必须以 "${i.suffix}" 结尾`;if(i.format==="includes")return`无效字符串:必须包含 "${i.includes}"`;if(i.format==="regex")return`无效字符串:必须满足正则表达式 ${i.pattern}`;return`无效${r[i.format]??n.format}`}case"not_multiple_of":return`无效数字:必须是 ${n.divisor} 的倍数`;case"unrecognized_keys":return`出现未知的键(key): ${N(n.keys,", ")}`;case"invalid_key":return`${n.origin} 中的键(key)无效`;case"invalid_union":return"无效输入";case"invalid_element":return`${n.origin} 中包含无效值(value)`;default:return"无效输入"}}};function wP(){return{localeError:Bne()}}var Dne=()=>{let e={string:{unit:"字元",verb:"擁有"},file:{unit:"位元組",verb:"擁有"},array:{unit:"項目",verb:"擁有"},set:{unit:"項目",verb:"擁有"}};function t(n){return e[n]??null}let r={regex:"輸入",email:"郵件地址",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO 日期時間",date:"ISO 日期",time:"ISO 時間",duration:"ISO 期間",ipv4:"IPv4 位址",ipv6:"IPv6 位址",cidrv4:"IPv4 範圍",cidrv6:"IPv6 範圍",base64:"base64 編碼字串",base64url:"base64url 編碼字串",json_string:"JSON 字串",e164:"E.164 數值",jwt:"JWT",template_literal:"輸入"},o={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`無效的輸入值:預期為 instanceof ${n.expected},但收到 ${s}`;return`無效的輸入值:預期為 ${i},但收到 ${s}`}case"invalid_value":if(n.values.length===1)return`無效的輸入值:預期為 ${Y(n.values[0])}`;return`無效的選項:預期為以下其中之一 ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()} ${a.unit??"個元素"}`;return`數值過大:預期 ${n.origin??"值"} 應為 ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()} ${a.unit}`;return`數值過小:預期 ${n.origin} 應為 ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`無效的字串:必須以 "${i.prefix}" 開頭`;if(i.format==="ends_with")return`無效的字串:必須以 "${i.suffix}" 結尾`;if(i.format==="includes")return`無效的字串:必須包含 "${i.includes}"`;if(i.format==="regex")return`無效的字串:必須符合格式 ${i.pattern}`;return`無效的 ${r[i.format]??n.format}`}case"not_multiple_of":return`無效的數字:必須為 ${n.divisor} 的倍數`;case"unrecognized_keys":return`無法識別的鍵值${n.keys.length>1?"們":""}:${N(n.keys,"、")}`;case"invalid_key":return`${n.origin} 中有無效的鍵值`;case"invalid_union":return"無效的輸入值";case"invalid_element":return`${n.origin} 中有無效的值`;default:return"無效的輸入值"}}};function SP(){return{localeError:Dne()}}var Une=()=>{let e={string:{unit:"àmi",verb:"ní"},file:{unit:"bytes",verb:"ní"},array:{unit:"nkan",verb:"ní"},set:{unit:"nkan",verb:"ní"}};function t(n){return e[n]??null}let r={regex:"ẹ̀rọ ìbáwọlé",email:"àdírẹ́sì ìmẹ́lì",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"àkókò ISO",date:"ọjọ́ ISO",time:"àkókò ISO",duration:"àkókò tó pé ISO",ipv4:"àdírẹ́sì IPv4",ipv6:"àdírẹ́sì IPv6",cidrv4:"àgbègbè IPv4",cidrv6:"àgbègbè IPv6",base64:"ọ̀rọ̀ tí a kọ́ ní base64",base64url:"ọ̀rọ̀ base64url",json_string:"ọ̀rọ̀ JSON",e164:"nọ́mbà E.164",jwt:"JWT",template_literal:"ẹ̀rọ ìbáwọlé"},o={nan:"NaN",number:"nọ́mbà",array:"akopọ"};return(n)=>{switch(n.code){case"invalid_type":{let i=o[n.expected]??n.expected,a=Q(n.input),s=o[a]??a;if(/^[A-Z]/.test(n.expected))return`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${n.expected}, àmọ̀ a rí ${s}`;return`Ìbáwọlé aṣìṣe: a ní láti fi ${i}, àmọ̀ a rí ${s}`}case"invalid_value":if(n.values.length===1)return`Ìbáwọlé aṣìṣe: a ní láti fi ${Y(n.values[0])}`;return`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${N(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Tó pọ̀ jù: a ní láti jẹ́ pé ${n.origin??"iye"} ${a.verb} ${i}${n.maximum} ${a.unit}`;return`Tó pọ̀ jù: a ní láti jẹ́ ${i}${n.maximum}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Kéré ju: a ní láti jẹ́ pé ${n.origin} ${a.verb} ${i}${n.minimum} ${a.unit}`;return`Kéré ju: a ní láti jẹ́ ${i}${n.minimum}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${i.prefix}"`;if(i.format==="ends_with")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${i.suffix}"`;if(i.format==="includes")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${i.includes}"`;if(i.format==="regex")return`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${i.pattern}`;return`Aṣìṣe: ${r[i.format]??n.format}`}case"not_multiple_of":return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${n.divisor}`;case"unrecognized_keys":return`Bọtìnì àìmọ̀: ${N(n.keys,", ")}`;case"invalid_key":return`Bọtìnì aṣìṣe nínú ${n.origin}`;case"invalid_union":return"Ìbáwọlé aṣìṣe";case"invalid_element":return`Iye aṣìṣe nínú ${n.origin}`;default:return"Ìbáwọlé aṣìṣe"}}};function TP(){return{localeError:Une()}}var R4,EP=Symbol("ZodOutput"),IP=Symbol("ZodInput");class PP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function fx(){return new PP}(R4=globalThis).__zod_globalRegistry??(R4.__zod_globalRegistry=fx());var Nr=globalThis.__zod_globalRegistry;function mx(e,t){return new e({type:"string",...oe(t)})}function kP(e,t){return new e({type:"string",coerce:!0,...oe(t)})}function Hm(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...oe(t)})}function Ql(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...oe(t)})}function Gm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...oe(t)})}function Vm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...oe(t)})}function Zm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...oe(t)})}function Wm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...oe(t)})}function Xl(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...oe(t)})}function Km(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...oe(t)})}function Jm(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...oe(t)})}function Ym(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...oe(t)})}function Qm(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...oe(t)})}function Xm(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...oe(t)})}function eh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...oe(t)})}function th(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...oe(t)})}function rh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...oe(t)})}function nh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...oe(t)})}function hx(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...oe(t)})}function oh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...oe(t)})}function ih(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...oe(t)})}function ah(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...oe(t)})}function sh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...oe(t)})}function ch(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...oe(t)})}function uh(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...oe(t)})}var AP={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function RP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...oe(t)})}function $P(e,t){return new e({type:"string",format:"date",check:"string_format",...oe(t)})}function OP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...oe(t)})}function CP(e,t){return new e({type:"string",format:"duration",check:"string_format",...oe(t)})}function gx(e,t){return new e({type:"number",checks:[],...oe(t)})}function zP(e,t){return new e({type:"number",coerce:!0,checks:[],...oe(t)})}function yx(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...oe(t)})}function bx(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...oe(t)})}function xx(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...oe(t)})}function vx(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...oe(t)})}function _x(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...oe(t)})}function wx(e,t){return new e({type:"boolean",...oe(t)})}function NP(e,t){return new e({type:"boolean",coerce:!0,...oe(t)})}function Sx(e,t){return new e({type:"bigint",...oe(t)})}function MP(e,t){return new e({type:"bigint",coerce:!0,...oe(t)})}function Tx(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...oe(t)})}function Ex(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...oe(t)})}function Ix(e,t){return new e({type:"symbol",...oe(t)})}function Px(e,t){return new e({type:"undefined",...oe(t)})}function kx(e,t){return new e({type:"null",...oe(t)})}function Ax(e){return new e({type:"any"})}function Rx(e){return new e({type:"unknown"})}function $x(e,t){return new e({type:"never",...oe(t)})}function Ox(e,t){return new e({type:"void",...oe(t)})}function Cx(e,t){return new e({type:"date",...oe(t)})}function BP(e,t){return new e({type:"date",coerce:!0,...oe(t)})}function zx(e,t){return new e({type:"nan",...oe(t)})}function xi(e,t){return new n0({check:"less_than",...oe(t),value:e,inclusive:!1})}function Wn(e,t){return new n0({check:"less_than",...oe(t),value:e,inclusive:!0})}function vi(e,t){return new o0({check:"greater_than",...oe(t),value:e,inclusive:!1})}function un(e,t){return new o0({check:"greater_than",...oe(t),value:e,inclusive:!0})}function Nx(e){return vi(0,e)}function Mx(e){return xi(0,e)}function Bx(e){return Wn(0,e)}function Dx(e){return un(0,e)}function vs(e,t){return new nI({check:"multiple_of",...oe(t),value:e})}function _s(e,t){return new aI({check:"max_size",...oe(t),maximum:e})}function _i(e,t){return new sI({check:"min_size",...oe(t),minimum:e})}function Zc(e,t){return new cI({check:"size_equals",...oe(t),size:e})}function Wc(e,t){return new uI({check:"max_length",...oe(t),maximum:e})}function la(e,t){return new lI({check:"min_length",...oe(t),minimum:e})}function Kc(e,t){return new dI({check:"length_equals",...oe(t),length:e})}function ed(e,t){return new pI({check:"string_format",format:"regex",...oe(t),pattern:e})}function td(e){return new fI({check:"string_format",format:"lowercase",...oe(e)})}function rd(e){return new mI({check:"string_format",format:"uppercase",...oe(e)})}function nd(e,t){return new hI({check:"string_format",format:"includes",...oe(t),includes:e})}function od(e,t){return new gI({check:"string_format",format:"starts_with",...oe(t),prefix:e})}function id(e,t){return new yI({check:"string_format",format:"ends_with",...oe(t),suffix:e})}function Ux(e,t,r){return new bI({check:"property",property:e,schema:t,...oe(r)})}function ad(e,t){return new xI({check:"mime_type",mime:e,...oe(t)})}function Co(e){return new vI({check:"overwrite",tx:e})}function sd(e){return Co((t)=>t.normalize(e))}function cd(){return Co((e)=>e.trim())}function ud(){return Co((e)=>e.toLowerCase())}function ld(){return Co((e)=>e.toUpperCase())}function dd(){return Co((e)=>xE(e))}function DP(e,t,r){return new e({type:"array",element:t,...oe(r)})}function jne(e,t,r){return new e({type:"union",options:t,...oe(r)})}function Fne(e,t,r){return new e({type:"union",options:t,inclusive:!1,...oe(r)})}function qne(e,t,r,o){return new e({type:"union",options:r,discriminator:t,...oe(o)})}function Hne(e,t,r){return new e({type:"intersection",left:t,right:r})}function Gne(e,t,r,o){let n=r instanceof Ue;return new e({type:"tuple",items:t,rest:n?r:null,...oe(n?o:r)})}function Vne(e,t,r,o){return new e({type:"record",keyType:t,valueType:r,...oe(o)})}function Zne(e,t,r,o){return new e({type:"map",keyType:t,valueType:r,...oe(o)})}function Wne(e,t,r){return new e({type:"set",valueType:t,...oe(r)})}function Kne(e,t,r){let o=Array.isArray(t)?Object.fromEntries(t.map((n)=>[n,n])):t;return new e({type:"enum",entries:o,...oe(r)})}function Jne(e,t,r){return new e({type:"enum",entries:t,...oe(r)})}function Yne(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...oe(r)})}function Lx(e,t){return new e({type:"file",...oe(t)})}function Qne(e,t){return new e({type:"transform",transform:t})}function Xne(e,t){return new e({type:"optional",innerType:t})}function eoe(e,t){return new e({type:"nullable",innerType:t})}function toe(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r==="function"?r():Zb(r)}})}function roe(e,t,r){return new e({type:"nonoptional",innerType:t,...oe(r)})}function noe(e,t){return new e({type:"success",innerType:t})}function ooe(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r==="function"?r:()=>r})}function ioe(e,t,r){return new e({type:"pipe",in:t,out:r})}function aoe(e,t){return new e({type:"readonly",innerType:t})}function soe(e,t,r){return new e({type:"template_literal",parts:t,...oe(r)})}function coe(e,t){return new e({type:"lazy",getter:t})}function uoe(e,t){return new e({type:"promise",innerType:t})}function jx(e,t,r){let o=oe(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}function Fx(e,t,r){return new e({type:"custom",check:"custom",fn:t,...oe(r)})}function qx(e,t){let r=$4((o)=>(o.addIssue=(n)=>{if(typeof n==="string")o.issues.push(jl(n,o.value,r._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),o.issues.push(jl(i))}},e(o.value,o)),t);return r}function $4(e,t){let r=new Rt({check:"custom",...oe(t)});return r._zod.check=e,r}function Hx(e){let t=new Rt({check:"describe"});return t._zod.onattach=[(r)=>{let o=Nr.get(r)??{};Nr.add(r,{...o,description:e})}],t._zod.check=()=>{},t}function Gx(e){let t=new Rt({check:"meta"});return t._zod.onattach=[(r)=>{let o=Nr.get(r)??{};Nr.add(r,{...o,...e})}],t._zod.check=()=>{},t}function Vx(e,t){let r=oe(t),o=r.truthy??["true","1","yes","on","y","enabled"],n=r.falsy??["false","0","no","off","n","disabled"];if(r.case!=="sensitive")o=o.map((h)=>typeof h==="string"?h.toLowerCase():h),n=n.map((h)=>typeof h==="string"?h.toLowerCase():h);let i=new Set(o),a=new Set(n),s=e.Codec??Kl,c=e.Boolean??Zl,d=new(e.String??xs)({type:"string",error:r.error}),p=new c({type:"boolean",error:r.error}),m=new s({type:"pipe",in:d,out:p,transform:(h,y)=>{let x=h;if(r.case!=="sensitive")x=x.toLowerCase();if(i.has(x))return!0;else if(a.has(x))return!1;else return y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...a],input:y.value,inst:m,continue:!1}),{}},reverseTransform:(h,y)=>{if(h===!0)return o[0]||"true";else return n[0]||"false"},error:r.error});return m}function Jc(e,t,r,o={}){let n=oe(o),i={...oe(o),check:"string_format",type:"string",format:t,fn:typeof r==="function"?r:(s)=>r.test(s),...n};if(r instanceof RegExp)i.pattern=r;return new e(i)}function ws(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Nr,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Et(e,t,r={path:[],schemaPath:[]}){var o;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let s=e._zod.toJSONSchema?.();if(s)a.schema=s;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{let m=a.schema,h=t.processors[n.type];if(!h)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);h(e,t,m,d)}let p=e._zod.parent;if(p){if(!a.ref)a.ref=p;Et(p,t,d),t.seen.get(p).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)Object.assign(a.schema,c);if(t.io==="input"&&ln(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(o=a.schema).default??(o.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function Ss(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=new Map;for(let a of e.seen.entries()){let s=e.metadataRegistry.get(a[0])?.id;if(s){let c=o.get(s);if(c&&c!==a[0])throw Error(`Duplicate schema id "${s}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(s,a[0])}}let n=(a)=>{let s=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(a[0])?.id,m=e.external.uri??((y)=>y);if(p)return{ref:m(p)};let h=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=h,{defId:h,ref:`${m("__shared")}#/${s}/${h}`}}if(a[1]===r)return{ref:"#"};let u=`${"#"}/${s}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:u+d}},i=(a)=>{if(a[1].schema.$ref)return;let s=a[1],{ref:c,defId:u}=n(a);if(s.def={...s.schema},u)s.defId=u;let d=s.schema;for(let p in d)delete d[p];d.$ref=c};if(e.cycles==="throw")for(let a of e.seen.entries()){let s=a[1];if(s.cycle)throw Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
129
129
|
|
|
130
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1){if(e.reused==="ref"){i(a);continue}}}}function Ts(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(s)=>{let c=e.seen.get(s);if(c.ref===null)return;let u=c.def??c.schema,d={...u},p=c.ref;if(c.ref=null,p){o(p);let h=e.seen.get(p),y=h.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(y);else Object.assign(u,y);if(Object.assign(u,d),s._zod.parent===p)for(let S in u){if(S==="$ref"||S==="allOf")continue;if(!(S in d))delete u[S]}if(y.$ref&&h.def)for(let S in u){if(S==="$ref"||S==="allOf")continue;if(S in h.def&&JSON.stringify(u[S])===JSON.stringify(h.def[S]))delete u[S]}}let m=s._zod.parent;if(m&&m!==p){o(m);let h=e.seen.get(m);if(h?.schema.$ref){if(u.$ref=h.schema.$ref,h.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in h.def&&JSON.stringify(u[y])===JSON.stringify(h.def[y]))delete u[y]}}}e.override({zodSchema:s,jsonSchema:u,path:c.path??[]})};for(let s of[...e.seen.entries()].reverse())o(s[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Object.assign(n,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let a=e.external?.defs??{};for(let s of e.seen.entries()){let c=s[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;a[c.defId]=c.def}}if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")n.$defs=a;else n.definitions=a;try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:pd(t,"input",e.processors),output:pd(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error("Error converting schema to JSON.")}}function ln(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ln(o.element,r);if(o.type==="set")return ln(o.valueType,r);if(o.type==="lazy")return ln(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return ln(o.innerType,r);if(o.type==="intersection")return ln(o.left,r)||ln(o.right,r);if(o.type==="record"||o.type==="map")return ln(o.keyType,r)||ln(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return ln(o.in,r)||ln(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(ln(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ln(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ln(n,r))return!0;if(o.rest&&ln(o.rest,r))return!0;return!1}return!1}var UP=(e,t={})=>(r)=>{let o=ws({...r,processors:t});return Et(e,o),Ss(o,e),Ts(o,e)},pd=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},a=ws({...n??{},target:i,io:t,processors:r});return Et(e,a),Ss(a,e),Ts(a,e)};var loe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},LP=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof a==="number")n.maxLength=a;if(s){if(n.format=loe[s]??s,n.format==="")delete n.format;if(s==="time")delete n.format}if(u)n.contentEncoding=u;if(c&&c.size>0){let d=[...c];if(d.length===1)n.pattern=d[0].source;else if(d.length>1)n.allOf=[...d.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},jP=(e,t,r,o)=>{let n=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;if(typeof s==="string"&&s.includes("int"))n.type="integer";else n.type="number";let p=typeof d==="number"&&d>=(i??Number.NEGATIVE_INFINITY),m=typeof u==="number"&&u<=(a??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(h)n.minimum=d,n.exclusiveMinimum=!0;else n.exclusiveMinimum=d;else if(typeof i==="number")n.minimum=i;if(m)if(h)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof a==="number")n.maximum=a;if(typeof c==="number")n.multipleOf=c},FP=(e,t,r,o)=>{r.type="boolean"},qP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},HP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},GP=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},VP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},ZP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},WP=(e,t,r,o)=>{r.not={}},KP=(e,t,r,o)=>{},JP=(e,t,r,o)=>{},YP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},QP=(e,t,r,o)=>{let n=e._zod.def,i=Tm(n.entries);if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";r.enum=i},XP=(e,t,r,o)=>{let n=e._zod.def,i=[];for(let a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(a));else i.push(a);if(i.length===0);else if(i.length===1){let a=i[0];if(r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[a];else r.const=a}else{if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";if(i.every((a)=>typeof a==="boolean"))r.type="boolean";if(i.every((a)=>a===null))r.type="null";r.enum=i}},ek=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},tk=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},rk=(e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;if(a!==void 0)i.minLength=a;if(s!==void 0)i.maxLength=s;if(c)if(c.length===1)i.contentMediaType=c[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=c.map((u)=>({contentMediaType:u}));else Object.assign(n,i)},nk=(e,t,r,o)=>{r.type="boolean"},ok=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},ik=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},ak=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},sk=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},ck=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},uk=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;if(typeof a==="number")n.minItems=a;if(typeof s==="number")n.maxItems=s;n.type="array",n.items=Et(i.element,t,{...o,path:[...o.path,"items"]})},lk=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let a=i.shape;for(let u in a)n.properties[u]=Et(a[u],t,{...o,path:[...o.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter((u)=>{let d=i.shape[u]._zod;if(t.io==="input")return d.optin===void 0;else return d.optout===void 0}));if(c.size>0)n.required=Array.from(c);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=Et(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Wx=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((s,c)=>Et(s,t,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));if(i)r.oneOf=a;else r.anyOf=a},dk=(e,t,r,o)=>{let n=e._zod.def,i=Et(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=Et(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},pk=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((m,h)=>Et(m,t,{...o,path:[...o.path,a,h]})),u=i.rest?Et(i.rest,t,{...o,path:[...o.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=c,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:c},u)n.items.anyOf.push(u);if(n.minItems=c.length,!u)n.maxItems=c.length}else if(n.items=c,u)n.additionalItems=u;let{minimum:d,maximum:p}=e._zod.bag;if(typeof d==="number")n.minItems=d;if(typeof p==="number")n.maxItems=p},fk=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let d=Et(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)n.patternProperties[p.source]=d}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=Et(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=Et(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let u=a._zod.values;if(u){let d=[...u].filter((p)=>typeof p==="string"||typeof p==="number");if(d.length>0)n.required=d}},mk=(e,t,r,o)=>{let n=e._zod.def,i=Et(n.innerType,t,o),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},hk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},gk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},yk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},bk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},xk=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;Et(a,t,o);let s=t.seen.get(e);s.ref=a},vk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},_k=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Kx=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},wk=(e,t,r,o)=>{let n=e._zod.innerType;Et(n,t,o);let i=t.seen.get(e);i.ref=n},Zx={string:LP,number:jP,boolean:FP,bigint:qP,symbol:HP,null:GP,undefined:VP,void:ZP,never:WP,any:KP,unknown:JP,date:YP,enum:QP,literal:XP,nan:ek,template_literal:tk,file:rk,success:nk,custom:ok,function:ik,transform:ak,map:sk,set:ck,array:uk,object:lk,union:Wx,intersection:dk,tuple:pk,record:fk,nullable:mk,nonoptional:hk,default:gk,prefault:yk,catch:bk,pipe:xk,readonly:vk,promise:_k,optional:Kx,lazy:wk};function Yc(e,t){if("_idmap"in e){let o=e,n=ws({...t,processors:Zx}),i={};for(let c of o._idmap.entries()){let[u,d]=c;Et(d,n)}let a={},s={registry:o,uri:t?.uri,defs:i};n.external=s;for(let c of o._idmap.entries()){let[u,d]=c;Ss(n,d),a[u]=Ts(n,d)}if(Object.keys(i).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[c]:i}}return{schemas:a}}let r=ws({...t,processors:Zx});return Et(e,r),Ss(r,e),Ts(r,e)}class Sk{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";this.ctx=ws({processors:Zx,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return Et(e,this.ctx,t)}emit(e,t){if(t){if(t.cycles)this.ctx.cycles=t.cycles;if(t.reused)this.ctx.reused=t.reused;if(t.external)this.ctx.external=t.external}Ss(this.ctx,e);let r=Ts(this.ctx,e),{"~standard":o,...n}=r;return n}}var O4={};var foe=R("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");Ue.init(e,t),e.def=t,e.type=t.type,e.parse=(r,o)=>Hc(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>ys(e,r,o),e.parseAsync=async(r,o)=>Gc(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>bs(e,r,o),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]},{parent:!0}),e.with=e.check,e.clone=(r,o)=>zr(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.apply=(r)=>r(e)});var moe=R("ZodMiniObject",(e,t)=>{F0.init(e,t),foe.init(e,t),Ye(e,"shape",()=>t.shape)});function Tk(e,t){let r={type:"object",shape:e??{},...oe(t)};return new moe(r)}function io(e){return!!e._zod}function Qc(e){let t=Object.values(e);if(t.length===0)return Tk({});let r=t.every(io),o=t.every((n)=>!io(n));if(r)return Tk(e);if(o)return zM(e);throw Error("Mixed Zod versions detected in object shape.")}function Es(e,t){if(io(e))return ys(e,t);return e.safeParse(t)}async function Jx(e,t){if(io(e))return await bs(e,t);return await e.safeParseAsync(t)}function Is(e){if(!e)return;let t;if(io(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function fd(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let o=Object.values(e);if(o.length>0&&o.every((n)=>typeof n==="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse==="function")))return Qc(e)}}if(io(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function Yx(e){if(e&&typeof e==="object"){if("message"in e&&typeof e.message==="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function C4(e){return e.description}function z4(e){if(io(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Qx(e){if(io(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o;return}var f={};kn(f,{$brand:()=>gE,$input:()=>IP,$output:()=>EP,NEVER:()=>hE,TimePrecision:()=>AP,ZodAny:()=>Gk,ZodArray:()=>Kk,ZodBase64:()=>xv,ZodBase64URL:()=>vv,ZodBigInt:()=>vd,ZodBigIntFormat:()=>Sv,ZodBoolean:()=>xd,ZodCIDRv4:()=>yv,ZodCIDRv6:()=>bv,ZodCUID:()=>lv,ZodCUID2:()=>dv,ZodCatch:()=>hA,ZodCodec:()=>_h,ZodCustom:()=>wh,ZodCustomStringFormat:()=>yd,ZodDate:()=>gh,ZodDefault:()=>uA,ZodDiscriminatedUnion:()=>Yk,ZodE164:()=>_v,ZodEmail:()=>sv,ZodEmoji:()=>cv,ZodEnum:()=>hd,ZodError:()=>goe,ZodExactOptional:()=>aA,ZodFile:()=>oA,ZodFirstPartyTypeKind:()=>kA,ZodFunction:()=>EA,ZodGUID:()=>dh,ZodIPv4:()=>hv,ZodIPv6:()=>gv,ZodISODate:()=>tv,ZodISODateTime:()=>ev,ZodISODuration:()=>nv,ZodISOTime:()=>rv,ZodIntersection:()=>Qk,ZodIssueCode:()=>boe,ZodJWT:()=>wv,ZodKSUID:()=>mv,ZodLazy:()=>wA,ZodLiteral:()=>nA,ZodMAC:()=>jk,ZodMap:()=>tA,ZodNaN:()=>yA,ZodNanoID:()=>uv,ZodNever:()=>Zk,ZodNonOptional:()=>Iv,ZodNull:()=>Hk,ZodNullable:()=>cA,ZodNumber:()=>bd,ZodNumberFormat:()=>Xc,ZodObject:()=>yh,ZodOptional:()=>wd,ZodPipe:()=>vh,ZodPrefault:()=>dA,ZodPreprocess:()=>bA,ZodPromise:()=>TA,ZodReadonly:()=>xA,ZodRealError:()=>Cn,ZodRecord:()=>md,ZodSet:()=>rA,ZodString:()=>gd,ZodStringFormat:()=>$t,ZodSuccess:()=>mA,ZodSymbol:()=>Fk,ZodTemplateLiteral:()=>_A,ZodTransform:()=>iA,ZodTuple:()=>Xk,ZodType:()=>Je,ZodULID:()=>pv,ZodURL:()=>mh,ZodUUID:()=>wi,ZodUndefined:()=>qk,ZodUnion:()=>bh,ZodUnknown:()=>Vk,ZodVoid:()=>Wk,ZodXID:()=>fv,ZodXor:()=>Jk,_ZodString:()=>av,_default:()=>lA,_function:()=>UB,any:()=>vB,array:()=>nt,base64:()=>nB,base64url:()=>oB,bigint:()=>hB,boolean:()=>ar,catch:()=>gA,check:()=>LB,cidrv4:()=>tB,cidrv6:()=>rB,clone:()=>zr,codec:()=>NB,coerce:()=>AA,config:()=>or,core:()=>zo,cuid:()=>Z4,cuid2:()=>W4,custom:()=>Pv,date:()=>wB,decode:()=>zk,decodeAsync:()=>Mk,describe:()=>jB,discriminatedUnion:()=>xh,e164:()=>iB,email:()=>B4,emoji:()=>G4,encode:()=>Ck,encodeAsync:()=>Nk,endsWith:()=>id,enum:()=>Br,exactOptional:()=>sA,file:()=>$B,flattenError:()=>Rm,float32:()=>dB,float64:()=>pB,formatError:()=>$m,fromJSONSchema:()=>ZB,function:()=>UB,getErrorMap:()=>voe,globalRegistry:()=>Nr,gt:()=>vi,gte:()=>un,guid:()=>D4,hash:()=>lB,hex:()=>uB,hostname:()=>cB,httpUrl:()=>H4,includes:()=>nd,instanceof:()=>qB,int:()=>ov,int32:()=>fB,int64:()=>gB,intersection:()=>_d,invertCodec:()=>MB,ipv4:()=>Q4,ipv6:()=>eB,iso:()=>Ps,json:()=>GB,jwt:()=>aB,keyof:()=>SB,ksuid:()=>Y4,lazy:()=>SA,length:()=>Kc,literal:()=>Ee,locales:()=>Yl,looseObject:()=>Mr,looseRecord:()=>PB,lowercase:()=>td,lt:()=>xi,lte:()=>Wn,mac:()=>X4,map:()=>kB,maxLength:()=>Wc,maxSize:()=>_s,meta:()=>FB,mime:()=>ad,minLength:()=>la,minSize:()=>_i,multipleOf:()=>vs,nan:()=>zB,nanoid:()=>V4,nativeEnum:()=>RB,negative:()=>Mx,never:()=>Tv,nonnegative:()=>Dx,nonoptional:()=>fA,nonpositive:()=>Bx,normalize:()=>sd,null:()=>hh,nullable:()=>ph,nullish:()=>OB,number:()=>gt,object:()=>ye,optional:()=>Bt,overwrite:()=>Co,parse:()=>Ak,parseAsync:()=>Rk,partialRecord:()=>IB,pipe:()=>iv,positive:()=>Nx,prefault:()=>pA,preprocess:()=>Sh,prettifyError:()=>PE,promise:()=>DB,property:()=>Ux,readonly:()=>vA,record:()=>kt,refine:()=>IA,regex:()=>ed,regexes:()=>On,registry:()=>fx,safeDecode:()=>Dk,safeDecodeAsync:()=>Lk,safeEncode:()=>Bk,safeEncodeAsync:()=>Uk,safeParse:()=>$k,safeParseAsync:()=>Ok,set:()=>AB,setErrorMap:()=>xoe,size:()=>Zc,slugify:()=>dd,startsWith:()=>od,strictObject:()=>TB,string:()=>D,stringFormat:()=>sB,stringbool:()=>HB,success:()=>CB,superRefine:()=>PA,symbol:()=>bB,templateLiteral:()=>BB,toJSONSchema:()=>Yc,toLowerCase:()=>ud,toUpperCase:()=>ld,transform:()=>Ev,treeifyError:()=>IE,trim:()=>cd,tuple:()=>eA,uint32:()=>mB,uint64:()=>yB,ulid:()=>K4,undefined:()=>xB,union:()=>Ct,unknown:()=>Ot,uppercase:()=>rd,url:()=>q4,util:()=>ee,uuid:()=>U4,uuidv4:()=>L4,uuidv6:()=>j4,uuidv7:()=>F4,void:()=>_B,xid:()=>J4,xor:()=>EB});var lh={};kn(lh,{ZodAny:()=>Gk,ZodArray:()=>Kk,ZodBase64:()=>xv,ZodBase64URL:()=>vv,ZodBigInt:()=>vd,ZodBigIntFormat:()=>Sv,ZodBoolean:()=>xd,ZodCIDRv4:()=>yv,ZodCIDRv6:()=>bv,ZodCUID:()=>lv,ZodCUID2:()=>dv,ZodCatch:()=>hA,ZodCodec:()=>_h,ZodCustom:()=>wh,ZodCustomStringFormat:()=>yd,ZodDate:()=>gh,ZodDefault:()=>uA,ZodDiscriminatedUnion:()=>Yk,ZodE164:()=>_v,ZodEmail:()=>sv,ZodEmoji:()=>cv,ZodEnum:()=>hd,ZodExactOptional:()=>aA,ZodFile:()=>oA,ZodFunction:()=>EA,ZodGUID:()=>dh,ZodIPv4:()=>hv,ZodIPv6:()=>gv,ZodIntersection:()=>Qk,ZodJWT:()=>wv,ZodKSUID:()=>mv,ZodLazy:()=>wA,ZodLiteral:()=>nA,ZodMAC:()=>jk,ZodMap:()=>tA,ZodNaN:()=>yA,ZodNanoID:()=>uv,ZodNever:()=>Zk,ZodNonOptional:()=>Iv,ZodNull:()=>Hk,ZodNullable:()=>cA,ZodNumber:()=>bd,ZodNumberFormat:()=>Xc,ZodObject:()=>yh,ZodOptional:()=>wd,ZodPipe:()=>vh,ZodPrefault:()=>dA,ZodPreprocess:()=>bA,ZodPromise:()=>TA,ZodReadonly:()=>xA,ZodRecord:()=>md,ZodSet:()=>rA,ZodString:()=>gd,ZodStringFormat:()=>$t,ZodSuccess:()=>mA,ZodSymbol:()=>Fk,ZodTemplateLiteral:()=>_A,ZodTransform:()=>iA,ZodTuple:()=>Xk,ZodType:()=>Je,ZodULID:()=>pv,ZodURL:()=>mh,ZodUUID:()=>wi,ZodUndefined:()=>qk,ZodUnion:()=>bh,ZodUnknown:()=>Vk,ZodVoid:()=>Wk,ZodXID:()=>fv,ZodXor:()=>Jk,_ZodString:()=>av,_default:()=>lA,_function:()=>UB,any:()=>vB,array:()=>nt,base64:()=>nB,base64url:()=>oB,bigint:()=>hB,boolean:()=>ar,catch:()=>gA,check:()=>LB,cidrv4:()=>tB,cidrv6:()=>rB,codec:()=>NB,cuid:()=>Z4,cuid2:()=>W4,custom:()=>Pv,date:()=>wB,describe:()=>jB,discriminatedUnion:()=>xh,e164:()=>iB,email:()=>B4,emoji:()=>G4,enum:()=>Br,exactOptional:()=>sA,file:()=>$B,float32:()=>dB,float64:()=>pB,function:()=>UB,guid:()=>D4,hash:()=>lB,hex:()=>uB,hostname:()=>cB,httpUrl:()=>H4,instanceof:()=>qB,int:()=>ov,int32:()=>fB,int64:()=>gB,intersection:()=>_d,invertCodec:()=>MB,ipv4:()=>Q4,ipv6:()=>eB,json:()=>GB,jwt:()=>aB,keyof:()=>SB,ksuid:()=>Y4,lazy:()=>SA,literal:()=>Ee,looseObject:()=>Mr,looseRecord:()=>PB,mac:()=>X4,map:()=>kB,meta:()=>FB,nan:()=>zB,nanoid:()=>V4,nativeEnum:()=>RB,never:()=>Tv,nonoptional:()=>fA,null:()=>hh,nullable:()=>ph,nullish:()=>OB,number:()=>gt,object:()=>ye,optional:()=>Bt,partialRecord:()=>IB,pipe:()=>iv,prefault:()=>pA,preprocess:()=>Sh,promise:()=>DB,readonly:()=>vA,record:()=>kt,refine:()=>IA,set:()=>AB,strictObject:()=>TB,string:()=>D,stringFormat:()=>sB,stringbool:()=>HB,success:()=>CB,superRefine:()=>PA,symbol:()=>bB,templateLiteral:()=>BB,transform:()=>Ev,tuple:()=>eA,uint32:()=>mB,uint64:()=>yB,ulid:()=>K4,undefined:()=>xB,union:()=>Ct,unknown:()=>Ot,url:()=>q4,uuid:()=>U4,uuidv4:()=>L4,uuidv6:()=>j4,uuidv7:()=>F4,void:()=>_B,xid:()=>J4,xor:()=>EB});var Xx={};kn(Xx,{endsWith:()=>id,gt:()=>vi,gte:()=>un,includes:()=>nd,length:()=>Kc,lowercase:()=>td,lt:()=>xi,lte:()=>Wn,maxLength:()=>Wc,maxSize:()=>_s,mime:()=>ad,minLength:()=>la,minSize:()=>_i,multipleOf:()=>vs,negative:()=>Mx,nonnegative:()=>Dx,nonpositive:()=>Bx,normalize:()=>sd,overwrite:()=>Co,positive:()=>Nx,property:()=>Ux,regex:()=>ed,size:()=>Zc,slugify:()=>dd,startsWith:()=>od,toLowerCase:()=>ud,toUpperCase:()=>ld,trim:()=>cd,uppercase:()=>rd});var Ps={};kn(Ps,{ZodISODate:()=>tv,ZodISODateTime:()=>ev,ZodISODuration:()=>nv,ZodISOTime:()=>rv,date:()=>Ik,datetime:()=>Ek,duration:()=>kk,time:()=>Pk});var ev=R("ZodISODateTime",(e,t)=>{SI.init(e,t),$t.init(e,t)});function Ek(e){return RP(ev,e)}var tv=R("ZodISODate",(e,t)=>{TI.init(e,t),$t.init(e,t)});function Ik(e){return $P(tv,e)}var rv=R("ZodISOTime",(e,t)=>{EI.init(e,t),$t.init(e,t)});function Pk(e){return OP(rv,e)}var nv=R("ZodISODuration",(e,t)=>{II.init(e,t),$t.init(e,t)});function kk(e){return CP(nv,e)}var N4=(e,t)=>{Am.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>$m(e,r)},flatten:{value:(r)=>Rm(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ul,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ul,2)}},isEmpty:{get(){return e.issues.length===0}}})},goe=R("ZodError",N4),Cn=R("ZodError",N4,{Parent:Error});var Ak=Fl(Cn),Rk=ql(Cn),$k=Hl(Cn),Ok=Gl(Cn),Ck=Wb(Cn),zk=Kb(Cn),Nk=Jb(Cn),Mk=Yb(Cn),Bk=Qb(Cn),Dk=Xb(Cn),Uk=e0(Cn),Lk=t0(Cn);var M4=new WeakMap;function fh(e,t,r){let o=Object.getPrototypeOf(e),n=M4.get(o);if(!n)n=new Set,M4.set(o,n);if(n.has(t))return;n.add(t);for(let i in r){let a=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let s=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}var Je=R("ZodType",(e,t)=>(Ue.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:pd(e,"input"),output:pd(e,"output")}}),e.toJSONSchema=UP(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Ak(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>$k(e,r,o),e.parseAsync=async(r,o)=>Rk(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Ok(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Ck(e,r,o),e.decode=(r,o)=>zk(e,r,o),e.encodeAsync=async(r,o)=>Nk(e,r,o),e.decodeAsync=async(r,o)=>Mk(e,r,o),e.safeEncode=(r,o)=>Bk(e,r,o),e.safeDecode=(r,o)=>Dk(e,r,o),e.safeEncodeAsync=async(r,o)=>Uk(e,r,o),e.safeDecodeAsync=async(r,o)=>Lk(e,r,o),fh(e,"ZodType",{check(...r){let o=this.def;return this.clone(ee.mergeDefs(o,{checks:[...o.checks??[],...r.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return zr(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(IA(r,o))},superRefine(r,o){return this.check(PA(r,o))},overwrite(r){return this.check(Co(r))},optional(){return Bt(this)},exactOptional(){return sA(this)},nullable(){return ph(this)},nullish(){return Bt(ph(this))},nonoptional(r){return fA(this,r)},array(){return nt(this)},or(r){return Ct([this,r])},and(r){return _d(this,r)},transform(r){return iv(this,Ev(r))},default(r){return lA(this,r)},prefault(r){return pA(this,r)},catch(r){return gA(this,r)},pipe(r){return iv(this,r)},readonly(){return vA(this)},describe(r){let o=this.clone();return Nr.add(o,{description:r}),o},meta(...r){if(r.length===0)return Nr.get(this);let o=this.clone();return Nr.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Nr.get(e)?.description},configurable:!0}),e)),av=R("_ZodString",(e,t)=>{xs.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>LP(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,fh(e,"_ZodString",{regex(...o){return this.check(ed(...o))},includes(...o){return this.check(nd(...o))},startsWith(...o){return this.check(od(...o))},endsWith(...o){return this.check(id(...o))},min(...o){return this.check(la(...o))},max(...o){return this.check(Wc(...o))},length(...o){return this.check(Kc(...o))},nonempty(...o){return this.check(la(1,...o))},lowercase(o){return this.check(td(o))},uppercase(o){return this.check(rd(o))},trim(){return this.check(cd())},normalize(...o){return this.check(sd(...o))},toLowerCase(){return this.check(ud())},toUpperCase(){return this.check(ld())},slugify(){return this.check(dd())}})}),gd=R("ZodString",(e,t)=>{xs.init(e,t),av.init(e,t),e.email=(r)=>e.check(Hm(sv,r)),e.url=(r)=>e.check(Xl(mh,r)),e.jwt=(r)=>e.check(uh(wv,r)),e.emoji=(r)=>e.check(Km(cv,r)),e.guid=(r)=>e.check(Ql(dh,r)),e.uuid=(r)=>e.check(Gm(wi,r)),e.uuidv4=(r)=>e.check(Vm(wi,r)),e.uuidv6=(r)=>e.check(Zm(wi,r)),e.uuidv7=(r)=>e.check(Wm(wi,r)),e.nanoid=(r)=>e.check(Jm(uv,r)),e.guid=(r)=>e.check(Ql(dh,r)),e.cuid=(r)=>e.check(Ym(lv,r)),e.cuid2=(r)=>e.check(Qm(dv,r)),e.ulid=(r)=>e.check(Xm(pv,r)),e.base64=(r)=>e.check(ah(xv,r)),e.base64url=(r)=>e.check(sh(vv,r)),e.xid=(r)=>e.check(eh(fv,r)),e.ksuid=(r)=>e.check(th(mv,r)),e.ipv4=(r)=>e.check(rh(hv,r)),e.ipv6=(r)=>e.check(nh(gv,r)),e.cidrv4=(r)=>e.check(oh(yv,r)),e.cidrv6=(r)=>e.check(ih(bv,r)),e.e164=(r)=>e.check(ch(_v,r)),e.datetime=(r)=>e.check(Ek(r)),e.date=(r)=>e.check(Ik(r)),e.time=(r)=>e.check(Pk(r)),e.duration=(r)=>e.check(kk(r))});function D(e){return mx(gd,e)}var $t=R("ZodStringFormat",(e,t)=>{Pt.init(e,t),av.init(e,t)}),sv=R("ZodEmail",(e,t)=>{p0.init(e,t),$t.init(e,t)});function B4(e){return Hm(sv,e)}var dh=R("ZodGUID",(e,t)=>{l0.init(e,t),$t.init(e,t)});function D4(e){return Ql(dh,e)}var wi=R("ZodUUID",(e,t)=>{d0.init(e,t),$t.init(e,t)});function U4(e){return Gm(wi,e)}function L4(e){return Vm(wi,e)}function j4(e){return Zm(wi,e)}function F4(e){return Wm(wi,e)}var mh=R("ZodURL",(e,t)=>{f0.init(e,t),$t.init(e,t)});function q4(e){return Xl(mh,e)}function H4(e){return Xl(mh,{protocol:On.httpProtocol,hostname:On.domain,...ee.normalizeParams(e)})}var cv=R("ZodEmoji",(e,t)=>{m0.init(e,t),$t.init(e,t)});function G4(e){return Km(cv,e)}var uv=R("ZodNanoID",(e,t)=>{h0.init(e,t),$t.init(e,t)});function V4(e){return Jm(uv,e)}var lv=R("ZodCUID",(e,t)=>{g0.init(e,t),$t.init(e,t)});function Z4(e){return Ym(lv,e)}var dv=R("ZodCUID2",(e,t)=>{y0.init(e,t),$t.init(e,t)});function W4(e){return Qm(dv,e)}var pv=R("ZodULID",(e,t)=>{b0.init(e,t),$t.init(e,t)});function K4(e){return Xm(pv,e)}var fv=R("ZodXID",(e,t)=>{x0.init(e,t),$t.init(e,t)});function J4(e){return eh(fv,e)}var mv=R("ZodKSUID",(e,t)=>{v0.init(e,t),$t.init(e,t)});function Y4(e){return th(mv,e)}var hv=R("ZodIPv4",(e,t)=>{_0.init(e,t),$t.init(e,t)});function Q4(e){return rh(hv,e)}var jk=R("ZodMAC",(e,t)=>{S0.init(e,t),$t.init(e,t)});function X4(e){return hx(jk,e)}var gv=R("ZodIPv6",(e,t)=>{w0.init(e,t),$t.init(e,t)});function eB(e){return nh(gv,e)}var yv=R("ZodCIDRv4",(e,t)=>{T0.init(e,t),$t.init(e,t)});function tB(e){return oh(yv,e)}var bv=R("ZodCIDRv6",(e,t)=>{E0.init(e,t),$t.init(e,t)});function rB(e){return ih(bv,e)}var xv=R("ZodBase64",(e,t)=>{I0.init(e,t),$t.init(e,t)});function nB(e){return ah(xv,e)}var vv=R("ZodBase64URL",(e,t)=>{P0.init(e,t),$t.init(e,t)});function oB(e){return sh(vv,e)}var _v=R("ZodE164",(e,t)=>{k0.init(e,t),$t.init(e,t)});function iB(e){return ch(_v,e)}var wv=R("ZodJWT",(e,t)=>{A0.init(e,t),$t.init(e,t)});function aB(e){return uh(wv,e)}var yd=R("ZodCustomStringFormat",(e,t)=>{R0.init(e,t),$t.init(e,t)});function sB(e,t,r={}){return Jc(yd,e,t,r)}function cB(e){return Jc(yd,"hostname",On.hostname,e)}function uB(e){return Jc(yd,"hex",On.hex,e)}function lB(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=On[o];if(!n)throw Error(`Unrecognized hash format: ${o}`);return Jc(yd,o,n,t)}var bd=R("ZodNumber",(e,t)=>{Nm.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>jP(e,o,n,i),fh(e,"ZodNumber",{gt(o,n){return this.check(vi(o,n))},gte(o,n){return this.check(un(o,n))},min(o,n){return this.check(un(o,n))},lt(o,n){return this.check(xi(o,n))},lte(o,n){return this.check(Wn(o,n))},max(o,n){return this.check(Wn(o,n))},int(o){return this.check(ov(o))},safe(o){return this.check(ov(o))},positive(o){return this.check(vi(0,o))},nonnegative(o){return this.check(un(0,o))},negative(o){return this.check(xi(0,o))},nonpositive(o){return this.check(Wn(0,o))},multipleOf(o,n){return this.check(vs(o,n))},step(o,n){return this.check(vs(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function gt(e){return gx(bd,e)}var Xc=R("ZodNumberFormat",(e,t)=>{$0.init(e,t),bd.init(e,t)});function ov(e){return yx(Xc,e)}function dB(e){return bx(Xc,e)}function pB(e){return xx(Xc,e)}function fB(e){return vx(Xc,e)}function mB(e){return _x(Xc,e)}var xd=R("ZodBoolean",(e,t)=>{Zl.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>FP(e,r,o,n)});function ar(e){return wx(xd,e)}var vd=R("ZodBigInt",(e,t)=>{Mm.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>qP(e,o,n,i),e.gte=(o,n)=>e.check(un(o,n)),e.min=(o,n)=>e.check(un(o,n)),e.gt=(o,n)=>e.check(vi(o,n)),e.gte=(o,n)=>e.check(un(o,n)),e.min=(o,n)=>e.check(un(o,n)),e.lt=(o,n)=>e.check(xi(o,n)),e.lte=(o,n)=>e.check(Wn(o,n)),e.max=(o,n)=>e.check(Wn(o,n)),e.positive=(o)=>e.check(vi(BigInt(0),o)),e.negative=(o)=>e.check(xi(BigInt(0),o)),e.nonpositive=(o)=>e.check(Wn(BigInt(0),o)),e.nonnegative=(o)=>e.check(un(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(vs(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function hB(e){return Sx(vd,e)}var Sv=R("ZodBigIntFormat",(e,t)=>{O0.init(e,t),vd.init(e,t)});function gB(e){return Tx(Sv,e)}function yB(e){return Ex(Sv,e)}var Fk=R("ZodSymbol",(e,t)=>{C0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>HP(e,r,o,n)});function bB(e){return Ix(Fk,e)}var qk=R("ZodUndefined",(e,t)=>{z0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>VP(e,r,o,n)});function xB(e){return Px(qk,e)}var Hk=R("ZodNull",(e,t)=>{N0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>GP(e,r,o,n)});function hh(e){return kx(Hk,e)}var Gk=R("ZodAny",(e,t)=>{M0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>KP(e,r,o,n)});function vB(){return Ax(Gk)}var Vk=R("ZodUnknown",(e,t)=>{B0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>JP(e,r,o,n)});function Ot(){return Rx(Vk)}var Zk=R("ZodNever",(e,t)=>{D0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>WP(e,r,o,n)});function Tv(e){return $x(Zk,e)}var Wk=R("ZodVoid",(e,t)=>{U0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ZP(e,r,o,n)});function _B(e){return Ox(Wk,e)}var gh=R("ZodDate",(e,t)=>{L0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>YP(e,o,n,i),e.min=(o,n)=>e.check(un(o,n)),e.max=(o,n)=>e.check(Wn(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function wB(e){return Cx(gh,e)}var Kk=R("ZodArray",(e,t)=>{j0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>uk(e,r,o,n),e.element=t.element,fh(e,"ZodArray",{min(r,o){return this.check(la(r,o))},nonempty(r){return this.check(la(1,r))},max(r,o){return this.check(Wc(r,o))},length(r,o){return this.check(Kc(r,o))},unwrap(){return this.element}})});function nt(e,t){return DP(Kk,e,t)}function SB(e){let t=e._zod.def.shape;return Br(Object.keys(t))}var yh=R("ZodObject",(e,t)=>{kI.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lk(e,r,o,n),ee.defineLazy(e,"shape",()=>t.shape),fh(e,"ZodObject",{keyof(){return Br(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Ot()})},loose(){return this.clone({...this._zod.def,catchall:Ot()})},strict(){return this.clone({...this._zod.def,catchall:Tv()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return ee.extend(this,r)},safeExtend(r){return ee.safeExtend(this,r)},merge(r){return ee.merge(this,r)},pick(r){return ee.pick(this,r)},omit(r){return ee.omit(this,r)},partial(...r){return ee.partial(wd,this,r[0])},required(...r){return ee.required(Iv,this,r[0])}})});function ye(e,t){let r={type:"object",shape:e??{},...ee.normalizeParams(t)};return new yh(r)}function TB(e,t){return new yh({type:"object",shape:e,catchall:Tv(),...ee.normalizeParams(t)})}function Mr(e,t){return new yh({type:"object",shape:e,catchall:Ot(),...ee.normalizeParams(t)})}var bh=R("ZodUnion",(e,t)=>{Wl.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wx(e,r,o,n),e.options=t.options});function Ct(e,t){return new bh({type:"union",options:e,...ee.normalizeParams(t)})}var Jk=R("ZodXor",(e,t)=>{bh.init(e,t),q0.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wx(e,r,o,n),e.options=t.options});function EB(e,t){return new Jk({type:"union",options:e,inclusive:!1,...ee.normalizeParams(t)})}var Yk=R("ZodDiscriminatedUnion",(e,t)=>{bh.init(e,t),H0.init(e,t)});function xh(e,t,r){return new Yk({type:"union",options:t,discriminator:e,...ee.normalizeParams(r)})}var Qk=R("ZodIntersection",(e,t)=>{G0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dk(e,r,o,n)});function _d(e,t){return new Qk({type:"intersection",left:e,right:t})}var Xk=R("ZodTuple",(e,t)=>{Bm.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pk(e,r,o,n),e.rest=(r)=>e.clone({...e._zod.def,rest:r})});function eA(e,t,r){let o=t instanceof Ue,n=o?r:t;return new Xk({type:"tuple",items:e,rest:o?t:null,...ee.normalizeParams(n)})}var md=R("ZodRecord",(e,t)=>{V0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fk(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function kt(e,t,r){if(!t||!t._zod)return new md({type:"record",keyType:D(),valueType:e,...ee.normalizeParams(t)});return new md({type:"record",keyType:e,valueType:t,...ee.normalizeParams(r)})}function IB(e,t,r){let o=zr(e);return o._zod.values=void 0,new md({type:"record",keyType:o,valueType:t,...ee.normalizeParams(r)})}function PB(e,t,r){return new md({type:"record",keyType:e,valueType:t,mode:"loose",...ee.normalizeParams(r)})}var tA=R("ZodMap",(e,t)=>{Z0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sk(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(_i(...r)),e.nonempty=(r)=>e.check(_i(1,r)),e.max=(...r)=>e.check(_s(...r)),e.size=(...r)=>e.check(Zc(...r))});function kB(e,t,r){return new tA({type:"map",keyType:e,valueType:t,...ee.normalizeParams(r)})}var rA=R("ZodSet",(e,t)=>{W0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ck(e,r,o,n),e.min=(...r)=>e.check(_i(...r)),e.nonempty=(r)=>e.check(_i(1,r)),e.max=(...r)=>e.check(_s(...r)),e.size=(...r)=>e.check(Zc(...r))});function AB(e,t){return new rA({type:"set",valueType:e,...ee.normalizeParams(t)})}var hd=R("ZodEnum",(e,t)=>{K0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>QP(e,o,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let a of o)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new hd({...t,checks:[],...ee.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let a of o)if(r.has(a))delete i[a];else throw Error(`Key ${a} not found in enum`);return new hd({...t,checks:[],...ee.normalizeParams(n),entries:i})}});function Br(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new hd({type:"enum",entries:r,...ee.normalizeParams(t)})}function RB(e,t){return new hd({type:"enum",entries:e,...ee.normalizeParams(t)})}var nA=R("ZodLiteral",(e,t)=>{J0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>XP(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ee(e,t){return new nA({type:"literal",values:Array.isArray(e)?e:[e],...ee.normalizeParams(t)})}var oA=R("ZodFile",(e,t)=>{Y0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rk(e,r,o,n),e.min=(r,o)=>e.check(_i(r,o)),e.max=(r,o)=>e.check(_s(r,o)),e.mime=(r,o)=>e.check(ad(Array.isArray(r)?r:[r],o))});function $B(e){return Lx(oA,e)}var iA=R("ZodTransform",(e,t)=>{Q0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ak(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Fc(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ee.issue(i,r.value,t));else{let a=i;if(a.fatal)a.continue=!1;a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(ee.issue(a))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r.fallback=!0,r));return r.value=n,r.fallback=!0,r}});function Ev(e){return new iA({type:"transform",transform:e})}var wd=R("ZodOptional",(e,t)=>{Dm.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kx(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Bt(e){return new wd({type:"optional",innerType:e})}var aA=R("ZodExactOptional",(e,t)=>{X0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kx(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function sA(e){return new aA({type:"optional",innerType:e})}var cA=R("ZodNullable",(e,t)=>{ex.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ph(e){return new cA({type:"nullable",innerType:e})}function OB(e){return Bt(ph(e))}var uA=R("ZodDefault",(e,t)=>{tx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lA(e,t){return new uA({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ee.shallowClone(t)}})}var dA=R("ZodPrefault",(e,t)=>{rx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function pA(e,t){return new dA({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ee.shallowClone(t)}})}var Iv=R("ZodNonOptional",(e,t)=>{nx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function fA(e,t){return new Iv({type:"nonoptional",innerType:e,...ee.normalizeParams(t)})}var mA=R("ZodSuccess",(e,t)=>{ox.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function CB(e){return new mA({type:"success",innerType:e})}var hA=R("ZodCatch",(e,t)=>{ix.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gA(e,t){return new hA({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var yA=R("ZodNaN",(e,t)=>{ax.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ek(e,r,o,n)});function zB(e){return zx(yA,e)}var vh=R("ZodPipe",(e,t)=>{Um.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xk(e,r,o,n),e.in=t.in,e.out=t.out});function iv(e,t){return new vh({type:"pipe",in:e,out:t})}var _h=R("ZodCodec",(e,t)=>{vh.init(e,t),Kl.init(e,t)});function NB(e,t,r){return new _h({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function MB(e){let t=e._zod.def;return new _h({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var bA=R("ZodPreprocess",(e,t)=>{vh.init(e,t),AI.init(e,t)}),xA=R("ZodReadonly",(e,t)=>{sx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function vA(e){return new xA({type:"readonly",innerType:e})}var _A=R("ZodTemplateLiteral",(e,t)=>{cx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tk(e,r,o,n)});function BB(e,t){return new _A({type:"template_literal",parts:e,...ee.normalizeParams(t)})}var wA=R("ZodLazy",(e,t)=>{dx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wk(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function SA(e){return new wA({type:"lazy",getter:e})}var TA=R("ZodPromise",(e,t)=>{lx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_k(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function DB(e){return new TA({type:"promise",innerType:e})}var EA=R("ZodFunction",(e,t)=>{ux.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ik(e,r,o,n)});function UB(e){return new EA({type:"function",input:Array.isArray(e?.input)?eA(e?.input):e?.input??nt(Ot()),output:e?.output??Ot()})}var wh=R("ZodCustom",(e,t)=>{px.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ok(e,r,o,n)});function LB(e){let t=new Rt({check:"custom"});return t._zod.check=e,t}function Pv(e,t){return jx(wh,e??(()=>!0),t)}function IA(e,t={}){return Fx(wh,e,t)}function PA(e,t){return qx(e,t)}var jB=Hx,FB=Gx;function qB(e,t={}){let r=new wh({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...ee.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=(o)=>{if(!(o.value instanceof e))o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var HB=(...e)=>Vx({Codec:_h,Boolean:xd,String:gd},...e);function GB(e){let t=SA(()=>Ct([D(e),gt(),ar(),hh(),nt(t),kt(D(),t)]));return t}function Sh(e,t){return new bA({type:"pipe",in:Ev(e),out:t})}var boe={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function xoe(e){or({customError:e})}function voe(){return or().customError}var kA;(function(e){})(kA||(kA={}));var he={...lh,...Xx,iso:Ps},_oe=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function woe(e,t){let r=e.$schema;if(r==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(r==="http://json-schema.org/draft-07/schema#")return"draft-7";if(r==="http://json-schema.org/draft-04/schema#")return"draft-4";return t??"draft-2020-12"}function Soe(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}function VB(e,t){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return he.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return he.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=Soe(n,t),a=Qr(i,t);return t.refs.set(n,a),t.processing.delete(n),a}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return he.null();if(n.length===0)return he.never();if(n.length===1)return he.literal(n[0]);if(n.every((a)=>typeof a==="string"))return he.enum(n);let i=n.map((a)=>he.literal(a));if(i.length<2)return i[0];return he.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return he.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map((i)=>{let a={...e,type:i};return VB(a,t)});if(n.length===0)return he.never();if(n.length===1)return n[0];return he.union(n)}if(!r)return he.any();let o;switch(r){case"string":{let n=he.string();if(e.format){let i=e.format;if(i==="email")n=n.check(he.email());else if(i==="uri"||i==="uri-reference")n=n.check(he.url());else if(i==="uuid"||i==="guid")n=n.check(he.uuid());else if(i==="date-time")n=n.check(he.iso.datetime());else if(i==="date")n=n.check(he.iso.date());else if(i==="time")n=n.check(he.iso.time());else if(i==="duration")n=n.check(he.iso.duration());else if(i==="ipv4")n=n.check(he.ipv4());else if(i==="ipv6")n=n.check(he.ipv6());else if(i==="mac")n=n.check(he.mac());else if(i==="cidr")n=n.check(he.cidrv4());else if(i==="cidr-v6")n=n.check(he.cidrv6());else if(i==="base64")n=n.check(he.base64());else if(i==="base64url")n=n.check(he.base64url());else if(i==="e164")n=n.check(he.e164());else if(i==="jwt")n=n.check(he.jwt());else if(i==="emoji")n=n.check(he.emoji());else if(i==="nanoid")n=n.check(he.nanoid());else if(i==="cuid")n=n.check(he.cuid());else if(i==="cuid2")n=n.check(he.cuid2());else if(i==="ulid")n=n.check(he.ulid());else if(i==="xid")n=n.check(he.xid());else if(i==="ksuid")n=n.check(he.ksuid())}if(typeof e.minLength==="number")n=n.min(e.minLength);if(typeof e.maxLength==="number")n=n.max(e.maxLength);if(e.pattern)n=n.regex(new RegExp(e.pattern));o=n;break}case"number":case"integer":{let n=r==="integer"?he.number().int():he.number();if(typeof e.minimum==="number")n=n.min(e.minimum);if(typeof e.maximum==="number")n=n.max(e.maximum);if(typeof e.exclusiveMinimum==="number")n=n.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")n=n.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")n=n.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")n=n.lt(e.maximum);if(typeof e.multipleOf==="number")n=n.multipleOf(e.multipleOf);o=n;break}case"boolean":{o=he.boolean();break}case"null":{o=he.null();break}case"object":{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[c,u]of Object.entries(i)){let d=Qr(u,t);n[c]=a.has(c)?d:d.optional()}if(e.propertyNames){let c=Qr(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties==="object"?Qr(e.additionalProperties,t):he.any();if(Object.keys(n).length===0){o=he.record(c,u);break}let d=he.object(n).passthrough(),p=he.looseRecord(c,u);o=he.intersection(d,p);break}if(e.patternProperties){let c=e.patternProperties,u=Object.keys(c),d=[];for(let m of u){let h=Qr(c[m],t),y=he.string().regex(new RegExp(m));d.push(he.looseRecord(y,h))}let p=[];if(Object.keys(n).length>0)p.push(he.object(n).passthrough());if(p.push(...d),p.length===0)o=he.object({}).passthrough();else if(p.length===1)o=p[0];else{let m=he.intersection(p[0],p[1]);for(let h=2;h<p.length;h++)m=he.intersection(m,p[h]);o=m}break}let s=he.object(n);if(e.additionalProperties===!1)o=s.strict();else if(typeof e.additionalProperties==="object")o=s.catchall(Qr(e.additionalProperties,t));else o=s.passthrough();break}case"array":{let{prefixItems:n,items:i}=e;if(n&&Array.isArray(n)){let a=n.map((c)=>Qr(c,t)),s=i&&typeof i==="object"&&!Array.isArray(i)?Qr(i,t):void 0;if(s)o=he.tuple(a).rest(s);else o=he.tuple(a);if(typeof e.minItems==="number")o=o.check(he.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(he.maxLength(e.maxItems))}else if(Array.isArray(i)){let a=i.map((c)=>Qr(c,t)),s=e.additionalItems&&typeof e.additionalItems==="object"?Qr(e.additionalItems,t):void 0;if(s)o=he.tuple(a).rest(s);else o=he.tuple(a);if(typeof e.minItems==="number")o=o.check(he.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(he.maxLength(e.maxItems))}else if(i!==void 0){let a=Qr(i,t),s=he.array(a);if(typeof e.minItems==="number")s=s.min(e.minItems);if(typeof e.maxItems==="number")s=s.max(e.maxItems);o=s}else o=he.array(he.any());break}default:throw Error(`Unsupported type: ${r}`)}return o}function Qr(e,t){if(typeof e==="boolean")return e?he.any():he.never();let r=VB(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map((u)=>Qr(u,t)),c=he.union(s);r=o?he.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map((u)=>Qr(u,t)),c=he.xor(s);r=o?he.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:he.any();else{let s=o?r:Qr(e.allOf[0],t),c=o?0:1;for(let u=c;u<e.allOf.length;u++)s=he.intersection(s,Qr(e.allOf[u],t));r=s}if(e.nullable===!0&&t.version==="openapi-3.0")r=he.nullable(r);if(e.readOnly===!0)r=he.readonly(r);if(e.default!==void 0)r=r.default(e.default);let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of i)if(s in e)n[s]=e[s];let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)if(s in e)n[s]=e[s];for(let s of Object.keys(e))if(!_oe.has(s))n[s]=e[s];if(Object.keys(n).length>0)t.registry.add(r,n);if(e.description)r=r.describe(e.description);return r}function ZB(e,t){if(typeof e==="boolean")return e?he.any():he.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=woe(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Nr};return Qr(r,i)}var AA={};kn(AA,{bigint:()=>Poe,boolean:()=>Ioe,date:()=>koe,number:()=>Eoe,string:()=>Toe});function Toe(e){return kP(gd,e)}function Eoe(e){return zP(bd,e)}function Ioe(e){return NP(xd,e)}function Poe(e){return MP(vd,e)}function koe(e){return BP(gh,e)}or(Lm());var RA="2025-11-25";var WB=[RA,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ks="io.modelcontextprotocol/related-task",Av="2.0",yr=Pv((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),KB=Ct([D(),gt().int()]),JB=D(),CEe=Mr({ttl:gt().optional(),pollInterval:gt().optional()}),Aoe=ye({ttl:gt().optional()}),Roe=ye({taskId:D()}),$A=Mr({progressToken:KB.optional(),[ks]:Roe.optional()}),Kn=ye({_meta:$A.optional()}),Th=Kn.extend({task:Aoe.optional()}),YB=(e)=>Th.safeParse(e).success,Dr=ye({method:D(),params:Kn.loose().optional()}),ao=ye({_meta:$A.optional()}),so=ye({method:D(),params:ao.loose().optional()}),Ur=Mr({_meta:$A.optional()}),Rv=Ct([D(),gt().int()]),QB=ye({jsonrpc:Ee(Av),id:Rv,...Dr.shape}).strict(),OA=(e)=>QB.safeParse(e).success,XB=ye({jsonrpc:Ee(Av),...so.shape}).strict(),eD=(e)=>XB.safeParse(e).success,CA=ye({jsonrpc:Ee(Av),id:Rv,result:Ur}).strict(),Eh=(e)=>CA.safeParse(e).success;var Oe;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Oe||(Oe={}));var zA=ye({jsonrpc:Ee(Av),id:Rv.optional(),error:ye({code:gt().int(),message:D(),data:Ot().optional()})}).strict();var tD=(e)=>zA.safeParse(e).success;var rD=Ct([QB,XB,CA,zA]),zEe=Ct([CA,zA]),$v=Ur.strict(),$oe=ao.extend({requestId:Rv.optional(),reason:D().optional()}),Ov=so.extend({method:Ee("notifications/cancelled"),params:$oe}),Ooe=ye({src:D(),mimeType:D().optional(),sizes:nt(D()).optional(),theme:Br(["light","dark"]).optional()}),Ih=ye({icons:nt(Ooe).optional()}),Sd=ye({name:D(),title:D().optional()}),nD=Sd.extend({...Sd.shape,...Ih.shape,version:D(),websiteUrl:D().optional(),description:D().optional()}),Coe=_d(ye({applyDefaults:ar().optional()}),kt(D(),Ot())),zoe=Sh((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},_d(ye({form:Coe.optional(),url:yr.optional()}),kt(D(),Ot()).optional())),Noe=Mr({list:yr.optional(),cancel:yr.optional(),requests:Mr({sampling:Mr({createMessage:yr.optional()}).optional(),elicitation:Mr({create:yr.optional()}).optional()}).optional()}),Moe=Mr({list:yr.optional(),cancel:yr.optional(),requests:Mr({tools:Mr({call:yr.optional()}).optional()}).optional()}),Boe=ye({experimental:kt(D(),yr).optional(),sampling:ye({context:yr.optional(),tools:yr.optional()}).optional(),elicitation:zoe.optional(),roots:ye({listChanged:ar().optional()}).optional(),tasks:Noe.optional(),extensions:kt(D(),yr).optional()}),Doe=Kn.extend({protocolVersion:D(),capabilities:Boe,clientInfo:nD}),NA=Dr.extend({method:Ee("initialize"),params:Doe});var Uoe=ye({experimental:kt(D(),yr).optional(),logging:yr.optional(),completions:yr.optional(),prompts:ye({listChanged:ar().optional()}).optional(),resources:ye({subscribe:ar().optional(),listChanged:ar().optional()}).optional(),tools:ye({listChanged:ar().optional()}).optional(),tasks:Moe.optional(),extensions:kt(D(),yr).optional()}),Loe=Ur.extend({protocolVersion:D(),capabilities:Uoe,serverInfo:nD,instructions:D().optional()}),MA=so.extend({method:Ee("notifications/initialized"),params:ao.optional()});var Cv=Dr.extend({method:Ee("ping"),params:Kn.optional()}),joe=ye({progress:gt(),total:Bt(gt()),message:Bt(D())}),Foe=ye({...ao.shape,...joe.shape,progressToken:KB}),zv=so.extend({method:Ee("notifications/progress"),params:Foe}),qoe=Kn.extend({cursor:JB.optional()}),Ph=Dr.extend({params:qoe.optional()}),kh=Ur.extend({nextCursor:JB.optional()}),Hoe=Br(["working","input_required","completed","failed","cancelled"]),Ah=ye({taskId:D(),status:Hoe,ttl:Ct([gt(),hh()]),createdAt:D(),lastUpdatedAt:D(),pollInterval:Bt(gt()),statusMessage:Bt(D())}),Td=Ur.extend({task:Ah}),Goe=ao.merge(Ah),Rh=so.extend({method:Ee("notifications/tasks/status"),params:Goe}),Nv=Dr.extend({method:Ee("tasks/get"),params:Kn.extend({taskId:D()})}),Mv=Ur.merge(Ah),Bv=Dr.extend({method:Ee("tasks/result"),params:Kn.extend({taskId:D()})}),NEe=Ur.loose(),Dv=Ph.extend({method:Ee("tasks/list")}),Uv=kh.extend({tasks:nt(Ah)}),Lv=Dr.extend({method:Ee("tasks/cancel"),params:Kn.extend({taskId:D()})}),oD=Ur.merge(Ah),iD=ye({uri:D(),mimeType:Bt(D()),_meta:kt(D(),Ot()).optional()}),aD=iD.extend({text:D()}),BA=D().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),sD=iD.extend({blob:BA}),$h=Br(["user","assistant"]),Ed=ye({audience:nt($h).optional(),priority:gt().min(0).max(1).optional(),lastModified:Ps.datetime({offset:!0}).optional()}),cD=ye({...Sd.shape,...Ih.shape,uri:D(),description:Bt(D()),mimeType:Bt(D()),size:Bt(gt()),annotations:Ed.optional(),_meta:Bt(Mr({}))}),Voe=ye({...Sd.shape,...Ih.shape,uriTemplate:D(),description:Bt(D()),mimeType:Bt(D()),annotations:Ed.optional(),_meta:Bt(Mr({}))}),jv=Ph.extend({method:Ee("resources/list")}),Zoe=kh.extend({resources:nt(cD)}),Fv=Ph.extend({method:Ee("resources/templates/list")}),Woe=kh.extend({resourceTemplates:nt(Voe)}),DA=Kn.extend({uri:D()}),Koe=DA,qv=Dr.extend({method:Ee("resources/read"),params:Koe}),Joe=Ur.extend({contents:nt(Ct([aD,sD]))}),Yoe=so.extend({method:Ee("notifications/resources/list_changed"),params:ao.optional()}),Qoe=DA,Xoe=Dr.extend({method:Ee("resources/subscribe"),params:Qoe}),eie=DA,tie=Dr.extend({method:Ee("resources/unsubscribe"),params:eie}),rie=ao.extend({uri:D()}),nie=so.extend({method:Ee("notifications/resources/updated"),params:rie}),oie=ye({name:D(),description:Bt(D()),required:Bt(ar())}),iie=ye({...Sd.shape,...Ih.shape,description:Bt(D()),arguments:Bt(nt(oie)),_meta:Bt(Mr({}))}),Hv=Ph.extend({method:Ee("prompts/list")}),aie=kh.extend({prompts:nt(iie)}),sie=Kn.extend({name:D(),arguments:kt(D(),D()).optional()}),Gv=Dr.extend({method:Ee("prompts/get"),params:sie}),UA=ye({type:Ee("text"),text:D(),annotations:Ed.optional(),_meta:kt(D(),Ot()).optional()}),LA=ye({type:Ee("image"),data:BA,mimeType:D(),annotations:Ed.optional(),_meta:kt(D(),Ot()).optional()}),jA=ye({type:Ee("audio"),data:BA,mimeType:D(),annotations:Ed.optional(),_meta:kt(D(),Ot()).optional()}),cie=ye({type:Ee("tool_use"),name:D(),id:D(),input:kt(D(),Ot()),_meta:kt(D(),Ot()).optional()}),uie=ye({type:Ee("resource"),resource:Ct([aD,sD]),annotations:Ed.optional(),_meta:kt(D(),Ot()).optional()}),lie=cD.extend({type:Ee("resource_link")}),FA=Ct([UA,LA,jA,lie,uie]),die=ye({role:$h,content:FA}),pie=Ur.extend({description:D().optional(),messages:nt(die)}),fie=so.extend({method:Ee("notifications/prompts/list_changed"),params:ao.optional()}),mie=ye({title:D().optional(),readOnlyHint:ar().optional(),destructiveHint:ar().optional(),idempotentHint:ar().optional(),openWorldHint:ar().optional()}),hie=ye({taskSupport:Br(["required","optional","forbidden"]).optional()}),uD=ye({...Sd.shape,...Ih.shape,description:D().optional(),inputSchema:ye({type:Ee("object"),properties:kt(D(),yr).optional(),required:nt(D()).optional()}).catchall(Ot()),outputSchema:ye({type:Ee("object"),properties:kt(D(),yr).optional(),required:nt(D()).optional()}).catchall(Ot()).optional(),annotations:mie.optional(),execution:hie.optional(),_meta:kt(D(),Ot()).optional()}),Vv=Ph.extend({method:Ee("tools/list")}),gie=kh.extend({tools:nt(uD)}),Zv=Ur.extend({content:nt(FA).default([]),structuredContent:kt(D(),Ot()).optional(),isError:ar().optional()}),MEe=Zv.or(Ur.extend({toolResult:Ot()})),yie=Th.extend({name:D(),arguments:kt(D(),Ot()).optional()}),Id=Dr.extend({method:Ee("tools/call"),params:yie}),bie=so.extend({method:Ee("notifications/tools/list_changed"),params:ao.optional()}),BEe=ye({autoRefresh:ar().default(!0),debounceMs:gt().int().nonnegative().default(300)}),Oh=Br(["debug","info","notice","warning","error","critical","alert","emergency"]),xie=Kn.extend({level:Oh}),qA=Dr.extend({method:Ee("logging/setLevel"),params:xie}),vie=ao.extend({level:Oh,logger:D().optional(),data:Ot()}),_ie=so.extend({method:Ee("notifications/message"),params:vie}),wie=ye({name:D().optional()}),Sie=ye({hints:nt(wie).optional(),costPriority:gt().min(0).max(1).optional(),speedPriority:gt().min(0).max(1).optional(),intelligencePriority:gt().min(0).max(1).optional()}),Tie=ye({mode:Br(["auto","required","none"]).optional()}),Eie=ye({type:Ee("tool_result"),toolUseId:D().describe("The unique identifier for the corresponding tool call."),content:nt(FA).default([]),structuredContent:ye({}).loose().optional(),isError:ar().optional(),_meta:kt(D(),Ot()).optional()}),Iie=xh("type",[UA,LA,jA]),kv=xh("type",[UA,LA,jA,cie,Eie]),Pie=ye({role:$h,content:Ct([kv,nt(kv)]),_meta:kt(D(),Ot()).optional()}),kie=Th.extend({messages:nt(Pie),modelPreferences:Sie.optional(),systemPrompt:D().optional(),includeContext:Br(["none","thisServer","allServers"]).optional(),temperature:gt().optional(),maxTokens:gt().int(),stopSequences:nt(D()).optional(),metadata:yr.optional(),tools:nt(uD).optional(),toolChoice:Tie.optional()}),Aie=Dr.extend({method:Ee("sampling/createMessage"),params:kie}),Ch=Ur.extend({model:D(),stopReason:Bt(Br(["endTurn","stopSequence","maxTokens"]).or(D())),role:$h,content:Iie}),HA=Ur.extend({model:D(),stopReason:Bt(Br(["endTurn","stopSequence","maxTokens","toolUse"]).or(D())),role:$h,content:Ct([kv,nt(kv)])}),Rie=ye({type:Ee("boolean"),title:D().optional(),description:D().optional(),default:ar().optional()}),$ie=ye({type:Ee("string"),title:D().optional(),description:D().optional(),minLength:gt().optional(),maxLength:gt().optional(),format:Br(["email","uri","date","date-time"]).optional(),default:D().optional()}),Oie=ye({type:Br(["number","integer"]),title:D().optional(),description:D().optional(),minimum:gt().optional(),maximum:gt().optional(),default:gt().optional()}),Cie=ye({type:Ee("string"),title:D().optional(),description:D().optional(),enum:nt(D()),default:D().optional()}),zie=ye({type:Ee("string"),title:D().optional(),description:D().optional(),oneOf:nt(ye({const:D(),title:D()})),default:D().optional()}),Nie=ye({type:Ee("string"),title:D().optional(),description:D().optional(),enum:nt(D()),enumNames:nt(D()).optional(),default:D().optional()}),Mie=Ct([Cie,zie]),Bie=ye({type:Ee("array"),title:D().optional(),description:D().optional(),minItems:gt().optional(),maxItems:gt().optional(),items:ye({type:Ee("string"),enum:nt(D())}),default:nt(D()).optional()}),Die=ye({type:Ee("array"),title:D().optional(),description:D().optional(),minItems:gt().optional(),maxItems:gt().optional(),items:ye({anyOf:nt(ye({const:D(),title:D()}))}),default:nt(D()).optional()}),Uie=Ct([Bie,Die]),Lie=Ct([Nie,Mie,Uie]),jie=Ct([Lie,Rie,$ie,Oie]),Fie=Th.extend({mode:Ee("form").optional(),message:D(),requestedSchema:ye({type:Ee("object"),properties:kt(D(),jie),required:nt(D()).optional()})}),qie=Th.extend({mode:Ee("url"),message:D(),elicitationId:D(),url:D().url()}),Hie=Ct([Fie,qie]),Gie=Dr.extend({method:Ee("elicitation/create"),params:Hie}),Vie=ao.extend({elicitationId:D()}),Zie=so.extend({method:Ee("notifications/elicitation/complete"),params:Vie}),Pd=Ur.extend({action:Br(["accept","decline","cancel"]),content:Sh((e)=>e===null?void 0:e,kt(D(),Ct([D(),gt(),ar(),nt(D())])).optional())}),Wie=ye({type:Ee("ref/resource"),uri:D()});var Kie=ye({type:Ee("ref/prompt"),name:D()}),Jie=Kn.extend({ref:Ct([Kie,Wie]),argument:ye({name:D(),value:D()}),context:ye({arguments:kt(D(),D()).optional()}).optional()}),Wv=Dr.extend({method:Ee("completion/complete"),params:Jie});function lD(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function dD(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var Yie=Ur.extend({completion:Mr({values:nt(D()).max(100),total:Bt(gt().int()),hasMore:Bt(ar())})}),Qie=ye({uri:D().startsWith("file://"),name:D().optional(),_meta:kt(D(),Ot()).optional()}),Xie=Dr.extend({method:Ee("roots/list"),params:Kn.optional()}),GA=Ur.extend({roots:nt(Qie)}),eae=so.extend({method:Ee("notifications/roots/list_changed"),params:ao.optional()}),DEe=Ct([Cv,NA,Wv,qA,Gv,Hv,jv,Fv,qv,Xoe,tie,Id,Vv,Nv,Bv,Dv,Lv]),UEe=Ct([Ov,zv,MA,eae,Rh]),LEe=Ct([$v,Ch,HA,Pd,GA,Mv,Uv,Td]),jEe=Ct([Cv,Aie,Gie,Xie,Nv,Bv,Dv,Lv]),FEe=Ct([Ov,zv,_ie,nie,Yoe,bie,fie,Rh,Zie]),qEe=Ct([$v,Loe,Yie,pie,aie,Zoe,Woe,Joe,Zv,gie,Mv,Uv,Td]);class Ie extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===Oe.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new pD(o.elicitations,t)}return new Ie(e,t,r)}}class pD extends Ie{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Oe.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function As(e){return e==="completed"||e==="failed"||e==="cancelled"}var mD=Symbol("Let zodToJsonSchema decide on which parser to use");var fD={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},hD=(e)=>typeof e==="string"?{...fD,name:e}:{...fD,...e};var gD=(e)=>{let t=hD(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([o,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,o],jsonSchema:void 0}]))}};function VA(e,t,r,o){if(!o?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function lt(e,t,r,o,n){e[t]=r,VA(e,t,o,n)}var Kv=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function Jt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Kv(t,e.currentPath):t.join("/")}}function yD(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==ne.ZodAny)r.items=Be(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)lt(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)lt(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)lt(r,"minItems",e.exactLength.value,e.exactLength.message,t),lt(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function bD(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"min":if(t.target==="jsonSchema7")if(o.inclusive)lt(r,"minimum",o.value,o.message,t);else lt(r,"exclusiveMinimum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMinimum=!0;lt(r,"minimum",o.value,o.message,t)}break;case"max":if(t.target==="jsonSchema7")if(o.inclusive)lt(r,"maximum",o.value,o.message,t);else lt(r,"exclusiveMaximum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMaximum=!0;lt(r,"maximum",o.value,o.message,t)}break;case"multipleOf":lt(r,"multipleOf",o.value,o.message,t);break}return r}function xD(){return{type:"boolean"}}function Jv(e,t){return Be(e.type._def,t)}var vD=(e,t)=>Be(e.innerType._def,t);function ZA(e,t,r){let o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>ZA(e,t,n))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return tae(e,t)}}var tae=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let o of e.checks)switch(o.kind){case"min":lt(r,"minimum",o.value,o.message,t);break;case"max":lt(r,"maximum",o.value,o.message,t);break}return r};function _D(e,t){return{...Be(e.innerType._def,t),default:e.defaultValue()}}function wD(e,t){return t.effectStrategy==="input"?Be(e.schema._def,t):Jt(t)}function SD(e){return{type:"string",enum:Array.from(e.values)}}var rae=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function TD(e,t){let r=[Be(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Be(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((i)=>!!i),o=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach((i)=>{if(rae(i)){if(n.push(...i.allOf),i.unevaluatedProperties===void 0)o=void 0}else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...c}=i;a=c}else o=void 0;n.push(a)}}),n.length?{allOf:n,...o}:void 0}function ED(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var WA=void 0,No={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(WA===void 0)WA=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return WA},uuid:/^[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}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([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})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Yv(e,t){let r={type:"string"};if(e.checks)for(let o of e.checks)switch(o.kind){case"min":lt(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t);break;case"max":lt(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Mo(r,"email",o.message,t);break;case"format:idn-email":Mo(r,"idn-email",o.message,t);break;case"pattern:zod":dn(r,No.email,o.message,t);break}break;case"url":Mo(r,"uri",o.message,t);break;case"uuid":Mo(r,"uuid",o.message,t);break;case"regex":dn(r,o.regex,o.message,t);break;case"cuid":dn(r,No.cuid,o.message,t);break;case"cuid2":dn(r,No.cuid2,o.message,t);break;case"startsWith":dn(r,RegExp(`^${KA(o.value,t)}`),o.message,t);break;case"endsWith":dn(r,RegExp(`${KA(o.value,t)}$`),o.message,t);break;case"datetime":Mo(r,"date-time",o.message,t);break;case"date":Mo(r,"date",o.message,t);break;case"time":Mo(r,"time",o.message,t);break;case"duration":Mo(r,"duration",o.message,t);break;case"length":lt(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t),lt(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"includes":{dn(r,RegExp(KA(o.value,t)),o.message,t);break}case"ip":{if(o.version!=="v6")Mo(r,"ipv4",o.message,t);if(o.version!=="v4")Mo(r,"ipv6",o.message,t);break}case"base64url":dn(r,No.base64url,o.message,t);break;case"jwt":dn(r,No.jwt,o.message,t);break;case"cidr":{if(o.version!=="v6")dn(r,No.ipv4Cidr,o.message,t);if(o.version!=="v4")dn(r,No.ipv6Cidr,o.message,t);break}case"emoji":dn(r,No.emoji(),o.message,t);break;case"ulid":{dn(r,No.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Mo(r,"binary",o.message,t);break}case"contentEncoding:base64":{lt(r,"contentEncoding","base64",o.message,t);break}case"pattern:zod":{dn(r,No.base64,o.message,t);break}}break}case"nanoid":dn(r,No.nanoid,o.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((n)=>{})(o)}return r}function KA(e,t){return t.patternStrategy==="escape"?oae(e):e}var nae=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function oae(e){let t="";for(let r=0;r<e.length;r++){if(!nae.has(e[r]))t+="\\";t+=e[r]}return t}function Mo(e,t,r,o){if(e.format||e.anyOf?.some((n)=>n.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&o.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&o.errorMessages&&{errorMessage:{format:r}}})}else lt(e,"format",t,r,o)}function dn(e,t,r,o){if(e.pattern||e.allOf?.some((n)=>n.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&o.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:ID(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})}else lt(e,"pattern",ID(t,o),r,o)}function ID(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=r.i?e.source.toLowerCase():e.source,n="",i=!1,a=!1,s=!1;for(let c=0;c<o.length;c++){if(i){n+=o[c],i=!1;continue}if(r.i){if(a){if(o[c].match(/[a-z]/)){if(s)n+=o[c],n+=`${o[c-2]}-${o[c]}`.toUpperCase(),s=!1;else if(o[c+1]==="-"&&o[c+2]?.match(/[a-z]/))n+=o[c],s=!0;else n+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){n+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(r.m){if(o[c]==="^"){n+=`(^|(?<=[\r
|
|
130
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let s=a[1];if(t===a[0]){i(a);continue}if(e.external){let u=e.external.registry.get(a[0])?.id;if(t!==a[0]&&u){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(s.cycle){i(a);continue}if(s.count>1){if(e.reused==="ref"){i(a);continue}}}}function Ts(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let o=(s)=>{let c=e.seen.get(s);if(c.ref===null)return;let u=c.def??c.schema,d={...u},p=c.ref;if(c.ref=null,p){o(p);let h=e.seen.get(p),y=h.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))u.allOf=u.allOf??[],u.allOf.push(y);else Object.assign(u,y);if(Object.assign(u,d),s._zod.parent===p)for(let S in u){if(S==="$ref"||S==="allOf")continue;if(!(S in d))delete u[S]}if(y.$ref&&h.def)for(let S in u){if(S==="$ref"||S==="allOf")continue;if(S in h.def&&JSON.stringify(u[S])===JSON.stringify(h.def[S]))delete u[S]}}let m=s._zod.parent;if(m&&m!==p){o(m);let h=e.seen.get(m);if(h?.schema.$ref){if(u.$ref=h.schema.$ref,h.def)for(let y in u){if(y==="$ref"||y==="allOf")continue;if(y in h.def&&JSON.stringify(u[y])===JSON.stringify(h.def[y]))delete u[y]}}}e.override({zodSchema:s,jsonSchema:u,path:c.path??[]})};for(let s of[...e.seen.entries()].reverse())o(s[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(s)}Object.assign(n,r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let a=e.external?.defs??{};for(let s of e.seen.entries()){let c=s[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;a[c.defId]=c.def}}if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")n.$defs=a;else n.definitions=a;try{let s=JSON.parse(JSON.stringify(n));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:pd(t,"input",e.processors),output:pd(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch(s){throw Error("Error converting schema to JSON.")}}function ln(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ln(o.element,r);if(o.type==="set")return ln(o.valueType,r);if(o.type==="lazy")return ln(o.getter(),r);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return ln(o.innerType,r);if(o.type==="intersection")return ln(o.left,r)||ln(o.right,r);if(o.type==="record"||o.type==="map")return ln(o.keyType,r)||ln(o.valueType,r);if(o.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return ln(o.in,r)||ln(o.out,r)}if(o.type==="object"){for(let n in o.shape)if(ln(o.shape[n],r))return!0;return!1}if(o.type==="union"){for(let n of o.options)if(ln(n,r))return!0;return!1}if(o.type==="tuple"){for(let n of o.items)if(ln(n,r))return!0;if(o.rest&&ln(o.rest,r))return!0;return!1}return!1}var UP=(e,t={})=>(r)=>{let o=ws({...r,processors:t});return Et(e,o),Ss(o,e),Ts(o,e)},pd=(e,t,r={})=>(o)=>{let{libraryOptions:n,target:i}=o??{},a=ws({...n??{},target:i,io:t,processors:r});return Et(e,a),Ss(a,e),Ts(a,e)};var loe={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},LP=(e,t,r,o)=>{let n=r;n.type="string";let{minimum:i,maximum:a,format:s,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof a==="number")n.maxLength=a;if(s){if(n.format=loe[s]??s,n.format==="")delete n.format;if(s==="time")delete n.format}if(u)n.contentEncoding=u;if(c&&c.size>0){let d=[...c];if(d.length===1)n.pattern=d[0].source;else if(d.length>1)n.allOf=[...d.map((p)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},jP=(e,t,r,o)=>{let n=r,{minimum:i,maximum:a,format:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=e._zod.bag;if(typeof s==="string"&&s.includes("int"))n.type="integer";else n.type="number";let p=typeof d==="number"&&d>=(i??Number.NEGATIVE_INFINITY),m=typeof u==="number"&&u<=(a??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p)if(h)n.minimum=d,n.exclusiveMinimum=!0;else n.exclusiveMinimum=d;else if(typeof i==="number")n.minimum=i;if(m)if(h)n.maximum=u,n.exclusiveMaximum=!0;else n.exclusiveMaximum=u;else if(typeof a==="number")n.maximum=a;if(typeof c==="number")n.multipleOf=c},FP=(e,t,r,o)=>{r.type="boolean"},qP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},HP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},GP=(e,t,r,o)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},VP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},ZP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},WP=(e,t,r,o)=>{r.not={}},KP=(e,t,r,o)=>{},JP=(e,t,r,o)=>{},YP=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},QP=(e,t,r,o)=>{let n=e._zod.def,i=Tm(n.entries);if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";r.enum=i},XP=(e,t,r,o)=>{let n=e._zod.def,i=[];for(let a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(a));else i.push(a);if(i.length===0);else if(i.length===1){let a=i[0];if(r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[a];else r.const=a}else{if(i.every((a)=>typeof a==="number"))r.type="number";if(i.every((a)=>typeof a==="string"))r.type="string";if(i.every((a)=>typeof a==="boolean"))r.type="boolean";if(i.every((a)=>a===null))r.type="null";r.enum=i}},ek=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},tk=(e,t,r,o)=>{let n=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},rk=(e,t,r,o)=>{let n=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:c}=e._zod.bag;if(a!==void 0)i.minLength=a;if(s!==void 0)i.maxLength=s;if(c)if(c.length===1)i.contentMediaType=c[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=c.map((u)=>({contentMediaType:u}));else Object.assign(n,i)},nk=(e,t,r,o)=>{r.type="boolean"},ok=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},ik=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},ak=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},sk=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},ck=(e,t,r,o)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},uk=(e,t,r,o)=>{let n=r,i=e._zod.def,{minimum:a,maximum:s}=e._zod.bag;if(typeof a==="number")n.minItems=a;if(typeof s==="number")n.maxItems=s;n.type="array",n.items=Et(i.element,t,{...o,path:[...o.path,"items"]})},lk=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object",n.properties={};let a=i.shape;for(let u in a)n.properties[u]=Et(a[u],t,{...o,path:[...o.path,"properties",u]});let s=new Set(Object.keys(a)),c=new Set([...s].filter((u)=>{let d=i.shape[u]._zod;if(t.io==="input")return d.optin===void 0;else return d.optout===void 0}));if(c.size>0)n.required=Array.from(c);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=Et(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})},Wx=(e,t,r,o)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((s,c)=>Et(s,t,{...o,path:[...o.path,i?"oneOf":"anyOf",c]}));if(i)r.oneOf=a;else r.anyOf=a},dk=(e,t,r,o)=>{let n=e._zod.def,i=Et(n.left,t,{...o,path:[...o.path,"allOf",0]}),a=Et(n.right,t,{...o,path:[...o.path,"allOf",1]}),s=(u)=>("allOf"in u)&&Object.keys(u).length===1,c=[...s(i)?i.allOf:[i],...s(a)?a.allOf:[a]];r.allOf=c},pk=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",s=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((m,h)=>Et(m,t,{...o,path:[...o.path,a,h]})),u=i.rest?Et(i.rest,t,{...o,path:[...o.path,s,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=c,u)n.items=u}else if(t.target==="openapi-3.0"){if(n.items={anyOf:c},u)n.items.anyOf.push(u);if(n.minItems=c.length,!u)n.maxItems=c.length}else if(n.items=c,u)n.additionalItems=u;let{minimum:d,maximum:p}=e._zod.bag;if(typeof d==="number")n.minItems=d;if(typeof p==="number")n.maxItems=p},fk=(e,t,r,o)=>{let n=r,i=e._zod.def;n.type="object";let a=i.keyType,c=a._zod.bag?.patterns;if(i.mode==="loose"&&c&&c.size>0){let d=Et(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});n.patternProperties={};for(let p of c)n.patternProperties[p.source]=d}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=Et(i.keyType,t,{...o,path:[...o.path,"propertyNames"]});n.additionalProperties=Et(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]})}let u=a._zod.values;if(u){let d=[...u].filter((p)=>typeof p==="string"||typeof p==="number");if(d.length>0)n.required=d}},mk=(e,t,r,o)=>{let n=e._zod.def,i=Et(n.innerType,t,o),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=n.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},hk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},gk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},yk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")r._prefault=JSON.parse(JSON.stringify(n.defaultValue))},bk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},xk=(e,t,r,o)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;Et(a,t,o);let s=t.seen.get(e);s.ref=a},vk=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType,r.readOnly=!0},_k=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},Kx=(e,t,r,o)=>{let n=e._zod.def;Et(n.innerType,t,o);let i=t.seen.get(e);i.ref=n.innerType},wk=(e,t,r,o)=>{let n=e._zod.innerType;Et(n,t,o);let i=t.seen.get(e);i.ref=n},Zx={string:LP,number:jP,boolean:FP,bigint:qP,symbol:HP,null:GP,undefined:VP,void:ZP,never:WP,any:KP,unknown:JP,date:YP,enum:QP,literal:XP,nan:ek,template_literal:tk,file:rk,success:nk,custom:ok,function:ik,transform:ak,map:sk,set:ck,array:uk,object:lk,union:Wx,intersection:dk,tuple:pk,record:fk,nullable:mk,nonoptional:hk,default:gk,prefault:yk,catch:bk,pipe:xk,readonly:vk,promise:_k,optional:Kx,lazy:wk};function Yc(e,t){if("_idmap"in e){let o=e,n=ws({...t,processors:Zx}),i={};for(let c of o._idmap.entries()){let[u,d]=c;Et(d,n)}let a={},s={registry:o,uri:t?.uri,defs:i};n.external=s;for(let c of o._idmap.entries()){let[u,d]=c;Ss(n,d),a[u]=Ts(n,d)}if(Object.keys(i).length>0){let c=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[c]:i}}return{schemas:a}}let r=ws({...t,processors:Zx});return Et(e,r),Ss(r,e),Ts(r,e)}class Sk{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";this.ctx=ws({processors:Zx,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return Et(e,this.ctx,t)}emit(e,t){if(t){if(t.cycles)this.ctx.cycles=t.cycles;if(t.reused)this.ctx.reused=t.reused;if(t.external)this.ctx.external=t.external}Ss(this.ctx,e);let r=Ts(this.ctx,e),{"~standard":o,...n}=r;return n}}var O4={};var foe=R("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");Ue.init(e,t),e.def=t,e.type=t.type,e.parse=(r,o)=>Hc(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>ys(e,r,o),e.parseAsync=async(r,o)=>Gc(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>bs(e,r,o),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map((o)=>typeof o==="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]},{parent:!0}),e.with=e.check,e.clone=(r,o)=>zr(e,r,o),e.brand=()=>e,e.register=(r,o)=>(r.add(e,o),e),e.apply=(r)=>r(e)});var moe=R("ZodMiniObject",(e,t)=>{F0.init(e,t),foe.init(e,t),Ye(e,"shape",()=>t.shape)});function Tk(e,t){let r={type:"object",shape:e??{},...oe(t)};return new moe(r)}function io(e){return!!e._zod}function Qc(e){let t=Object.values(e);if(t.length===0)return Tk({});let r=t.every(io),o=t.every((n)=>!io(n));if(r)return Tk(e);if(o)return zM(e);throw Error("Mixed Zod versions detected in object shape.")}function Es(e,t){if(io(e))return ys(e,t);return e.safeParse(t)}async function Jx(e,t){if(io(e))return await bs(e,t);return await e.safeParseAsync(t)}function Is(e){if(!e)return;let t;if(io(e))t=e._zod?.def?.shape;else t=e.shape;if(!t)return;if(typeof t==="function")try{return t()}catch{return}return t}function fd(e){if(!e)return;if(typeof e==="object"){let t=e,r=e;if(!t._def&&!r._zod){let o=Object.values(e);if(o.length>0&&o.every((n)=>typeof n==="object"&&n!==null&&(n._def!==void 0||n._zod!==void 0||typeof n.parse==="function")))return Qc(e)}}if(io(e)){let r=e._zod?.def;if(r&&(r.type==="object"||r.shape!==void 0))return e}else if(e.shape!==void 0)return e;return}function Yx(e){if(e&&typeof e==="object"){if("message"in e&&typeof e.message==="string")return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&typeof t==="object"&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function C4(e){return e.description}function z4(e){if(io(e))return e._zod?.def?.type==="optional";let t=e;if(typeof e.isOptional==="function")return e.isOptional();return t._def?.typeName==="ZodOptional"}function Qx(e){if(io(e)){let i=e._zod?.def;if(i){if(i.value!==void 0)return i.value;if(Array.isArray(i.values)&&i.values.length>0)return i.values[0]}}let r=e._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let o=e.value;if(o!==void 0)return o;return}var f={};kn(f,{$brand:()=>gE,$input:()=>IP,$output:()=>EP,NEVER:()=>hE,TimePrecision:()=>AP,ZodAny:()=>Gk,ZodArray:()=>Kk,ZodBase64:()=>xv,ZodBase64URL:()=>vv,ZodBigInt:()=>vd,ZodBigIntFormat:()=>Sv,ZodBoolean:()=>xd,ZodCIDRv4:()=>yv,ZodCIDRv6:()=>bv,ZodCUID:()=>lv,ZodCUID2:()=>dv,ZodCatch:()=>hA,ZodCodec:()=>_h,ZodCustom:()=>wh,ZodCustomStringFormat:()=>yd,ZodDate:()=>gh,ZodDefault:()=>uA,ZodDiscriminatedUnion:()=>Yk,ZodE164:()=>_v,ZodEmail:()=>sv,ZodEmoji:()=>cv,ZodEnum:()=>hd,ZodError:()=>goe,ZodExactOptional:()=>aA,ZodFile:()=>oA,ZodFirstPartyTypeKind:()=>kA,ZodFunction:()=>EA,ZodGUID:()=>dh,ZodIPv4:()=>hv,ZodIPv6:()=>gv,ZodISODate:()=>tv,ZodISODateTime:()=>ev,ZodISODuration:()=>nv,ZodISOTime:()=>rv,ZodIntersection:()=>Qk,ZodIssueCode:()=>boe,ZodJWT:()=>wv,ZodKSUID:()=>mv,ZodLazy:()=>wA,ZodLiteral:()=>nA,ZodMAC:()=>jk,ZodMap:()=>tA,ZodNaN:()=>yA,ZodNanoID:()=>uv,ZodNever:()=>Zk,ZodNonOptional:()=>Iv,ZodNull:()=>Hk,ZodNullable:()=>cA,ZodNumber:()=>bd,ZodNumberFormat:()=>Xc,ZodObject:()=>yh,ZodOptional:()=>wd,ZodPipe:()=>vh,ZodPrefault:()=>dA,ZodPreprocess:()=>bA,ZodPromise:()=>TA,ZodReadonly:()=>xA,ZodRealError:()=>Cn,ZodRecord:()=>md,ZodSet:()=>rA,ZodString:()=>gd,ZodStringFormat:()=>$t,ZodSuccess:()=>mA,ZodSymbol:()=>Fk,ZodTemplateLiteral:()=>_A,ZodTransform:()=>iA,ZodTuple:()=>Xk,ZodType:()=>Je,ZodULID:()=>pv,ZodURL:()=>mh,ZodUUID:()=>wi,ZodUndefined:()=>qk,ZodUnion:()=>bh,ZodUnknown:()=>Vk,ZodVoid:()=>Wk,ZodXID:()=>fv,ZodXor:()=>Jk,_ZodString:()=>av,_default:()=>lA,_function:()=>UB,any:()=>vB,array:()=>nt,base64:()=>nB,base64url:()=>oB,bigint:()=>hB,boolean:()=>ar,catch:()=>gA,check:()=>LB,cidrv4:()=>tB,cidrv6:()=>rB,clone:()=>zr,codec:()=>NB,coerce:()=>AA,config:()=>or,core:()=>zo,cuid:()=>Z4,cuid2:()=>W4,custom:()=>Pv,date:()=>wB,decode:()=>zk,decodeAsync:()=>Mk,describe:()=>jB,discriminatedUnion:()=>xh,e164:()=>iB,email:()=>B4,emoji:()=>G4,encode:()=>Ck,encodeAsync:()=>Nk,endsWith:()=>id,enum:()=>Br,exactOptional:()=>sA,file:()=>$B,flattenError:()=>Rm,float32:()=>dB,float64:()=>pB,formatError:()=>$m,fromJSONSchema:()=>ZB,function:()=>UB,getErrorMap:()=>voe,globalRegistry:()=>Nr,gt:()=>vi,gte:()=>un,guid:()=>D4,hash:()=>lB,hex:()=>uB,hostname:()=>cB,httpUrl:()=>H4,includes:()=>nd,instanceof:()=>qB,int:()=>ov,int32:()=>fB,int64:()=>gB,intersection:()=>_d,invertCodec:()=>MB,ipv4:()=>Q4,ipv6:()=>eB,iso:()=>Ps,json:()=>GB,jwt:()=>aB,keyof:()=>SB,ksuid:()=>Y4,lazy:()=>SA,length:()=>Kc,literal:()=>Ee,locales:()=>Yl,looseObject:()=>Mr,looseRecord:()=>PB,lowercase:()=>td,lt:()=>xi,lte:()=>Wn,mac:()=>X4,map:()=>kB,maxLength:()=>Wc,maxSize:()=>_s,meta:()=>FB,mime:()=>ad,minLength:()=>la,minSize:()=>_i,multipleOf:()=>vs,nan:()=>zB,nanoid:()=>V4,nativeEnum:()=>RB,negative:()=>Mx,never:()=>Tv,nonnegative:()=>Dx,nonoptional:()=>fA,nonpositive:()=>Bx,normalize:()=>sd,null:()=>hh,nullable:()=>ph,nullish:()=>OB,number:()=>bt,object:()=>ye,optional:()=>Bt,overwrite:()=>Co,parse:()=>Ak,parseAsync:()=>Rk,partialRecord:()=>IB,pipe:()=>iv,positive:()=>Nx,prefault:()=>pA,preprocess:()=>Sh,prettifyError:()=>PE,promise:()=>DB,property:()=>Ux,readonly:()=>vA,record:()=>kt,refine:()=>IA,regex:()=>ed,regexes:()=>On,registry:()=>fx,safeDecode:()=>Dk,safeDecodeAsync:()=>Lk,safeEncode:()=>Bk,safeEncodeAsync:()=>Uk,safeParse:()=>$k,safeParseAsync:()=>Ok,set:()=>AB,setErrorMap:()=>xoe,size:()=>Zc,slugify:()=>dd,startsWith:()=>od,strictObject:()=>TB,string:()=>D,stringFormat:()=>sB,stringbool:()=>HB,success:()=>CB,superRefine:()=>PA,symbol:()=>bB,templateLiteral:()=>BB,toJSONSchema:()=>Yc,toLowerCase:()=>ud,toUpperCase:()=>ld,transform:()=>Ev,treeifyError:()=>IE,trim:()=>cd,tuple:()=>eA,uint32:()=>mB,uint64:()=>yB,ulid:()=>K4,undefined:()=>xB,union:()=>Ct,unknown:()=>Ot,uppercase:()=>rd,url:()=>q4,util:()=>ee,uuid:()=>U4,uuidv4:()=>L4,uuidv6:()=>j4,uuidv7:()=>F4,void:()=>_B,xid:()=>J4,xor:()=>EB});var lh={};kn(lh,{ZodAny:()=>Gk,ZodArray:()=>Kk,ZodBase64:()=>xv,ZodBase64URL:()=>vv,ZodBigInt:()=>vd,ZodBigIntFormat:()=>Sv,ZodBoolean:()=>xd,ZodCIDRv4:()=>yv,ZodCIDRv6:()=>bv,ZodCUID:()=>lv,ZodCUID2:()=>dv,ZodCatch:()=>hA,ZodCodec:()=>_h,ZodCustom:()=>wh,ZodCustomStringFormat:()=>yd,ZodDate:()=>gh,ZodDefault:()=>uA,ZodDiscriminatedUnion:()=>Yk,ZodE164:()=>_v,ZodEmail:()=>sv,ZodEmoji:()=>cv,ZodEnum:()=>hd,ZodExactOptional:()=>aA,ZodFile:()=>oA,ZodFunction:()=>EA,ZodGUID:()=>dh,ZodIPv4:()=>hv,ZodIPv6:()=>gv,ZodIntersection:()=>Qk,ZodJWT:()=>wv,ZodKSUID:()=>mv,ZodLazy:()=>wA,ZodLiteral:()=>nA,ZodMAC:()=>jk,ZodMap:()=>tA,ZodNaN:()=>yA,ZodNanoID:()=>uv,ZodNever:()=>Zk,ZodNonOptional:()=>Iv,ZodNull:()=>Hk,ZodNullable:()=>cA,ZodNumber:()=>bd,ZodNumberFormat:()=>Xc,ZodObject:()=>yh,ZodOptional:()=>wd,ZodPipe:()=>vh,ZodPrefault:()=>dA,ZodPreprocess:()=>bA,ZodPromise:()=>TA,ZodReadonly:()=>xA,ZodRecord:()=>md,ZodSet:()=>rA,ZodString:()=>gd,ZodStringFormat:()=>$t,ZodSuccess:()=>mA,ZodSymbol:()=>Fk,ZodTemplateLiteral:()=>_A,ZodTransform:()=>iA,ZodTuple:()=>Xk,ZodType:()=>Je,ZodULID:()=>pv,ZodURL:()=>mh,ZodUUID:()=>wi,ZodUndefined:()=>qk,ZodUnion:()=>bh,ZodUnknown:()=>Vk,ZodVoid:()=>Wk,ZodXID:()=>fv,ZodXor:()=>Jk,_ZodString:()=>av,_default:()=>lA,_function:()=>UB,any:()=>vB,array:()=>nt,base64:()=>nB,base64url:()=>oB,bigint:()=>hB,boolean:()=>ar,catch:()=>gA,check:()=>LB,cidrv4:()=>tB,cidrv6:()=>rB,codec:()=>NB,cuid:()=>Z4,cuid2:()=>W4,custom:()=>Pv,date:()=>wB,describe:()=>jB,discriminatedUnion:()=>xh,e164:()=>iB,email:()=>B4,emoji:()=>G4,enum:()=>Br,exactOptional:()=>sA,file:()=>$B,float32:()=>dB,float64:()=>pB,function:()=>UB,guid:()=>D4,hash:()=>lB,hex:()=>uB,hostname:()=>cB,httpUrl:()=>H4,instanceof:()=>qB,int:()=>ov,int32:()=>fB,int64:()=>gB,intersection:()=>_d,invertCodec:()=>MB,ipv4:()=>Q4,ipv6:()=>eB,json:()=>GB,jwt:()=>aB,keyof:()=>SB,ksuid:()=>Y4,lazy:()=>SA,literal:()=>Ee,looseObject:()=>Mr,looseRecord:()=>PB,mac:()=>X4,map:()=>kB,meta:()=>FB,nan:()=>zB,nanoid:()=>V4,nativeEnum:()=>RB,never:()=>Tv,nonoptional:()=>fA,null:()=>hh,nullable:()=>ph,nullish:()=>OB,number:()=>bt,object:()=>ye,optional:()=>Bt,partialRecord:()=>IB,pipe:()=>iv,prefault:()=>pA,preprocess:()=>Sh,promise:()=>DB,readonly:()=>vA,record:()=>kt,refine:()=>IA,set:()=>AB,strictObject:()=>TB,string:()=>D,stringFormat:()=>sB,stringbool:()=>HB,success:()=>CB,superRefine:()=>PA,symbol:()=>bB,templateLiteral:()=>BB,transform:()=>Ev,tuple:()=>eA,uint32:()=>mB,uint64:()=>yB,ulid:()=>K4,undefined:()=>xB,union:()=>Ct,unknown:()=>Ot,url:()=>q4,uuid:()=>U4,uuidv4:()=>L4,uuidv6:()=>j4,uuidv7:()=>F4,void:()=>_B,xid:()=>J4,xor:()=>EB});var Xx={};kn(Xx,{endsWith:()=>id,gt:()=>vi,gte:()=>un,includes:()=>nd,length:()=>Kc,lowercase:()=>td,lt:()=>xi,lte:()=>Wn,maxLength:()=>Wc,maxSize:()=>_s,mime:()=>ad,minLength:()=>la,minSize:()=>_i,multipleOf:()=>vs,negative:()=>Mx,nonnegative:()=>Dx,nonpositive:()=>Bx,normalize:()=>sd,overwrite:()=>Co,positive:()=>Nx,property:()=>Ux,regex:()=>ed,size:()=>Zc,slugify:()=>dd,startsWith:()=>od,toLowerCase:()=>ud,toUpperCase:()=>ld,trim:()=>cd,uppercase:()=>rd});var Ps={};kn(Ps,{ZodISODate:()=>tv,ZodISODateTime:()=>ev,ZodISODuration:()=>nv,ZodISOTime:()=>rv,date:()=>Ik,datetime:()=>Ek,duration:()=>kk,time:()=>Pk});var ev=R("ZodISODateTime",(e,t)=>{SI.init(e,t),$t.init(e,t)});function Ek(e){return RP(ev,e)}var tv=R("ZodISODate",(e,t)=>{TI.init(e,t),$t.init(e,t)});function Ik(e){return $P(tv,e)}var rv=R("ZodISOTime",(e,t)=>{EI.init(e,t),$t.init(e,t)});function Pk(e){return OP(rv,e)}var nv=R("ZodISODuration",(e,t)=>{II.init(e,t),$t.init(e,t)});function kk(e){return CP(nv,e)}var N4=(e,t)=>{Am.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(r)=>$m(e,r)},flatten:{value:(r)=>Rm(e,r)},addIssue:{value:(r)=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Ul,2)}},addIssues:{value:(r)=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Ul,2)}},isEmpty:{get(){return e.issues.length===0}}})},goe=R("ZodError",N4),Cn=R("ZodError",N4,{Parent:Error});var Ak=Fl(Cn),Rk=ql(Cn),$k=Hl(Cn),Ok=Gl(Cn),Ck=Wb(Cn),zk=Kb(Cn),Nk=Jb(Cn),Mk=Yb(Cn),Bk=Qb(Cn),Dk=Xb(Cn),Uk=e0(Cn),Lk=t0(Cn);var M4=new WeakMap;function fh(e,t,r){let o=Object.getPrototypeOf(e),n=M4.get(o);if(!n)n=new Set,M4.set(o,n);if(n.has(t))return;n.add(t);for(let i in r){let a=r[i];Object.defineProperty(o,i,{configurable:!0,enumerable:!1,get(){let s=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s}),s},set(s){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:s})}})}}var Je=R("ZodType",(e,t)=>(Ue.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:pd(e,"input"),output:pd(e,"output")}}),e.toJSONSchema=UP(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(r,o)=>Ak(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>$k(e,r,o),e.parseAsync=async(r,o)=>Rk(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>Ok(e,r,o),e.spa=e.safeParseAsync,e.encode=(r,o)=>Ck(e,r,o),e.decode=(r,o)=>zk(e,r,o),e.encodeAsync=async(r,o)=>Nk(e,r,o),e.decodeAsync=async(r,o)=>Mk(e,r,o),e.safeEncode=(r,o)=>Bk(e,r,o),e.safeDecode=(r,o)=>Dk(e,r,o),e.safeEncodeAsync=async(r,o)=>Uk(e,r,o),e.safeDecodeAsync=async(r,o)=>Lk(e,r,o),fh(e,"ZodType",{check(...r){let o=this.def;return this.clone(ee.mergeDefs(o,{checks:[...o.checks??[],...r.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,o){return zr(this,r,o)},brand(){return this},register(r,o){return r.add(this,o),this},refine(r,o){return this.check(IA(r,o))},superRefine(r,o){return this.check(PA(r,o))},overwrite(r){return this.check(Co(r))},optional(){return Bt(this)},exactOptional(){return sA(this)},nullable(){return ph(this)},nullish(){return Bt(ph(this))},nonoptional(r){return fA(this,r)},array(){return nt(this)},or(r){return Ct([this,r])},and(r){return _d(this,r)},transform(r){return iv(this,Ev(r))},default(r){return lA(this,r)},prefault(r){return pA(this,r)},catch(r){return gA(this,r)},pipe(r){return iv(this,r)},readonly(){return vA(this)},describe(r){let o=this.clone();return Nr.add(o,{description:r}),o},meta(...r){if(r.length===0)return Nr.get(this);let o=this.clone();return Nr.add(o,r[0]),o},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(e,"description",{get(){return Nr.get(e)?.description},configurable:!0}),e)),av=R("_ZodString",(e,t)=>{xs.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>LP(e,o,n,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,fh(e,"_ZodString",{regex(...o){return this.check(ed(...o))},includes(...o){return this.check(nd(...o))},startsWith(...o){return this.check(od(...o))},endsWith(...o){return this.check(id(...o))},min(...o){return this.check(la(...o))},max(...o){return this.check(Wc(...o))},length(...o){return this.check(Kc(...o))},nonempty(...o){return this.check(la(1,...o))},lowercase(o){return this.check(td(o))},uppercase(o){return this.check(rd(o))},trim(){return this.check(cd())},normalize(...o){return this.check(sd(...o))},toLowerCase(){return this.check(ud())},toUpperCase(){return this.check(ld())},slugify(){return this.check(dd())}})}),gd=R("ZodString",(e,t)=>{xs.init(e,t),av.init(e,t),e.email=(r)=>e.check(Hm(sv,r)),e.url=(r)=>e.check(Xl(mh,r)),e.jwt=(r)=>e.check(uh(wv,r)),e.emoji=(r)=>e.check(Km(cv,r)),e.guid=(r)=>e.check(Ql(dh,r)),e.uuid=(r)=>e.check(Gm(wi,r)),e.uuidv4=(r)=>e.check(Vm(wi,r)),e.uuidv6=(r)=>e.check(Zm(wi,r)),e.uuidv7=(r)=>e.check(Wm(wi,r)),e.nanoid=(r)=>e.check(Jm(uv,r)),e.guid=(r)=>e.check(Ql(dh,r)),e.cuid=(r)=>e.check(Ym(lv,r)),e.cuid2=(r)=>e.check(Qm(dv,r)),e.ulid=(r)=>e.check(Xm(pv,r)),e.base64=(r)=>e.check(ah(xv,r)),e.base64url=(r)=>e.check(sh(vv,r)),e.xid=(r)=>e.check(eh(fv,r)),e.ksuid=(r)=>e.check(th(mv,r)),e.ipv4=(r)=>e.check(rh(hv,r)),e.ipv6=(r)=>e.check(nh(gv,r)),e.cidrv4=(r)=>e.check(oh(yv,r)),e.cidrv6=(r)=>e.check(ih(bv,r)),e.e164=(r)=>e.check(ch(_v,r)),e.datetime=(r)=>e.check(Ek(r)),e.date=(r)=>e.check(Ik(r)),e.time=(r)=>e.check(Pk(r)),e.duration=(r)=>e.check(kk(r))});function D(e){return mx(gd,e)}var $t=R("ZodStringFormat",(e,t)=>{Pt.init(e,t),av.init(e,t)}),sv=R("ZodEmail",(e,t)=>{p0.init(e,t),$t.init(e,t)});function B4(e){return Hm(sv,e)}var dh=R("ZodGUID",(e,t)=>{l0.init(e,t),$t.init(e,t)});function D4(e){return Ql(dh,e)}var wi=R("ZodUUID",(e,t)=>{d0.init(e,t),$t.init(e,t)});function U4(e){return Gm(wi,e)}function L4(e){return Vm(wi,e)}function j4(e){return Zm(wi,e)}function F4(e){return Wm(wi,e)}var mh=R("ZodURL",(e,t)=>{f0.init(e,t),$t.init(e,t)});function q4(e){return Xl(mh,e)}function H4(e){return Xl(mh,{protocol:On.httpProtocol,hostname:On.domain,...ee.normalizeParams(e)})}var cv=R("ZodEmoji",(e,t)=>{m0.init(e,t),$t.init(e,t)});function G4(e){return Km(cv,e)}var uv=R("ZodNanoID",(e,t)=>{h0.init(e,t),$t.init(e,t)});function V4(e){return Jm(uv,e)}var lv=R("ZodCUID",(e,t)=>{g0.init(e,t),$t.init(e,t)});function Z4(e){return Ym(lv,e)}var dv=R("ZodCUID2",(e,t)=>{y0.init(e,t),$t.init(e,t)});function W4(e){return Qm(dv,e)}var pv=R("ZodULID",(e,t)=>{b0.init(e,t),$t.init(e,t)});function K4(e){return Xm(pv,e)}var fv=R("ZodXID",(e,t)=>{x0.init(e,t),$t.init(e,t)});function J4(e){return eh(fv,e)}var mv=R("ZodKSUID",(e,t)=>{v0.init(e,t),$t.init(e,t)});function Y4(e){return th(mv,e)}var hv=R("ZodIPv4",(e,t)=>{_0.init(e,t),$t.init(e,t)});function Q4(e){return rh(hv,e)}var jk=R("ZodMAC",(e,t)=>{S0.init(e,t),$t.init(e,t)});function X4(e){return hx(jk,e)}var gv=R("ZodIPv6",(e,t)=>{w0.init(e,t),$t.init(e,t)});function eB(e){return nh(gv,e)}var yv=R("ZodCIDRv4",(e,t)=>{T0.init(e,t),$t.init(e,t)});function tB(e){return oh(yv,e)}var bv=R("ZodCIDRv6",(e,t)=>{E0.init(e,t),$t.init(e,t)});function rB(e){return ih(bv,e)}var xv=R("ZodBase64",(e,t)=>{I0.init(e,t),$t.init(e,t)});function nB(e){return ah(xv,e)}var vv=R("ZodBase64URL",(e,t)=>{P0.init(e,t),$t.init(e,t)});function oB(e){return sh(vv,e)}var _v=R("ZodE164",(e,t)=>{k0.init(e,t),$t.init(e,t)});function iB(e){return ch(_v,e)}var wv=R("ZodJWT",(e,t)=>{A0.init(e,t),$t.init(e,t)});function aB(e){return uh(wv,e)}var yd=R("ZodCustomStringFormat",(e,t)=>{R0.init(e,t),$t.init(e,t)});function sB(e,t,r={}){return Jc(yd,e,t,r)}function cB(e){return Jc(yd,"hostname",On.hostname,e)}function uB(e){return Jc(yd,"hex",On.hex,e)}function lB(e,t){let r=t?.enc??"hex",o=`${e}_${r}`,n=On[o];if(!n)throw Error(`Unrecognized hash format: ${o}`);return Jc(yd,o,n,t)}var bd=R("ZodNumber",(e,t)=>{Nm.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>jP(e,o,n,i),fh(e,"ZodNumber",{gt(o,n){return this.check(vi(o,n))},gte(o,n){return this.check(un(o,n))},min(o,n){return this.check(un(o,n))},lt(o,n){return this.check(xi(o,n))},lte(o,n){return this.check(Wn(o,n))},max(o,n){return this.check(Wn(o,n))},int(o){return this.check(ov(o))},safe(o){return this.check(ov(o))},positive(o){return this.check(vi(0,o))},nonnegative(o){return this.check(un(0,o))},negative(o){return this.check(xi(0,o))},nonpositive(o){return this.check(Wn(0,o))},multipleOf(o,n){return this.check(vs(o,n))},step(o,n){return this.check(vs(o,n))},finite(){return this}});let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??0.5),e.isFinite=!0,e.format=r.format??null});function bt(e){return gx(bd,e)}var Xc=R("ZodNumberFormat",(e,t)=>{$0.init(e,t),bd.init(e,t)});function ov(e){return yx(Xc,e)}function dB(e){return bx(Xc,e)}function pB(e){return xx(Xc,e)}function fB(e){return vx(Xc,e)}function mB(e){return _x(Xc,e)}var xd=R("ZodBoolean",(e,t)=>{Zl.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>FP(e,r,o,n)});function ar(e){return wx(xd,e)}var vd=R("ZodBigInt",(e,t)=>{Mm.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>qP(e,o,n,i),e.gte=(o,n)=>e.check(un(o,n)),e.min=(o,n)=>e.check(un(o,n)),e.gt=(o,n)=>e.check(vi(o,n)),e.gte=(o,n)=>e.check(un(o,n)),e.min=(o,n)=>e.check(un(o,n)),e.lt=(o,n)=>e.check(xi(o,n)),e.lte=(o,n)=>e.check(Wn(o,n)),e.max=(o,n)=>e.check(Wn(o,n)),e.positive=(o)=>e.check(vi(BigInt(0),o)),e.negative=(o)=>e.check(xi(BigInt(0),o)),e.nonpositive=(o)=>e.check(Wn(BigInt(0),o)),e.nonnegative=(o)=>e.check(un(BigInt(0),o)),e.multipleOf=(o,n)=>e.check(vs(o,n));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function hB(e){return Sx(vd,e)}var Sv=R("ZodBigIntFormat",(e,t)=>{O0.init(e,t),vd.init(e,t)});function gB(e){return Tx(Sv,e)}function yB(e){return Ex(Sv,e)}var Fk=R("ZodSymbol",(e,t)=>{C0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>HP(e,r,o,n)});function bB(e){return Ix(Fk,e)}var qk=R("ZodUndefined",(e,t)=>{z0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>VP(e,r,o,n)});function xB(e){return Px(qk,e)}var Hk=R("ZodNull",(e,t)=>{N0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>GP(e,r,o,n)});function hh(e){return kx(Hk,e)}var Gk=R("ZodAny",(e,t)=>{M0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>KP(e,r,o,n)});function vB(){return Ax(Gk)}var Vk=R("ZodUnknown",(e,t)=>{B0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>JP(e,r,o,n)});function Ot(){return Rx(Vk)}var Zk=R("ZodNever",(e,t)=>{D0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>WP(e,r,o,n)});function Tv(e){return $x(Zk,e)}var Wk=R("ZodVoid",(e,t)=>{U0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ZP(e,r,o,n)});function _B(e){return Ox(Wk,e)}var gh=R("ZodDate",(e,t)=>{L0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>YP(e,o,n,i),e.min=(o,n)=>e.check(un(o,n)),e.max=(o,n)=>e.check(Wn(o,n));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function wB(e){return Cx(gh,e)}var Kk=R("ZodArray",(e,t)=>{j0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>uk(e,r,o,n),e.element=t.element,fh(e,"ZodArray",{min(r,o){return this.check(la(r,o))},nonempty(r){return this.check(la(1,r))},max(r,o){return this.check(Wc(r,o))},length(r,o){return this.check(Kc(r,o))},unwrap(){return this.element}})});function nt(e,t){return DP(Kk,e,t)}function SB(e){let t=e._zod.def.shape;return Br(Object.keys(t))}var yh=R("ZodObject",(e,t)=>{kI.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>lk(e,r,o,n),ee.defineLazy(e,"shape",()=>t.shape),fh(e,"ZodObject",{keyof(){return Br(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:Ot()})},loose(){return this.clone({...this._zod.def,catchall:Ot()})},strict(){return this.clone({...this._zod.def,catchall:Tv()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return ee.extend(this,r)},safeExtend(r){return ee.safeExtend(this,r)},merge(r){return ee.merge(this,r)},pick(r){return ee.pick(this,r)},omit(r){return ee.omit(this,r)},partial(...r){return ee.partial(wd,this,r[0])},required(...r){return ee.required(Iv,this,r[0])}})});function ye(e,t){let r={type:"object",shape:e??{},...ee.normalizeParams(t)};return new yh(r)}function TB(e,t){return new yh({type:"object",shape:e,catchall:Tv(),...ee.normalizeParams(t)})}function Mr(e,t){return new yh({type:"object",shape:e,catchall:Ot(),...ee.normalizeParams(t)})}var bh=R("ZodUnion",(e,t)=>{Wl.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wx(e,r,o,n),e.options=t.options});function Ct(e,t){return new bh({type:"union",options:e,...ee.normalizeParams(t)})}var Jk=R("ZodXor",(e,t)=>{bh.init(e,t),q0.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Wx(e,r,o,n),e.options=t.options});function EB(e,t){return new Jk({type:"union",options:e,inclusive:!1,...ee.normalizeParams(t)})}var Yk=R("ZodDiscriminatedUnion",(e,t)=>{bh.init(e,t),H0.init(e,t)});function xh(e,t,r){return new Yk({type:"union",options:t,discriminator:e,...ee.normalizeParams(r)})}var Qk=R("ZodIntersection",(e,t)=>{G0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>dk(e,r,o,n)});function _d(e,t){return new Qk({type:"intersection",left:e,right:t})}var Xk=R("ZodTuple",(e,t)=>{Bm.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>pk(e,r,o,n),e.rest=(r)=>e.clone({...e._zod.def,rest:r})});function eA(e,t,r){let o=t instanceof Ue,n=o?r:t;return new Xk({type:"tuple",items:e,rest:o?t:null,...ee.normalizeParams(n)})}var md=R("ZodRecord",(e,t)=>{V0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>fk(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType});function kt(e,t,r){if(!t||!t._zod)return new md({type:"record",keyType:D(),valueType:e,...ee.normalizeParams(t)});return new md({type:"record",keyType:e,valueType:t,...ee.normalizeParams(r)})}function IB(e,t,r){let o=zr(e);return o._zod.values=void 0,new md({type:"record",keyType:o,valueType:t,...ee.normalizeParams(r)})}function PB(e,t,r){return new md({type:"record",keyType:e,valueType:t,mode:"loose",...ee.normalizeParams(r)})}var tA=R("ZodMap",(e,t)=>{Z0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>sk(e,r,o,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(_i(...r)),e.nonempty=(r)=>e.check(_i(1,r)),e.max=(...r)=>e.check(_s(...r)),e.size=(...r)=>e.check(Zc(...r))});function kB(e,t,r){return new tA({type:"map",keyType:e,valueType:t,...ee.normalizeParams(r)})}var rA=R("ZodSet",(e,t)=>{W0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ck(e,r,o,n),e.min=(...r)=>e.check(_i(...r)),e.nonempty=(r)=>e.check(_i(1,r)),e.max=(...r)=>e.check(_s(...r)),e.size=(...r)=>e.check(Zc(...r))});function AB(e,t){return new rA({type:"set",valueType:e,...ee.normalizeParams(t)})}var hd=R("ZodEnum",(e,t)=>{K0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(o,n,i)=>QP(e,o,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(o,n)=>{let i={};for(let a of o)if(r.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new hd({...t,checks:[],...ee.normalizeParams(n),entries:i})},e.exclude=(o,n)=>{let i={...t.entries};for(let a of o)if(r.has(a))delete i[a];else throw Error(`Key ${a} not found in enum`);return new hd({...t,checks:[],...ee.normalizeParams(n),entries:i})}});function Br(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((o)=>[o,o])):e;return new hd({type:"enum",entries:r,...ee.normalizeParams(t)})}function RB(e,t){return new hd({type:"enum",entries:e,...ee.normalizeParams(t)})}var nA=R("ZodLiteral",(e,t)=>{J0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>XP(e,r,o,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ee(e,t){return new nA({type:"literal",values:Array.isArray(e)?e:[e],...ee.normalizeParams(t)})}var oA=R("ZodFile",(e,t)=>{Y0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>rk(e,r,o,n),e.min=(r,o)=>e.check(_i(r,o)),e.max=(r,o)=>e.check(_s(r,o)),e.mime=(r,o)=>e.check(ad(Array.isArray(r)?r:[r],o))});function $B(e){return Lx(oA,e)}var iA=R("ZodTransform",(e,t)=>{Q0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ak(e,r,o,n),e._zod.parse=(r,o)=>{if(o.direction==="backward")throw new Fc(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ee.issue(i,r.value,t));else{let a=i;if(a.fatal)a.continue=!1;a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(ee.issue(a))}};let n=t.transform(r.value,r);if(n instanceof Promise)return n.then((i)=>(r.value=i,r.fallback=!0,r));return r.value=n,r.fallback=!0,r}});function Ev(e){return new iA({type:"transform",transform:e})}var wd=R("ZodOptional",(e,t)=>{Dm.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kx(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function Bt(e){return new wd({type:"optional",innerType:e})}var aA=R("ZodExactOptional",(e,t)=>{X0.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>Kx(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function sA(e){return new aA({type:"optional",innerType:e})}var cA=R("ZodNullable",(e,t)=>{ex.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>mk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function ph(e){return new cA({type:"nullable",innerType:e})}function OB(e){return Bt(ph(e))}var uA=R("ZodDefault",(e,t)=>{tx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>gk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function lA(e,t){return new uA({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ee.shallowClone(t)}})}var dA=R("ZodPrefault",(e,t)=>{rx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>yk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function pA(e,t){return new dA({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ee.shallowClone(t)}})}var Iv=R("ZodNonOptional",(e,t)=>{nx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>hk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function fA(e,t){return new Iv({type:"nonoptional",innerType:e,...ee.normalizeParams(t)})}var mA=R("ZodSuccess",(e,t)=>{ox.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>nk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function CB(e){return new mA({type:"success",innerType:e})}var hA=R("ZodCatch",(e,t)=>{ix.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>bk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function gA(e,t){return new hA({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var yA=R("ZodNaN",(e,t)=>{ax.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ek(e,r,o,n)});function zB(e){return zx(yA,e)}var vh=R("ZodPipe",(e,t)=>{Um.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>xk(e,r,o,n),e.in=t.in,e.out=t.out});function iv(e,t){return new vh({type:"pipe",in:e,out:t})}var _h=R("ZodCodec",(e,t)=>{vh.init(e,t),Kl.init(e,t)});function NB(e,t,r){return new _h({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}function MB(e){let t=e._zod.def;return new _h({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var bA=R("ZodPreprocess",(e,t)=>{vh.init(e,t),AI.init(e,t)}),xA=R("ZodReadonly",(e,t)=>{sx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>vk(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function vA(e){return new xA({type:"readonly",innerType:e})}var _A=R("ZodTemplateLiteral",(e,t)=>{cx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>tk(e,r,o,n)});function BB(e,t){return new _A({type:"template_literal",parts:e,...ee.normalizeParams(t)})}var wA=R("ZodLazy",(e,t)=>{dx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>wk(e,r,o,n),e.unwrap=()=>e._zod.def.getter()});function SA(e){return new wA({type:"lazy",getter:e})}var TA=R("ZodPromise",(e,t)=>{lx.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>_k(e,r,o,n),e.unwrap=()=>e._zod.def.innerType});function DB(e){return new TA({type:"promise",innerType:e})}var EA=R("ZodFunction",(e,t)=>{ux.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ik(e,r,o,n)});function UB(e){return new EA({type:"function",input:Array.isArray(e?.input)?eA(e?.input):e?.input??nt(Ot()),output:e?.output??Ot()})}var wh=R("ZodCustom",(e,t)=>{px.init(e,t),Je.init(e,t),e._zod.processJSONSchema=(r,o,n)=>ok(e,r,o,n)});function LB(e){let t=new Rt({check:"custom"});return t._zod.check=e,t}function Pv(e,t){return jx(wh,e??(()=>!0),t)}function IA(e,t={}){return Fx(wh,e,t)}function PA(e,t){return qx(e,t)}var jB=Hx,FB=Gx;function qB(e,t={}){let r=new wh({type:"custom",check:"custom",fn:(o)=>o instanceof e,abort:!0,...ee.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=(o)=>{if(!(o.value instanceof e))o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:r,path:[...r._zod.def.path??[]]})},r}var HB=(...e)=>Vx({Codec:_h,Boolean:xd,String:gd},...e);function GB(e){let t=SA(()=>Ct([D(e),bt(),ar(),hh(),nt(t),kt(D(),t)]));return t}function Sh(e,t){return new bA({type:"pipe",in:Ev(e),out:t})}var boe={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function xoe(e){or({customError:e})}function voe(){return or().customError}var kA;(function(e){})(kA||(kA={}));var he={...lh,...Xx,iso:Ps},_oe=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function woe(e,t){let r=e.$schema;if(r==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(r==="http://json-schema.org/draft-07/schema#")return"draft-7";if(r==="http://json-schema.org/draft-04/schema#")return"draft-4";return t??"draft-2020-12"}function Soe(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let o=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===o){let n=r[1];if(!n||!t.defs[n])throw Error(`Reference not found: ${e}`);return t.defs[n]}throw Error(`Reference not found: ${e}`)}function VB(e,t){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return he.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return he.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let i=Soe(n,t),a=Qr(i,t);return t.refs.set(n,a),t.processing.delete(n),a}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return he.null();if(n.length===0)return he.never();if(n.length===1)return he.literal(n[0]);if(n.every((a)=>typeof a==="string"))return he.enum(n);let i=n.map((a)=>he.literal(a));if(i.length<2)return i[0];return he.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return he.literal(e.const);let r=e.type;if(Array.isArray(r)){let n=r.map((i)=>{let a={...e,type:i};return VB(a,t)});if(n.length===0)return he.never();if(n.length===1)return n[0];return he.union(n)}if(!r)return he.any();let o;switch(r){case"string":{let n=he.string();if(e.format){let i=e.format;if(i==="email")n=n.check(he.email());else if(i==="uri"||i==="uri-reference")n=n.check(he.url());else if(i==="uuid"||i==="guid")n=n.check(he.uuid());else if(i==="date-time")n=n.check(he.iso.datetime());else if(i==="date")n=n.check(he.iso.date());else if(i==="time")n=n.check(he.iso.time());else if(i==="duration")n=n.check(he.iso.duration());else if(i==="ipv4")n=n.check(he.ipv4());else if(i==="ipv6")n=n.check(he.ipv6());else if(i==="mac")n=n.check(he.mac());else if(i==="cidr")n=n.check(he.cidrv4());else if(i==="cidr-v6")n=n.check(he.cidrv6());else if(i==="base64")n=n.check(he.base64());else if(i==="base64url")n=n.check(he.base64url());else if(i==="e164")n=n.check(he.e164());else if(i==="jwt")n=n.check(he.jwt());else if(i==="emoji")n=n.check(he.emoji());else if(i==="nanoid")n=n.check(he.nanoid());else if(i==="cuid")n=n.check(he.cuid());else if(i==="cuid2")n=n.check(he.cuid2());else if(i==="ulid")n=n.check(he.ulid());else if(i==="xid")n=n.check(he.xid());else if(i==="ksuid")n=n.check(he.ksuid())}if(typeof e.minLength==="number")n=n.min(e.minLength);if(typeof e.maxLength==="number")n=n.max(e.maxLength);if(e.pattern)n=n.regex(new RegExp(e.pattern));o=n;break}case"number":case"integer":{let n=r==="integer"?he.number().int():he.number();if(typeof e.minimum==="number")n=n.min(e.minimum);if(typeof e.maximum==="number")n=n.max(e.maximum);if(typeof e.exclusiveMinimum==="number")n=n.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")n=n.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")n=n.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")n=n.lt(e.maximum);if(typeof e.multipleOf==="number")n=n.multipleOf(e.multipleOf);o=n;break}case"boolean":{o=he.boolean();break}case"null":{o=he.null();break}case"object":{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[c,u]of Object.entries(i)){let d=Qr(u,t);n[c]=a.has(c)?d:d.optional()}if(e.propertyNames){let c=Qr(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties==="object"?Qr(e.additionalProperties,t):he.any();if(Object.keys(n).length===0){o=he.record(c,u);break}let d=he.object(n).passthrough(),p=he.looseRecord(c,u);o=he.intersection(d,p);break}if(e.patternProperties){let c=e.patternProperties,u=Object.keys(c),d=[];for(let m of u){let h=Qr(c[m],t),y=he.string().regex(new RegExp(m));d.push(he.looseRecord(y,h))}let p=[];if(Object.keys(n).length>0)p.push(he.object(n).passthrough());if(p.push(...d),p.length===0)o=he.object({}).passthrough();else if(p.length===1)o=p[0];else{let m=he.intersection(p[0],p[1]);for(let h=2;h<p.length;h++)m=he.intersection(m,p[h]);o=m}break}let s=he.object(n);if(e.additionalProperties===!1)o=s.strict();else if(typeof e.additionalProperties==="object")o=s.catchall(Qr(e.additionalProperties,t));else o=s.passthrough();break}case"array":{let{prefixItems:n,items:i}=e;if(n&&Array.isArray(n)){let a=n.map((c)=>Qr(c,t)),s=i&&typeof i==="object"&&!Array.isArray(i)?Qr(i,t):void 0;if(s)o=he.tuple(a).rest(s);else o=he.tuple(a);if(typeof e.minItems==="number")o=o.check(he.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(he.maxLength(e.maxItems))}else if(Array.isArray(i)){let a=i.map((c)=>Qr(c,t)),s=e.additionalItems&&typeof e.additionalItems==="object"?Qr(e.additionalItems,t):void 0;if(s)o=he.tuple(a).rest(s);else o=he.tuple(a);if(typeof e.minItems==="number")o=o.check(he.minLength(e.minItems));if(typeof e.maxItems==="number")o=o.check(he.maxLength(e.maxItems))}else if(i!==void 0){let a=Qr(i,t),s=he.array(a);if(typeof e.minItems==="number")s=s.min(e.minItems);if(typeof e.maxItems==="number")s=s.max(e.maxItems);o=s}else o=he.array(he.any());break}default:throw Error(`Unsupported type: ${r}`)}return o}function Qr(e,t){if(typeof e==="boolean")return e?he.any():he.never();let r=VB(e,t),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let s=e.anyOf.map((u)=>Qr(u,t)),c=he.union(s);r=o?he.intersection(r,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let s=e.oneOf.map((u)=>Qr(u,t)),c=he.xor(s);r=o?he.intersection(r,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=o?r:he.any();else{let s=o?r:Qr(e.allOf[0],t),c=o?0:1;for(let u=c;u<e.allOf.length;u++)s=he.intersection(s,Qr(e.allOf[u],t));r=s}if(e.nullable===!0&&t.version==="openapi-3.0")r=he.nullable(r);if(e.readOnly===!0)r=he.readonly(r);if(e.default!==void 0)r=r.default(e.default);let n={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let s of i)if(s in e)n[s]=e[s];let a=["contentEncoding","contentMediaType","contentSchema"];for(let s of a)if(s in e)n[s]=e[s];for(let s of Object.keys(e))if(!_oe.has(s))n[s]=e[s];if(Object.keys(n).length>0)t.registry.add(r,n);if(e.description)r=r.describe(e.description);return r}function ZB(e,t){if(typeof e==="boolean")return e?he.any():he.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=woe(r,t?.defaultTarget),n=r.$defs||r.definitions||{},i={version:o,defs:n,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??Nr};return Qr(r,i)}var AA={};kn(AA,{bigint:()=>Poe,boolean:()=>Ioe,date:()=>koe,number:()=>Eoe,string:()=>Toe});function Toe(e){return kP(gd,e)}function Eoe(e){return zP(bd,e)}function Ioe(e){return NP(xd,e)}function Poe(e){return MP(vd,e)}function koe(e){return BP(gh,e)}or(Lm());var RA="2025-11-25";var WB=[RA,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ks="io.modelcontextprotocol/related-task",Av="2.0",yr=Pv((e)=>e!==null&&(typeof e==="object"||typeof e==="function")),KB=Ct([D(),bt().int()]),JB=D(),CEe=Mr({ttl:bt().optional(),pollInterval:bt().optional()}),Aoe=ye({ttl:bt().optional()}),Roe=ye({taskId:D()}),$A=Mr({progressToken:KB.optional(),[ks]:Roe.optional()}),Kn=ye({_meta:$A.optional()}),Th=Kn.extend({task:Aoe.optional()}),YB=(e)=>Th.safeParse(e).success,Dr=ye({method:D(),params:Kn.loose().optional()}),ao=ye({_meta:$A.optional()}),so=ye({method:D(),params:ao.loose().optional()}),Ur=Mr({_meta:$A.optional()}),Rv=Ct([D(),bt().int()]),QB=ye({jsonrpc:Ee(Av),id:Rv,...Dr.shape}).strict(),OA=(e)=>QB.safeParse(e).success,XB=ye({jsonrpc:Ee(Av),...so.shape}).strict(),eD=(e)=>XB.safeParse(e).success,CA=ye({jsonrpc:Ee(Av),id:Rv,result:Ur}).strict(),Eh=(e)=>CA.safeParse(e).success;var Oe;(function(e){e[e.ConnectionClosed=-32000]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(Oe||(Oe={}));var zA=ye({jsonrpc:Ee(Av),id:Rv.optional(),error:ye({code:bt().int(),message:D(),data:Ot().optional()})}).strict();var tD=(e)=>zA.safeParse(e).success;var rD=Ct([QB,XB,CA,zA]),zEe=Ct([CA,zA]),$v=Ur.strict(),$oe=ao.extend({requestId:Rv.optional(),reason:D().optional()}),Ov=so.extend({method:Ee("notifications/cancelled"),params:$oe}),Ooe=ye({src:D(),mimeType:D().optional(),sizes:nt(D()).optional(),theme:Br(["light","dark"]).optional()}),Ih=ye({icons:nt(Ooe).optional()}),Sd=ye({name:D(),title:D().optional()}),nD=Sd.extend({...Sd.shape,...Ih.shape,version:D(),websiteUrl:D().optional(),description:D().optional()}),Coe=_d(ye({applyDefaults:ar().optional()}),kt(D(),Ot())),zoe=Sh((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)){if(Object.keys(e).length===0)return{form:{}}}return e},_d(ye({form:Coe.optional(),url:yr.optional()}),kt(D(),Ot()).optional())),Noe=Mr({list:yr.optional(),cancel:yr.optional(),requests:Mr({sampling:Mr({createMessage:yr.optional()}).optional(),elicitation:Mr({create:yr.optional()}).optional()}).optional()}),Moe=Mr({list:yr.optional(),cancel:yr.optional(),requests:Mr({tools:Mr({call:yr.optional()}).optional()}).optional()}),Boe=ye({experimental:kt(D(),yr).optional(),sampling:ye({context:yr.optional(),tools:yr.optional()}).optional(),elicitation:zoe.optional(),roots:ye({listChanged:ar().optional()}).optional(),tasks:Noe.optional(),extensions:kt(D(),yr).optional()}),Doe=Kn.extend({protocolVersion:D(),capabilities:Boe,clientInfo:nD}),NA=Dr.extend({method:Ee("initialize"),params:Doe});var Uoe=ye({experimental:kt(D(),yr).optional(),logging:yr.optional(),completions:yr.optional(),prompts:ye({listChanged:ar().optional()}).optional(),resources:ye({subscribe:ar().optional(),listChanged:ar().optional()}).optional(),tools:ye({listChanged:ar().optional()}).optional(),tasks:Moe.optional(),extensions:kt(D(),yr).optional()}),Loe=Ur.extend({protocolVersion:D(),capabilities:Uoe,serverInfo:nD,instructions:D().optional()}),MA=so.extend({method:Ee("notifications/initialized"),params:ao.optional()});var Cv=Dr.extend({method:Ee("ping"),params:Kn.optional()}),joe=ye({progress:bt(),total:Bt(bt()),message:Bt(D())}),Foe=ye({...ao.shape,...joe.shape,progressToken:KB}),zv=so.extend({method:Ee("notifications/progress"),params:Foe}),qoe=Kn.extend({cursor:JB.optional()}),Ph=Dr.extend({params:qoe.optional()}),kh=Ur.extend({nextCursor:JB.optional()}),Hoe=Br(["working","input_required","completed","failed","cancelled"]),Ah=ye({taskId:D(),status:Hoe,ttl:Ct([bt(),hh()]),createdAt:D(),lastUpdatedAt:D(),pollInterval:Bt(bt()),statusMessage:Bt(D())}),Td=Ur.extend({task:Ah}),Goe=ao.merge(Ah),Rh=so.extend({method:Ee("notifications/tasks/status"),params:Goe}),Nv=Dr.extend({method:Ee("tasks/get"),params:Kn.extend({taskId:D()})}),Mv=Ur.merge(Ah),Bv=Dr.extend({method:Ee("tasks/result"),params:Kn.extend({taskId:D()})}),NEe=Ur.loose(),Dv=Ph.extend({method:Ee("tasks/list")}),Uv=kh.extend({tasks:nt(Ah)}),Lv=Dr.extend({method:Ee("tasks/cancel"),params:Kn.extend({taskId:D()})}),oD=Ur.merge(Ah),iD=ye({uri:D(),mimeType:Bt(D()),_meta:kt(D(),Ot()).optional()}),aD=iD.extend({text:D()}),BA=D().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),sD=iD.extend({blob:BA}),$h=Br(["user","assistant"]),Ed=ye({audience:nt($h).optional(),priority:bt().min(0).max(1).optional(),lastModified:Ps.datetime({offset:!0}).optional()}),cD=ye({...Sd.shape,...Ih.shape,uri:D(),description:Bt(D()),mimeType:Bt(D()),size:Bt(bt()),annotations:Ed.optional(),_meta:Bt(Mr({}))}),Voe=ye({...Sd.shape,...Ih.shape,uriTemplate:D(),description:Bt(D()),mimeType:Bt(D()),annotations:Ed.optional(),_meta:Bt(Mr({}))}),jv=Ph.extend({method:Ee("resources/list")}),Zoe=kh.extend({resources:nt(cD)}),Fv=Ph.extend({method:Ee("resources/templates/list")}),Woe=kh.extend({resourceTemplates:nt(Voe)}),DA=Kn.extend({uri:D()}),Koe=DA,qv=Dr.extend({method:Ee("resources/read"),params:Koe}),Joe=Ur.extend({contents:nt(Ct([aD,sD]))}),Yoe=so.extend({method:Ee("notifications/resources/list_changed"),params:ao.optional()}),Qoe=DA,Xoe=Dr.extend({method:Ee("resources/subscribe"),params:Qoe}),eie=DA,tie=Dr.extend({method:Ee("resources/unsubscribe"),params:eie}),rie=ao.extend({uri:D()}),nie=so.extend({method:Ee("notifications/resources/updated"),params:rie}),oie=ye({name:D(),description:Bt(D()),required:Bt(ar())}),iie=ye({...Sd.shape,...Ih.shape,description:Bt(D()),arguments:Bt(nt(oie)),_meta:Bt(Mr({}))}),Hv=Ph.extend({method:Ee("prompts/list")}),aie=kh.extend({prompts:nt(iie)}),sie=Kn.extend({name:D(),arguments:kt(D(),D()).optional()}),Gv=Dr.extend({method:Ee("prompts/get"),params:sie}),UA=ye({type:Ee("text"),text:D(),annotations:Ed.optional(),_meta:kt(D(),Ot()).optional()}),LA=ye({type:Ee("image"),data:BA,mimeType:D(),annotations:Ed.optional(),_meta:kt(D(),Ot()).optional()}),jA=ye({type:Ee("audio"),data:BA,mimeType:D(),annotations:Ed.optional(),_meta:kt(D(),Ot()).optional()}),cie=ye({type:Ee("tool_use"),name:D(),id:D(),input:kt(D(),Ot()),_meta:kt(D(),Ot()).optional()}),uie=ye({type:Ee("resource"),resource:Ct([aD,sD]),annotations:Ed.optional(),_meta:kt(D(),Ot()).optional()}),lie=cD.extend({type:Ee("resource_link")}),FA=Ct([UA,LA,jA,lie,uie]),die=ye({role:$h,content:FA}),pie=Ur.extend({description:D().optional(),messages:nt(die)}),fie=so.extend({method:Ee("notifications/prompts/list_changed"),params:ao.optional()}),mie=ye({title:D().optional(),readOnlyHint:ar().optional(),destructiveHint:ar().optional(),idempotentHint:ar().optional(),openWorldHint:ar().optional()}),hie=ye({taskSupport:Br(["required","optional","forbidden"]).optional()}),uD=ye({...Sd.shape,...Ih.shape,description:D().optional(),inputSchema:ye({type:Ee("object"),properties:kt(D(),yr).optional(),required:nt(D()).optional()}).catchall(Ot()),outputSchema:ye({type:Ee("object"),properties:kt(D(),yr).optional(),required:nt(D()).optional()}).catchall(Ot()).optional(),annotations:mie.optional(),execution:hie.optional(),_meta:kt(D(),Ot()).optional()}),Vv=Ph.extend({method:Ee("tools/list")}),gie=kh.extend({tools:nt(uD)}),Zv=Ur.extend({content:nt(FA).default([]),structuredContent:kt(D(),Ot()).optional(),isError:ar().optional()}),MEe=Zv.or(Ur.extend({toolResult:Ot()})),yie=Th.extend({name:D(),arguments:kt(D(),Ot()).optional()}),Id=Dr.extend({method:Ee("tools/call"),params:yie}),bie=so.extend({method:Ee("notifications/tools/list_changed"),params:ao.optional()}),BEe=ye({autoRefresh:ar().default(!0),debounceMs:bt().int().nonnegative().default(300)}),Oh=Br(["debug","info","notice","warning","error","critical","alert","emergency"]),xie=Kn.extend({level:Oh}),qA=Dr.extend({method:Ee("logging/setLevel"),params:xie}),vie=ao.extend({level:Oh,logger:D().optional(),data:Ot()}),_ie=so.extend({method:Ee("notifications/message"),params:vie}),wie=ye({name:D().optional()}),Sie=ye({hints:nt(wie).optional(),costPriority:bt().min(0).max(1).optional(),speedPriority:bt().min(0).max(1).optional(),intelligencePriority:bt().min(0).max(1).optional()}),Tie=ye({mode:Br(["auto","required","none"]).optional()}),Eie=ye({type:Ee("tool_result"),toolUseId:D().describe("The unique identifier for the corresponding tool call."),content:nt(FA).default([]),structuredContent:ye({}).loose().optional(),isError:ar().optional(),_meta:kt(D(),Ot()).optional()}),Iie=xh("type",[UA,LA,jA]),kv=xh("type",[UA,LA,jA,cie,Eie]),Pie=ye({role:$h,content:Ct([kv,nt(kv)]),_meta:kt(D(),Ot()).optional()}),kie=Th.extend({messages:nt(Pie),modelPreferences:Sie.optional(),systemPrompt:D().optional(),includeContext:Br(["none","thisServer","allServers"]).optional(),temperature:bt().optional(),maxTokens:bt().int(),stopSequences:nt(D()).optional(),metadata:yr.optional(),tools:nt(uD).optional(),toolChoice:Tie.optional()}),Aie=Dr.extend({method:Ee("sampling/createMessage"),params:kie}),Ch=Ur.extend({model:D(),stopReason:Bt(Br(["endTurn","stopSequence","maxTokens"]).or(D())),role:$h,content:Iie}),HA=Ur.extend({model:D(),stopReason:Bt(Br(["endTurn","stopSequence","maxTokens","toolUse"]).or(D())),role:$h,content:Ct([kv,nt(kv)])}),Rie=ye({type:Ee("boolean"),title:D().optional(),description:D().optional(),default:ar().optional()}),$ie=ye({type:Ee("string"),title:D().optional(),description:D().optional(),minLength:bt().optional(),maxLength:bt().optional(),format:Br(["email","uri","date","date-time"]).optional(),default:D().optional()}),Oie=ye({type:Br(["number","integer"]),title:D().optional(),description:D().optional(),minimum:bt().optional(),maximum:bt().optional(),default:bt().optional()}),Cie=ye({type:Ee("string"),title:D().optional(),description:D().optional(),enum:nt(D()),default:D().optional()}),zie=ye({type:Ee("string"),title:D().optional(),description:D().optional(),oneOf:nt(ye({const:D(),title:D()})),default:D().optional()}),Nie=ye({type:Ee("string"),title:D().optional(),description:D().optional(),enum:nt(D()),enumNames:nt(D()).optional(),default:D().optional()}),Mie=Ct([Cie,zie]),Bie=ye({type:Ee("array"),title:D().optional(),description:D().optional(),minItems:bt().optional(),maxItems:bt().optional(),items:ye({type:Ee("string"),enum:nt(D())}),default:nt(D()).optional()}),Die=ye({type:Ee("array"),title:D().optional(),description:D().optional(),minItems:bt().optional(),maxItems:bt().optional(),items:ye({anyOf:nt(ye({const:D(),title:D()}))}),default:nt(D()).optional()}),Uie=Ct([Bie,Die]),Lie=Ct([Nie,Mie,Uie]),jie=Ct([Lie,Rie,$ie,Oie]),Fie=Th.extend({mode:Ee("form").optional(),message:D(),requestedSchema:ye({type:Ee("object"),properties:kt(D(),jie),required:nt(D()).optional()})}),qie=Th.extend({mode:Ee("url"),message:D(),elicitationId:D(),url:D().url()}),Hie=Ct([Fie,qie]),Gie=Dr.extend({method:Ee("elicitation/create"),params:Hie}),Vie=ao.extend({elicitationId:D()}),Zie=so.extend({method:Ee("notifications/elicitation/complete"),params:Vie}),Pd=Ur.extend({action:Br(["accept","decline","cancel"]),content:Sh((e)=>e===null?void 0:e,kt(D(),Ct([D(),bt(),ar(),nt(D())])).optional())}),Wie=ye({type:Ee("ref/resource"),uri:D()});var Kie=ye({type:Ee("ref/prompt"),name:D()}),Jie=Kn.extend({ref:Ct([Kie,Wie]),argument:ye({name:D(),value:D()}),context:ye({arguments:kt(D(),D()).optional()}).optional()}),Wv=Dr.extend({method:Ee("completion/complete"),params:Jie});function lD(e){if(e.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function dD(e){if(e.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var Yie=Ur.extend({completion:Mr({values:nt(D()).max(100),total:Bt(bt().int()),hasMore:Bt(ar())})}),Qie=ye({uri:D().startsWith("file://"),name:D().optional(),_meta:kt(D(),Ot()).optional()}),Xie=Dr.extend({method:Ee("roots/list"),params:Kn.optional()}),GA=Ur.extend({roots:nt(Qie)}),eae=so.extend({method:Ee("notifications/roots/list_changed"),params:ao.optional()}),DEe=Ct([Cv,NA,Wv,qA,Gv,Hv,jv,Fv,qv,Xoe,tie,Id,Vv,Nv,Bv,Dv,Lv]),UEe=Ct([Ov,zv,MA,eae,Rh]),LEe=Ct([$v,Ch,HA,Pd,GA,Mv,Uv,Td]),jEe=Ct([Cv,Aie,Gie,Xie,Nv,Bv,Dv,Lv]),FEe=Ct([Ov,zv,_ie,nie,Yoe,bie,fie,Rh,Zie]),qEe=Ct([$v,Loe,Yie,pie,aie,Zoe,Woe,Joe,Zv,gie,Mv,Uv,Td]);class Ie extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`);this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===Oe.UrlElicitationRequired&&r){let o=r;if(o.elicitations)return new pD(o.elicitations,t)}return new Ie(e,t,r)}}class pD extends Ie{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Oe.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function As(e){return e==="completed"||e==="failed"||e==="cancelled"}var mD=Symbol("Let zodToJsonSchema decide on which parser to use");var fD={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},hD=(e)=>typeof e==="string"?{...fD,name:e}:{...fD,...e};var gD=(e)=>{let t=hD(e),r=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([o,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,o],jsonSchema:void 0}]))}};function VA(e,t,r,o){if(!o?.errorMessages)return;if(r)e.errorMessage={...e.errorMessage,[t]:r}}function lt(e,t,r,o,n){e[t]=r,VA(e,t,o,n)}var Kv=(e,t)=>{let r=0;for(;r<e.length&&r<t.length;r++)if(e[r]!==t[r])break;return[(e.length-r).toString(),...t.slice(r)].join("/")};function Jt(e){if(e.target!=="openAi")return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?Kv(t,e.currentPath):t.join("/")}}function yD(e,t){let r={type:"array"};if(e.type?._def&&e.type?._def?.typeName!==ne.ZodAny)r.items=Be(e.type._def,{...t,currentPath:[...t.currentPath,"items"]});if(e.minLength)lt(r,"minItems",e.minLength.value,e.minLength.message,t);if(e.maxLength)lt(r,"maxItems",e.maxLength.value,e.maxLength.message,t);if(e.exactLength)lt(r,"minItems",e.exactLength.value,e.exactLength.message,t),lt(r,"maxItems",e.exactLength.value,e.exactLength.message,t);return r}function bD(e,t){let r={type:"integer",format:"int64"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"min":if(t.target==="jsonSchema7")if(o.inclusive)lt(r,"minimum",o.value,o.message,t);else lt(r,"exclusiveMinimum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMinimum=!0;lt(r,"minimum",o.value,o.message,t)}break;case"max":if(t.target==="jsonSchema7")if(o.inclusive)lt(r,"maximum",o.value,o.message,t);else lt(r,"exclusiveMaximum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMaximum=!0;lt(r,"maximum",o.value,o.message,t)}break;case"multipleOf":lt(r,"multipleOf",o.value,o.message,t);break}return r}function xD(){return{type:"boolean"}}function Jv(e,t){return Be(e.type._def,t)}var vD=(e,t)=>Be(e.innerType._def,t);function ZA(e,t,r){let o=r??t.dateStrategy;if(Array.isArray(o))return{anyOf:o.map((n,i)=>ZA(e,t,n))};switch(o){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return tae(e,t)}}var tae=(e,t)=>{let r={type:"integer",format:"unix-time"};if(t.target==="openApi3")return r;for(let o of e.checks)switch(o.kind){case"min":lt(r,"minimum",o.value,o.message,t);break;case"max":lt(r,"maximum",o.value,o.message,t);break}return r};function _D(e,t){return{...Be(e.innerType._def,t),default:e.defaultValue()}}function wD(e,t){return t.effectStrategy==="input"?Be(e.schema._def,t):Jt(t)}function SD(e){return{type:"string",enum:Array.from(e.values)}}var rae=(e)=>{if("type"in e&&e.type==="string")return!1;return"allOf"in e};function TD(e,t){let r=[Be(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Be(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter((i)=>!!i),o=t.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,n=[];return r.forEach((i)=>{if(rae(i)){if(n.push(...i.allOf),i.unevaluatedProperties===void 0)o=void 0}else{let a=i;if("additionalProperties"in i&&i.additionalProperties===!1){let{additionalProperties:s,...c}=i;a=c}else o=void 0;n.push(a)}}),n.length?{allOf:n,...o}:void 0}function ED(e,t){let r=typeof e.value;if(r!=="bigint"&&r!=="number"&&r!=="boolean"&&r!=="string")return{type:Array.isArray(e.value)?"array":"object"};if(t.target==="openApi3")return{type:r==="bigint"?"integer":r,enum:[e.value]};return{type:r==="bigint"?"integer":r,const:e.value}}var WA=void 0,No={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(WA===void 0)WA=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return WA},uuid:/^[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}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([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})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Yv(e,t){let r={type:"string"};if(e.checks)for(let o of e.checks)switch(o.kind){case"min":lt(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t);break;case"max":lt(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Mo(r,"email",o.message,t);break;case"format:idn-email":Mo(r,"idn-email",o.message,t);break;case"pattern:zod":dn(r,No.email,o.message,t);break}break;case"url":Mo(r,"uri",o.message,t);break;case"uuid":Mo(r,"uuid",o.message,t);break;case"regex":dn(r,o.regex,o.message,t);break;case"cuid":dn(r,No.cuid,o.message,t);break;case"cuid2":dn(r,No.cuid2,o.message,t);break;case"startsWith":dn(r,RegExp(`^${KA(o.value,t)}`),o.message,t);break;case"endsWith":dn(r,RegExp(`${KA(o.value,t)}$`),o.message,t);break;case"datetime":Mo(r,"date-time",o.message,t);break;case"date":Mo(r,"date",o.message,t);break;case"time":Mo(r,"time",o.message,t);break;case"duration":Mo(r,"duration",o.message,t);break;case"length":lt(r,"minLength",typeof r.minLength==="number"?Math.max(r.minLength,o.value):o.value,o.message,t),lt(r,"maxLength",typeof r.maxLength==="number"?Math.min(r.maxLength,o.value):o.value,o.message,t);break;case"includes":{dn(r,RegExp(KA(o.value,t)),o.message,t);break}case"ip":{if(o.version!=="v6")Mo(r,"ipv4",o.message,t);if(o.version!=="v4")Mo(r,"ipv6",o.message,t);break}case"base64url":dn(r,No.base64url,o.message,t);break;case"jwt":dn(r,No.jwt,o.message,t);break;case"cidr":{if(o.version!=="v6")dn(r,No.ipv4Cidr,o.message,t);if(o.version!=="v4")dn(r,No.ipv6Cidr,o.message,t);break}case"emoji":dn(r,No.emoji(),o.message,t);break;case"ulid":{dn(r,No.ulid,o.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{Mo(r,"binary",o.message,t);break}case"contentEncoding:base64":{lt(r,"contentEncoding","base64",o.message,t);break}case"pattern:zod":{dn(r,No.base64,o.message,t);break}}break}case"nanoid":dn(r,No.nanoid,o.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:((n)=>{})(o)}return r}function KA(e,t){return t.patternStrategy==="escape"?oae(e):e}var nae=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function oae(e){let t="";for(let r=0;r<e.length;r++){if(!nae.has(e[r]))t+="\\";t+=e[r]}return t}function Mo(e,t,r,o){if(e.format||e.anyOf?.some((n)=>n.format)){if(!e.anyOf)e.anyOf=[];if(e.format){if(e.anyOf.push({format:e.format,...e.errorMessage&&o.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage){if(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.anyOf.push({format:t,...r&&o.errorMessages&&{errorMessage:{format:r}}})}else lt(e,"format",t,r,o)}function dn(e,t,r,o){if(e.pattern||e.allOf?.some((n)=>n.pattern)){if(!e.allOf)e.allOf=[];if(e.pattern){if(e.allOf.push({pattern:e.pattern,...e.errorMessage&&o.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage){if(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0)delete e.errorMessage}}e.allOf.push({pattern:ID(t,o),...r&&o.errorMessages&&{errorMessage:{pattern:r}}})}else lt(e,"pattern",ID(t,o),r,o)}function ID(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=r.i?e.source.toLowerCase():e.source,n="",i=!1,a=!1,s=!1;for(let c=0;c<o.length;c++){if(i){n+=o[c],i=!1;continue}if(r.i){if(a){if(o[c].match(/[a-z]/)){if(s)n+=o[c],n+=`${o[c-2]}-${o[c]}`.toUpperCase(),s=!1;else if(o[c+1]==="-"&&o[c+2]?.match(/[a-z]/))n+=o[c],s=!0;else n+=`${o[c]}${o[c].toUpperCase()}`;continue}}else if(o[c].match(/[a-z]/)){n+=`[${o[c]}${o[c].toUpperCase()}]`;continue}}if(r.m){if(o[c]==="^"){n+=`(^|(?<=[\r
|
|
131
131
|
]))`;continue}else if(o[c]==="$"){n+=`($|(?=[\r
|
|
132
132
|
]))`;continue}}if(r.s&&o[c]==="."){n+=a?`${o[c]}\r
|
|
133
133
|
`:`[${o[c]}\r
|
|
134
134
|
]`;continue}if(n+=o[c],o[c]==="\\")i=!0;else if(a&&o[c]==="]")a=!1;else if(!a&&o[c]==="[")a=!0}try{new RegExp(n)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return n}function Qv(e,t){if(t.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(t.target==="openApi3"&&e.keyType?._def.typeName===ne.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((o,n)=>({...o,[n]:Be(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??Jt(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:Be(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if(t.target==="openApi3")return r;if(e.keyType?._def.typeName===ne.ZodString&&e.keyType._def.checks?.length){let{type:o,...n}=Yv(e.keyType._def,t);return{...r,propertyNames:n}}else if(e.keyType?._def.typeName===ne.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===ne.ZodBranded&&e.keyType._def.type._def.typeName===ne.ZodString&&e.keyType._def.type._def.checks?.length){let{type:o,...n}=Jv(e.keyType._def,t);return{...r,propertyNames:n}}return r}function PD(e,t){if(t.mapStrategy==="record")return Qv(e,t);let r=Be(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Jt(t),o=Be(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Jt(t);return{type:"array",maxItems:125,items:{type:"array",items:[r,o],minItems:2,maxItems:2}}}function kD(e){let t=e.values,o=Object.keys(e.values).filter((i)=>typeof t[t[i]]!=="number").map((i)=>t[i]),n=Array.from(new Set(o.map((i)=>typeof i)));return{type:n.length===1?n[0]==="string"?"string":"number":["string","number"],enum:o}}function AD(e){return e.target==="openAi"?void 0:{not:Jt({...e,currentPath:[...e.currentPath,"not"]})}}function RD(e){return e.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var zh={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function OD(e,t){if(t.target==="openApi3")return $D(e,t);let r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every((o)=>(o._def.typeName in zh)&&(!o._def.checks||!o._def.checks.length))){let o=r.reduce((n,i)=>{let a=zh[i._def.typeName];return a&&!n.includes(a)?[...n,a]:n},[]);return{type:o.length>1?o:o[0]}}else if(r.every((o)=>o._def.typeName==="ZodLiteral"&&!o.description)){let o=r.reduce((n,i)=>{let a=typeof i._def.value;switch(a){case"string":case"number":case"boolean":return[...n,a];case"bigint":return[...n,"integer"];case"object":if(i._def.value===null)return[...n,"null"];case"symbol":case"undefined":case"function":default:return n}},[]);if(o.length===r.length){let n=o.filter((i,a,s)=>s.indexOf(i)===a);return{type:n.length>1?n:n[0],enum:r.reduce((i,a)=>i.includes(a._def.value)?i:[...i,a._def.value],[])}}}else if(r.every((o)=>o._def.typeName==="ZodEnum"))return{type:"string",enum:r.reduce((o,n)=>[...o,...n._def.values.filter((i)=>!o.includes(i))],[])};return $D(e,t)}var $D=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((o,n)=>Be(o._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter((o)=>!!o&&(!t.strictUnions||typeof o==="object"&&Object.keys(o).length>0));return r.length?{anyOf:r}:void 0};function CD(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length)){if(t.target==="openApi3")return{type:zh[e.innerType._def.typeName],nullable:!0};return{type:[zh[e.innerType._def.typeName],"null"]}}if(t.target==="openApi3"){let o=Be(e.innerType._def,{...t,currentPath:[...t.currentPath]});if(o&&"$ref"in o)return{allOf:[o],nullable:!0};return o&&{...o,nullable:!0}}let r=Be(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}function zD(e,t){let r={type:"number"};if(!e.checks)return r;for(let o of e.checks)switch(o.kind){case"int":r.type="integer",VA(r,"type",o.message,t);break;case"min":if(t.target==="jsonSchema7")if(o.inclusive)lt(r,"minimum",o.value,o.message,t);else lt(r,"exclusiveMinimum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMinimum=!0;lt(r,"minimum",o.value,o.message,t)}break;case"max":if(t.target==="jsonSchema7")if(o.inclusive)lt(r,"maximum",o.value,o.message,t);else lt(r,"exclusiveMaximum",o.value,o.message,t);else{if(!o.inclusive)r.exclusiveMaximum=!0;lt(r,"maximum",o.value,o.message,t)}break;case"multipleOf":lt(r,"multipleOf",o.value,o.message,t);break}return r}function ND(e,t){let r=t.target==="openAi",o={type:"object",properties:{}},n=[],i=e.shape();for(let s in i){let c=i[s];if(c===void 0||c._def===void 0)continue;let u=aae(c);if(u&&r){if(c._def.typeName==="ZodOptional")c=c._def.innerType;if(!c.isNullable())c=c.nullable();u=!1}let d=Be(c._def,{...t,currentPath:[...t.currentPath,"properties",s],propertyPath:[...t.currentPath,"properties",s]});if(d===void 0)continue;if(o.properties[s]=d,!u)n.push(s)}if(n.length)o.required=n;let a=iae(e,t);if(a!==void 0)o.additionalProperties=a;return o}function iae(e,t){if(e.catchall._def.typeName!=="ZodNever")return Be(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function aae(e){try{return e.isOptional()}catch{return!0}}var MD=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Be(e.innerType._def,t);let r=Be(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Jt(t)},r]}:Jt(t)};var BD=(e,t)=>{if(t.pipeStrategy==="input")return Be(e.in._def,t);else if(t.pipeStrategy==="output")return Be(e.out._def,t);let r=Be(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),o=Be(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]});return{allOf:[r,o].filter((n)=>n!==void 0)}};function DD(e,t){return Be(e.type._def,t)}function UD(e,t){let o={type:"array",uniqueItems:!0,items:Be(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};if(e.minSize)lt(o,"minItems",e.minSize.value,e.minSize.message,t);if(e.maxSize)lt(o,"maxItems",e.maxSize.value,e.maxSize.message,t);return o}function LD(e,t){if(e.rest)return{type:"array",minItems:e.items.length,items:e.items.map((r,o)=>Be(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[]),additionalItems:Be(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})};else return{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((r,o)=>Be(r._def,{...t,currentPath:[...t.currentPath,"items",`${o}`]})).reduce((r,o)=>o===void 0?r:[...r,o],[])}}function jD(e){return{not:Jt(e)}}function FD(e){return Jt(e)}var qD=(e,t)=>Be(e.innerType._def,t);var HD=(e,t,r)=>{switch(t){case ne.ZodString:return Yv(e,r);case ne.ZodNumber:return zD(e,r);case ne.ZodObject:return ND(e,r);case ne.ZodBigInt:return bD(e,r);case ne.ZodBoolean:return xD();case ne.ZodDate:return ZA(e,r);case ne.ZodUndefined:return jD(r);case ne.ZodNull:return RD(r);case ne.ZodArray:return yD(e,r);case ne.ZodUnion:case ne.ZodDiscriminatedUnion:return OD(e,r);case ne.ZodIntersection:return TD(e,r);case ne.ZodTuple:return LD(e,r);case ne.ZodRecord:return Qv(e,r);case ne.ZodLiteral:return ED(e,r);case ne.ZodEnum:return SD(e);case ne.ZodNativeEnum:return kD(e);case ne.ZodNullable:return CD(e,r);case ne.ZodOptional:return MD(e,r);case ne.ZodMap:return PD(e,r);case ne.ZodSet:return UD(e,r);case ne.ZodLazy:return()=>e.getter()._def;case ne.ZodPromise:return DD(e,r);case ne.ZodNaN:case ne.ZodNever:return AD(r);case ne.ZodEffects:return wD(e,r);case ne.ZodAny:return Jt(r);case ne.ZodUnknown:return FD(r);case ne.ZodDefault:return _D(e,r);case ne.ZodBranded:return Jv(e,r);case ne.ZodReadonly:return qD(e,r);case ne.ZodCatch:return vD(e,r);case ne.ZodPipeline:return BD(e,r);case ne.ZodFunction:case ne.ZodVoid:case ne.ZodSymbol:return;default:return((o)=>{return})(t)}};function Be(e,t,r=!1){let o=t.seen.get(e);if(t.override){let s=t.override?.(e,t,o,r);if(s!==mD)return s}if(o&&!r){let s=sae(o,t);if(s!==void 0)return s}let n={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,n);let i=HD(e,e.typeName,t),a=typeof i==="function"?Be(i(),t):i;if(a)cae(e,t,a);if(t.postProcess){let s=t.postProcess(a,e,t);return n.jsonSchema=a,s}return n.jsonSchema=a,a}var sae=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Kv(t.currentPath,e.path)};case"none":case"seen":{if(e.path.length<t.currentPath.length&&e.path.every((r,o)=>t.currentPath[o]===r))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Jt(t);return t.$refStrategy==="seen"?Jt(t):void 0}}},cae=(e,t,r)=>{if(e.description){if(r.description=e.description,t.markdownDescription)r.markdownDescription=e.description}return r};var JA=(e,t)=>{let r=gD(t),o=typeof t==="object"&&t.definitions?Object.entries(t.definitions).reduce((c,[u,d])=>({...c,[u]:Be(d._def,{...r,currentPath:[...r.basePath,r.definitionPath,u]},!0)??Jt(r)}),{}):void 0,n=typeof t==="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=Be(e._def,n===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,n]},!1)??Jt(r),a=typeof t==="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;if(a!==void 0)i.title=a;if(r.flags.hasReferencedOpenAiAnyType){if(!o)o={};if(!o[r.openAiAnyTypeName])o[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:r.$refStrategy==="relative"?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}}let s=n===void 0?o?{...i,[r.definitionPath]:o}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,n].join("/"),[r.definitionPath]:{...o,[n]:i}};if(r.target==="jsonSchema7")s.$schema="http://json-schema.org/draft-07/schema#";else if(r.target==="jsonSchema2019-09"||r.target==="openAi")s.$schema="https://json-schema.org/draft/2019-09/schema#";if(r.target==="openAi"&&(("anyOf"in s)||("oneOf"in s)||("allOf"in s)||("type"in s)&&Array.isArray(s.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return s};function uae(e){if(!e)return"draft-7";if(e==="jsonSchema7"||e==="draft-7")return"draft-7";if(e==="jsonSchema2019-09"||e==="draft-2020-12")return"draft-2020-12";return"draft-7"}function YA(e,t){if(io(e))return Yc(e,{target:uae(t?.target),io:t?.pipeStrategy??"input"});return JA(e,{strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})}function QA(e){let r=Is(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=Qx(r);if(typeof o!=="string")throw Error("Schema method literal must be a string");return o}function XA(e,t){let r=Es(e,t);if(!r.success)throw r.error;return r.data}var lae=60000;class e6{constructor(e){if(this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ov,(t)=>{this._oncancel(t)}),this.setNotificationHandler(zv,(t)=>{this._onprogress(t)}),this.setRequestHandler(Cv,(t)=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore)this.setRequestHandler(Nv,async(t,r)=>{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new Ie(Oe.InvalidParams,"Failed to retrieve task: Task not found");return{...o}}),this.setRequestHandler(Bv,async(t,r)=>{let o=async()=>{let n=t.params.taskId;if(this._taskMessageQueue){let a;while(a=await this._taskMessageQueue.dequeue(n,r.sessionId)){if(a.type==="response"||a.type==="error"){let s=a.message,c=s.id,u=this._requestResolvers.get(c);if(u)if(this._requestResolvers.delete(c),a.type==="response")u(s);else{let d=s,p=new Ie(d.error.code,d.error.message,d.error.data);u(p)}else{let d=a.type==="response"?"Response":"Error";this._onerror(Error(`${d} handler missing for request ${c}`))}continue}await this._transport?.send(a.message,{relatedRequestId:r.requestId})}}let i=await this._taskStore.getTask(n,r.sessionId);if(!i)throw new Ie(Oe.InvalidParams,`Task not found: ${n}`);if(!As(i.status))return await this._waitForTaskUpdate(n,r.signal),await o();if(As(i.status)){let a=await this._taskStore.getTaskResult(n,r.sessionId);return this._clearTaskQueue(n),{...a,_meta:{...a._meta,[ks]:{taskId:n}}}}return await o()};return await o()}),this.setRequestHandler(Dv,async(t,r)=>{try{let{tasks:o,nextCursor:n}=await this._taskStore.listTasks(t.params?.cursor,r.sessionId);return{tasks:o,nextCursor:n,_meta:{}}}catch(o){throw new Ie(Oe.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(Lv,async(t,r)=>{try{let o=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!o)throw new Ie(Oe.InvalidParams,`Task not found: ${t.params.taskId}`);if(As(o.status))throw new Ie(Oe.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(t.params.taskId,"cancelled","Client cancelled task execution.",r.sessionId),this._clearTaskQueue(t.params.taskId);let n=await this._taskStore.getTask(t.params.taskId,r.sessionId);if(!n)throw new Ie(Oe.InvalidParams,`Task not found after cancellation: ${t.params.taskId}`);return{_meta:{},...n}}catch(o){if(o instanceof Ie)throw o;throw new Ie(Oe.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}})}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,r,o,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:n,onTimeout:o})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Ie.fromError(Oe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=(n)=>{r?.(n),this._onerror(n)};let o=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{if(o?.(n,i),Eh(n)||tD(n))this._onresponse(n);else if(OA(n))this._onrequest(n,i);else if(eD(n))this._onnotification(n);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(let r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();let t=Ie.fromError(Oe.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;if(t===void 0)return;Promise.resolve().then(()=>t(e)).catch((r)=>this._onerror(Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,n=e.params?._meta?.[ks]?.taskId;if(r===void 0){let u={jsonrpc:"2.0",id:e.id,error:{code:Oe.MethodNotFound,message:"Method not found"}};if(n&&this._taskMessageQueue)this._enqueueTaskMessage(n,{type:"error",message:u,timestamp:Date.now()},o?.sessionId).catch((d)=>this._onerror(Error(`Failed to enqueue error response: ${d}`)));else o?.send(u).catch((d)=>this._onerror(Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=YB(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,c={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async(u)=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};if(n)d.relatedTask={taskId:n};await this.notification(u,d)},sendRequest:async(u,d,p)=>{if(i.signal.aborted)throw new Ie(Oe.ConnectionClosed,"Request was cancelled");let m={...p,relatedRequestId:e.id};if(n&&!m.relatedTask)m.relatedTask={taskId:n};let h=m.relatedTask?.taskId??n;if(h&&s)await s.updateTaskStatus(h,"input_required");return await this.request(u,d,m)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:n,taskStore:s,taskRequestedTtl:a?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(a)this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,c)).then(async(u)=>{if(i.signal.aborted)return;let d={result:u,jsonrpc:"2.0",id:e.id};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"response",message:d,timestamp:Date.now()},o?.sessionId);else await o?.send(d)},async(u)=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(u.code)?u.code:Oe.InternalError,message:u.message??"Internal error",...u.data!==void 0&&{data:u.data}}};if(n&&this._taskMessageQueue)await this._enqueueTaskMessage(n,{type:"error",message:d,timestamp:Date.now()},o?.sessionId);else await o?.send(d)}).catch((u)=>this._onerror(Error(`Failed to send response: ${u}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(e.id)===i)this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,o=Number(t),n=this._progressHandlers.get(o);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o)}catch(s){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(s);return}n(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),Eh(e))r(e);else{let i=new Ie(e.error.code,e.error.message,e.error.data);r(i)}return}let o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let n=!1;if(Eh(e)&&e.result&&typeof e.result==="object"){let i=e.result;if(i.task&&typeof i.task==="object"){let a=i.task;if(typeof a.taskId==="string")n=!0,this._taskProgressTokens.set(a.taskId,t)}}if(!n)this._progressHandlers.delete(t);if(Eh(e))o(e);else{let i=Ie.fromError(e.error.code,e.error.message,e.error.data);o(i)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,r){let{task:o}=r??{};if(!o){try{yield{type:"result",result:await this.request(e,t,r)}}catch(i){yield{type:"error",error:i instanceof Ie?i:new Ie(Oe.InternalError,String(i))}}return}let n;try{let i=await this.request(e,Td,r);if(i.task)n=i.task.taskId,yield{type:"taskCreated",task:i.task};else throw new Ie(Oe.InternalError,"Task creation did not return a task");while(!0){let a=await this.getTask({taskId:n},r);if(yield{type:"taskStatus",task:a},As(a.status)){if(a.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};else if(a.status==="failed")yield{type:"error",error:new Ie(Oe.InternalError,`Task ${n} failed`)};else if(a.status==="cancelled")yield{type:"error",error:new Ie(Oe.InternalError,`Task ${n} was cancelled`)};return}if(a.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:n},t,r)};return}let s=a.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((c)=>setTimeout(c,s)),r?.signal?.throwIfAborted()}}catch(i){yield{type:"error",error:i instanceof Ie?i:new Ie(Oe.InternalError,String(i))}}}request(e,t,r){let{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i,task:a,relatedTask:s}=r??{};return new Promise((c,u)=>{let d=(v)=>{u(v)};if(!this._transport){d(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(e.method),a)this.assertTaskCapability(e.method)}catch(v){d(v);return}r?.signal?.throwIfAborted();let p=this._requestMessageId++,m={...e,jsonrpc:"2.0",id:p};if(r?.onprogress)this._progressHandlers.set(p,r.onprogress),m.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}};if(a)m.params={...m.params,task:a};if(s)m.params={...m.params,_meta:{...m.params?._meta||{},[ks]:s}};let h=(v)=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String(v)}},{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i}).catch((w)=>this._onerror(Error(`Failed to send cancellation: ${w}`)));let E=v instanceof Ie?v:new Ie(Oe.RequestTimeout,String(v));u(E)};this._responseHandlers.set(p,(v)=>{if(r?.signal?.aborted)return;if(v instanceof Error)return u(v);try{let E=Es(t,v.result);if(!E.success)u(E.error);else c(E.data)}catch(E){u(E)}}),r?.signal?.addEventListener("abort",()=>{h(r?.signal?.reason)});let y=r?.timeout??lae,x=()=>h(Ie.fromError(Oe.RequestTimeout,"Request timed out",{timeout:y}));this._setupTimeout(p,y,r?.maxTotalTimeout,x,r?.resetTimeoutOnProgress??!1);let S=s?.taskId;if(S){let v=(E)=>{let w=this._responseHandlers.get(p);if(w)w(E);else this._onerror(Error(`Response handler missing for side-channeled request ${p}`))};this._requestResolvers.set(p,v),this._enqueueTaskMessage(S,{type:"request",message:m,timestamp:Date.now()}).catch((E)=>{this._cleanupTimeout(p),u(E)})}else this._transport.send(m,{relatedRequestId:o,resumptionToken:n,onresumptiontoken:i}).catch((v)=>{this._cleanupTimeout(p),u(v)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},Mv,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},Uv,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},oD,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ks]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};if(t?.relatedTask)a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ks]:t.relatedTask}}};this._transport?.send(a,t).catch((s)=>this._onerror(s))});return}let i={...e,jsonrpc:"2.0"};if(t?.relatedTask)i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[ks]:t.relatedTask}}};await this._transport.send(i,t)}setRequestHandler(e,t){let r=QA(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(o,n)=>{let i=XA(e,o);return Promise.resolve(t(i,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=QA(e);this._notificationHandlers.set(r,(o)=>{let n=XA(e,o);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);if(t!==void 0)this._progressHandlers.delete(t),this._taskProgressTokens.delete(e)}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,o)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let r=await this._taskMessageQueue.dequeueAll(e,t);for(let o of r)if(o.type==="request"&&OA(o.message)){let n=o.message.id,i=this._requestResolvers.get(n);if(i)i(new Ie(Oe.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(n);else this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1000;try{let o=await this._taskStore?.getTask(e);if(o?.pollInterval)r=o.pollInterval}catch{}return new Promise((o,n)=>{if(t.aborted){n(new Ie(Oe.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,r);t.addEventListener("abort",()=>{clearTimeout(i),n(new Ie(Oe.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async(o)=>{if(!e)throw Error("No request provided");return await r.createTask(o,e.id,{method:e.method,params:e.params},t)},getTask:async(o)=>{let n=await r.getTask(o,t);if(!n)throw new Ie(Oe.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(o,n,i)=>{await r.storeTaskResult(o,n,i,t);let a=await r.getTask(o,t);if(a){let s=Rh.parse({method:"notifications/tasks/status",params:a});if(await this.notification(s),As(a.status))this._cleanupTaskProgressHandler(o)}},getTaskResult:(o)=>r.getTaskResult(o,t),updateTaskStatus:async(o,n,i)=>{let a=await r.getTask(o,t);if(!a)throw new Ie(Oe.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(As(a.status))throw new Ie(Oe.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(o,n,i,t);let s=await r.getTask(o,t);if(s){let c=Rh.parse({method:"notifications/tasks/status",params:s});if(await this.notification(c),As(s.status))this._cleanupTaskProgressHandler(o)}},listTasks:(o)=>r.listTasks(o,t)}}}function GD(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function VD(e,t){let r={...e};for(let o in t){let n=o,i=t[n];if(i===void 0)continue;let a=r[n];if(GD(a)&&GD(i))r[n]={...a,...i};else r[n]=i}return r}var k3=on(K6(),1),A3=on(P3(),1);function Ome(){let e=new k3.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return A3.default(e),e}class iR{constructor(e){this._ajv=e??Ome()}getValidator(e){let t="$id"in e&&typeof e.$id==="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return(r)=>{if(t(r))return{valid:!0,data:r,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}}class aR{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){let r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],n=Array.isArray(o.content)?o.content:[o.content],i=n.some((u)=>u.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=a?Array.isArray(a.content)?a.content:[a.content]:[],c=s.some((u)=>u.type==="tool_use");if(i){if(n.some((u)=>u.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!c)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(s.filter((p)=>p.type==="tool_use").map((p)=>p.id)),d=new Set(n.filter((p)=>p.type==="tool_result").map((p)=>p.toolUseId));if(u.size!==d.size||![...u].every((p)=>d.has(p)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Ch,t)}elicitInputStream(e,t){let r=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case"url":{if(!r?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!r?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let n=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:n},Pd,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}function R3(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"tools/call":if(!e.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${t})`);break;default:break}}function $3(e,t,r){if(!e)throw Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${t})`);break;default:break}}class sR extends e6{constructor(e,t){super(t);if(this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Oh.options.map((r,o)=>[r,o])),this.isMessageIgnored=(r,o)=>{let n=this._loggingLevels.get(o);return n?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new iR,this.setRequestHandler(NA,(r)=>this._oninitialize(r)),this.setNotificationHandler(MA,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(qA,async(r,o)=>{let n=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=r.params,a=Oh.safeParse(i);if(a.success)this._loggingLevels.set(n,a.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new aR(this)};return this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=VD(this._capabilities,e)}setRequestHandler(e,t){let o=Is(e)?.method;if(!o)throw Error("Schema is missing a method literal");let n;if(io(o)){let a=o;n=a._zod?.def?.value??a.value}else{let a=o;n=a._def?.value??a.value}if(typeof n!=="string")throw Error("Schema method literal must be a string");if(n==="tools/call"){let a=async(s,c)=>{let u=Es(Id,s);if(!u.success){let h=u.error instanceof Error?u.error.message:String(u.error);throw new Ie(Oe.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=u.data,p=await Promise.resolve(t(s,c));if(d.task){let h=Es(Td,p);if(!h.success){let y=h.error instanceof Error?h.error.message:String(h.error);throw new Ie(Oe.InvalidParams,`Invalid task creation result: ${y}`)}return h.data}let m=Es(Zv,p);if(!m.success){let h=m.error instanceof Error?m.error.message:String(m.error);throw new Ie(Oe.InvalidParams,`Invalid tools/call result: ${h}`)}return m.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){if(!this._capabilities)return;switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case"ping":case"initialize":break}}assertTaskCapability(e){$3(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){if(!this._capabilities)return;R3(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:WB.includes(t)?t:RA,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},$v)}async createMessage(e,t){if(e.tools||e.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(e.messages.length>0){let r=e.messages[e.messages.length-1],o=Array.isArray(r.content)?r.content:[r.content],n=o.some((c)=>c.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],s=a.some((c)=>c.type==="tool_use");if(n){if(o.some((c)=>c.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!s)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(s){let c=new Set(a.filter((d)=>d.type==="tool_use").map((d)=>d.id)),u=new Set(o.filter((d)=>d.type==="tool_result").map((d)=>d.toolUseId));if(c.size!==u.size||![...c].every((d)=>u.has(d)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(e.tools)return this.request({method:"sampling/createMessage",params:e},HA,t);return this.request({method:"sampling/createMessage",params:e},Ch,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},Pd,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},n=await this.request({method:"elicitation/create",params:o},Pd,t);if(n.action==="accept"&&n.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(n.content);if(!a.valid)throw new Ie(Oe.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){if(i instanceof Ie)throw i;throw new Ie(Oe.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return n}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},GA,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging){if(!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var C3=Symbol.for("mcp.completable");function cR(e){return!!e&&typeof e==="object"&&C3 in e}function z3(e){return e[C3]?.complete}var O3;(function(e){e.Completable="McpCompletable"})(O3||(O3={}));var Cme=/^[A-Za-z0-9._-]{1,128}$/;function zme(e){let t=[];if(e.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" "))t.push("Tool name contains spaces, which may cause parsing issues");if(e.includes(","))t.push("Tool name contains commas, which may cause parsing issues");if(e.startsWith("-")||e.endsWith("-"))t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(e.startsWith(".")||e.endsWith("."))t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!Cme.test(e)){let r=e.split("").filter((o)=>!/[A-Za-z0-9._-]/.test(o)).filter((o,n,i)=>i.indexOf(o)===n);return t.push(`Tool name contains invalid characters: ${r.map((o)=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}function Nme(e,t){if(t.length>0){console.warn(`Tool name validation warning for "${e}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function uR(e){let t=zme(e);return Nme(e,t.warnings),t.isValid}class lR{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let o={taskSupport:"required",...t.execution};if(o.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,o,t._meta,r)}}class pR{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new sR(e,t)}get experimental(){if(!this._experimental)this._experimental={tasks:new lR(this)};return this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(Bs(Vv)),this.server.assertCanSetRequestHandler(Bs(Id)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Vv,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r={name:e,title:t.title,description:t.description,inputSchema:(()=>{let o=fd(t.inputSchema);return o?YA(o,{strictUnions:!0,pipeStrategy:"input"}):Mme})(),annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let o=fd(t.outputSchema);if(o)r.outputSchema=YA(o,{strictUnions:!0,pipeStrategy:"output"})}return r})})),this.server.setRequestHandler(Id,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new Ie(Oe.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new Ie(Oe.InvalidParams,`Tool ${e.params.name} disabled`);let o=!!e.params.task,n=r.execution?.taskSupport,i="createTask"in r.handler;if((n==="required"||n==="optional")&&!i)throw new Ie(Oe.InternalError,`Tool ${e.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!o)throw new Ie(Oe.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!o&&i)return await this.handleAutomaticTaskPolling(r,e,t);let a=await this.validateToolInput(r,e.params.arguments,e.params.name),s=await this.executeToolHandler(r,a,t);if(o)return s;return await this.validateToolOutput(r,s,e.params.name),s}catch(r){if(r instanceof Ie){if(r.code===Oe.UrlElicitationRequired)throw r}return this.createToolError(r instanceof Error?r.message:String(r))}}),this._toolHandlersInitialized=!0}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let n=fd(e.inputSchema)??e.inputSchema,i=await Jx(n,t);if(!i.success){let a="error"in i?i.error:"Unknown error",s=Yx(a);throw new Ie(Oe.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${s}`)}return i.data}async validateToolOutput(e,t,r){if(!e.outputSchema)return;if(!("content"in t))return;if(t.isError)return;if(!t.structuredContent)throw new Ie(Oe.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let o=fd(e.outputSchema),n=await Jx(o,t.structuredContent);if(!n.success){let i="error"in n?n.error:"Unknown error",a=Yx(i);throw new Ie(Oe.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${a}`)}}async executeToolHandler(e,t,r){let o=e.handler;if("createTask"in o){if(!r.taskStore)throw Error("No task store provided.");let i={...r,taskStore:r.taskStore};if(e.inputSchema)return await Promise.resolve(o.createTask(t,i));else return await Promise.resolve(o.createTask(i))}if(e.inputSchema)return await Promise.resolve(o(t,r));else return await Promise.resolve(o(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let o=await this.validateToolInput(e,t.params.arguments,t.params.name),n=e.handler,i={...r,taskStore:r.taskStore},a=o?await Promise.resolve(n.createTask(o,i)):await Promise.resolve(n.createTask(i)),s=a.task.taskId,c=a.task,u=c.pollInterval??5000;while(c.status!=="completed"&&c.status!=="failed"&&c.status!=="cancelled"){await new Promise((p)=>setTimeout(p,u));let d=await r.taskStore.getTask(s);if(!d)throw new Ie(Oe.InternalError,`Task ${s} not found during polling`);c=d}return await r.taskStore.getTaskResult(s)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(Bs(Wv)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(Wv,async(e)=>{switch(e.params.ref.type){case"ref/prompt":return lD(e),this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return dD(e),this.handleResourceCompletion(e,e.params.ref);default:throw new Ie(Oe.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(e,t){let r=this._registeredPrompts[t.name];if(!r)throw new Ie(Oe.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new Ie(Oe.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return og;let n=Is(r.argsSchema)?.[e.params.argument.name];if(!cR(n))return og;let i=z3(n);if(!i)return og;let a=await i(e.params.argument.value,e.params.context);return M3(a)}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find((i)=>i.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return og;throw new Ie(Oe.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let o=r.resourceTemplate.completeCallback(e.params.argument.name);if(!o)return og;let n=await o(e.params.argument.value,e.params.context);return M3(n)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(Bs(jv)),this.server.assertCanSetRequestHandler(Bs(Fv)),this.server.assertCanSetRequestHandler(Bs(qv)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(jv,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([n,i])=>i.enabled).map(([n,i])=>({uri:n,name:i.name,...i.metadata})),o=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let i=await n.resourceTemplate.listCallback(t);for(let a of i.resources)o.push({...n.metadata,...a})}return{resources:[...r,...o]}}),this.server.setRequestHandler(Fv,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([t,r])=>({name:t,uriTemplate:r.resourceTemplate.uriTemplate.toString(),...r.metadata}))})),this.server.setRequestHandler(qv,async(e,t)=>{let r=new URL(e.params.uri),o=this._registeredResources[r.toString()];if(o){if(!o.enabled)throw new Ie(Oe.InvalidParams,`Resource ${r} disabled`);return o.readCallback(r,t)}for(let n of Object.values(this._registeredResourceTemplates)){let i=n.resourceTemplate.uriTemplate.match(r.toString());if(i)return n.readCallback(r,i,t)}throw new Ie(Oe.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(Bs(Hv)),this.server.assertCanSetRequestHandler(Bs(Gv)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(Hv,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>({name:e,title:t.title,description:t.description,arguments:t.argsSchema?Bme(t.argsSchema):void 0}))})),this.server.setRequestHandler(Gv,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new Ie(Oe.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new Ie(Oe.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let o=fd(r.argsSchema),n=await Jx(o,e.params.arguments);if(!n.success){let s="error"in n?n.error:"Unknown error",c=Yx(s);throw new Ie(Oe.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${c}`)}let i=n.data,a=r.callback;return await Promise.resolve(a(i,t))}else{let o=r.callback;return await Promise.resolve(o(t))}}),this._promptHandlersInitialized=!0}resource(e,t,...r){let o;if(typeof r[0]==="object")o=r.shift();let n=r[0];if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let i=this._createRegisteredResource(e,void 0,t,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let i=this._createRegisteredResourceTemplate(e,void 0,t,o,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),i}}registerResource(e,t,r,o){if(typeof t==="string"){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let n=this._createRegisteredResource(e,r.title,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let n=this._createRegisteredResourceTemplate(e,r.title,t,r,o);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(e,t,r,o,n){let i={name:e,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:(a)=>{if(typeof a.uri<"u"&&a.uri!==r){if(delete this._registeredResources[r],a.uri)this._registeredResources[a.uri]=i}if(typeof a.name<"u")i.name=a.name;if(typeof a.title<"u")i.title=a.title;if(typeof a.metadata<"u")i.metadata=a.metadata;if(typeof a.callback<"u")i.readCallback=a.callback;if(typeof a.enabled<"u")i.enabled=a.enabled;this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,o,n){let i={resourceTemplate:r,title:t,metadata:o,readCallback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:(c)=>{if(typeof c.name<"u"&&c.name!==e){if(delete this._registeredResourceTemplates[e],c.name)this._registeredResourceTemplates[c.name]=i}if(typeof c.title<"u")i.title=c.title;if(typeof c.template<"u")i.resourceTemplate=c.template;if(typeof c.metadata<"u")i.metadata=c.metadata;if(typeof c.callback<"u")i.readCallback=c.callback;if(typeof c.enabled<"u")i.enabled=c.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let a=r.uriTemplate.variableNames;if(Array.isArray(a)&&a.some((c)=>!!r.completeCallback(c)))this.setCompletionRequestHandler();return i}_createRegisteredPrompt(e,t,r,o,n){let i={title:t,description:r,argsSchema:o===void 0?void 0:Qc(o),callback:n,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:(a)=>{if(typeof a.name<"u"&&a.name!==e){if(delete this._registeredPrompts[e],a.name)this._registeredPrompts[a.name]=i}if(typeof a.title<"u")i.title=a.title;if(typeof a.description<"u")i.description=a.description;if(typeof a.argsSchema<"u")i.argsSchema=Qc(a.argsSchema);if(typeof a.callback<"u")i.callback=a.callback;if(typeof a.enabled<"u")i.enabled=a.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[e]=i,o){if(Object.values(o).some((s)=>{let c=s instanceof wd?s._def?.innerType:s;return cR(c)}))this.setCompletionRequestHandler()}return i}_createRegisteredTool(e,t,r,o,n,i,a,s,c){uR(e);let u={title:t,description:r,inputSchema:N3(o),outputSchema:N3(n),annotations:i,execution:a,_meta:s,handler:c,enabled:!0,disable:()=>u.update({enabled:!1}),enable:()=>u.update({enabled:!0}),remove:()=>u.update({name:null}),update:(d)=>{if(typeof d.name<"u"&&d.name!==e){if(typeof d.name==="string")uR(d.name);if(delete this._registeredTools[e],d.name)this._registeredTools[d.name]=u}if(typeof d.title<"u")u.title=d.title;if(typeof d.description<"u")u.description=d.description;if(typeof d.paramsSchema<"u")u.inputSchema=Qc(d.paramsSchema);if(typeof d.outputSchema<"u")u.outputSchema=Qc(d.outputSchema);if(typeof d.callback<"u")u.handler=d.callback;if(typeof d.annotations<"u")u.annotations=d.annotations;if(typeof d._meta<"u")u._meta=d._meta;if(typeof d.enabled<"u")u.enabled=d.enabled;this.sendToolListChanged()}};return this._registeredTools[e]=u,this.setToolRequestHandlers(),this.sendToolListChanged(),u}tool(e,...t){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r,o,n,i;if(typeof t[0]==="string")r=t.shift();if(t.length>1){let s=t[0];if(dR(s)){if(o=t.shift(),t.length>1&&typeof t[0]==="object"&&t[0]!==null&&!dR(t[0]))i=t.shift()}else if(typeof s==="object"&&s!==null){if(Object.values(s).some((c)=>typeof c==="object"&&c!==null))throw Error(`Tool ${e} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);i=t.shift()}}let a=t[0];return this._createRegisteredTool(e,void 0,r,o,n,i,{taskSupport:"forbidden"},void 0,a)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:o,description:n,inputSchema:i,outputSchema:a,annotations:s,_meta:c}=t;return this._createRegisteredTool(e,o,n,i,a,s,{taskSupport:"forbidden"},c,r)}prompt(e,...t){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let r;if(typeof t[0]==="string")r=t.shift();let o;if(t.length>1)o=t.shift();let n=t[0],i=this._createRegisteredPrompt(e,void 0,r,o,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:o,description:n,argsSchema:i}=t,a=this._createRegisteredPrompt(e,o,n,i,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),a}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var Mme={type:"object",properties:{}};function B3(e){return e!==null&&typeof e==="object"&&"parse"in e&&typeof e.parse==="function"&&"safeParse"in e&&typeof e.safeParse==="function"}function D3(e){return"_def"in e||"_zod"in e||B3(e)}function dR(e){if(typeof e!=="object"||e===null)return!1;if(D3(e))return!1;if(Object.keys(e).length===0)return!0;return Object.values(e).some(B3)}function N3(e){if(!e)return;if(dR(e))return Qc(e);if(!D3(e))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return e}function Bme(e){let t=Is(e);if(!t)return[];return Object.entries(t).map(([r,o])=>{let n=C4(o),i=z4(o);return{name:r,description:n,required:!i}})}function Bs(e){let r=Is(e)?.method;if(!r)throw Error("Schema is missing a method literal");let o=Qx(r);if(typeof o==="string")return o;throw Error("Schema method literal must be a string")}function M3(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}var og={completion:{values:[],hasMore:!1}};import L3 from"node:process";class fR{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
135
135
|
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Dme(t)}clear(){this._buffer=void 0}}function Dme(e){return rD.parse(JSON.parse(e))}function U3(e){return JSON.stringify(e)+`
|
|
136
|
-
`}class mR{constructor(e=L3.stdin,t=L3.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new fR,this._started=!1,this._ondata=(r)=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=(r)=>{this.onerror?.(r)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise((t)=>{let r=U3(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var N_={name:"@0xmonaco/mcp-server",version:"1.0.42",type:"module",repository:{type:"git",url:"https://github.com/Monaco-Research/monaco-sdk.git",directory:"packages/mcp-server"},description:"MCP server for the Monaco SDK",engines:{node:">=18"},bin:"./dist/bin.js",files:["dist"],scripts:{build:"bun build src/bin.ts --outdir dist --target node --format esm --minify",dev:"bun --watch src/bin.ts",start:"bun dist/bin.js",clean:"rm -rf dist",lint:"biome lint .",test:"bun test"},author:"@codebycarson",dependencies:{"@0xmonaco/core":"1.0.42","@0xmonaco/types":"1.0.42","@modelcontextprotocol/sdk":"^1.29.0","node-fetch":"^3.3.2",viem:"^2.53.1",ws:"^8.21.0",zod:"^4.4.3"},devDependencies:{"@types/bun":"latest","@types/ws":"^8.18.1"}};var M_=["read","market-maker","full"],Ei=[{name:"search_docs",description:"Search the Monaco documentation for protocol, SDK, trading, and development guides.",category:"search",authMode:"public",sideEffect:"read-only"},{name:"get_trading_pairs",description:"List trading pairs with optional filters (market type, base/quote token, active status).",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_trading_pair_by_symbol",description:"Look up a trading pair by symbol (e.g. `BTC/USDC`).",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_candlesticks",description:"Fetch OHLCV candlestick data for a trading pair.",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_market_metadata",description:"Get tick size, minimum order size, and trading rules for a pair.",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_screener",description:"Screen trading pairs with market stats (price, volume, change), filtered by market type, category, and active status.",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_market_stats",description:"Get exchange-wide life-to-date cumulative volume and trade count across all markets.",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_perp_market_config",description:"Get a perpetual market's configuration (leverage limits, margin requirements, funding parameters).",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_perp_market_summary",description:"Get a perpetual market's live summary (mark/index price, funding rate, open interest, 24h stats).",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_mark_price",description:"Get the current mark price for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_index_price",description:"Get the current index (oracle) price for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_funding_state",description:"Get the current funding rate and next funding time for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_open_interest",description:"Get the current open interest for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_funding_history",description:"List historical funding-rate records for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_all_funding_history",description:"List historical funding-rate records across all perpetual markets.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_orderbook",description:"Fetch a current orderbook snapshot with bids and asks.",category:"orderbook",authMode:"public",sideEffect:"read-only"},{name:"get_trades",description:"Fetch historical trades for a trading pair.",category:"trades",authMode:"public",sideEffect:"read-only"},{name:"place_limit_order",description:"Place a limit order with price, quantity, and time-in-force. Not idempotent — after an ambiguous failure (timeout/network error/5xx with no order), reconcile with get_orders/get_order before retrying; never blind-retry.",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"place_market_order",description:"Place a market order — executes immediately inside a mandatory 1,000 bps protective price band, so it may partially fill or be rejected. Not idempotent — after an ambiguous failure (timeout/network error/5xx with no order), reconcile with get_orders/get_order before retrying; never blind-retry.",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"replace_order",description:"Modify an existing order's price and/or quantity. Not idempotent — after an ambiguous failure (timeout/network error/5xx with no order), reconcile with get_order before retrying; never blind-retry.",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"cancel_order",description:"Cancel a single order by ID.",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"batch_cancel_orders",description:"Cancel multiple orders by ID (non-atomic — a failed leg does not stop the others).",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"batch_cancel_all_orders",description:"Cancel all open orders, optionally filtered to a trading pair (unfiltered, it cancels your entire open-order book).",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"batch_close_all_positions",description:"Close all open perpetual positions with market reduce-only orders (best-effort, optional pair filter).",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"get_orders",description:"List your orders with optional filters.",category:"trading",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_order",description:"Get details for a specific order by ID.",category:"trading",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_positions",description:"List your perpetual positions with optional filters (margin account, trading pair, status).",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_position",description:"Get details for a specific perpetual position by ID.",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_position_risk",description:"Get liquidation price, margin ratio, and risk metrics for a perpetual position.",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_position_history",description:"List historical (closed/reduced) perpetual position records with optional filters.",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_position_pnl_history",description:"Get the PnL history time series for a perpetual position over an interval.",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"close_position",description:"Close a perpetual position with a market, limit, or IOC reduce order.",category:"positions",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"get_profile",description:"Fetch your core profile (address, username, account type, withdrawal status).",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_balances",description:"List token balances with pagination.",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_balance_by_asset",description:"Get balance for a specific asset.",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_movements",description:"Fetch transaction and movement history with optional filters.",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_user_trades",description:"List your own trade fills with optional filters and cursor pagination.",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_funding_payments",description:"List your perpetual funding payments with optional filters (trading pair, position, margin account).",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_summary",description:"Get your authoritative portfolio summary (equity, PnL, exposure) over a period.",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_performance",description:"Get your portfolio performance time series over a period.",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_realized_pnl",description:"Get your realized PnL breakdown over a period.",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_assets",description:"Get your per-asset portfolio allocation and balances over a period.",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_margin",description:"Get your portfolio margin overview (collateral, maintenance margin, health).",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_margin_accounts",description:"List your margin accounts with optional filters (state, trading pair).",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_parent_margin_account_summary",description:"Get your parent (cross) margin account summary.",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_available_collateral",description:"Get available (unlocked) collateral for allocating to margin accounts or risk buckets.",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_parent_margin_account_movements",description:"List collateral movements for your parent (cross) margin account.",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"simulate_parent_margin_order_risk",description:"Preview the risk impact of a prospective order against your parent (cross) margin account (read-only simulation).",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"simulate_risk_bucket_order_risk",description:"Preview the risk impact of a prospective order for a new or existing risk bucket (read-only simulation).",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"transfer_collateral_to_parent_margin_account",description:"Move collateral from spot into your parent (cross) margin account.",category:"margin",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"transfer_collateral_from_parent_margin_account",description:"Move collateral out of your parent (cross) margin account back to spot.",category:"margin",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"transfer_collateral_to_risk_bucket",description:"Allocate collateral into an isolated or cross risk bucket.",category:"margin",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"simulate_fees",description:"Simulate fees for an order before placing it.",category:"fees",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_my_fee_tier",description:"Get your current fee tier, rolling 14-day volumes, and a pair's fee schedule.",category:"fees",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"vault_approve",description:"Approve the vault contract to spend a token.",category:"vault",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"vault_deposit",description:"Deposit tokens into the vault (optional `target`: `spot` default, or `margin` to route into collateral).",category:"vault",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"vault_withdraw",description:"Withdraw tokens from the vault.",category:"vault",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"vault_get_allowance",description:"Check current token allowance for the vault.",category:"vault",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"vault_needs_approval",description:"Check whether an approval transaction is needed before depositing.",category:"vault",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_pending_withdrawals",description:"List your pending withdrawals still awaiting on-chain root confirmation.",category:"vault",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"request_faucet",description:"Request test tokens for all trading pairs.",category:"faucet",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating",excludedOnMainnet:!0},{name:"get_faucet_info",description:"Check remaining faucet quota, next-request time, and recent mint history.",category:"faucet",authMode:"authenticated",capability:"read",sideEffect:"read-only",excludedOnMainnet:!0},{name:"get_trader_code_info",description:"Look up a trader code's details (no credentials required).",category:"pitpass",authMode:"public",sideEffect:"read-only"},{name:"check_trader_code_availability",description:"Public advisory check of whether a custom PitPass TraderCode handle is available (no credentials required).",category:"pitpass",authMode:"public",sideEffect:"read-only"},{name:"get_my_trader_code",description:"Fetch your own trader code.",category:"pitpass",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"set_trader_code",description:"Claim or edit your custom (vanity) PitPass TraderCode handle.",category:"pitpass",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"clear_trader_code",description:"Clear your custom PitPass TraderCode handle, reverting to the wallet-derived default.",category:"pitpass",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"get_rewards_balance",description:"Fetch your PitPass rewards-bucket balances across reward tokens.",category:"pitpass",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"transfer_rewards",description:"Move your earned PitPass rewards from the rewards bucket into your own tradeable balance (ledger-only).",category:"pitpass",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"get_pulse",description:"Get the latest market-pulse news feed: AI-synthesized, per-asset headlines with sentiment tags.",category:"pulse",authMode:"public",sideEffect:"read-only"}],pRe=Ei.map((e)=>e.name),j3=Ei.filter((e)=>e.authMode==="public").map((e)=>e.name),fRe=Ei.filter((e)=>e.authMode==="authenticated"&&e.capability==="read").map((e)=>e.name),mRe=Ei.filter((e)=>e.authMode==="authenticated"&&e.capability==="market-maker").map((e)=>e.name),hRe=Ei.filter((e)=>e.authMode==="authenticated"&&e.capability==="full").map((e)=>e.name),gRe=Ei.filter((e)=>e.excludedOnMainnet).map((e)=>e.name),F3=Ei.filter((e)=>e.sideEffect==="fund-movement").map((e)=>e.name),Lme=new Map(Ei.map((e)=>[e.name,e.sideEffect]));function q3(e){let t=Lme.get(e);if(!t)return;let r=t==="read-only";return{readOnlyHint:r,destructiveHint:!r}}var H3={read:0,"market-maker":1,full:2},hR=j3,gR=Object.fromEntries(Ei.filter((e)=>e.authMode==="authenticated").map((e)=>[e.name,{capability:e.capability??"full",...e.sideEffect==="fund-movement"?{fundMovement:!0}:{},...e.excludedOnMainnet?{excludedOnMainnet:!0}:{}}])),G3=Object.fromEntries(Object.entries(gR).map(([e,t])=>[e,t.capability])),xRe=new Set(F3);function V3(e){let t=gR[e];if(!t)return"full";if(t.fundMovement)return"full";return t.capability}function Z3(e){return V3(e)==="read"}function W3(e,t){if(t.network==="mainnet"&&gR[e]?.excludedOnMainnet)return!1;if(t.deny.includes(e))return!1;if(hR.includes(e))return!0;if(!t.authenticated)return!1;if(t.allow.includes(e))return!0;return H3[t.capability]>=H3[V3(e)]}var jme=new Set([...hR,...Object.keys(G3)]),Fme={mainnet:"https://evm-rpc.sei-apis.com",development:"https://evm-rpc-testnet.sei-apis.com",staging:"https://evm-rpc-testnet.sei-apis.com",local:"http://localhost:8545"};function K3(e){if(!e)return[];return e.split(",").map((t)=>t.trim()).filter(Boolean)}function su(e=process.env){let t=e.MONACO_PRIVATE_KEY||null;if(t&&!t.startsWith("0x"))throw Error("MONACO_PRIVATE_KEY must start with '0x'.");let r=e.MONACO_CLIENT_ID||null;if(t&&!r)throw Error("MONACO_CLIENT_ID is required when MONACO_PRIVATE_KEY is set.");let o=["mainnet","development","staging","local"],n=e.MONACO_NETWORK;if(t&&!n)throw Error(`MONACO_NETWORK must be set explicitly (one of: ${o.join(", ")}) when MONACO_PRIVATE_KEY is configured. Refusing to default to mainnet for an authenticated session.`);let i=n||"mainnet";if(!o.includes(i))throw Error(`MONACO_NETWORK must be one of: ${o.join(", ")}.`);let a=i,s=e.MONACO_CAPABILITY;if(s&&!M_.includes(s))throw Error(`MONACO_CAPABILITY must be one of: ${M_.join(", ")}.`);let c=s||"read",u=K3(e.MONACO_TOOL_ALLOWLIST),d=K3(e.MONACO_TOOL_DENYLIST),p=[...u,...d].filter((y)=>!jme.has(y)).length;if(p>0)throw Error(`${p} unknown tool name(s) in MONACO_TOOL_ALLOWLIST/MONACO_TOOL_DENYLIST. Check them against the documented tool list.`);let m=e.MONACO_RPC_URL||Fme[a],h=null;if(e.MONACO_DELEGATED_OWNER_USER_ID!==void 0){let y=e.MONACO_DELEGATED_OWNER_USER_ID.trim();if(!y)throw Error("MONACO_DELEGATED_OWNER_USER_ID must be a non-empty owner user id when set.");if(!t||!r)throw Error("MONACO_DELEGATED_OWNER_USER_ID requires MONACO_PRIVATE_KEY and MONACO_CLIENT_ID (the agent authenticates as itself before adopting the owner).");h=y}return{privateKey:t,clientId:r,network:a,seiRpcUrl:m,capability:c,allow:u,deny:d,delegatedOwnerUserId:h}}function qme(e){return e.replace(/_([a-z])/g,(t,r)=>r.toUpperCase())}function lo(e){if(e===null||e===void 0)return e;if(typeof e!=="object")return e;if(Array.isArray(e))return e.map((r)=>lo(r));let t={};for(let[r,o]of Object.entries(e))t[qme(r)]=typeof o==="object"&&o!==null?lo(o):o;return t}fo();ug();fo();zR();vu();bu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var Ai=BigInt(0),gn=BigInt(1),MF=BigInt(2),dhe=BigInt(8),phe={zip215:!0};function fhe(e){let t=pg(e);return Go(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function BF(e){let t=fhe(e),{Fp:r,n:o,prehash:n,hash:i,randomBytes:a,nByteLength:s,h:c}=t,u=MF<<BigInt(s*8)-gn,d=r.create,p=Sa(t.n,t.nBitLength);function m(C,B){let Z=r.sqr(C),we=r.sqr(B),Pe=r.add(r.mul(t.a,Z),we),je=r.add(r.ONE,r.mul(t.d,r.mul(Z,we)));return r.eql(Pe,je)}if(!m(t.Gx,t.Gy))throw Error("bad curve params: generator point");let h=t.uvRatio||((C,B)=>{try{return{isValid:!0,value:r.sqrt(C*r.inv(B))}}catch(Z){return{isValid:!1,value:Ai}}}),y=t.adjustScalarBytes||((C)=>C),x=t.domain||((C,B,Z)=>{if(Pi("phflag",Z),B.length||Z)throw Error("Contexts/pre-hash are not supported");return C});function S(C,B,Z=!1){let we=Z?gn:Ai;mn("coordinate "+C,B,we,u)}function v(C){if(!(C instanceof _))throw Error("ExtendedPoint expected")}let E=Gd((C,B)=>{let{ex:Z,ey:we,ez:Pe}=C,je=C.is0();if(B==null)B=je?dhe:r.inv(Pe);let De=d(Z*B),Ce=d(we*B),V=d(Pe*B);if(je)return{x:Ai,y:gn};if(V!==gn)throw Error("invZ was invalid");return{x:De,y:Ce}}),w=Gd((C)=>{let{a:B,d:Z}=t;if(C.is0())throw Error("bad point: ZERO");let{ex:we,ey:Pe,ez:je,et:De}=C,Ce=d(we*we),V=d(Pe*Pe),se=d(je*je),le=d(se*se),be=d(Ce*B),ie=d(se*d(be+V)),Fe=d(le+d(Z*d(Ce*V)));if(ie!==Fe)throw Error("bad point: equation left != right (1)");let Kt=d(we*Pe),Ve=d(je*De);if(Kt!==Ve)throw Error("bad point: equation left != right (2)");return!0});class _{constructor(C,B,Z,we){S("x",C),S("y",B),S("z",Z,!0),S("t",we),this.ex=C,this.ey=B,this.ez=Z,this.et=we,Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(C){if(C instanceof _)throw Error("extended point not allowed");let{x:B,y:Z}=C||{};return S("x",B),S("y",Z),new _(B,Z,gn,d(B*Z))}static normalizeZ(C){let B=wa(r,C.map((Z)=>Z.ez));return C.map((Z,we)=>Z.toAffine(B[we])).map(_.fromAffine)}static msm(C,B){return V_(_,p,C,B)}_setWindowSize(C){O.setWindowSize(this,C)}assertValidity(){w(this)}equals(C){v(C);let{ex:B,ey:Z,ez:we}=this,{ex:Pe,ey:je,ez:De}=C,Ce=d(B*De),V=d(Pe*we),se=d(Z*De),le=d(je*we);return Ce===V&&se===le}is0(){return this.equals(_.ZERO)}negate(){return new _(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){let{a:C}=t,{ex:B,ey:Z,ez:we}=this,Pe=d(B*B),je=d(Z*Z),De=d(MF*d(we*we)),Ce=d(C*Pe),V=B+Z,se=d(d(V*V)-Pe-je),le=Ce+je,be=le-De,ie=Ce-je,Fe=d(se*be),Kt=d(le*ie),Ve=d(se*ie),at=d(be*le);return new _(Fe,Kt,at,Ve)}add(C){v(C);let{a:B,d:Z}=t,{ex:we,ey:Pe,ez:je,et:De}=this,{ex:Ce,ey:V,ez:se,et:le}=C,be=d(we*Ce),ie=d(Pe*V),Fe=d(De*Z*le),Kt=d(je*se),Ve=d((we+Pe)*(Ce+V)-be-ie),at=Kt-Fe,pr=Kt+Fe,_r=d(ie-B*be),Bf=d(Ve*at),ul=d(pr*_r),Ly=d(Ve*_r),Po=d(at*pr);return new _(Bf,ul,Po,Ly)}subtract(C){return this.add(C.negate())}wNAF(C){return O.wNAFCached(this,C,_.normalizeZ)}multiply(C){let B=C;mn("scalar",B,gn,o);let{p:Z,f:we}=this.wNAF(B);return _.normalizeZ([Z,we])[0]}multiplyUnsafe(C,B=_.ZERO){let Z=C;if(mn("scalar",Z,Ai,o),Z===Ai)return k;if(this.is0()||Z===gn)return this;return O.wNAFCachedUnsafe(this,Z,_.normalizeZ,B)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return O.unsafeLadder(this,o).is0()}toAffine(C){return E(this,C)}clearCofactor(){let{h:C}=t;if(C===gn)return this;return this.multiplyUnsafe(C)}static fromHex(C,B=!1){let{d:Z,a:we}=t,Pe=r.BYTES;C=It("pointHex",C,Pe),Pi("zip215",B);let je=C.slice(),De=C[Pe-1];je[Pe-1]=De&-129;let Ce=hu(je),V=B?u:r.ORDER;mn("pointHex.y",Ce,Ai,V);let se=d(Ce*Ce),le=d(se-gn),be=d(Z*se-we),{isValid:ie,value:Fe}=h(le,be);if(!ie)throw Error("Point.fromHex: invalid y coordinate");let Kt=(Fe&gn)===gn,Ve=(De&128)!==0;if(!B&&Fe===Ai&&Ve)throw Error("Point.fromHex: x=0 and x_0=1");if(Ve!==Kt)Fe=d(-Fe);return _.fromAffine({x:Fe,y:Ce})}static fromPrivateKey(C){let{scalar:B}=P(C);return T.multiply(B)}toRawBytes(){let{x:C,y:B}=this.toAffine(),Z=Hd(B,r.BYTES);return Z[Z.length-1]|=C&gn?128:0,Z}toHex(){return js(this.toRawBytes())}}_.BASE=new _(t.Gx,t.Gy,gn,d(t.Gx*t.Gy)),_.ZERO=new _(Ai,gn,gn,Ai);let{BASE:T,ZERO:k}=_,O=G_(_,s*8);function z(C){return yt(C,o)}function L(C){return z(hu(C))}function P(C){let B=r.BYTES;C=It("private key",C,B);let Z=It("hashed private key",i(C),2*B),we=y(Z.slice(0,B)),Pe=Z.slice(B,2*B),je=L(we);return{head:we,prefix:Pe,scalar:je}}function F(C){let{head:B,prefix:Z,scalar:we}=P(C),Pe=T.multiply(we),je=Pe.toRawBytes();return{head:B,prefix:Z,scalar:we,point:Pe,pointBytes:je}}function G(C){return F(C).pointBytes}function ue(C=Uint8Array.of(),...B){let Z=Tr(...B);return L(i(x(Z,It("context",C),!!n)))}function W(C,B,Z={}){if(C=It("message",C),n)C=n(C);let{prefix:we,scalar:Pe,pointBytes:je}=F(B),De=ue(Z.context,we,C),Ce=T.multiply(De).toRawBytes(),V=ue(Z.context,Ce,je,C),se=z(De+V*Pe);mn("signature.s",se,Ai,o);let le=Tr(Ce,Hd(se,r.BYTES));return It("result",le,r.BYTES*2)}let H=phe;function fe(C,B,Z,we=H){let{context:Pe,zip215:je}=we,De=r.BYTES;if(C=It("signature",C,2*De),B=It("message",B),Z=It("publicKey",Z,De),je!==void 0)Pi("zip215",je);if(n)B=n(B);let Ce=hu(C.slice(De,2*De)),V,se,le;try{V=_.fromHex(Z,je),se=_.fromHex(C.slice(0,De),je),le=T.multiplyUnsafe(Ce)}catch(Fe){return!1}if(!je&&V.isSmallOrder())return!1;let be=ue(Pe,se.toRawBytes(),V.toRawBytes(),B);return se.add(V.multiplyUnsafe(be)).subtract(le).clearCofactor().equals(_.ZERO)}return T._setWindowSize(8),{CURVE:t,getPublicKey:G,sign:W,verify:fe,ExtendedPoint:_,utils:{getExtendedPublicKey:F,randomPrivateKey:()=>a(r.BYTES),precompute(C=8,B=_.BASE){return B._setWindowSize(C),B.multiply(BigInt(3)),B}}}}vu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var NR=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),FF=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),t$e=BigInt(0),bhe=BigInt(1),qF=BigInt(2),r$e=BigInt(3),xhe=BigInt(5),vhe=BigInt(8);function _he(e){let t=BigInt(10),r=BigInt(20),o=BigInt(40),n=BigInt(80),i=NR,s=e*e%i*e%i,c=Yt(s,qF,i)*s%i,u=Yt(c,bhe,i)*e%i,d=Yt(u,xhe,i)*u%i,p=Yt(d,t,i)*d%i,m=Yt(p,r,i)*p%i,h=Yt(m,o,i)*m%i,y=Yt(h,n,i)*h%i,x=Yt(y,n,i)*h%i,S=Yt(x,t,i)*d%i;return{pow_p_5_8:Yt(S,qF,i)*e%i,b2:s}}function whe(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function She(e,t){let r=NR,o=yt(t*t*t,r),n=yt(o*o*t,r),i=_he(e*n).pow_p_5_8,a=yt(e*o*i,r),s=yt(t*a*a,r),c=a,u=yt(a*FF,r),d=s===e,p=s===yt(-e,r),m=s===yt(-e*FF,r);if(d)a=c;if(p||m)a=u;if(AF(a,r))a=yt(-a,r);return{isValid:d||p,value:a}}var HF=(()=>Sa(NR,void 0,!0))(),The=(()=>({a:HF.create(BigInt(-1)),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:HF,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:vhe,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:yF,randomBytes:Fd,adjustScalarBytes:whe,uvRatio:She}))(),Z_=(()=>BF(The))();ug();fo();function W_(){if(typeof globalThis.crypto?.getRandomValues!=="function")throw Error("Secure randomness (crypto.getRandomValues) is unavailable; cannot generate a session keypair.");let e=Z_.utils.randomPrivateKey();return{publicKey:Z_.getPublicKey(e),privateKey:e}}function K_(e){return lu(e.publicKey)}function J_(e){return lu(e.privateKey)}function GF(e,t){return{publicKey:ig(e),privateKey:ig(t)}}function VF(e){return lu(xa(e))}function ZF(e,t,r,o){return`${e.toUpperCase()}
|
|
136
|
+
`}class mR{constructor(e=L3.stdin,t=L3.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new fR,this._started=!1,this._ondata=(r)=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=(r)=>{this.onerror?.(r)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise((t)=>{let r=U3(e);if(this._stdout.write(r))t();else this._stdout.once("drain",t)})}}var N_={name:"@0xmonaco/mcp-server",version:"1.0.43",type:"module",repository:{type:"git",url:"https://github.com/Monaco-Research/monaco-sdk.git",directory:"packages/mcp-server"},description:"MCP server for the Monaco SDK",engines:{node:">=18"},bin:"./dist/bin.js",files:["dist"],scripts:{build:"bun build src/bin.ts --outdir dist --target node --format esm --minify",dev:"bun --watch src/bin.ts",start:"bun dist/bin.js",clean:"rm -rf dist",lint:"biome lint .",test:"bun test"},author:"@codebycarson",dependencies:{"@0xmonaco/core":"1.0.43","@0xmonaco/types":"1.0.43","@modelcontextprotocol/sdk":"^1.29.0","node-fetch":"^3.3.2",viem:"^2.53.1",ws:"^8.21.0",zod:"^4.4.3"},devDependencies:{"@types/bun":"latest","@types/ws":"^8.18.1"}};var M_=["read","market-maker","full"],Ei=[{name:"search_docs",description:"Search the Monaco documentation for protocol, SDK, trading, and development guides.",category:"search",authMode:"public",sideEffect:"read-only"},{name:"get_trading_pairs",description:"List trading pairs with optional filters (market type, base/quote token, active status).",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_trading_pair_by_symbol",description:"Look up a trading pair by symbol (e.g. `BTC/USDC`).",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_candlesticks",description:"Fetch OHLCV candlestick data for a trading pair.",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_market_metadata",description:"Get tick size, minimum order size, and trading rules for a pair.",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_screener",description:"Screen trading pairs with market stats (price, volume, change), filtered by market type, category, and active status.",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_market_stats",description:"Get exchange-wide life-to-date cumulative volume and trade count across all markets.",category:"market",authMode:"public",sideEffect:"read-only"},{name:"get_perp_market_config",description:"Get a perpetual market's configuration (leverage limits, margin requirements, funding parameters).",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_perp_market_summary",description:"Get a perpetual market's live summary (mark/index price, funding rate, open interest, 24h stats).",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_mark_price",description:"Get the current mark price for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_index_price",description:"Get the current index (oracle) price for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_funding_state",description:"Get the current funding rate and next funding time for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_open_interest",description:"Get the current open interest for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_funding_history",description:"List historical funding-rate records for a perpetual market.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_all_funding_history",description:"List historical funding-rate records across all perpetual markets.",category:"perp",authMode:"public",sideEffect:"read-only"},{name:"get_orderbook",description:"Fetch a current orderbook snapshot with bids and asks.",category:"orderbook",authMode:"public",sideEffect:"read-only"},{name:"get_trades",description:"Fetch historical trades for a trading pair.",category:"trades",authMode:"public",sideEffect:"read-only"},{name:"place_limit_order",description:"Place a limit order with price, quantity, and time-in-force. Not idempotent — after an ambiguous failure (timeout/network error/5xx with no order), reconcile with get_orders/get_order before retrying; never blind-retry.",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"place_market_order",description:"Place a market order — executes immediately inside a mandatory 1,000 bps protective price band, so it may partially fill or be rejected. Not idempotent — after an ambiguous failure (timeout/network error/5xx with no order), reconcile with get_orders/get_order before retrying; never blind-retry.",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"replace_order",description:"Modify an existing order's price and/or quantity. Not idempotent — after an ambiguous failure (timeout/network error/5xx with no order), reconcile with get_order before retrying; never blind-retry.",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"cancel_order",description:"Cancel a single order by ID.",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"batch_cancel_orders",description:"Cancel multiple orders by ID (non-atomic — a failed leg does not stop the others).",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"batch_cancel_all_orders",description:"Cancel all open orders, optionally filtered to a trading pair (unfiltered, it cancels your entire open-order book).",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"batch_close_all_positions",description:"Close all open perpetual positions with market reduce-only orders (best-effort, optional pair filter).",category:"trading",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"get_orders",description:"List your orders with optional filters.",category:"trading",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_order",description:"Get details for a specific order by ID.",category:"trading",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_positions",description:"List your perpetual positions with optional filters (margin account, trading pair, status).",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_position",description:"Get details for a specific perpetual position by ID.",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_position_risk",description:"Get liquidation price, margin ratio, and risk metrics for a perpetual position.",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_position_history",description:"List historical (closed/reduced) perpetual position records with optional filters.",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_position_pnl_history",description:"Get the PnL history time series for a perpetual position over an interval.",category:"positions",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"close_position",description:"Close a perpetual position with a market, limit, or IOC reduce order.",category:"positions",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"get_profile",description:"Fetch your core profile (address, username, account type, withdrawal status).",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_balances",description:"List token balances with pagination.",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_balance_by_asset",description:"Get balance for a specific asset.",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_movements",description:"Fetch transaction and movement history with optional filters.",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_user_trades",description:"List your own trade fills with optional filters and cursor pagination.",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_funding_payments",description:"List your perpetual funding payments with optional filters (trading pair, position, margin account).",category:"profile",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_summary",description:"Get your authoritative portfolio summary (equity, PnL, exposure) over a period.",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_performance",description:"Get your portfolio performance time series over a period.",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_realized_pnl",description:"Get your realized PnL breakdown over a period.",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_assets",description:"Get your per-asset portfolio allocation and balances over a period.",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_portfolio_margin",description:"Get your portfolio margin overview (collateral, maintenance margin, health).",category:"portfolio",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_margin_accounts",description:"List your margin accounts with optional filters (state, trading pair).",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_parent_margin_account_summary",description:"Get your parent (cross) margin account summary.",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_available_collateral",description:"Get available (unlocked) collateral for allocating to margin accounts or risk buckets.",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_parent_margin_account_movements",description:"List collateral movements for your parent (cross) margin account.",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"simulate_parent_margin_order_risk",description:"Preview the risk impact of a prospective order against your parent (cross) margin account (read-only simulation).",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"simulate_risk_bucket_order_risk",description:"Preview the risk impact of a prospective order for a new or existing risk bucket (read-only simulation).",category:"margin",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"transfer_collateral_to_parent_margin_account",description:"Move collateral from spot into your parent (cross) margin account.",category:"margin",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"transfer_collateral_from_parent_margin_account",description:"Move collateral out of your parent (cross) margin account back to spot.",category:"margin",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"transfer_collateral_to_risk_bucket",description:"Allocate collateral into an isolated or cross risk bucket.",category:"margin",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"simulate_fees",description:"Simulate fees for an order before placing it.",category:"fees",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_my_fee_tier",description:"Get your current fee tier, rolling 14-day volumes, and a pair's fee schedule.",category:"fees",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"vault_approve",description:"Approve the vault contract to spend a token.",category:"vault",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"vault_deposit",description:"Deposit tokens into the vault (optional `target`: `spot` default, or `margin` to route into collateral).",category:"vault",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"vault_withdraw",description:"Withdraw tokens from the vault.",category:"vault",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"vault_get_allowance",description:"Check current token allowance for the vault.",category:"vault",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"vault_needs_approval",description:"Check whether an approval transaction is needed before depositing.",category:"vault",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"get_pending_withdrawals",description:"List your pending withdrawals still awaiting on-chain root confirmation.",category:"vault",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"request_faucet",description:"Request test tokens for all trading pairs.",category:"faucet",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating",excludedOnMainnet:!0},{name:"get_faucet_info",description:"Check remaining faucet quota, next-request time, and recent mint history.",category:"faucet",authMode:"authenticated",capability:"read",sideEffect:"read-only",excludedOnMainnet:!0},{name:"get_trader_code_info",description:"Look up a trader code's details (no credentials required).",category:"pitpass",authMode:"public",sideEffect:"read-only"},{name:"check_trader_code_availability",description:"Public advisory check of whether a custom PitPass TraderCode handle is available (no credentials required).",category:"pitpass",authMode:"public",sideEffect:"read-only"},{name:"get_my_trader_code",description:"Fetch your own trader code.",category:"pitpass",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"set_trader_code",description:"Claim or edit your custom (vanity) PitPass TraderCode handle.",category:"pitpass",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"clear_trader_code",description:"Clear your custom PitPass TraderCode handle, reverting to the wallet-derived default.",category:"pitpass",authMode:"authenticated",capability:"market-maker",sideEffect:"mutating"},{name:"get_rewards_balance",description:"Fetch your PitPass rewards-bucket balances across reward tokens.",category:"pitpass",authMode:"authenticated",capability:"read",sideEffect:"read-only"},{name:"transfer_rewards",description:"Move your earned PitPass rewards from the rewards bucket into your own tradeable balance (ledger-only).",category:"pitpass",authMode:"authenticated",capability:"full",sideEffect:"fund-movement"},{name:"get_pulse",description:"Get the latest market-pulse news feed: AI-synthesized, per-asset headlines with sentiment tags.",category:"pulse",authMode:"public",sideEffect:"read-only"}],pRe=Ei.map((e)=>e.name),j3=Ei.filter((e)=>e.authMode==="public").map((e)=>e.name),fRe=Ei.filter((e)=>e.authMode==="authenticated"&&e.capability==="read").map((e)=>e.name),mRe=Ei.filter((e)=>e.authMode==="authenticated"&&e.capability==="market-maker").map((e)=>e.name),hRe=Ei.filter((e)=>e.authMode==="authenticated"&&e.capability==="full").map((e)=>e.name),gRe=Ei.filter((e)=>e.excludedOnMainnet).map((e)=>e.name),F3=Ei.filter((e)=>e.sideEffect==="fund-movement").map((e)=>e.name),Lme=new Map(Ei.map((e)=>[e.name,e.sideEffect]));function q3(e){let t=Lme.get(e);if(!t)return;let r=t==="read-only";return{readOnlyHint:r,destructiveHint:!r}}var H3={read:0,"market-maker":1,full:2},hR=j3,gR=Object.fromEntries(Ei.filter((e)=>e.authMode==="authenticated").map((e)=>[e.name,{capability:e.capability??"full",...e.sideEffect==="fund-movement"?{fundMovement:!0}:{},...e.excludedOnMainnet?{excludedOnMainnet:!0}:{}}])),G3=Object.fromEntries(Object.entries(gR).map(([e,t])=>[e,t.capability])),xRe=new Set(F3);function V3(e){let t=gR[e];if(!t)return"full";if(t.fundMovement)return"full";return t.capability}function Z3(e){return V3(e)==="read"}function W3(e,t){if(t.network==="mainnet"&&gR[e]?.excludedOnMainnet)return!1;if(t.deny.includes(e))return!1;if(hR.includes(e))return!0;if(!t.authenticated)return!1;if(t.allow.includes(e))return!0;return H3[t.capability]>=H3[V3(e)]}var jme=new Set([...hR,...Object.keys(G3)]),Fme={mainnet:"https://evm-rpc.sei-apis.com",development:"https://evm-rpc-testnet.sei-apis.com",staging:"https://evm-rpc-testnet.sei-apis.com",local:"http://localhost:8545"};function K3(e){if(!e)return[];return e.split(",").map((t)=>t.trim()).filter(Boolean)}function su(e=process.env){let t=e.MONACO_PRIVATE_KEY||null;if(t&&!t.startsWith("0x"))throw Error("MONACO_PRIVATE_KEY must start with '0x'.");let r=e.MONACO_CLIENT_ID||null;if(t&&!r)throw Error("MONACO_CLIENT_ID is required when MONACO_PRIVATE_KEY is set.");let o=["mainnet","development","staging","local"],n=e.MONACO_NETWORK;if(t&&!n)throw Error(`MONACO_NETWORK must be set explicitly (one of: ${o.join(", ")}) when MONACO_PRIVATE_KEY is configured. Refusing to default to mainnet for an authenticated session.`);let i=n||"mainnet";if(!o.includes(i))throw Error(`MONACO_NETWORK must be one of: ${o.join(", ")}.`);let a=i,s=e.MONACO_CAPABILITY;if(s&&!M_.includes(s))throw Error(`MONACO_CAPABILITY must be one of: ${M_.join(", ")}.`);let c=s||"read",u=K3(e.MONACO_TOOL_ALLOWLIST),d=K3(e.MONACO_TOOL_DENYLIST),p=[...u,...d].filter((y)=>!jme.has(y)).length;if(p>0)throw Error(`${p} unknown tool name(s) in MONACO_TOOL_ALLOWLIST/MONACO_TOOL_DENYLIST. Check them against the documented tool list.`);let m=e.MONACO_RPC_URL||Fme[a],h=null;if(e.MONACO_DELEGATED_OWNER_USER_ID!==void 0){let y=e.MONACO_DELEGATED_OWNER_USER_ID.trim();if(!y)throw Error("MONACO_DELEGATED_OWNER_USER_ID must be a non-empty owner user id when set.");if(!t||!r)throw Error("MONACO_DELEGATED_OWNER_USER_ID requires MONACO_PRIVATE_KEY and MONACO_CLIENT_ID (the agent authenticates as itself before adopting the owner).");h=y}return{privateKey:t,clientId:r,network:a,seiRpcUrl:m,capability:c,allow:u,deny:d,delegatedOwnerUserId:h}}function qme(e){return e.replace(/_([a-z])/g,(t,r)=>r.toUpperCase())}function lo(e){if(e===null||e===void 0)return e;if(typeof e!=="object")return e;if(Array.isArray(e))return e.map((r)=>lo(r));let t={};for(let[r,o]of Object.entries(e))t[qme(r)]=typeof o==="object"&&o!==null?lo(o):o;return t}fo();ug();fo();zR();vu();bu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var Ai=BigInt(0),gn=BigInt(1),MF=BigInt(2),dhe=BigInt(8),phe={zip215:!0};function fhe(e){let t=pg(e);return Go(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function BF(e){let t=fhe(e),{Fp:r,n:o,prehash:n,hash:i,randomBytes:a,nByteLength:s,h:c}=t,u=MF<<BigInt(s*8)-gn,d=r.create,p=Sa(t.n,t.nBitLength);function m(C,B){let Z=r.sqr(C),we=r.sqr(B),Pe=r.add(r.mul(t.a,Z),we),je=r.add(r.ONE,r.mul(t.d,r.mul(Z,we)));return r.eql(Pe,je)}if(!m(t.Gx,t.Gy))throw Error("bad curve params: generator point");let h=t.uvRatio||((C,B)=>{try{return{isValid:!0,value:r.sqrt(C*r.inv(B))}}catch(Z){return{isValid:!1,value:Ai}}}),y=t.adjustScalarBytes||((C)=>C),x=t.domain||((C,B,Z)=>{if(Pi("phflag",Z),B.length||Z)throw Error("Contexts/pre-hash are not supported");return C});function S(C,B,Z=!1){let we=Z?gn:Ai;mn("coordinate "+C,B,we,u)}function v(C){if(!(C instanceof _))throw Error("ExtendedPoint expected")}let E=Gd((C,B)=>{let{ex:Z,ey:we,ez:Pe}=C,je=C.is0();if(B==null)B=je?dhe:r.inv(Pe);let De=d(Z*B),Ce=d(we*B),V=d(Pe*B);if(je)return{x:Ai,y:gn};if(V!==gn)throw Error("invZ was invalid");return{x:De,y:Ce}}),w=Gd((C)=>{let{a:B,d:Z}=t;if(C.is0())throw Error("bad point: ZERO");let{ex:we,ey:Pe,ez:je,et:De}=C,Ce=d(we*we),V=d(Pe*Pe),se=d(je*je),le=d(se*se),be=d(Ce*B),ie=d(se*d(be+V)),Fe=d(le+d(Z*d(Ce*V)));if(ie!==Fe)throw Error("bad point: equation left != right (1)");let Kt=d(we*Pe),Ve=d(je*De);if(Kt!==Ve)throw Error("bad point: equation left != right (2)");return!0});class _{constructor(C,B,Z,we){S("x",C),S("y",B),S("z",Z,!0),S("t",we),this.ex=C,this.ey=B,this.ez=Z,this.et=we,Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(C){if(C instanceof _)throw Error("extended point not allowed");let{x:B,y:Z}=C||{};return S("x",B),S("y",Z),new _(B,Z,gn,d(B*Z))}static normalizeZ(C){let B=wa(r,C.map((Z)=>Z.ez));return C.map((Z,we)=>Z.toAffine(B[we])).map(_.fromAffine)}static msm(C,B){return V_(_,p,C,B)}_setWindowSize(C){O.setWindowSize(this,C)}assertValidity(){w(this)}equals(C){v(C);let{ex:B,ey:Z,ez:we}=this,{ex:Pe,ey:je,ez:De}=C,Ce=d(B*De),V=d(Pe*we),se=d(Z*De),le=d(je*we);return Ce===V&&se===le}is0(){return this.equals(_.ZERO)}negate(){return new _(d(-this.ex),this.ey,this.ez,d(-this.et))}double(){let{a:C}=t,{ex:B,ey:Z,ez:we}=this,Pe=d(B*B),je=d(Z*Z),De=d(MF*d(we*we)),Ce=d(C*Pe),V=B+Z,se=d(d(V*V)-Pe-je),le=Ce+je,be=le-De,ie=Ce-je,Fe=d(se*be),Kt=d(le*ie),Ve=d(se*ie),at=d(be*le);return new _(Fe,Kt,at,Ve)}add(C){v(C);let{a:B,d:Z}=t,{ex:we,ey:Pe,ez:je,et:De}=this,{ex:Ce,ey:V,ez:se,et:le}=C,be=d(we*Ce),ie=d(Pe*V),Fe=d(De*Z*le),Kt=d(je*se),Ve=d((we+Pe)*(Ce+V)-be-ie),at=Kt-Fe,pr=Kt+Fe,_r=d(ie-B*be),Bf=d(Ve*at),ul=d(pr*_r),Ly=d(Ve*_r),Po=d(at*pr);return new _(Bf,ul,Po,Ly)}subtract(C){return this.add(C.negate())}wNAF(C){return O.wNAFCached(this,C,_.normalizeZ)}multiply(C){let B=C;mn("scalar",B,gn,o);let{p:Z,f:we}=this.wNAF(B);return _.normalizeZ([Z,we])[0]}multiplyUnsafe(C,B=_.ZERO){let Z=C;if(mn("scalar",Z,Ai,o),Z===Ai)return k;if(this.is0()||Z===gn)return this;return O.wNAFCachedUnsafe(this,Z,_.normalizeZ,B)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return O.unsafeLadder(this,o).is0()}toAffine(C){return E(this,C)}clearCofactor(){let{h:C}=t;if(C===gn)return this;return this.multiplyUnsafe(C)}static fromHex(C,B=!1){let{d:Z,a:we}=t,Pe=r.BYTES;C=It("pointHex",C,Pe),Pi("zip215",B);let je=C.slice(),De=C[Pe-1];je[Pe-1]=De&-129;let Ce=hu(je),V=B?u:r.ORDER;mn("pointHex.y",Ce,Ai,V);let se=d(Ce*Ce),le=d(se-gn),be=d(Z*se-we),{isValid:ie,value:Fe}=h(le,be);if(!ie)throw Error("Point.fromHex: invalid y coordinate");let Kt=(Fe&gn)===gn,Ve=(De&128)!==0;if(!B&&Fe===Ai&&Ve)throw Error("Point.fromHex: x=0 and x_0=1");if(Ve!==Kt)Fe=d(-Fe);return _.fromAffine({x:Fe,y:Ce})}static fromPrivateKey(C){let{scalar:B}=P(C);return T.multiply(B)}toRawBytes(){let{x:C,y:B}=this.toAffine(),Z=Hd(B,r.BYTES);return Z[Z.length-1]|=C&gn?128:0,Z}toHex(){return js(this.toRawBytes())}}_.BASE=new _(t.Gx,t.Gy,gn,d(t.Gx*t.Gy)),_.ZERO=new _(Ai,gn,gn,Ai);let{BASE:T,ZERO:k}=_,O=G_(_,s*8);function z(C){return xt(C,o)}function L(C){return z(hu(C))}function P(C){let B=r.BYTES;C=It("private key",C,B);let Z=It("hashed private key",i(C),2*B),we=y(Z.slice(0,B)),Pe=Z.slice(B,2*B),je=L(we);return{head:we,prefix:Pe,scalar:je}}function F(C){let{head:B,prefix:Z,scalar:we}=P(C),Pe=T.multiply(we),je=Pe.toRawBytes();return{head:B,prefix:Z,scalar:we,point:Pe,pointBytes:je}}function G(C){return F(C).pointBytes}function ue(C=Uint8Array.of(),...B){let Z=Tr(...B);return L(i(x(Z,It("context",C),!!n)))}function W(C,B,Z={}){if(C=It("message",C),n)C=n(C);let{prefix:we,scalar:Pe,pointBytes:je}=F(B),De=ue(Z.context,we,C),Ce=T.multiply(De).toRawBytes(),V=ue(Z.context,Ce,je,C),se=z(De+V*Pe);mn("signature.s",se,Ai,o);let le=Tr(Ce,Hd(se,r.BYTES));return It("result",le,r.BYTES*2)}let H=phe;function fe(C,B,Z,we=H){let{context:Pe,zip215:je}=we,De=r.BYTES;if(C=It("signature",C,2*De),B=It("message",B),Z=It("publicKey",Z,De),je!==void 0)Pi("zip215",je);if(n)B=n(B);let Ce=hu(C.slice(De,2*De)),V,se,le;try{V=_.fromHex(Z,je),se=_.fromHex(C.slice(0,De),je),le=T.multiplyUnsafe(Ce)}catch(Fe){return!1}if(!je&&V.isSmallOrder())return!1;let be=ue(Pe,se.toRawBytes(),V.toRawBytes(),B);return se.add(V.multiplyUnsafe(be)).subtract(le).clearCofactor().equals(_.ZERO)}return T._setWindowSize(8),{CURVE:t,getPublicKey:G,sign:W,verify:fe,ExtendedPoint:_,utils:{getExtendedPublicKey:F,randomPrivateKey:()=>a(r.BYTES),precompute(C=8,B=_.BASE){return B._setWindowSize(C),B.multiply(BigInt(3)),B}}}}vu();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */var NR=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),FF=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),t$e=BigInt(0),bhe=BigInt(1),qF=BigInt(2),r$e=BigInt(3),xhe=BigInt(5),vhe=BigInt(8);function _he(e){let t=BigInt(10),r=BigInt(20),o=BigInt(40),n=BigInt(80),i=NR,s=e*e%i*e%i,c=Yt(s,qF,i)*s%i,u=Yt(c,bhe,i)*e%i,d=Yt(u,xhe,i)*u%i,p=Yt(d,t,i)*d%i,m=Yt(p,r,i)*p%i,h=Yt(m,o,i)*m%i,y=Yt(h,n,i)*h%i,x=Yt(y,n,i)*h%i,S=Yt(x,t,i)*d%i;return{pow_p_5_8:Yt(S,qF,i)*e%i,b2:s}}function whe(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function She(e,t){let r=NR,o=xt(t*t*t,r),n=xt(o*o*t,r),i=_he(e*n).pow_p_5_8,a=xt(e*o*i,r),s=xt(t*a*a,r),c=a,u=xt(a*FF,r),d=s===e,p=s===xt(-e,r),m=s===xt(-e*FF,r);if(d)a=c;if(p||m)a=u;if(AF(a,r))a=xt(-a,r);return{isValid:d||p,value:a}}var HF=(()=>Sa(NR,void 0,!0))(),The=(()=>({a:HF.create(BigInt(-1)),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:HF,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:vhe,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:yF,randomBytes:Fd,adjustScalarBytes:whe,uvRatio:She}))(),Z_=(()=>BF(The))();ug();fo();function W_(){if(typeof globalThis.crypto?.getRandomValues!=="function")throw Error("Secure randomness (crypto.getRandomValues) is unavailable; cannot generate a session keypair.");let e=Z_.utils.randomPrivateKey();return{publicKey:Z_.getPublicKey(e),privateKey:e}}function K_(e){return lu(e.publicKey)}function J_(e){return lu(e.privateKey)}function GF(e,t){return{publicKey:ig(e),privateKey:ig(t)}}function VF(e){return lu(xa(e))}function ZF(e,t,r,o){return`${e.toUpperCase()}
|
|
137
137
|
${t}
|
|
138
138
|
${r}
|
|
139
139
|
${o}`}function WF(e,t){return`WS-AUTH
|
|
@@ -143,7 +143,7 @@ ${t}`}function Y_(e,t){return lu(Z_.sign(jd(t),e))}var mg=[0.0001,0.001,0.01,0.1
|
|
|
143
143
|
`;mo();et();function hV(e){let t=(()=>{if(typeof e==="string")return Wd(e);if(typeof e.raw==="string")return e.raw;return Tt(e.raw)})(),r=Wd(`${mV}${ht(t)}`);return Vr([r,t])}function R1(e,t){return Ut(hV(e),t)}async function gV(e,{address:t,message:r,factory:o,factoryData:n,signature:i,...a}){let s=R1(r);return pe(e,lc,"verifyHash")({address:t,factory:o,factoryData:n,hash:s,signature:i,...a})}Ra();et();Yo();ur();wu();pt();class OO extends j{constructor({domain:e}){super(`Invalid domain "${vt(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class CO extends j{constructor({primaryType:e,types:t}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(t))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class zO extends j{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}Aa();mo();et();_$();function yV(e){let{domain:t,message:r,primaryType:o,types:n}=e,i=(a,s)=>{for(let c of a){let{name:u,type:d}=c,p=s[u],m=d.match(yw);if(m&&(typeof p==="number"||typeof p==="bigint")){let[x,S,v]=m;ge(p,{signed:S==="int",size:Number.parseInt(v,10)/8})}if(d==="address"&&typeof p==="string"&&!fr(p))throw new bn({address:p});let h=d.match(Iq);if(h){let[x,S]=h;if(S&&ht(p)!==Number.parseInt(S,10))throw new s$({expectedSize:Number.parseInt(S,10),givenSize:ht(p)})}let y=n[d];if(y)r0e(d),i(y,p)}};if(n.EIP712Domain&&t){if(typeof t!=="object")throw new OO({domain:t});i(n.EIP712Domain,t)}if(o!=="EIP712Domain")if(n[o])i(n[o],r);else throw new CO({primaryType:o,types:n})}function bV({domain:e}){return[typeof e?.name==="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},(typeof e?.chainId==="number"||typeof e?.chainId==="bigint")&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function r0e(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new zO({type:e})}function xV(e){let{domain:t={},message:r,primaryType:o}=e,n={EIP712Domain:bV({domain:t}),...e.types};yV({domain:t,message:r,primaryType:o,types:n});let i=["0x1901"];if(t)i.push(n0e({domain:t,types:n}));if(o!=="EIP712Domain")i.push(vV({data:r,primaryType:o,types:n}));return Ut(Vr(i))}function n0e({domain:e,types:t}){return vV({data:e,primaryType:"EIP712Domain",types:t})}function vV({data:e,primaryType:t,types:r}){let o=_V({data:e,primaryType:t,types:r});return Ut(o)}function _V({data:e,primaryType:t,types:r}){let o=[{type:"bytes32"}],n=[o0e({primaryType:t,types:r})];for(let i of r[t]){let[a,s]=SV({types:r,name:i.name,type:i.type,value:e[i.name]});o.push(a),n.push(s)}return vn(o,n)}function o0e({primaryType:e,types:t}){let r=en(i0e({primaryType:e,types:t}));return Ut(r)}function i0e({primaryType:e,types:t}){let r="",o=wV({primaryType:e,types:t});o.delete(e);let n=[e,...Array.from(o).sort()];for(let i of n)r+=`${i}(${t[i].map(({name:a,type:s})=>`${s} ${a}`).join(",")})`;return r}function wV({primaryType:e,types:t},r=new Set){let n=e.match(/^\w*/u)?.[0];if(r.has(n)||t[n]===void 0)return r;r.add(n);for(let i of t[n])wV({primaryType:i.type,types:t},r);return r}function SV({types:e,name:t,type:r,value:o}){if(e[r]!==void 0)return[{type:"bytes32"},Ut(_V({data:o,primaryType:r,types:e}))];if(r==="bytes")return[{type:"bytes32"},Ut(o)];if(r==="string")return[{type:"bytes32"},Ut(en(o))];if(r.lastIndexOf("]")===r.length-1){let n=r.slice(0,r.lastIndexOf("[")),i=o.map((a)=>SV({name:t,type:n,types:e,value:a}));return[{type:"bytes32"},Ut(vn(i.map(([a])=>a),i.map(([,a])=>a)))]}return[{type:r},o]}async function TV(e,t){let{address:r,factory:o,factoryData:n,signature:i,message:a,primaryType:s,types:c,domain:u,...d}=t,p=xV({message:a,primaryType:s,types:c,domain:u});return pe(e,lc,"verifyHash")({address:r,factory:o,factoryData:n,hash:p,signature:i,...d})}Ma();var NO=new Map,EV=new Map,a0e=0;function qn(e,t,r){let o=++a0e,n=()=>NO.get(e)||[],i=()=>{let d=n();NO.set(e,d.filter((p)=>p.id!==o))},a=()=>{let d=n();if(!d.some((m)=>m.id===o))return;let p=EV.get(e);if(d.length===1&&p){let m=p();if(m instanceof Promise)m.catch(()=>{})}i()},s=n();if(NO.set(e,[...s,{id:o,fns:t}]),s&&s.length>0)return a;let c={};for(let d in t)c[d]=(...p)=>{let m=n();if(m.length===0)return;for(let h of m)h.fns[d]?.(...p)};let u=r(c);if(typeof u==="function")EV.set(e,u);return a}async function py(e){return new Promise((t)=>setTimeout(t,e))}function fy(e,{delay:t=100,retryCount:r=2,shouldRetry:o=()=>!0}={}){return new Promise((n,i)=>{let a=async({count:s=0}={})=>{let c=async({error:u})=>{let d=typeof t==="function"?t({count:s,error:u}):t;if(d)await py(d);a({count:s+1})};try{let u=await e();n(u)}catch(u){if(s<r&&await o({count:s,error:u}))return c({error:u});i(u)}};a()})}xn();function Ui(e,{emitOnBegin:t,initialWaitTime:r,interval:o}){let n=!0,i=()=>n=!1;return(async()=>{let s;if(t)s=await e({unpoll:i});let c=await r?.(s)??o;await py(c);let u=async()=>{if(!n)return;await e({unpoll:i}),await py(o),u()};u()})(),i}function $1(e,{emitOnBegin:t=!1,emitMissed:r=!1,onBlockNumber:o,onError:n,poll:i,pollingInterval:a=e.pollingInterval}){let s=(()=>{if(typeof i<"u")return i;if(e.transport.type==="webSocket"||e.transport.type==="ipc")return!1;if(e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"))return!1;return!0})(),c;return s?(()=>{let p=vt(["watchBlockNumber",e.uid,t,r,a]);return qn(p,{onBlockNumber:o,onError:n},(m)=>Ui(async()=>{try{let h=await pe(e,Di,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(h===c)return;if(h-c>1&&r)for(let y=c+1n;y<h;y++)m.onBlockNumber(y,c),c=y}if(c===void 0||h>c)m.onBlockNumber(h,c),c=h}catch(h){m.onError?.(h)}},{emitOnBegin:t,interval:a}))})():(()=>{let p=vt(["watchBlockNumber",e.uid,t,r]);return qn(p,{onBlockNumber:o,onError:n},(m)=>{let h=!0,y=()=>h=!1;return(async()=>{try{let x=(()=>{if(e.transport.type==="fallback"){let v=e.transport.transports.find((E)=>E.config.type==="webSocket"||E.config.type==="ipc");if(!v)return e.transport;return v.value}return e.transport})(),{unsubscribe:S}=await x.subscribe({params:["newHeads"],onData(v){if(!h)return;let E=qr(v.result?.number);m.onBlockNumber(E,c),c=E},onError(v){m.onError?.(v)}});if(y=S,!h)y()}catch(x){n?.(x)}})(),()=>y()})})()}async function IV(e,t){let{checkReplacement:r=!0,confirmations:o=1,hash:n,onReplaced:i,retryCount:a=6,retryDelay:s=({count:T})=>~~(1<<T)*200,timeout:c=180000}=t,u=vt(["waitForTransactionReceipt",e.uid,n]),d=(()=>{if(t.pollingInterval)return t.pollingInterval;if(e.chain?.experimental_preconfirmationTime)return e.chain.experimental_preconfirmationTime;return e.pollingInterval})(),p,m,h,y=!1,x,S,{promise:v,resolve:E,reject:w}=Zw(),_=c?setTimeout(()=>{S?.(),x?.(),w(new n2({hash:n}))},c):void 0;return x=qn(u,{onReplaced:i,resolve:E,reject:w},async(T)=>{if(h=await pe(e,Wp,"getTransactionReceipt")({hash:n}).catch(()=>{return}),h&&o<=1){clearTimeout(_),T.resolve(h),x?.();return}S=pe(e,$1,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:d,async onBlockNumber(k){let O=(L)=>{clearTimeout(_),S?.(),L(),x?.()},z=k;if(y)return;try{if(h){if(o>1&&(!h.blockNumber||z-h.blockNumber+1n<o))return;O(()=>T.resolve(h));return}if(r&&!p)y=!0,await fy(async()=>{if(p=await pe(e,Zp,"getTransaction")({hash:n}),p.blockNumber)z=p.blockNumber},{delay:s,retryCount:a}),y=!1;if(h=await pe(e,Wp,"getTransactionReceipt")({hash:n}),o>1&&(!h.blockNumber||z-h.blockNumber+1n<o))return;O(()=>T.resolve(h))}catch(L){if(L instanceof $g||L instanceof Og){if(!p){y=!1;return}try{m=p,y=!0;let P=await fy(()=>pe(e,kr,"getBlock")({blockNumber:z,includeTransactions:!0}),{delay:s,retryCount:a,shouldRetry:({error:ue})=>ue instanceof ny});y=!1;let F=P.transactions.find(({from:ue,nonce:W})=>ue===m.from&&W===m.nonce);if(!F)return;if(h=await pe(e,Wp,"getTransactionReceipt")({hash:F.hash}),o>1&&(!h.blockNumber||z-h.blockNumber+1n<o))return;let G="replaced";if(F.to===m.to&&F.value===m.value&&F.input===m.input)G="repriced";else if(F.from===F.to&&F.value===0n)G="cancelled";O(()=>{T.onReplaced?.({reason:G,replacedTransaction:m,transaction:F,transactionReceipt:h}),T.resolve(h)})}catch(P){O(()=>T.reject(P))}}else O(()=>T.reject(L))}}})}),v}function PV(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:r=!1,emitOnBegin:o=!1,onBlock:n,onError:i,includeTransactions:a,poll:s,pollingInterval:c=e.pollingInterval}){let u=(()=>{if(typeof s<"u")return s;if(e.transport.type==="webSocket"||e.transport.type==="ipc")return!1;if(e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"))return!1;return!0})(),d=a??!1,p;return u?(()=>{let y=vt(["watchBlocks",e.uid,t,r,o,d,c]);return qn(y,{onBlock:n,onError:i},(x)=>Ui(async()=>{try{let S=await pe(e,kr,"getBlock")({blockTag:t,includeTransactions:d});if(S.number!==null&&p?.number!=null){if(S.number===p.number)return;if(S.number-p.number>1&&r)for(let v=p?.number+1n;v<S.number;v++){let E=await pe(e,kr,"getBlock")({blockNumber:v,includeTransactions:d});x.onBlock(E,p),p=E}}if(p?.number==null||t==="pending"&&S?.number==null||S.number!==null&&S.number>p.number)x.onBlock(S,p),p=S}catch(S){x.onError?.(S)}},{emitOnBegin:o,interval:c}))})():(()=>{let y=!0,x=!0,S=()=>y=!1;return(async()=>{try{if(o)pe(e,kr,"getBlock")({blockTag:t,includeTransactions:d}).then((w)=>{if(!y)return;if(!x)return;n(w,void 0),x=!1}).catch(i);let v=(()=>{if(e.transport.type==="fallback"){let w=e.transport.transports.find((_)=>_.config.type==="webSocket"||_.config.type==="ipc");if(!w)return e.transport;return w.value}return e.transport})(),{unsubscribe:E}=await v.subscribe({params:["newHeads"],async onData(w){if(!y)return;let _=await pe(e,kr,"getBlock")({blockNumber:w.result?.number,includeTransactions:d}).catch(()=>{});if(!y)return;n(_,p),x=!1,p=_},onError(w){i?.(w)}});if(S=E,!y)S()}catch(v){i?.(v)}})(),()=>S()})()}ur();Bg();function kV(e,t){let{abi:r,address:o,args:n,batch:i=!0,eventName:a,fromBlock:s,onError:c,onLogs:u,poll:d,pollingInterval:p=e.pollingInterval,strict:m}=t;return(()=>{if(typeof d<"u")return d;if(typeof s==="bigint")return!0;if(e.transport.type==="webSocket"||e.transport.type==="ipc")return!1;if(e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"))return!1;return!0})()?(()=>{let S=m??!1,v=vt(["watchContractEvent",o,n,i,e.uid,a,p,S,s]);return qn(v,{onLogs:u,onError:c},(E)=>{let w;if(s!==void 0)w=s-1n;let _,T=!1,k=Ui(async()=>{if(!T){try{_=await pe(e,Xw,"createContractEventFilter")({abi:r,address:o,args:n,eventName:a,strict:S,fromBlock:s})}catch{}T=!0;return}try{let O;if(_)O=await pe(e,ac,"getFilterChanges")({filter:_});else{let z=await pe(e,Di,"getBlockNumber")({});if(w&&w<z)O=await pe(e,m1,"getContractEvents")({abi:r,address:o,args:n,eventName:a,fromBlock:w+1n,toBlock:z,strict:S});else O=[];w=z}if(O.length===0)return;if(i)E.onLogs(O);else for(let z of O)E.onLogs([z])}catch(O){if(_&&O instanceof xo)T=!1;E.onError?.(O)}},{emitOnBegin:!0,interval:p});return async()=>{if(_)await pe(e,cc,"uninstallFilter")({filter:_});k()}})})():(()=>{let S=m??!1,v=vt(["watchContractEvent",o,n,i,e.uid,a,p,S]),E=!0,w=()=>E=!1;return qn(v,{onLogs:u,onError:c},(_)=>((async()=>{try{let T=(()=>{if(e.transport.type==="fallback"){let z=e.transport.transports.find((L)=>L.config.type==="webSocket"||L.config.type==="ipc");if(!z)return e.transport;return z.value}return e.transport})(),k=a?Bi({abi:r,eventName:a,args:n}):[],{unsubscribe:O}=await T.subscribe({params:["logs",{address:o,topics:k}],onData(z){if(!E)return;let L=z.result;try{let{eventName:P,args:F}=Hu({abi:r,data:L.data,topics:L.topics,strict:m}),G=Ar(L,{args:F,eventName:P});_.onLogs([G])}catch(P){let F,G;if(P instanceof Hs||P instanceof _u){if(m)return;F=P.abiItem.name,G=P.abiItem.inputs?.some((W)=>!(("name"in W)&&W.name))}let ue=Ar(L,{args:G?[]:{},eventName:F});_.onLogs([ue])}},onError(z){_.onError?.(z)}});if(w=O,!E)w()}catch(T){c?.(T)}})(),()=>w()))})()}ur();Bg();function AV(e,{address:t,args:r,batch:o=!0,event:n,events:i,fromBlock:a,onError:s,onLogs:c,poll:u,pollingInterval:d=e.pollingInterval,strict:p}){let m=(()=>{if(typeof u<"u")return u;if(typeof a==="bigint")return!0;if(e.transport.type==="webSocket"||e.transport.type==="ipc")return!1;if(e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"))return!1;return!0})(),h=p??!1;return m?(()=>{let S=vt(["watchEvent",t,r,o,e.uid,n,d,a]);return qn(S,{onLogs:c,onError:s},(v)=>{let E;if(a!==void 0)E=a-1n;let w,_=!1,T=Ui(async()=>{if(!_){try{w=await pe(e,e1,"createEventFilter")({address:t,args:r,event:n,events:i,strict:h,fromBlock:a})}catch{}_=!0;return}try{let k;if(w)k=await pe(e,ac,"getFilterChanges")({filter:w});else{let O=await pe(e,Di,"getBlockNumber")({});if(E&&E!==O)k=await pe(e,Vp,"getLogs")({address:t,args:r,event:n,events:i,fromBlock:E+1n,toBlock:O});else k=[];E=O}if(k.length===0)return;if(o)v.onLogs(k);else for(let O of k)v.onLogs([O])}catch(k){if(w&&k instanceof xo)_=!1;v.onError?.(k)}},{emitOnBegin:!0,interval:d});return async()=>{if(w)await pe(e,cc,"uninstallFilter")({filter:w});T()}})})():(()=>{let S=!0,v=()=>S=!1;return(async()=>{try{let E=(()=>{if(e.transport.type==="fallback"){let k=e.transport.transports.find((O)=>O.config.type==="webSocket"||O.config.type==="ipc");if(!k)return e.transport;return k.value}return e.transport})(),w=i??(n?[n]:void 0),_=[];if(w){if(_=[w.flatMap((O)=>Bi({abi:[O],eventName:O.name,args:r}))],n)_=_[0]}let{unsubscribe:T}=await E.subscribe({params:["logs",{address:t,topics:_}],onData(k){if(!S)return;let O=k.result;try{let{eventName:z,args:L}=Hu({abi:w??[],data:O.data,topics:O.topics,strict:h}),P=Ar(O,{args:L,eventName:z});c([P])}catch(z){let L,P;if(z instanceof Hs||z instanceof _u){if(p)return;L=z.abiItem.name,P=z.abiItem.inputs?.some((G)=>!(("name"in G)&&G.name))}let F=Ar(O,{args:P?[]:{},eventName:L});c([F])}},onError(k){s?.(k)}});if(v=T,!S)v()}catch(E){s?.(E)}})(),()=>v()})()}function RV(e,{batch:t=!0,onError:r,onTransactions:o,poll:n,pollingInterval:i=e.pollingInterval}){return(typeof n<"u"?n:e.transport.type!=="webSocket"&&e.transport.type!=="ipc")?(()=>{let u=vt(["watchPendingTransactions",e.uid,t,i]);return qn(u,{onTransactions:o,onError:r},(d)=>{let p,m=Ui(async()=>{try{if(!p)try{p=await pe(e,t1,"createPendingTransactionFilter")({});return}catch(y){throw m(),y}let h=await pe(e,ac,"getFilterChanges")({filter:p});if(h.length===0)return;if(t)d.onTransactions(h);else for(let y of h)d.onTransactions([y])}catch(h){d.onError?.(h)}},{emitOnBegin:!0,interval:i});return async()=>{if(p)await pe(e,cc,"uninstallFilter")({filter:p});m()}})})():(()=>{let u=!0,d=()=>u=!1;return(async()=>{try{let{unsubscribe:p}=await e.transport.subscribe({params:["newPendingTransactions"],onData(m){if(!u)return;let h=m.result;o([h])},onError(m){r?.(m)}});if(d=p,!u)d()}catch(p){r?.(p)}})(),()=>d()})()}function $V(e){let{scheme:t,statement:r,...o}=e.match(s0e)?.groups??{},{chainId:n,expirationTime:i,issuedAt:a,notBefore:s,requestId:c,...u}=e.match(c0e)?.groups??{},d=e.split("Resources:")[1]?.split(`
|
|
144
144
|
- `).slice(1);return{...o,...u,...n?{chainId:Number(n)}:{},...i?{expirationTime:new Date(i)}:{},...a?{issuedAt:new Date(a)}:{},...s?{notBefore:new Date(s)}:{},...c?{requestId:c}:{},...d?{resources:d}:{},...t?{scheme:t}:{},...r?{statement:r}:{}}}var s0e=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,c0e=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;Aa();Up();function OV(e){let{address:t,domain:r,message:o,nonce:n,scheme:i,time:a=new Date}=e;if(r&&o.domain!==r)return!1;if(n&&o.nonce!==n)return!1;if(i&&o.scheme!==i)return!1;if(o.expirationTime&&a>=o.expirationTime)return!1;if(o.notBefore&&a<o.notBefore)return!1;try{if(!o.address)return!1;if(!fr(o.address,{strict:!1}))return!1;if(t&&!ni(o.address,t))return!1}catch{return!1}return!0}async function CV(e,t){let{address:r,domain:o,message:n,nonce:i,scheme:a,signature:s,time:c=new Date,...u}=t,d=$V(n);if(!d.address)return!1;if(!OV({address:r,domain:o,message:d,nonce:i,scheme:a,time:c}))return!1;let m=R1(n);return lc(e,{address:d.address,hash:m,signature:s,...u})}async function zV(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}Ma();async function NV(e,{serializedTransaction:t,throwOnReceiptRevert:r,timeout:o}){let n=await e.request({method:"eth_sendRawTransactionSync",params:o?[t,o]:[t]},{retryCount:0}),a=(e.chain?.formatters?.transactionReceipt?.format||h1)(n);if(a.status==="reverted"&&r)throw new r2({receipt:a});return a}function MV(e){return{call:(t)=>wo(e,t),createAccessList:(t)=>Qw(e,t),createBlockFilter:()=>_G(e),createContractEventFilter:(t)=>Xw(e,t),createEventFilter:(t)=>e1(e,t),createPendingTransactionFilter:()=>t1(e),estimateContractGas:(t)=>o7(e,t),estimateGas:(t)=>Hp(e,t),getBalance:(t)=>i7(e,t),getBlobBaseFee:()=>a7(e),getBlock:(t)=>kr(e,t),getBlockNumber:(t)=>Di(e,t),getBlockTransactionCount:(t)=>u7(e,t),getBytecode:(t)=>qu(e,t),getChainId:()=>qp(e),getCode:(t)=>qu(e,t),getContractEvents:(t)=>m1(e,t),getDelegation:(t)=>d7(e,t),getEip712Domain:(t)=>p7(e,t),getEnsAddress:(t)=>pG(e,t),getEnsAvatar:(t)=>bG(e,t),getEnsName:(t)=>xG(e,t),getEnsResolver:(t)=>vG(e,t),getEnsText:(t)=>Yw(e,t),getFeeHistory:(t)=>m7(e,t),estimateFeesPerGas:(t)=>VG(e,t),getFilterChanges:(t)=>ac(e,t),getFilterLogs:(t)=>h7(e,t),getGasPrice:()=>Fp(e),getLogs:(t)=>Vp(e,t),getProof:(t)=>y7(e,t),estimateMaxPriorityFeePerGas:(t)=>GG(e,t),fillTransaction:(t)=>p1(e,t),getStorageAt:(t)=>b7(e,t),getTransaction:(t)=>Zp(e,t),getTransactionConfirmations:(t)=>x7(e,t),getTransactionCount:(t)=>c1(e,t),getTransactionReceipt:(t)=>Wp(e,t),multicall:(t)=>v7(e,t),prepareTransactionRequest:(t)=>f1(e,t),readContract:(t)=>mr(e,t),sendRawTransaction:(t)=>zV(e,t),sendRawTransactionSync:(t)=>NV(e,t),simulate:(t)=>oy(e,t),simulateBlocks:(t)=>oy(e,t),simulateCalls:(t)=>K7(e,t),simulateContract:(t)=>J7(e,t),verifyHash:(t)=>lc(e,t),verifyMessage:(t)=>gV(e,t),verifySiweMessage:(t)=>CV(e,t),verifyTypedData:(t)=>TV(e,t),uninstallFilter:(t)=>cc(e,t),waitForTransactionReceipt:(t)=>IV(e,t),watchBlocks:(t)=>PV(e,t),watchBlockNumber:(t)=>$1(e,t),watchContractEvent:(t)=>kV(e,t),watchEvent:(t)=>AV(e,t),watchPendingTransactions:(t)=>RV(e,t)}}function MO(e){let{key:t="public",name:r="Public Client"}=e;return uq({...e,key:t,name:r,type:"publicClient"}).extend(MV)}Ou();pt();class BO extends j{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}A2();Ou();function BV(e,{errorInstance:t=Error("timed out"),timeout:r,signal:o}){return new Promise((n,i)=>{(async()=>{let a;try{let s=new AbortController;if(r>0)a=setTimeout(()=>{if(o)s.abort();else i(t)},r);n(await e({signal:s?.signal||null}))}catch(s){if(s?.name==="AbortError")i(t);i(s)}finally{clearTimeout(a)}})()})}function u0e(){return{current:0,take(){return this.current++},reset(){this.current=0}}}var DO=u0e();function DV(e,t={}){let{url:r,headers:o}=l0e(e);return{async request(n){let{body:i,fetchFn:a=t.fetchFn??fetch,onRequest:s=t.onRequest,onResponse:c=t.onResponse,timeout:u=t.timeout??1e4}=n,d={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:p,method:m,signal:h}=d;try{let y=await BV(async({signal:S})=>{let v={...d,body:Array.isArray(i)?vt(i.map((T)=>({jsonrpc:"2.0",id:T.id??DO.take(),...T}))):vt({jsonrpc:"2.0",id:i.id??DO.take(),...i}),headers:{...o,"Content-Type":"application/json",...p},method:m||"POST",signal:h||(u>0?S:null)},E=new Request(r,v),w=await s?.(E,v)??{...v,url:r};return await a(w.url??r,w)},{errorInstance:new Bw({body:i,url:r}),timeout:u,signal:!0});if(c)await c(y);let x;if(y.headers.get("Content-Type")?.startsWith("application/json"))x=await y.json();else{x=await y.text();try{x=JSON.parse(x||"{}")}catch(S){if(y.ok)throw S;x={error:x}}}if(!y.ok){if(typeof x.error?.code==="number"&&typeof x.error?.message==="string")return x;throw new ei({body:i,details:vt(x.error)||y.statusText,headers:y.headers,status:y.status,url:r})}return x}catch(y){if(y instanceof ei)throw y;if(y instanceof Bw)throw y;throw new ei({body:i,cause:y,url:r})}}}}function l0e(e){try{let t=new URL(e),r=(()=>{if(t.username){let o=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(o)}`}}}return})();return{url:t.toString(),...r}}catch{return{url:e}}}pt();Ou();Bg();Tg();var O1=new ka(8192);function UV(e,{enabled:t=!0,id:r}){if(!t||!r)return e();if(O1.get(r))return O1.get(r);let o=e().finally(()=>O1.delete(r));return O1.set(r,o),o}function LV(e,t={}){return async(r,o={})=>{let{dedupe:n=!1,methods:i,retryDelay:a=150,retryCount:s=3,uid:c}={...t,...o},{method:u}=r;if(i?.exclude?.includes(u))throw new Js(Error("method not supported"),{method:u});if(i?.include&&!i.include.includes(u))throw new Js(Error("method not supported"),{method:u});let d=n?p0e(`${c}.${vt(r)}`):void 0;return UV(()=>fy(async()=>{try{return await e(r)}catch(p){let m=p;switch(m.code){case lp.code:throw new lp(m);case dp.code:throw new dp(m);case pp.code:throw new pp(m,{method:r.method});case fp.code:throw new fp(m);case Ua.code:throw new Ua(m);case xo.code:throw new xo(m);case mp.code:throw new mp(m);case hp.code:throw new hp(m);case gp.code:throw new gp(m);case Js.code:throw new Js(m,{method:r.method});case Cu.code:throw new Cu(m);case yp.code:throw new yp(m);case zu.code:throw new zu(m);case bp.code:throw new bp(m);case xp.code:throw new xp(m);case vp.code:throw new vp(m);case _p.code:throw new _p(m);case wp.code:throw new wp(m);case Sp.code:throw new Sp(m);case Tp.code:throw new Tp(m);case Ep.code:throw new Ep(m);case Ip.code:throw new Ip(m);case Pp.code:throw new Pp(m);case kp.code:throw new kp(m);case Ap.code:throw new Ap(m);case 5000:throw new zu(m);case Rp.code:throw new Rp(m);default:if(p instanceof j)throw p;throw new l2(m)}}},{delay:({count:p,error:m})=>{if(m&&m instanceof ei){let h=m?.headers?.get("Retry-After");if(h?.match(/\d/))return Number.parseInt(h,10)*1000}return~~(1<<p)*a},retryCount:s,shouldRetry:({error:p})=>d0e(p)}),{enabled:n,id:d})}}function d0e(e){if("code"in e&&typeof e.code==="number"){if(e.code===-1)return!0;if(e.code===Cu.code)return!0;if(e.code===Ua.code)return!0;if(e.code===429)return!0;return!1}if(e instanceof ei&&e.status){if(e.status===403)return!0;if(e.status===408)return!0;if(e.status===413)return!0;if(e.status===429)return!0;if(e.status===500)return!0;if(e.status===502)return!0;if(e.status===503)return!0;if(e.status===504)return!0;return!1}return!0}function p0e(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);r=Math.imul(r^i,2654435761),o=Math.imul(o^i,1597334677)}return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>16,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>16,3266489909),(4294967296*(2097151&o)+(r>>>0)).toString(36)}function jV({key:e,methods:t,name:r,request:o,retryCount:n=3,retryDelay:i=150,timeout:a,type:s},c){let u=rw();return{config:{key:e,methods:t,name:r,request:o,retryCount:n,retryDelay:i,timeout:a,type:s},request:LV(o,{methods:t,retryCount:n,retryDelay:i,uid:u}),value:c}}function UO(e,t={}){let{batch:r,fetchFn:o,fetchOptions:n,key:i="http",methods:a,name:s="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:u,retryDelay:d,raw:p}=t;return({chain:m,retryCount:h,timeout:y})=>{let{batchSize:x=1000,wait:S=0}=typeof r==="object"?r:{},v=t.retryCount??h,E=y??t.timeout??1e4,w=e||m?.rpcUrls.default.http[0];if(!w)throw new BO;let _=DV(w,{fetchFn:o,fetchOptions:n,onRequest:c,onResponse:u,timeout:E});return jV({key:i,methods:a,name:s,async request({method:T,params:k}){let O={method:T,params:k},{schedule:z}=Ww({id:w,wait:S,shouldSplitBatch(G){return G.length>x},fn:(G)=>_.request({body:G}),sort:(G,ue)=>G.id-ue.id}),L=async(G)=>r?z(G):[await _.request({body:G})],[{error:P,result:F}]=await L(O);if(p)return{error:P,result:F};if(P)throw new $u({body:O,error:P,url:w});return F},retryCount:v,retryDelay:d,timeout:E,type:"http"},{fetchOptions:n,url:w})}}Ri();function C1(e){let t={formatters:void 0,fees:void 0,serializers:void 0,...e};function r(o){return(n)=>{let i=typeof n==="function"?n(o):n,a={...o,...i};return Object.assign(a,{extend:r(a)})}}return Object.assign(t,{extend:r(t)})}var LO=C1({id:1329,name:"Sei Network",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc.sei-apis.com/"],webSocket:["wss://evm-ws.sei-apis.com/"]}},blockExplorers:{default:{name:"Seiscan",url:"https://seiscan.io",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11"}}});var jO=C1({id:1328,name:"Sei Testnet",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc-testnet.sei-apis.com"],webSocket:["wss://evm-ws-testnet.sei-apis.com"]}},blockExplorers:{default:{name:"Seiscan",url:"https://testnet.seiscan.io",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:98697651}},testnet:!0});fo();var z1=on(X_(),1);var f0e="@0xmonaco/core",FO={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11},qO="Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec",m0e=new RegExp(`^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\\d{2}) (${qO}) (\\d{4}) (\\d{2}):(\\d{2}):(\\d{2}) GMT$`),h0e=new RegExp(`^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\\d{2})-(${qO})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2}) GMT$`),g0e=new RegExp(`^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (${qO}) ([ \\d]\\d) (\\d{2}):(\\d{2}):(\\d{2}) (\\d{4})$`);function y0e(e,t,r,o,n,i){let a=new Date(Date.now()),s=Math.floor(a.getUTCFullYear()/100)*100+e,c=Date.UTC(s,t,r,o,n,i),u=Date.UTC(a.getUTCFullYear()+50,a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds());return c>u?s-100:s}function b0e(e){let t,r,o,n,i,a,s=m0e.exec(e),c=h0e.exec(e),u=g0e.exec(e);if(s)t=Number(s[1]),r=FO[s[2]],o=Number(s[3]),n=Number(s[4]),i=Number(s[5]),a=Number(s[6]);else if(c){if(t=Number(c[1]),r=FO[c[2]],n=Number(c[4]),i=Number(c[5]),a=Number(c[6]),r===void 0)return;o=y0e(Number(c[3]),r,t,n,i,a)}else if(u)r=FO[u[1]],t=Number((u[2]??"").trim()),n=Number(u[3]),i=Number(u[4]),a=Number(u[5]),o=Number(u[6]);else return;if(r===void 0)return;let d=Date.UTC(o,r,t,n,i,a),p=new Date(d);if(p.getUTCFullYear()!==o||p.getUTCMonth()!==r||p.getUTCDate()!==t||p.getUTCHours()!==n||p.getUTCMinutes()!==i||p.getUTCSeconds()!==a)return;return d}class tt{apiUrl;sessionKeypair;serverKey;retryOptions;constructor(e,t){this.apiUrl=e,this.retryOptions={maxRetries:t?.maxRetries??3,baseDelayMs:t?.baseDelayMs??1000}}setSessionKeypair(e){this.sessionKeypair=e?GF(e.publicKey,e.privateKey):void 0}setServerKey(e){this.serverKey=e}parseRequestBody(e){if(!e)return;if(typeof e==="string")try{return JSON.parse(e)}catch{return e}if(e instanceof FormData){let t={};return e.forEach((r,o)=>{t[o]=r instanceof File?`[File: ${r.name}]`:r}),t}if(e instanceof URLSearchParams){let t={};return e.forEach((r,o)=>{t[o]=r}),t}if(e instanceof Blob)return{type:"[Blob]",size:e.size,contentType:e.type};if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return{type:"[ArrayBuffer]",size:e instanceof ArrayBuffer?e.byteLength:e.byteLength};if(typeof ReadableStream<"u"&&e instanceof ReadableStream)return{type:"[ReadableStream]",note:"Stream body not captured for logging"};return{type:"[Unknown]",bodyType:typeof e}}extractResponseMetadata(e){if(!e)return{};let t=e.get("x-request-id")||e.get("request-id")||e.get("x-correlation-id")||void 0,r=e.get("retry-after"),o;if(r!==null){let n=r.trim();if(/^\d+$/.test(n))o=Number.parseInt(n,10);else{let i=b0e(n);if(i!==void 0)o=Math.max(0,Math.ceil((i-Date.now())/1000))}}return{requestId:t,retryAfter:o}}async executeRequest(e,t,r,o){let n,i={"User-Agent":f0e,...r.headers};try{n=await fetch(e,{...r,headers:i})}catch(u){throw new cr(`Network request failed for ${t}`,{endpoint:e,cause:u instanceof Error?u:Error(String(u)),requestBody:o})}let a,s=n.headers?.get("content-type")||"unknown",c=n.clone?n.clone():n;try{a=await n.json()}catch(u){let d;try{d=await c.text()}catch{d="[Unable to read response body]"}if(!n.ok){let p=`API request failed: ${n.status}. Response is not JSON (Content-Type: ${s})`,{requestId:m,retryAfter:h}=this.extractResponseMetadata(n.headers);throw new cr(p,{endpoint:e,statusCode:n.status,responseBody:{rawResponse:d.substring(0,500),contentType:s,parseError:u instanceof Error?u.message:String(u)},cause:u instanceof Error?u:void 0,requestBody:o,requestId:m,retryAfter:h})}if(d.trim()==="")return;throw new cr(`Expected JSON response but received ${s}`,{endpoint:e,statusCode:n.status,responseBody:{rawResponse:d.substring(0,500),contentType:s},cause:u instanceof Error?u:void 0,requestBody:o})}if(!n.ok){let u=a!==null&&typeof a==="object"?a:void 0,d=(typeof u?.message==="string"?u.message:void 0)||(typeof u?.error==="string"?u.error:void 0)||`API request failed: ${n.status}`,{requestId:p,retryAfter:m}=this.extractResponseMetadata(n.headers);throw new cr(d,{endpoint:e,statusCode:n.status,responseBody:a,requestBody:o,requestId:p,retryAfter:m})}return a}async makeAuthenticatedRequest(e,t={}){if(!this.sessionKeypair)throw new cr("Session keypair not set. Authenticate (login) first.",{endpoint:`${this.apiUrl}${e}`,statusCode:z1.StatusCodes.UNAUTHORIZED});let r=`${this.apiUrl}${e}`,o=this.parseRequestBody(t.body),n=this.buildSignatureHeaders(e,t);return this.executeRequest(r,e,{...t,headers:{"Content-Type":"application/json",...n,...t.headers}},o)}buildSignatureHeaders(e,t){if(!this.sessionKeypair)throw new cr("Session keypair not set. Authenticate (login) first.",{endpoint:`${this.apiUrl}${e}`,statusCode:z1.StatusCodes.UNAUTHORIZED});let r=(t.method??"GET").toUpperCase(),o=Date.now(),n=typeof t.body==="string"?jd(t.body):new Uint8Array(0),i=VF(n),a=ZF(r,e,o,i),s=Y_(this.sessionKeypair.privateKey,a);return{"X-Monaco-PublicKey":lu(this.sessionKeypair.publicKey),"X-Monaco-Timestamp":String(o),"X-Monaco-Signature":s}}async makeBackendRequest(e,t={}){if(!this.serverKey)throw new cr("Server key not set. Call setServerKey(sk_...) first.",{endpoint:`${this.apiUrl}${e}`,statusCode:z1.StatusCodes.UNAUTHORIZED});let r=`${this.apiUrl}${e}`,o=this.parseRequestBody(t.body);return this.executeRequest(r,e,{...t,headers:{"Content-Type":"application/json","x-server-key":this.serverKey,...t.headers}},o)}async makePublicRequest(e,t={}){let r=`${this.apiUrl}${e}`,o=this.parseRequestBody(t.body);return this.executeRequest(r,e,{...t,headers:{"Content-Type":"application/json",...t.headers}},o)}}function ut(e){return encodeURIComponent(e)}function qt(e,t){if(!t)return e;let r=new URLSearchParams;for(let[n,i]of Object.entries(t))if(i!==void 0)r.set(n,String(i));let o=r.toString();return o?`${e}?${o}`:e}var ce={orders:{create:()=>"/api/v1/orders",list:(e)=>qt("/api/v1/orders",e),get:(e)=>`/api/v1/orders/${ut(e)}`,replace:(e)=>`/api/v1/orders/${ut(e)}`,cancel:()=>"/api/v1/orders/cancel",batchCancel:()=>"/api/v1/orders/batch-cancel",batchCancelAll:()=>"/api/v1/orders/batch-cancel-all",batchCancelAllByPair:(e)=>`/api/v1/orders/batch-cancel-all/${ut(e)}`,batchCreate:()=>"/api/v1/orders/batch-create",batchReplace:()=>"/api/v1/orders/batch-replace",listConditional:(e)=>qt("/api/v1/orders/conditional",e),cancelConditional:(e)=>`/api/v1/orders/conditional/${ut(e)}`,getConditional:(e)=>`/api/v1/orders/conditional/${ut(e)}`,createTwap:()=>"/api/v1/orders/twap",listTwap:(e)=>qt("/api/v1/orders/twap",e),getTwap:(e)=>`/api/v1/orders/twap/${ut(e)}`,cancelTwap:(e)=>`/api/v1/orders/twap/${ut(e)}/cancel`},delegatedAgents:{list:()=>"/api/v1/delegated-agents",owners:()=>"/api/v1/delegated-agents/owners",byId:(e)=>`/api/v1/delegated-agents/${ut(e)}`,sessions:()=>"/api/v1/delegated-agents/sessions"},withdrawals:{initiate:()=>"/api/v1/withdrawals",byIndex:(e)=>`/api/v1/withdrawals/${ut(String(e))}`,list:(e)=>qt("/api/v1/withdrawals",e)},market:{listTradingPairs:(e)=>qt("/api/v1/market/pairs",e),getTradingPair:(e)=>`/api/v1/market/pairs/${ut(e)}`,getCandles:(e,t,r)=>qt(`/api/v1/market/pairs/charts/candlestick/${ut(e)}/${ut(t)}`,r),getMarketMetadata:(e)=>`/api/v1/market/pairs/${ut(e)}/metadata`,getPerpMarketConfig:(e)=>`/api/v1/market/pairs/${ut(e)}/perp/config`,getPerpMarketSummary:(e)=>`/api/v1/market/pairs/${ut(e)}/perp/summary`,getMarkPrice:(e)=>`/api/v1/market/pairs/${ut(e)}/mark-price`,getIndexPrice:(e)=>`/api/v1/market/pairs/${ut(e)}/index-price`,getFundingState:(e)=>`/api/v1/market/pairs/${ut(e)}/funding`,listFundingHistory:(e,t)=>qt(`/api/v1/market/pairs/${ut(e)}/funding/history`,t),listAllFundingHistory:(e)=>qt("/api/v1/market/funding/history",e),getOpenInterest:(e)=>`/api/v1/market/pairs/${ut(e)}/open-interest`,getScreener:(e)=>qt("/api/v1/market/screener",e),getMarketStats:()=>"/api/v1/market/stats"},orderbook:{get:(e,t)=>qt(`/api/v1/orderbook/${ut(e)}`,t)},trades:{publicByPair:(e,t)=>qt(`/api/v1/trades/${ut(e)}`,t),byId:(e)=>`/api/v1/trades/by-id/${ut(e)}`,user:(e)=>qt("/api/v1/accounts/trades",e)},applications:{orders:(e)=>qt("/api/v1/applications/orders",e),users:(e)=>qt("/api/v1/applications/users",e),movements:(e)=>qt("/api/v1/applications/movements",e),balances:(e)=>qt("/api/v1/applications/balances",e),stats:(e)=>qt("/api/v1/applications/stats",e)},subAccounts:{list:()=>"/api/v1/accounts/sub-accounts",createLimit:()=>"/api/v1/accounts/sub-accounts/limits",getLimits:(e)=>`/api/v1/accounts/sub-accounts/${ut(e)}/limits`,limit:(e,t)=>`/api/v1/accounts/sub-accounts/${ut(e)}/limits/${ut(t)}`},faucet:{mint:()=>"/api/v1/faucet/mint",info:()=>"/api/v1/faucet/info"},sweeper:{register:()=>"/api/v1/sweeper/register"},whitelist:{submit:()=>"/api/v1/whitelist"},positions:{list:(e)=>qt("/api/v1/positions",e),get:(e)=>`/api/v1/positions/${ut(e)}`,close:(e)=>`/api/v1/positions/${ut(e)}/close`,batchCloseAll:()=>"/api/v1/positions/batch-close-all",risk:(e)=>`/api/v1/positions/${ut(e)}/risk`,attachTpSl:(e)=>`/api/v1/positions/${ut(e)}/tp-sl`,history:(e)=>qt("/api/v1/positions/history",e),pnlHistory:(e,t)=>qt(`/api/v1/positions/${ut(e)}/pnl/history`,t)},marginAccounts:{list:(e)=>qt("/api/v1/margin/accounts",e),parentSummary:(e)=>qt("/api/v1/margin/parent-margin-account",e),summary:(e,t)=>qt(`/api/v1/margin/accounts/${ut(e)}`,t),availableCollateral:(e)=>qt("/api/v1/margin/collateral/available",e),transferIn:(e)=>`/api/v1/margin/accounts/${ut(e)}/collateral/transfer-in`,transferInParent:()=>"/api/v1/margin/parent-margin-account/collateral/transfer-in",transferInRiskBucket:()=>"/api/v1/margin/risk-buckets/collateral/transfer-in",transferOut:(e)=>`/api/v1/margin/accounts/${ut(e)}/collateral/transfer-out`,transferOutParent:()=>"/api/v1/margin/parent-margin-account/collateral/transfer-out",movements:(e,t)=>qt(`/api/v1/margin/accounts/${ut(e)}/movements`,t),parentMovements:(e)=>qt("/api/v1/margin/parent-margin-account/movements",e),simulateParentMarginOrderRisk:()=>"/api/v1/margin/parent-margin-account/simulate-order-risk",simulateOrderRisk:(e)=>`/api/v1/margin/accounts/${ut(e)}/simulate-order-risk`,simulateRiskBucketOrderRisk:()=>"/api/v1/margin/risk-buckets/simulate-order-risk"},streams:{orderbook:()=>"/api/v1/streaming/orderbook",trades:()=>"/api/v1/streaming/trades",perpMarketSummaries:()=>"/api/v1/streaming/perp-market-summaries",markPrices:()=>"/api/v1/streaming/mark-prices",privateTrades:()=>"/api/v1/streaming/private-trades",orders:()=>"/api/v1/streaming/orders",positions:()=>"/api/v1/streaming/positions",funding:()=>"/api/v1/streaming/funding",liquidationAlerts:()=>"/api/v1/streaming/liquidation-alerts"}};class N1 extends tt{async getApplicationConfig(){let e=await this.makeAuthenticatedRequest("/api/v1/applications/config",{method:"GET"});return{id:e.id,name:e.name,allowedOrigins:e.allowedOrigins,webhookUrl:e.webhookUrl,vaultContractAddress:e.vaultContractAddress,clientId:e.clientId}}async listApplicationOrders(e){return await this.makeBackendRequest(ce.applications.orders(e))}async listApplicationUsers(e){return await this.makeBackendRequest(ce.applications.users(e))}async listApplicationMovements(e){return await this.makeBackendRequest(ce.applications.movements(e))}async listApplicationBalances(e){return await this.makeBackendRequest(ce.applications.balances(e))}async getApplicationStats(e){return await this.makeBackendRequest(ce.applications.stats(e))}}class HO extends tt{async upsertDelegatedAgent(e){return this.makeAuthenticatedRequest(ce.delegatedAgents.list(),{method:"POST",body:JSON.stringify({agentAddress:e.agentAddress,name:e.name,expiresAt:e.expiresAt,allowedActions:e.allowedActions,allowedTradingPairIds:e.allowedTradingPairIds,allowedMarginAccountIds:e.allowedMarginAccountIds,allowedOrderTypes:e.allowedOrderTypes,allowedTimeInForce:e.allowedTimeInForce,maxLeverage:e.maxLeverage,maxOrderNotional:e.maxOrderNotional,maxOpenOrders:e.maxOpenOrders})})}async listDelegatedAgents(){return this.makeAuthenticatedRequest(ce.delegatedAgents.list())}async listDelegatedOwners(){return this.makeAuthenticatedRequest(ce.delegatedAgents.owners())}async revokeDelegatedAgent(e){return this.makeAuthenticatedRequest(ce.delegatedAgents.byId(e),{method:"DELETE"})}async createDelegatedSession(e){return this.makeAuthenticatedRequest(ce.delegatedAgents.sessions(),{method:"POST",body:JSON.stringify({ownerUserId:e.ownerUserId,sessionPublicKey:e.sessionPublicKey})})}}class M1 extends tt{async mint(e){return await this.makeAuthenticatedRequest(ce.faucet.mint(),{method:"POST",body:JSON.stringify({turnstileToken:e.turnstileToken})})}async getInfo(){return await this.makeAuthenticatedRequest(ce.faucet.info(),{method:"GET"})}}var GO=f.object({tradingPairId:f.string().trim().min(1,"Trading pair ID is required and cannot be empty"),side:f.enum(["BUY","SELL"],{message:"Order side is required and must be either 'BUY' or 'SELL'"}),price:f.string().trim().min(1,"Price is required and cannot be empty").refine((e)=>!Number.isNaN(Number(e)),"Price must be a valid number").refine((e)=>Number(e)>0,"Price must be greater than 0"),quantity:f.string().trim().min(1,"Quantity is required and cannot be empty").refine((e)=>!Number.isNaN(Number(e)),"Quantity must be a valid number").refine((e)=>Number(e)>0,"Quantity must be greater than 0"),orderType:f.enum(["LIMIT","MARKET"]).optional(),slippageToleranceBps:f.number().int().min(0,"Slippage tolerance must be between 0 and 1000 bps").max(1000,"Slippage tolerance must be between 0 and 1000 bps").optional()}).superRefine((e,t)=>{if(e.slippageToleranceBps!==void 0&&e.orderType!=="MARKET")t.addIssue({code:f.ZodIssueCode.custom,message:"slippageToleranceBps is only valid when orderType is MARKET",path:["slippageToleranceBps"]})}),x0e=f.object({applicationName:f.string().nullable().optional(),applicationTakerFee:f.string(),applicationTakerFeeBps:f.number(),buyOrderLockAmount:f.string().nullable().optional(),makerTotalReceipt:f.string(),monacoMakerRebate:f.string(),monacoMakerRebateBps:f.number(),monacoMakerRebateBpsExact:f.string(),monacoTakerFee:f.string(),monacoTakerFeeBps:f.number(),monacoTakerFeeBpsExact:f.string(),notional:f.string(),takerTotalPayment:f.string(),totalTakerFees:f.string(),maxQuantity:f.string().nullable(),maxQuantityRaw:f.string().nullable(),slippageToleranceBps:f.number().nullable()}),VO=f.object({tradingPairId:f.string().trim().min(1,"Trading pair ID is required and cannot be empty")}),FV=f.object({tierLevel:f.number().int(),minVolumeThreshold:f.string(),makerFeeBps:f.string(),takerFeeBps:f.string()}),v0e=f.object({currentTierLevel:f.number().int(),weightedVolume14d:f.string(),spotVolume14d:f.string(),perpVolume14d:f.string(),volumeToNextTier:f.string().nullable().optional(),nextTierLevel:f.number().int().nullable().optional(),feeSchedule:f.array(FV)});var qV=f.object({token:f.string(),available:f.string()}),_0e=f.object({balances:f.array(qV)}),w0e=f.object({code:f.string(),createdAt:f.string(),customCode:f.string(),isCustom:f.boolean(),display:f.string()}),HV=f.enum(["taken","too_short","too_long","reserved","invalid_char","looks_like_address"]),S0e=f.object({available:f.boolean(),reason:f.preprocess((e)=>e===""||e===null?void 0:e,HV.optional())}),ZO=f.object({code:f.string().trim().min(1,"code is required").regex(/^[A-Za-z][A-Za-z0-9_]{4,19}$/,"code must start with a letter and be 5–20 chars of letters, digits, or underscores")}),T0e=f.object({code:f.string()}),WO=f.object({token:f.string().trim().min(1,"token is required").regex(/^0x[0-9a-fA-F]{40}$/,"token must be a 0x-prefixed EVM address"),amount:f.string().trim().min(1,"amount is required").refine((e)=>/^\d+$/.test(e)&&BigInt(e)>0n,"amount must be a positive integer string")}),E0e=f.object({rewardsBalance:f.string(),tradingBalance:f.string()});var B1=["SUBMITTED","PARTIALLY_FILLED","FILLED","SETTLED_ON_CHAIN","SETTLED","CANCELLED","REJECTED","EXPIRED"];class GV extends Error{issues;constructor(e){let t=e.issues.map((r)=>{let o=r.path.join(".");return`${o?`${o}: `:""}${r.message}`});super(`Validation failed:
|
|
145
145
|
- ${t.join(`
|
|
146
|
-
- `)}`);this.name="ValidationError",this.issues=e.issues}getErrors(){let e={};for(let t of this.issues){let r=t.path.join(".");e[r||"root"]=t.message}return e}}function _e(e,t){let r=e.safeParse(t);if(!r.success)throw new GV(r.error);return r.data}var Yp=f.enum(["BUY","SELL"],{message:'Order side must be "BUY" or "SELL"'}),my=f.enum(["SPOT","MARGIN"],{message:'Trading mode must be "SPOT" or "MARGIN"'}),j1=f.enum(["ISOLATED","CROSS"],{message:'Margin mode must be "ISOLATED" or "CROSS"'}),hy=f.enum(["LONG","SHORT","NONE"],{message:'Position side must be "LONG", "SHORT", or "NONE"'}),VV=f.enum(["GTC","IOC","FOK"],{message:'Time in force must be "GTC", "IOC", or "FOK"'}),KO=f.enum(["GTC","IOC"],{message:'Conditional order time in force must be "GTC" or "IOC"'}),Qp=f.enum(["LIMIT","MARKET"],{message:'Order type must be "LIMIT" or "MARKET"'}),bt=f.string().trim().min(1,"Value cannot be empty").regex(/^\d+(\.\d+)?$/,"Value must be a positive decimal number (e.g., '1.5', '100')").refine((e)=>Number.parseFloat(e)>0,{message:"Value must be greater than 0"}),Ae=f.uuid({message:"Must be a valid UUID (e.g., '123e4567-e89b-12d3-a456-426614174000')"}),Ju=f.iso.datetime({message:"Must be a valid ISO 8601 date string (e.g., '2024-12-31T23:59:59Z')"}),ZV=f.number().min(0,"Slippage tolerance must be at least 0 (no slippage)").max(1,"Slippage tolerance cannot exceed 1 (100%)").optional(),gy=f.number().int().min(0,"Slippage tolerance must be at least 0 bps").max(1e4,"Slippage tolerance cannot exceed 10000 bps"),I0e=f.number().int().min(0,"Slippage tolerance must be at least 0 bps").max(500,"TWAP slippage tolerance cannot exceed 500 bps (5%)"),D1=f.object({triggerPrice:bt,orderType:Qp,limitPrice:bt.optional(),quantity:bt.optional(),closePosition:f.boolean().optional(),timeInForce:KO.optional(),slippageToleranceBps:gy.optional(),expiresAt:Ju.optional()}).refine((e)=>e.orderType!=="LIMIT"||e.limitPrice!==void 0,{message:"limitPrice is required for LIMIT parent TP/SL",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.limitPrice===void 0,{message:"limitPrice must not be provided for MARKET parent TP/SL",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce is only allowed for LIMIT parent TP/SL",path:["timeInForce"]}).refine((e)=>e.orderType!=="LIMIT"||e.slippageToleranceBps===void 0,{message:"slippageToleranceBps is only allowed for MARKET parent TP/SL",path:["slippageToleranceBps"]}).refine((e)=>e.closePosition!==!0||e.quantity===void 0,{message:"quantity must be omitted when closePosition is true",path:["quantity"]}).refine((e)=>e.quantity!==void 0||e.closePosition!==!1,{message:"quantity is required when closePosition is false",path:["closePosition"]}),U1=(e)=>e?.takeProfit!==void 0||e?.stopLoss!==void 0,JO=(e,t)=>t===void 0||t!=="NONE"&&(e==="BUY"&&t==="LONG"||e==="SELL"&&t==="SHORT"),WV=f.object({tradingPairId:Ae,side:Yp,quantity:bt,price:bt,options:f.object({tradingMode:my.optional(),useMasterBalance:f.boolean().optional(),expirationDate:Ju.optional(),timeInForce:VV.optional(),marginAccountId:Ae.optional(),marginMode:j1.optional(),riskBucketId:Ae.optional(),riskBucketCollateral:bt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:hy.optional(),leverage:bt.optional(),reduceOnly:f.boolean().optional(),postOnly:f.boolean().optional(),takeProfit:D1.optional(),stopLoss:D1.optional()}).optional()}).refine((e)=>JO(e.side,e.options?.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["options","positionSide"]}).refine((e)=>e.options?.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["options","leverage"]}).refine((e)=>!U1(e.options)||e.options?.tradingMode==="MARGIN",{message:"takeProfit/stopLoss are only supported for MARGIN orders",path:["options"]}).refine((e)=>!U1(e.options)||e.options?.reduceOnly!==!0,{message:"takeProfit/stopLoss cannot be attached to reduce-only orders",path:["options"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode===void 0||e.options?.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["options","marginAccountId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["options","riskBucketCollateral"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["options","reduceOnly"]}).refine((e)=>e.options?.postOnly!==!0||e.options?.timeInForce===void 0||e.options.timeInForce!=="IOC"&&e.options.timeInForce!=="FOK",{message:"postOnly cannot be combined with IOC/FOK time in force",path:["options","timeInForce"]}),KV=f.object({tradingPairId:Ae,side:Yp,quantity:bt,options:f.object({tradingMode:my.optional(),slippageTolerance:ZV,marginAccountId:Ae.optional(),marginMode:j1.optional(),riskBucketId:Ae.optional(),riskBucketCollateral:bt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:hy.optional(),leverage:bt.optional(),reduceOnly:f.boolean().optional(),takeProfit:D1.optional(),stopLoss:D1.optional()}).optional()}).refine((e)=>JO(e.side,e.options?.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["options","positionSide"]}).refine((e)=>e.options?.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["options","leverage"]}).refine((e)=>!U1(e.options)||e.options?.tradingMode==="MARGIN",{message:"takeProfit/stopLoss are only supported for MARGIN orders",path:["options"]}).refine((e)=>!U1(e.options)||e.options?.reduceOnly!==!0,{message:"takeProfit/stopLoss cannot be attached to reduce-only orders",path:["options"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode===void 0||e.options?.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["options","marginAccountId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["options","riskBucketCollateral"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["options","reduceOnly"]}),JV=f.object({orderId:Ae}),YV=f.object({orderId:Ae,newOrder:f.object({price:bt.optional(),quantity:bt.optional(),useMasterBalance:f.boolean().optional(),postOnly:f.boolean().optional()})}),QV=f.object({status:f.union([f.enum(B1),f.array(f.enum(B1)).min(1,"Status filter must list at least one status")]).optional(),tradingPairId:Ae.optional(),tradingMode:my.optional(),marginAccountId:Ae.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(1000,"Page size cannot exceed 1000").optional(),pageToken:f.string().optional()}).superRefine((e,t)=>{if(e.page!==void 0&&e.pageToken===void 0&&e.pageSize!==void 0&&e.pageSize>100)t.addIssue({code:f.ZodIssueCode.custom,message:"Page size cannot exceed 100 in page-number mode (page without pageToken)",path:["pageSize"]})}),t2t=f.enum(["STOP_LOSS","TAKE_PROFIT"],{message:'conditionType must be "STOP_LOSS" or "TAKE_PROFIT"'}),r2t=f.enum(["MARK_PRICE"],{message:'triggerSource must be "MARK_PRICE"'}),P0e=f.enum(["PENDING_PARENT","ACTIVE","TRIGGERING","TRIGGERED","CANCELLED","EXPIRED","FAILED"],{message:"Invalid conditional order state"}),n2t=f.enum(["LONG","SHORT"],{message:'Position side must be "LONG" or "SHORT"'}),YO=f.object({conditionalOrderId:Ae}),XV=f.object({marginAccountId:Ae.optional(),tradingPairId:Ae.optional(),state:P0e.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),k0e=f.enum(["PENDING","ACTIVE","COMPLETED","CANCELLED"],{message:"Invalid TWAP order state"}),A0e=f.union([f.number().int("durationSeconds must be a whole number of seconds").positive("durationSeconds must be greater than 0"),f.string().regex(/^[1-9]\d*$/,"durationSeconds must be a positive integer string (e.g., '3600')")]),eZ=f.object({tradingPairId:Ae,side:Yp,quantity:bt,options:f.object({durationSeconds:A0e.optional(),startTime:Ju.optional(),endTime:Ju.optional(),limitPrice:bt.optional(),slippageToleranceBps:I0e.optional(),randomize:f.boolean().optional(),reduceOnly:f.boolean().optional(),tradingMode:my.optional(),marginAccountId:Ae.optional(),riskBucketId:Ae.optional(),marginMode:j1.optional(),leverage:bt.optional(),strategyKey:f.string().min(1).max(128).optional(),useMasterBalance:f.boolean().optional(),clientTwapId:f.string().min(1).max(36,"clientTwapId cannot exceed 36 characters").optional()})}).refine((e)=>e.options.durationSeconds!==void 0!==(e.options.endTime!==void 0),{message:"Exactly one of durationSeconds or endTime must be set",path:["options","durationSeconds"]}).refine((e)=>e.options.startTime===void 0||e.options.endTime!==void 0,{message:"startTime is only valid together with endTime",path:["options","startTime"]}).refine((e)=>e.options.marginMode===void 0||e.options.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options.riskBucketId===void 0||e.options.tradingMode==="MARGIN",{message:"riskBucketId is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options.marginMode!=="CROSS"||e.options.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options.marginMode!=="CROSS"||e.options.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN TWAP orders",path:["options","leverage"]}),QO=f.object({twapOrderId:Ae}),tZ=f.object({state:k0e.optional(),tradingPairId:Ae.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),R0e=f.object({tradingPairId:Ae,orderType:Qp,side:Yp,price:bt.optional(),quantity:bt,tradingMode:my.optional(),slippageTolerance:ZV,useMasterBalance:f.boolean().optional(),expirationDate:Ju.optional(),timeInForce:VV.optional(),marginAccountId:Ae.optional(),marginMode:j1.optional(),riskBucketId:Ae.optional(),riskBucketCollateral:bt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:hy.optional(),leverage:bt.optional(),reduceOnly:f.boolean().optional(),postOnly:f.boolean().optional()}).refine((e)=>e.orderType!=="LIMIT"||e.price!==void 0,{message:"Price is required for LIMIT orders",path:["price"]}).refine((e)=>e.orderType!=="MARKET"||e.price===void 0,{message:"Price must not be provided for MARKET orders",path:["price"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce must not be provided for MARKET orders",path:["timeInForce"]}).refine((e)=>e.orderType!=="MARKET"||e.postOnly!==!0,{message:"postOnly must not be provided for MARKET orders",path:["postOnly"]}).refine((e)=>e.postOnly!==!0||e.timeInForce===void 0||e.timeInForce!=="IOC"&&e.timeInForce!=="FOK",{message:"postOnly cannot be combined with IOC/FOK time in force",path:["postOnly"]}).refine((e)=>e.riskBucketCollateral===void 0||e.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["tradingMode"]}).refine((e)=>e.marginMode===void 0||e.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["tradingMode"]}).refine((e)=>e.marginMode!=="CROSS"||e.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["marginAccountId"]}).refine((e)=>e.marginMode!=="CROSS"||e.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["riskBucketId"]}).refine((e)=>e.marginMode!=="CROSS"||e.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["riskBucketCollateral"]}).refine((e)=>e.marginMode!=="CROSS"||e.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["strategyKey"]}).refine((e)=>e.riskBucketCollateral===void 0||e.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["riskBucketId"]}).refine((e)=>e.riskBucketCollateral===void 0||e.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["reduceOnly"]}).refine((e)=>JO(e.side,e.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["positionSide"]}).refine((e)=>e.tradingMode!=="MARGIN"||e.reduceOnly===!0||e.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["leverage"]}),L1=100,rZ=f.object({orders:f.array(R0e).min(1,"At least one order is required").max(L1,`At most ${L1} orders per batch request`)}),$0e=f.object({orderId:Ae,price:bt.optional(),quantity:bt.optional(),useMasterBalance:f.boolean().optional(),postOnly:f.boolean().optional()}).refine((e)=>e.price!==void 0||e.quantity!==void 0,{message:"At least one of price or quantity must be provided"}),nZ=f.object({orders:f.array($0e).min(1,"At least one order is required").max(L1,`At most ${L1} orders per batch request`)});var XO=f.object({page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),oZ=XO.extend({state:f.string().trim().min(1,"State cannot be empty").optional(),tradingPairId:Ae.optional()}),iZ=f.object({marginAccountId:Ae,tradingPairId:Ae.optional()}),aZ=f.object({tradingPairId:Ae.optional()}).optional(),sZ=f.object({asset:f.string().trim().min(1,"Asset cannot be empty").optional()}).optional(),O0e=f.object({asset:f.string().trim().min(1,"Asset cannot be empty"),amount:bt,tradingPairId:Ae.optional(),strategyKey:f.string().trim().min(1,"Strategy key cannot be empty").optional(),marginMode:f.enum(["ISOLATED","CROSS"]).optional()}).refine((e)=>!(e.marginMode==="CROSS"&&e.tradingPairId!==void 0),{message:"tradingPairId is not supported for CROSS risk buckets",path:["tradingPairId"]}),F1=f.object({asset:f.string().trim().min(1,"Asset cannot be empty"),amount:bt}),C0e=f.object({tradingPairId:Ae,strategyKey:f.string().trim().min(1,"Strategy key cannot be empty").optional()}),z0e=f.array(Ae).min(1,"selectedTradingPairIds is required for CROSS risk buckets"),cZ=C0e.extend({marginMode:f.literal("ISOLATED").optional(),selectedTradingPairIds:f.never().optional()}),uZ=f.object({marginMode:f.literal("CROSS"),selectedTradingPairIds:z0e,strategyKey:f.never().optional()}),N0e=uZ.extend({tradingPairId:f.never().optional()}),eC=f.object({marginAccountId:Ae,request:O0e}),lZ=f.object({request:F1}),dZ=f.object({request:f.union([F1.merge(cZ).strict(),F1.merge(N0e).strict()])}),pZ=f.object({request:F1}),fZ=XO.extend({marginAccountId:Ae,movementType:f.string().trim().min(1,"Movement type cannot be empty").optional()}),mZ=XO.extend({movementType:f.string().trim().min(1,"Movement type cannot be empty").optional()}).optional(),tC=f.object({tradingPairId:Ae,side:Yp,positionSide:hy.optional(),orderType:Qp,price:bt.optional(),quantity:bt,leverage:bt.optional(),reduceOnly:f.boolean().optional()}),rC=(e,t)=>{if(e.positionSide!==void 0){let r=e.side==="BUY"?"LONG":"SHORT";if(e.positionSide!==r)t.addIssue({code:f.ZodIssueCode.custom,message:"positionSide must match side when provided (BUY=LONG, SELL=SHORT)",path:["positionSide"]})}if(e.reduceOnly!==!0&&e.leverage===void 0)t.addIssue({code:f.ZodIssueCode.custom,message:"leverage is required for normal margin orders",path:["leverage"]})},hZ=tC.strict().superRefine(rC),M0e=tC.merge(cZ).strict().superRefine(rC),B0e=tC.merge(uZ).strict().superRefine(rC).refine((e)=>e.selectedTradingPairIds.includes(e.tradingPairId),{message:"tradingPairId must be included in selectedTradingPairIds for CROSS risk buckets",path:["selectedTradingPairIds"]}),D0e=f.union([M0e,B0e]),gZ=f.object({marginAccountId:Ae,request:hZ}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]}),yZ=f.object({request:hZ}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]}),bZ=f.object({request:D0e}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]});var xZ=f.enum(["1m","5m","15m","30m","1h","4h","1d","1w","1M"],{message:'Interval must be one of: "1m", "5m", "15m", "30m", "1h", "4h", "1d", "1w", "1M"'}),U0e=31536000000,L0e=946684800000,q1=f.number().int().positive({message:"Timestamp must be a positive integer (milliseconds since epoch)"}).min(L0e,{message:"Timestamp must be at least Jan 1, 2000 (946684800000 ms). Did you pass seconds instead of milliseconds?"}).max(Number.MAX_SAFE_INTEGER,{message:"Timestamp must not exceed JavaScript's maximum safe integer"}).refine((e)=>e<=Date.now()+U0e,{message:"Timestamp must not be unreasonably far in the future (max 1 year ahead)"}),l2t=f.object({tradingPairId:Ae,interval:xZ,startTime:q1,endTime:q1}).refine((e)=>e.startTime<e.endTime,{message:"startTime must be less than endTime",path:["endTime"]}),d2t=f.string().min(1,"Trading pair symbol cannot be empty").regex(/^[A-Za-z0-9]{1,10}\/[A-Za-z0-9]{1,10}$/,{message:'Trading pair symbol must be in format "BASE/QUOTE" (e.g., "BTC/USDT", "ETH/USD")'}),j0e=f.number().int().positive({message:"Limit must be a positive integer"}).max(500,{message:"Limit cannot exceed 500 bars per request"}).optional(),vZ=f.object({tradingPairId:Ae,interval:xZ,startTime:q1.optional(),endTime:q1.optional(),limit:j0e,priceType:f.enum(["trade","mark"]).optional()}).refine((e)=>{if(e.startTime!==void 0&&e.endTime!==void 0)return e.startTime<e.endTime;return!0},{message:"startTime must be less than endTime",path:["endTime"]});var p2t=f.object({tradingPairId:Ae}),f2t=f.object({query:f.string().min(1,"Search query cannot be empty").optional(),pageSize:f.number().int().min(1).max(100).optional(),page:f.number().int().min(1).optional()}),Li=f.object({tradingPairId:Ae});var wZ=f.object({page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),F0e=f.enum(["OPEN","CLOSED","LIQUIDATING","LIQUIDATED"],{message:'Position status must be "OPEN", "CLOSED", "LIQUIDATING", or "LIQUIDATED"'}),q0e=f.enum(["MARKET","LIMIT","IOC"],{message:'Close type must be "MARKET", "LIMIT", or "IOC"'}),yy=f.object({positionId:Ae}),SZ=wZ.extend({marginAccountId:Ae.optional(),tradingPairId:Ae.optional(),status:F0e.optional()}),TZ=yy,EZ=yy.extend({request:f.object({closeType:q0e,limitPrice:bt.optional(),slippageToleranceBps:gy.optional(),quantity:bt.optional()})}).refine((e)=>e.request.closeType==="MARKET"||e.request.limitPrice!==void 0,{message:"limitPrice is required for LIMIT and IOC close requests",path:["request","limitPrice"]}).refine((e)=>e.request.closeType!=="MARKET"||e.request.limitPrice===void 0,{message:"limitPrice is not allowed for MARKET close requests",path:["request","limitPrice"]}),IZ=f.object({tradingPairId:Ae.optional(),slippageToleranceBps:gy.optional()}),PZ=yy,_Z=f.object({triggerPrice:bt,orderType:Qp,limitPrice:bt.optional(),quantity:bt.optional(),closePosition:f.boolean().optional(),timeInForce:KO.optional(),slippageToleranceBps:gy.optional(),expiresAt:Ju.optional()}).refine((e)=>e.orderType!=="LIMIT"||e.limitPrice!==void 0,{message:"limitPrice is required for LIMIT TP/SL legs",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.limitPrice===void 0,{message:"limitPrice must not be provided for MARKET TP/SL legs",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce is only allowed for LIMIT TP/SL legs",path:["timeInForce"]}).refine((e)=>e.orderType!=="LIMIT"||e.slippageToleranceBps===void 0,{message:"slippageToleranceBps is only allowed for MARKET TP/SL legs",path:["slippageToleranceBps"]}).refine((e)=>e.closePosition!==!0||e.quantity===void 0,{message:"quantity must be omitted when closePosition is true",path:["quantity"]}).refine((e)=>e.quantity!==void 0||e.closePosition!==!1,{message:"quantity is required when closePosition is false",path:["closePosition"]}),kZ=yy.extend({request:f.object({takeProfit:_Z.optional(),stopLoss:_Z.optional(),oco:f.boolean().optional()}).refine((e)=>e.takeProfit!==void 0||e.stopLoss!==void 0,{message:"At least one of takeProfit or stopLoss is required"}).refine((e)=>e.oco!==!0||e.takeProfit!==void 0&&e.stopLoss!==void 0,{message:"oco=true requires both takeProfit and stopLoss",path:["oco"]})}),AZ=wZ.extend({positionId:Ae.optional(),marginAccountId:Ae.optional(),tradingPairId:Ae.optional(),reductionOnly:f.boolean().optional()}),H0e=f.enum(["1m","5m","15m","1h","4h","1d"],{message:'Interval must be one of "1m", "5m", "15m", "1h", "4h", "1d"'}),RZ=yy.extend({params:f.object({interval:H0e,startTime:f.number().int().min(0,"startTime must be a non-negative millisecond timestamp").optional(),endTime:f.number().int().min(0,"endTime must be a non-negative millisecond timestamp").optional()}).refine((e)=>e.startTime===void 0||e.endTime===void 0||e.startTime<e.endTime,{message:"startTime must be less than endTime",path:["startTime"]})});var G0e=f.enum(["CREDIT","DEBIT","LOCK","UNLOCK","FEE"],{message:'Entry type must be "CREDIT", "DEBIT", "LOCK", "UNLOCK", or "FEE"'}),V0e=f.enum(["DEPOSIT","WITHDRAWAL","TRADE","FEE","FUNDING","LIQUIDATION","INTEREST","REWARD"],{message:'Transaction type must be "DEPOSIT", "WITHDRAWAL", "TRADE", "FEE", "FUNDING", "LIQUIDATION", "INTEREST", or "REWARD"'}),$Z=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional(),entryType:G0e.optional(),transactionType:V0e.optional(),assetId:Ae.optional()}),OZ=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(1000,"Page size cannot exceed 1000").optional(),tradingPairId:Ae.optional(),pageToken:f.string().optional()}).superRefine((e,t)=>{if(e.page!==void 0&&e.pageToken===void 0&&e.pageSize!==void 0&&e.pageSize>100)t.addIssue({code:f.ZodIssueCode.custom,message:"Page size cannot exceed 100 in page-number mode (page without pageToken)",path:["pageSize"]})}),CZ=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional(),tradingPairId:Ae.optional(),positionId:Ae.optional(),marginAccountId:Ae.optional()});var S2t=f.string().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Must be a valid Ethereum address (e.g., '0x1234...5678')"}),nC=f.union([f.string().regex(/^\d+$/,"Must be a positive integer string").refine((e)=>BigInt(e)>0n,{message:"Amount must be greater than 0"}),f.bigint().refine((e)=>e>0n,{message:"Amount must be greater than 0"})]),zZ=f.object({assetId:Ae,amount:nC,autoWait:f.boolean().optional()}),NZ=f.object({assetId:Ae,amount:nC,autoWait:f.boolean().optional(),target:f.enum(["spot","margin"]).optional()}),MZ=f.object({assetId:Ae,amount:nC,destination:f.string().regex(/^0x[a-fA-F0-9]{40}$/,"destination must be a 0x-prefixed 20-byte hex address"),autoWait:f.boolean().optional(),source:f.enum(["spot","margin"]).optional()}),T2t=f.object({assetId:Ae});class H1 extends tt{async simulateFees(e){let t=_e(GO,e),r=new URLSearchParams;if(r.append("tradingPairId",t.tradingPairId),r.append("side",t.side),r.append("price",t.price),r.append("quantity",t.quantity),t.orderType!==void 0)r.append("orderType",t.orderType);if(t.slippageToleranceBps!==void 0)r.append("slippageToleranceBps",String(t.slippageToleranceBps));let o=`/api/v1/fees/simulate?${r.toString()}`;return await this.makeAuthenticatedRequest(o,{method:"GET"})}async getMyFeeTier(e){let t=_e(VO,e),r=new URLSearchParams;r.append("tradingPairId",t.tradingPairId);let o=`/api/v1/fees/tier?${r.toString()}`;return await this.makeAuthenticatedRequest(o,{method:"GET"})}}class G1 extends tt{async listMarginAccounts(e){if(e)_e(oZ,e);return await this.makeAuthenticatedRequest(ce.marginAccounts.list(e?{page:e.page,pageSize:e.pageSize,state:e.state,tradingPairId:e.tradingPairId}:void 0))}async getMarginAccountSummary(e,t){return _e(iZ,{marginAccountId:e,...t}),await this.makeAuthenticatedRequest(ce.marginAccounts.summary(e,{tradingPairId:t?.tradingPairId}))}async getParentMarginAccountSummary(e){return _e(aZ,e),await this.makeAuthenticatedRequest(ce.marginAccounts.parentSummary({tradingPairId:e?.tradingPairId}))}async getAvailableCollateral(e){return _e(sZ,e),await this.makeAuthenticatedRequest(ce.marginAccounts.availableCollateral(e))}async transferCollateralToMarginAccount(e,t){return _e(eC,{marginAccountId:e,request:t}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferIn(e),{method:"POST",body:JSON.stringify({asset:t.asset,amount:t.amount,tradingPairId:t.tradingPairId,strategyKey:t.strategyKey})})}async transferCollateralToParentMarginAccount(e){return _e(lZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferInParent(),{method:"POST",body:JSON.stringify({asset:e.asset,amount:e.amount})})}async transferCollateralToRiskBucket(e){return _e(dZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferInRiskBucket(),{method:"POST",body:JSON.stringify({asset:e.asset,amount:e.amount,tradingPairId:e.tradingPairId,strategyKey:e.strategyKey,marginMode:e.marginMode,selectedTradingPairIds:e.selectedTradingPairIds})})}async transferCollateralFromMarginAccount(e,t){return _e(eC,{marginAccountId:e,request:t}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferOut(e),{method:"POST",body:JSON.stringify({asset:t.asset,amount:t.amount,tradingPairId:t.tradingPairId,strategyKey:t.strategyKey,marginMode:t.marginMode})})}async transferCollateralFromParentMarginAccount(e){return _e(pZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferOutParent(),{method:"POST",body:JSON.stringify({asset:e.asset,amount:e.amount})})}async getMarginAccountMovements(e,t){return _e(fZ,{marginAccountId:e,...t}),await this.makeAuthenticatedRequest(ce.marginAccounts.movements(e,t))}async getParentMarginAccountMovements(e){return _e(mZ,e),await this.makeAuthenticatedRequest(ce.marginAccounts.parentMovements(e))}async simulateOrderRisk(e,t){return _e(gZ,{marginAccountId:e,request:t}),await this.makeAuthenticatedRequest(ce.marginAccounts.simulateOrderRisk(e),{method:"POST",body:JSON.stringify({tradingPairId:t.tradingPairId,side:t.side,positionSide:t.positionSide,orderType:t.orderType,price:t.price,quantity:t.quantity,leverage:t.leverage,reduceOnly:t.reduceOnly})})}async simulateParentMarginOrderRisk(e){return _e(yZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.simulateParentMarginOrderRisk(),{method:"POST",body:JSON.stringify({tradingPairId:e.tradingPairId,side:e.side,positionSide:e.positionSide,orderType:e.orderType,price:e.price,quantity:e.quantity,leverage:e.leverage,reduceOnly:e.reduceOnly})})}async simulateRiskBucketOrderRisk(e){return _e(bZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.simulateRiskBucketOrderRisk(),{method:"POST",body:JSON.stringify({tradingPairId:e.tradingPairId,strategyKey:e.strategyKey,marginMode:e.marginMode,selectedTradingPairIds:e.selectedTradingPairIds,side:e.side,positionSide:e.positionSide,orderType:e.orderType,price:e.price,quantity:e.quantity,leverage:e.leverage,reduceOnly:e.reduceOnly})})}}class V1 extends tt{async getPaginatedTradingPairs(e){let t=new URLSearchParams;if(e?.page!==void 0)t.append("page",e.page.toString());if(e?.pageSize!==void 0)t.append("pageSize",e.pageSize.toString());if(e?.marketType)t.append("marketType",e.marketType);if(e?.baseToken)t.append("baseToken",e.baseToken);if(e?.quoteToken)t.append("quoteToken",e.quoteToken);if(e?.isActive!==void 0)t.append("isActive",e.isActive.toString());if(e?.category)t.append("category",e.category);let r=t.toString(),o=r?`/api/v1/market/pairs?${r}`:"/api/v1/market/pairs";return await this.makePublicRequest(o)}async getTradingPair(e){return _e(Li,{tradingPairId:e}),(await this.makePublicRequest(ce.market.getTradingPair(e))).tradingPair}async getTradingPairBySymbol(e,t){return(await this.getPaginatedTradingPairs({pageSize:100,marketType:t})).tradingPairs.find((o)=>o.symbol===e)}async getCandlesticks(e,t,r){_e(vZ,{tradingPairId:e,interval:t,startTime:r?.startTime,endTime:r?.endTime,limit:r?.limit,priceType:r?.priceType});let o=new URLSearchParams;if(r?.startTime!==void 0)o.append("startTime",r.startTime.toString());if(r?.endTime!==void 0)o.append("endTime",r.endTime.toString());if(r?.limit!==void 0)o.append("limit",r.limit.toString());if(r?.priceType!==void 0)o.append("priceType",r.priceType);let n=o.toString(),i=n?`/api/v1/market/pairs/charts/candlestick/${encodeURIComponent(e)}/${t}?${n}`:`/api/v1/market/pairs/charts/candlestick/${encodeURIComponent(e)}/${t}`;return(await this.makePublicRequest(i)).data||[]}async getMarketMetadata(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getMarketMetadata(e))}async getPerpMarketConfig(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getPerpMarketConfig(e))}async getPerpMarketSummary(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getPerpMarketSummary(e))}async getMarkPrice(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getMarkPrice(e))}async getIndexPrice(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getIndexPrice(e))}async getFundingState(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getFundingState(e))}async listFundingHistory(e,t){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.listFundingHistory(e,t))}async listAllFundingHistory(e){return await this.makePublicRequest(ce.market.listAllFundingHistory(e))}async getOpenInterest(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getOpenInterest(e))}async getScreener(e){return await this.makePublicRequest(ce.market.getScreener(e))}async getMarketStats(){return await this.makePublicRequest(ce.market.getMarketStats())}}class Z1 extends tt{async getOrderbook(e,t={}){let{depth:r=10,tradingMode:o,magnitude:n,denomination:i}=t,a=new URLSearchParams;if(a.set("levels",String(r)),o)a.set("tradingMode",o);if(n!==void 0)a.set("magnitude",String(n));if(i)a.set("denomination",i.toLowerCase());let s=await this.makePublicRequest(`/api/v1/orderbook/${encodeURIComponent(e)}?${a.toString()}`);return{tradingPairId:s.tradingPairId,tradingMode:s.tradingMode,bids:s.data.bids.map((c)=>({price:c.price,quantity:c.quantity,orderCount:c.orderCount})),asks:s.data.asks.map((c)=>({price:c.price,quantity:c.quantity,orderCount:c.orderCount})),bestBid:s.data.bestBid,bestAsk:s.data.bestAsk,bidVolume:s.data.bidVolume,askVolume:s.data.askVolume,baseDecimals:s.baseDecimals,quoteDecimals:s.quoteDecimals,timestamp:s.timestamp,sequence:s.sequenceNumber}}}class W1 extends tt{async getMyTraderCode(){return await this.makeAuthenticatedRequest("/api/v1/pitpass/codes/me",{method:"GET"})}async setTraderCode(e){let t=_e(ZO,{code:e});return await this.makeAuthenticatedRequest("/api/v1/pitpass/codes/me/custom",{method:"PUT",body:JSON.stringify({code:t.code})})}async clearTraderCode(){return await this.makeAuthenticatedRequest("/api/v1/pitpass/codes/me/custom",{method:"DELETE"})}async checkTraderCodeAvailability(e){let t=new URLSearchParams({code:e.trim()}).toString(),r=await this.makePublicRequest(`/api/v1/pitpass/codes/available?${t}`,{method:"GET"});return{available:r.available,reason:r.reason?r.reason:void 0}}async getTraderCodeInfo(e){let t=encodeURIComponent(e.trim());return await this.makePublicRequest(`/api/v1/pitpass/codes/${t}`,{method:"GET"})}async getRewardsBalance(){return await this.makeAuthenticatedRequest("/api/v1/pitpass/rewards/balance",{method:"GET"})}async transferRewards(e){let t=_e(WO,e);return await this.makeAuthenticatedRequest("/api/v1/pitpass/rewards/transfer",{method:"POST",body:JSON.stringify({token:t.token,amount:t.amount})})}}var by="/api/v1/accounts/me/portfolio";function K1(e,t){if(!t?.period)return e;return`${e}?${new URLSearchParams({period:t.period})}`}class J1 extends tt{async getSummary(e){return await this.makeAuthenticatedRequest(K1(`${by}/summary`,e))}async getPerformance(e){return await this.makeAuthenticatedRequest(K1(`${by}/performance`,e))}async getRealizedPnl(e){return await this.makeAuthenticatedRequest(K1(`${by}/realized-pnl`,e))}async getAssets(e){return await this.makeAuthenticatedRequest(K1(`${by}/assets`,e))}async getMargin(){return await this.makeAuthenticatedRequest(`${by}/margin`)}}class Y1 extends tt{async listPositions(e){if(e)_e(SZ,e);return await this.makeAuthenticatedRequest(ce.positions.list(e))}async getPosition(e){return _e(TZ,{positionId:e}),await this.makeAuthenticatedRequest(ce.positions.get(e))}async closePosition(e,t){return _e(EZ,{positionId:e,request:t}),await this.makeAuthenticatedRequest(ce.positions.close(e),{method:"POST",body:JSON.stringify({closeType:t.closeType,limitPrice:t.limitPrice,slippageToleranceBps:t.slippageToleranceBps,quantity:t.quantity})})}async batchCloseAllPositions(e){if(e)_e(IZ,e);return await this.makeAuthenticatedRequest(ce.positions.batchCloseAll(),{method:"POST",body:JSON.stringify({tradingPairId:e?.tradingPairId,slippageToleranceBps:e?.slippageToleranceBps})})}async getPositionRisk(e){return _e(PZ,{positionId:e}),await this.makeAuthenticatedRequest(ce.positions.risk(e))}async attachPositionTpSl(e,t){return _e(kZ,{positionId:e,request:t}),await this.makeAuthenticatedRequest(ce.positions.attachTpSl(e),{method:"POST",body:JSON.stringify({takeProfit:t.takeProfit?{triggerPrice:t.takeProfit.triggerPrice,orderType:t.takeProfit.orderType,limitPrice:t.takeProfit.limitPrice,quantity:t.takeProfit.quantity,closePosition:t.takeProfit.closePosition,timeInForce:t.takeProfit.timeInForce,slippageToleranceBps:t.takeProfit.slippageToleranceBps,expiresAt:t.takeProfit.expiresAt}:void 0,stopLoss:t.stopLoss?{triggerPrice:t.stopLoss.triggerPrice,orderType:t.stopLoss.orderType,limitPrice:t.stopLoss.limitPrice,quantity:t.stopLoss.quantity,closePosition:t.stopLoss.closePosition,timeInForce:t.stopLoss.timeInForce,slippageToleranceBps:t.stopLoss.slippageToleranceBps,expiresAt:t.stopLoss.expiresAt}:void 0,oco:t.oco})})}async listPositionHistory(e){if(e)_e(AZ,e);return await this.makeAuthenticatedRequest(ce.positions.history(e))}async getPositionPnlHistory(e,t){return _e(RZ,{positionId:e,params:t}),await this.makeAuthenticatedRequest(ce.positions.pnlHistory(e,t))}}class oC extends tt{async getProfile(){return await this.makeAuthenticatedRequest("/api/v1/accounts/me")}async getPaginatedUserMovements(e){if(e)_e($Z,e);let t=new URLSearchParams;if(e?.page!==void 0)t.append("page",e.page.toString());if(e?.pageSize!==void 0)t.append("pageSize",e.pageSize.toString());if(e?.entryType!==void 0)t.append("entryType",e.entryType);if(e?.transactionType!==void 0)t.append("transactionType",e.transactionType);if(e?.assetId!==void 0)t.append("assetId",e.assetId);let r=t.toString(),o=r?`/api/v1/accounts/movements?${r}`:"/api/v1/accounts/movements";return await this.makeAuthenticatedRequest(o)}async getUserBalances(e){let t=new URLSearchParams;if(e?.page!==void 0)t.append("page",e.page.toString());if(e?.pageSize!==void 0)t.append("pageSize",e.pageSize.toString());let r=t.toString(),o=r?`/api/v1/accounts/balances?${r}`:"/api/v1/accounts/balances";return await this.makeAuthenticatedRequest(o)}async getUserBalanceByAssetId(e){if(!e||e.trim()==="")throw new cr("assetId is required and cannot be empty",{endpoint:"/api/v1/accounts/balances/{assetId}"});let t=`/api/v1/accounts/balances/${e}`;return await this.makeAuthenticatedRequest(t)}async getPortfolioStats(e){let t=new URLSearchParams({period:e});return await this.makeAuthenticatedRequest(`/api/v1/accounts/me/portfolio?${t}`)}async getPortfolioChart(e,t){let r=new URLSearchParams({period:e,metric:t});return await this.makeAuthenticatedRequest(`/api/v1/accounts/me/portfolio/chart?${r}`)}async getUserTrades(e){if(e)_e(OZ,e);let t=e?.page!==void 0&&e?.pageToken===void 0,r=new URLSearchParams;if(t&&e?.page!==void 0)r.append("page",e.page.toString());if(e?.pageSize!==void 0)r.append("pageSize",e.pageSize.toString());if(e?.tradingPairId!==void 0)r.append("tradingPairId",e.tradingPairId);if(!t)r.append("pageToken",e?.pageToken??"");let o=r.toString(),n=o?`/api/v1/accounts/trades?${o}`:"/api/v1/accounts/trades";return await this.makeAuthenticatedRequest(n)}async*iterateUserTrades(e){let t="";for(;;){let r=await this.getUserTrades({...e,pageToken:t});if(yield*r.trades,!r.nextPageToken)return;t=r.nextPageToken}}async listFundingPayments(e){if(e)_e(CZ,e);let t=new URLSearchParams;if(e?.page!==void 0)t.append("page",e.page.toString());if(e?.pageSize!==void 0)t.append("pageSize",e.pageSize.toString());if(e?.tradingPairId!==void 0)t.append("tradingPairId",e.tradingPairId);if(e?.positionId!==void 0)t.append("positionId",e.positionId);if(e?.marginAccountId!==void 0)t.append("marginAccountId",e.marginAccountId);let r=t.toString(),o=r?`/api/v1/accounts/funding-payments?${r}`:"/api/v1/accounts/funding-payments";return await this.makeAuthenticatedRequest(o)}}class Q1 extends tt{async getPulse(){return await this.makePublicRequest("/api/v1/pulse",{method:"GET"})}}class X1 extends tt{async list(){return await this.makeAuthenticatedRequest(ce.subAccounts.list())}async createLimit(e){return await this.makeAuthenticatedRequest(ce.subAccounts.createLimit(),{method:"POST",body:JSON.stringify(e)})}async getLimits(e){return await this.makeAuthenticatedRequest(ce.subAccounts.getLimits(e))}async updateLimit(e,t,r){return await this.makeAuthenticatedRequest(ce.subAccounts.limit(e,t),{method:"PUT",body:JSON.stringify(r)})}async deleteLimit(e,t){await this.makeAuthenticatedRequest(ce.subAccounts.limit(e,t),{method:"DELETE"})}}class eS extends tt{async register(e){return await this.makePublicRequest(ce.sweeper.register(),{method:"POST",body:JSON.stringify(e)})}}function BZ(e){return{eventType:"trade",tradingPairId:e.tradingPairId,tradingMode:e.tradingMode.toUpperCase(),data:{tradeId:e.data.tradeId,price:e.data.price,quantity:e.data.quantity,makerSide:e.data.makerSide.toUpperCase(),executedAt:e.data.executedAt??""}}}class iC extends tt{async getTrades(e,t={}){let{page:r=1}=t,o=t.pageSize!=null&&t.pageSize>0?Math.min(t.pageSize,100):25,n=new URLSearchParams;if(r>1)n.set("page",String(r));return n.set("pageSize",String(o)),(await this.makePublicRequest(`/api/v1/trades/${encodeURIComponent(e)}?${n.toString()}`)).trades.map(BZ)}async getTradeById(e){let t=await this.makePublicRequest(ce.trades.byId(e));return BZ(t)}}function tS(e){if(!e)return;return{triggerPrice:e.triggerPrice,orderType:e.orderType,limitPrice:e.limitPrice,timeInForce:e.timeInForce,slippageToleranceBps:e.slippageToleranceBps,expiresAt:e.expiresAt,quantity:e.quantity,closePosition:e.closePosition}}class rS extends tt{async placeLimitOrder(e,t,r,o,n){_e(WV,{tradingPairId:e,side:t,quantity:r,price:o,options:n});let i={tradingPairId:e,orderType:"LIMIT",side:t,price:o,quantity:r,tradingMode:n?.tradingMode||"SPOT",useMasterBalance:n?.useMasterBalance,expirationDate:n?.expirationDate,timeInForce:n?.timeInForce,marginAccountId:n?.marginAccountId,marginMode:n?.marginMode,riskBucketId:n?.riskBucketId,riskBucketCollateral:n?.riskBucketCollateral,strategyKey:n?.strategyKey,positionSide:n?.positionSide,leverage:n?.leverage,reduceOnly:n?.reduceOnly,postOnly:n?.postOnly,clientOrderId:n?.clientOrderId,takeProfit:tS(n?.takeProfit),stopLoss:tS(n?.stopLoss)};return await this.makeAuthenticatedRequest(ce.orders.create(),{method:"POST",body:JSON.stringify(i)})}async placeMarketOrder(e,t,r,o){_e(KV,{tradingPairId:e,side:t,quantity:r,options:o});let n={tradingPairId:e,orderType:"MARKET",side:t,slippageToleranceBps:o?.slippageTolerance!==void 0?Math.round(o.slippageTolerance*1e4):void 0,price:null,quantity:r,tradingMode:o?.tradingMode||"SPOT",marginAccountId:o?.marginAccountId,marginMode:o?.marginMode,riskBucketId:o?.riskBucketId,riskBucketCollateral:o?.riskBucketCollateral,strategyKey:o?.strategyKey,positionSide:o?.positionSide,leverage:o?.leverage,reduceOnly:o?.reduceOnly,takeProfit:tS(o?.takeProfit),stopLoss:tS(o?.stopLoss),clientOrderId:o?.clientOrderId};return await this.makeAuthenticatedRequest(ce.orders.create(),{method:"POST",body:JSON.stringify(n)})}async cancelOrder(e){_e(JV,{orderId:e});let t={orderId:e};return await this.makeAuthenticatedRequest(ce.orders.cancel(),{method:"POST",body:JSON.stringify(t)})}async cancelConditionalOrder(e){return _e(YO,{conditionalOrderId:e}),await this.makeAuthenticatedRequest(ce.orders.cancelConditional(e),{method:"DELETE"})}async getConditionalOrder(e){return _e(YO,{conditionalOrderId:e}),await this.makeAuthenticatedRequest(ce.orders.getConditional(e),{method:"GET"})}async listConditionalOrders(e){if(e)_e(XV,e);let{page:t=1,pageSize:r=20,marginAccountId:o,tradingPairId:n,state:i}=e||{};return await this.makeAuthenticatedRequest(ce.orders.listConditional({page:t,pageSize:Math.min(Math.max(r,1),100),marginAccountId:o,tradingPairId:n,state:i}),{method:"GET"})}async batchCancel(e){if(!e||e.length===0)throw Error("orderIds is required and must not be empty");return this.makeAuthenticatedRequest(ce.orders.batchCancel(),{method:"POST",body:JSON.stringify({orderIds:e})})}async batchCancelAll(e){let t=e?ce.orders.batchCancelAllByPair(e):ce.orders.batchCancelAll();return this.makeAuthenticatedRequest(t,{method:"POST"})}async replaceOrder(e,t){_e(YV,{orderId:e,newOrder:t});let r={useMasterBalance:t.useMasterBalance??!1};if(t.price!==void 0)r.price=t.price;if(t.quantity!==void 0)r.quantity=t.quantity;if(t.postOnly!==void 0)r.postOnly=t.postOnly;if(t.clientOrderId!==void 0)r.clientOrderId=t.clientOrderId;return await this.makeAuthenticatedRequest(ce.orders.replace(e),{method:"PUT",body:JSON.stringify(r)})}async batchCreate(e){_e(rZ,{orders:e});let t={orders:e.map((r)=>({tradingPairId:r.tradingPairId,orderType:r.orderType,side:r.side,price:r.price,quantity:r.quantity,tradingMode:r.tradingMode||"SPOT",slippageToleranceBps:r.slippageTolerance!==void 0?Math.round(r.slippageTolerance*1e4):void 0,useMasterBalance:r.useMasterBalance,expirationDate:r.expirationDate,timeInForce:r.timeInForce,marginAccountId:r.marginAccountId,marginMode:r.marginMode,riskBucketId:r.riskBucketId,riskBucketCollateral:r.riskBucketCollateral,strategyKey:r.strategyKey,positionSide:r.positionSide,leverage:r.leverage,reduceOnly:r.reduceOnly,postOnly:r.postOnly,clientOrderId:r.clientOrderId}))};return this.makeAuthenticatedRequest(ce.orders.batchCreate(),{method:"POST",body:JSON.stringify(t)})}async batchReplace(e){_e(nZ,{orders:e});let t={orders:e.map((r)=>({orderId:r.orderId,price:r.price,quantity:r.quantity,useMasterBalance:r.useMasterBalance,postOnly:r.postOnly,clientOrderId:r.clientOrderId}))};return this.makeAuthenticatedRequest(ce.orders.batchReplace(),{method:"POST",body:JSON.stringify(t)})}async getPaginatedOrders(e){if(e)_e(QV,e);let{page:t,pageSize:r=10,status:o,tradingPairId:n,tradingMode:i,marginAccountId:a,pageToken:s}=e||{},c=r>0?r:10,u=t!==void 0&&s===void 0,d=Math.min(c,u?100:1000),p=new URLSearchParams;if(u){let y=t>0?t:1;p.append("page",y.toString())}p.append("pageSize",d.toString());let m=typeof o==="string"?o:o?.join(",");if(m)p.append("status",m);if(n)p.append("tradingPairId",n);if(i)p.append("tradingMode",i);if(a)p.append("marginAccountId",a);if(!u)p.append("pageToken",s??"");let h=`/api/v1/orders?${p.toString()}`;return await this.makeAuthenticatedRequest(h,{method:"GET"})}async*iterateOrders(e){let t="";for(;;){let r=await this.getPaginatedOrders({...e,pageToken:t});if(yield*r.orders,!r.nextPageToken)return;t=r.nextPageToken}}async getOrder(e){return{order:await this.makeAuthenticatedRequest(ce.orders.get(e),{method:"GET"}),status:"SUCCESS"}}async createTwapOrder(e,t,r,o){_e(eZ,{tradingPairId:e,side:t,quantity:r,options:o});let n={tradingPairId:e,side:t,quantity:r,durationSeconds:o.durationSeconds!==void 0?Number(o.durationSeconds):void 0,startTime:o.startTime,endTime:o.endTime,limitPrice:o.limitPrice,slippageToleranceBps:o.slippageToleranceBps,randomize:o.randomize,reduceOnly:o.reduceOnly,tradingMode:o.tradingMode||"SPOT",marginAccountId:o.marginAccountId,riskBucketId:o.riskBucketId,marginMode:o.marginMode,leverage:o.leverage,strategyKey:o.strategyKey,useMasterBalance:o.useMasterBalance,clientTwapId:o.clientTwapId};return await this.makeAuthenticatedRequest(ce.orders.createTwap(),{method:"POST",body:JSON.stringify(n)})}async cancelTwapOrder(e){return _e(QO,{twapOrderId:e}),await this.makeAuthenticatedRequest(ce.orders.cancelTwap(e),{method:"POST"})}async getTwapOrder(e){return _e(QO,{twapOrderId:e}),await this.makeAuthenticatedRequest(ce.orders.getTwap(e),{method:"GET"})}async listTwapOrders(e){if(e)_e(tZ,e);let{page:t=1,pageSize:r=20,state:o,tradingPairId:n}=e||{};return await this.makeAuthenticatedRequest(ce.orders.listTwap({page:t,pageSize:Math.min(Math.max(r,1),100),state:o,tradingPairId:n}),{method:"GET"})}}var aC=[{inputs:[{internalType:"address",name:"rollup_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"InvalidAddress",type:"error"},{inputs:[],name:"NativeTransferFailed",type:"error"},{inputs:[],name:"NothingToSweep",type:"error"},{inputs:[],name:"OnlyClone",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"SafeERC20FailedOperation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Refunded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"RefundedNative",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Swept",type:"event"},{inputs:[],name:"config",outputs:[{internalType:"address",name:"user",type:"address"},{internalType:"string",name:"applicationId",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"refundNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rollup",outputs:[{internalType:"contract IRollup",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"sweep",outputs:[],stateMutability:"nonpayable",type:"function"}];var sC=[{inputs:[{internalType:"address",name:"rollup_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"CloneArgumentsTooLong",type:"error"},{inputs:[],name:"Create2EmptyBytecode",type:"error"},{inputs:[],name:"FailedDeployment",type:"error"},{inputs:[{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sweeper",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"string",name:"applicationId",type:"string"}],name:"SweeperDeployed",type:"event"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"}],name:"deploy",outputs:[{internalType:"address",name:"sweeper",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"}],name:"isDeployed",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"}],name:"refundNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rollup",outputs:[{internalType:"contract IRollup",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"},{internalType:"address",name:"token",type:"address"}],name:"sweep",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"}],name:"sweeperFor",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}];var cC=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AccessControlBadConfirmation",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bytes32",name:"neededRole",type:"bytes32"}],name:"AccessControlUnauthorizedAccount",type:"error"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[],name:"ECDSAInvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"length",type:"uint256"}],name:"ECDSAInvalidSignatureLength",type:"error"},{inputs:[{internalType:"bytes32",name:"s",type:"bytes32"}],name:"ECDSAInvalidSignatureS",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidAddress",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidSeed",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"InvalidTimestamp",type:"error"},{inputs:[],name:"NonceAlreadyUsed",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[],name:"ReentrancyGuardReentrantCall",type:"error"},{inputs:[],name:"TransferFailed",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newFeeCollector",type:"address"}],name:"FeeCollectorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newSettlementContract",type:"address"}],name:"SettlementContractChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maker",type:"address"},{indexed:!0,internalType:"address",name:"taker",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"SettlementTransfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[],name:"DEBUGGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"FEE_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PAUSER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"SETTLEMENT_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPGRADER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"address",name:"token",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"seed",type:"bytes"}],name:"decodeSeed",outputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"destination",type:"address"},{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"depositERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"destination",type:"address"},{internalType:"string",name:"applicationId",type:"string"}],name:"depositNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"feeCollector",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getChainID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_admin",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"callerConfirmation",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_newFeeCollector",type:"address"}],name:"setFeeCollector",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_settlementContract",type:"address"}],name:"setSettlementContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"settlementContract",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maker",type:"address"},{internalType:"address",name:"taker",type:"address"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"fee",type:"uint256"}],name:"transferOnSettlement",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"seed",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"seed",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"withdrawNative",outputs:[],stateMutability:"nonpayable",type:"function"}];var UCt=new Uint8Array(32);var uC={vault:cC,sweeper:aC,sweeperFactory:sC};var Z0e=5000,W0e=300000,K0e=(e)=>new Promise((t)=>setTimeout(t,e));function DZ(e,t){return t==="margin"?JSON.stringify({clientId:e,depositTarget:"MARGIN"}):e}class nS extends tt{publicClient;chain;applicationsAPI;profileAPI;walletClient;constructor(e,t,r,o,n,i){super(i);this.publicClient=e,this.chain=r,this.walletClient=t,this.applicationsAPI=o,this.profileAPI=n}setWalletClient(e){this.walletClient=e}async getVaultAddress(){return(await this.applicationsAPI.getApplicationConfig()).vaultContractAddress}async getClientId(){return(await this.applicationsAPI.getApplicationConfig()).clientId}async resolveAsset(e){let t,r;try{let o=await this.profileAPI.getUserBalanceByAssetId(e);t=o.token,r=o.wrappedNative===!0}catch(o){if(o instanceof cr){if(o.statusCode===404)throw new Ta(`Asset ID '${e}' does not exist`,{revertReason:"ASSET_NOT_FOUND",cause:o});throw new Ta(`Failed to resolve asset ID '${e}': ${o.retryable?"Network error occurred":"API request failed"}`,{revertReason:o.retryable?"NETWORK_ERROR":"API_ERROR",cause:o})}throw new Ta(`Failed to resolve asset ID '${e}': Unexpected error`,{revertReason:"UNKNOWN_ERROR",cause:o instanceof Error?o:void 0})}return{tokenAddress:t,isWrappedNative:r}}async approve(e,t,r=!0){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");_e(zZ,{assetId:e,amount:t,autoWait:r});let o=await this.getVaultAddress(),{tokenAddress:n}=await this.resolveAsset(e),i=this.walletClient.account;if(!i)throw new Ft("No account available in wallet client","account");let a=i.getNonce?await i.getNonce():0n,s=await this.walletClient.writeContract({address:n,abi:iw,functionName:"approve",args:[o,t],chain:this.chain,account:i}),c={nonce:a,hash:s,status:"pending"};return await this.waitForTransaction(c,r)}async deposit(e,t,r=!0,o="spot"){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");_e(NZ,{assetId:e,amount:t,autoWait:r,target:o});let n=await this.getVaultAddress(),i=await this.getClientId(),a=DZ(i,o),{tokenAddress:s,isWrappedNative:c}=await this.resolveAsset(e);if(!c){if(await this.needsApproval(e,t))throw new Ta(`Approval required before deposit. Please invoke approve() first for asset ${e} (token address: ${s}).`,{revertReason:"APPROVAL_REQUIRED"})}let u=this.walletClient.account;if(!u)throw new Ft("No account available in wallet client","account");let d;if(c)d=await this.walletClient.writeContract({address:n,abi:uC.vault,functionName:"depositNative",args:[u.address,a],account:u,chain:this.chain,value:t});else d=await this.walletClient.writeContract({address:n,abi:uC.vault,functionName:"depositERC20",args:[u.address,a,s,t],account:u,chain:this.chain});let p=u.getNonce?await u.getNonce():0n,m={hash:d,status:"pending",nonce:p};return await this.waitForTransaction(m,r)}async pollWithdrawalCalldata(e,t){let r=t?.pollIntervalMs??Z0e,o=t?.timeoutMs??W0e,n=Date.now()+o;for(;;){try{let{vaultAddress:i,calldata:a}=await this.makePublicRequest(`/api/v1/withdrawals/${e}`);if(a&&a!=="0x")return{vaultAddress:i,calldata:a}}catch(i){if(!(i instanceof cr&&(i.statusCode===404||i.statusCode===409)))throw i}if(Date.now()+r>n)return null;await K0e(r)}}async withdraw(e,t,r=!0,o,n){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let i=this.walletClient.account;if(!i)throw new Ft("No account available in wallet client","account");let a=i.address.toLowerCase(),s=typeof o==="string"?o:"spot",c=typeof o==="string"?n:o;_e(MZ,{assetId:e,amount:t,destination:a,autoWait:r,source:s});let{withdrawalIndex:u}=await this.makeAuthenticatedRequest("/api/v1/withdrawals",{method:"POST",body:JSON.stringify({assetId:e,amount:t.toString(),destination:a,source:s})});if(!r)return{withdrawalIndex:u,status:"awaiting_proof"};let d=await this.pollWithdrawalCalldata(u,c);if(!d)return{withdrawalIndex:u,status:"awaiting_proof"};let{vaultAddress:p,calldata:m}=d,h;try{h=await this.walletClient.sendTransaction({to:p,data:m,account:i,chain:this.chain})}catch(v){throw new Ta(`Failed to submit executeWithdrawal for withdrawal ${u}: ${v instanceof Error?v.message:"unknown error"}`,{cause:v instanceof Error?v:void 0})}let y=i.getNonce?await i.getNonce():0n,x={hash:h,status:"pending",nonce:y};return{...await this.waitForTransaction(x,r),withdrawalIndex:u}}async retryWithdrawal(e,t=!0,r){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let o=this.walletClient.account;if(!o)throw new Ft("No account available in wallet client","account");let n=await this.pollWithdrawalCalldata(e,r);if(!n)return{withdrawalIndex:e,status:"awaiting_proof"};let{vaultAddress:i,calldata:a}=n,s;try{s=await this.walletClient.sendTransaction({to:i,data:a,account:o,chain:this.chain})}catch(p){throw new Ta(`Failed to resubmit executeWithdrawal for withdrawal ${e}: ${p instanceof Error?p.message:"unknown error"}`,{cause:p instanceof Error?p:void 0})}let c=o.getNonce?await o.getNonce():0n,u={hash:s,status:"pending",nonce:c};return{...await this.waitForTransaction(u,t),withdrawalIndex:e}}async getBalance(e){throw new cr("getBalance() is deprecated and no longer supported. Please use profileAPI.getUserBalances() or profileAPI.getUserBalanceByAssetId() instead for balance data.",{statusCode:410})}async getAllowance(e){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let t=await this.getVaultAddress(),o=(await this.walletClient.getAddresses())[0];if(!o)throw new Ft("No account found in wallet client.","walletClient");let{tokenAddress:n}=await this.resolveAsset(e);return await this.publicClient.readContract({address:n,abi:iw,functionName:"allowance",args:[o,t]})}async needsApproval(e,t){let{isWrappedNative:r}=await this.resolveAsset(e);if(r)return!1;return await this.getAllowance(e)<t}async waitForTransaction(e,t=!0,r={}){if(!t)return e;let{confirmations:o=1,timeout:n=60000}=r;try{let i=await this.publicClient.waitForTransactionReceipt({hash:e.hash,confirmations:o,timeout:n});return{...e,status:i.status==="success"?"confirmed":"failed",receipt:i}}catch{return{...e,status:"failed"}}}}class oS extends tt{async submit(e){return await this.makePublicRequest(ce.whitelist.submit(),{method:"POST",body:JSON.stringify(e)})}}class lC extends tt{async initiateWithdrawal(e){return this.makeAuthenticatedRequest(ce.withdrawals.initiate(),{method:"POST",body:JSON.stringify({assetId:e.assetId,amount:e.amount,destination:e.destination,source:e.source??"spot"})})}async getWithdrawal(e){return this.makePublicRequest(ce.withdrawals.byIndex(e))}async listPendingWithdrawals(e){return this.makeAuthenticatedRequest(ce.withdrawals.list({page:e?.page,pageSize:e?.pageSize}))}}class iS extends tt{chain;walletClient;constructor(e,t,r){super(r);this.chain=t,this.walletClient=e}setWalletClient(e){this.walletClient=e}async authenticate(e,t){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let r=this.walletClient.account;if(!r)throw new Ft("No account available in wallet client","account");let o=W_(),n={publicKey:K_(o),privateKey:J_(o)},i=await this.createChallenge(r.address,e,n.publicKey),a=await this.signChallenge(i.message);return await this.verifySignature(r.address,a,i.nonce,e,n,t)}async signChallenge(e){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let t=this.walletClient.account;if(!t)throw new Ft("No account available in wallet client","account");return await this.walletClient.signMessage({account:t,message:e})}async createChallenge(e,t,r){let o=await this.makePublicRequest("/api/v1/auth/challenge",{method:"POST",body:JSON.stringify({address:e,clientId:t,chainId:this.chain.id,sessionPublicKey:r})});return{nonce:o.nonce,message:o.message,expiresAt:o.expiresAt}}async verifySignature(e,t,r,o,n,i){let a=await this.makePublicRequest("/api/v1/auth/verify",{method:"POST",body:JSON.stringify({address:e,signature:t,nonce:r,clientId:o,chainId:this.chain.id,sessionPublicKey:n.publicKey,...i?{referralCode:i}:{}})});return{sessionPublicKey:n.publicKey,sessionPrivateKey:n.privateKey,expiresAt:a.expiresAt,user:{id:a.user.id,address:a.user.address,username:a.user.username}}}async refreshSession(){return{expiresAt:(await this.makeAuthenticatedRequest("/api/v1/auth/refresh",{method:"POST"})).expiresAt}}async revokeSession(){await this.makeAuthenticatedRequest("/api/v1/auth/revoke",{method:"POST"})}}var J0e=750;function UZ(e,t){try{new URL(e)}catch(r){throw new Ft(`${t} must be a valid URL, got: ${e}`,t)}return e}class pC{auth;delegatedAgents;applications;fees;pitpass;vault;withdrawals;trading;market;marginAccounts;positions;portfolio;subAccounts;faucet;sweeper;whitelist;profile;pulse;orderbook;trades;ws;walletClient;publicClient;authState;network;chain;propagateSession(e){this.auth.setSessionKeypair(e),this.delegatedAgents.setSessionKeypair(e),this.applications.setSessionKeypair(e),this.fees.setSessionKeypair(e),this.pitpass.setSessionKeypair(e),this.vault.setSessionKeypair(e),this.withdrawals.setSessionKeypair(e),this.trading.setSessionKeypair(e),this.market.setSessionKeypair(e),this.marginAccounts.setSessionKeypair(e),this.positions.setSessionKeypair(e),this.portfolio.setSessionKeypair(e),this.subAccounts.setSessionKeypair(e),this.faucet.setSessionKeypair(e),this.sweeper.setSessionKeypair(e),this.whitelist.setSessionKeypair(e),this.pulse.setSessionKeypair(e),this.profile.setSessionKeypair(e),this.orderbook.setSessionKeypair(e),this.trades.setSessionKeypair(e),this.ws.setSessionKeypair(e)}setServerKey(e){this.auth.setServerKey(e),this.delegatedAgents.setServerKey(e),this.applications.setServerKey(e),this.fees.setServerKey(e),this.pitpass.setServerKey(e),this.vault.setServerKey(e),this.withdrawals.setServerKey(e),this.trading.setServerKey(e),this.market.setServerKey(e),this.marginAccounts.setServerKey(e),this.positions.setServerKey(e),this.portfolio.setServerKey(e),this.subAccounts.setServerKey(e),this.faucet.setServerKey(e),this.sweeper.setServerKey(e),this.whitelist.setServerKey(e),this.pulse.setServerKey(e),this.profile.setServerKey(e),this.orderbook.setServerKey(e),this.trades.setServerKey(e)}sessionFromAuthState(e){return{publicKey:e.sessionPublicKey,privateKey:e.sessionPrivateKey}}constructor(e){let t=["mainnet","development","staging","local"];if(!e.network||!t.includes(e.network))throw new Ft(`network must be one of: ${t.join(", ")}. Got: ${e.network}`,"network");if(this.network=e.network,!e.seiRpcUrl)throw new Ft("seiRpcUrl is required","seiRpcUrl");try{new URL(e.seiRpcUrl)}catch(a){throw new Ft(`seiRpcUrl must be a valid URL, got: ${e.seiRpcUrl}`,"seiRpcUrl")}let r=e.wsUrl?UZ(e.wsUrl,"wsUrl"):GR(this.network),o=this.network==="mainnet"?LO:jO;if(this.chain=o,e.pollingInterval!==void 0&&(!Number.isFinite(e.pollingInterval)||e.pollingInterval<=0))throw new Ft(`pollingInterval must be a positive number of milliseconds, got: ${e.pollingInterval}`,"pollingInterval");let n=UO(e.seiRpcUrl);this.publicClient=MO({chain:o,transport:n,pollingInterval:e.pollingInterval??J0e});let i=e.apiUrl?UZ(e.apiUrl,"apiUrl"):HR(this.network);if(e.walletClient){if(e.walletClient.chain?.id!==o.id)throw new Ft(`Wallet client chain mismatch. Expected ${o.id}, got ${e.walletClient.chain?.id}`,"walletClient");this.walletClient=e.walletClient}this.applications=new N1(i),this.market=new V1(i),this.marginAccounts=new G1(i),this.positions=new Y1(i),this.portfolio=new J1(i),this.subAccounts=new X1(i),this.faucet=new M1(i),this.sweeper=new eS(i),this.whitelist=new oS(i),this.pulse=new Q1(i),this.auth=new iS(this.walletClient,this.chain,i),this.delegatedAgents=new HO(i),this.fees=new H1(i),this.pitpass=new W1(i),this.profile=new oC(i),this.vault=new nS(this.publicClient,this.walletClient,this.chain,this.applications,this.profile,i),this.withdrawals=new lC(i),this.trading=new rS(i),this.orderbook=new Z1(i),this.trades=new iC(i),this.ws=BR(r,e.ws),this.ws.connect().catch(console.error)}async login(e,t){if(this.authState=await this.auth.authenticate(e),this.propagateSession(this.sessionFromAuthState(this.authState)),t?.connectWebSocket)await this.ws.connect();return this.authState}async loginAsDelegatedOwner(e){if(!this.authState)throw new cr("No active agent session to create delegated session",{endpoint:"delegated-agents/sessions",statusCode:dC.StatusCodes.UNAUTHORIZED});let t=W_(),r={publicKey:K_(t),privateKey:J_(t)},o=await this.delegatedAgents.createDelegatedSession({ownerUserId:e,sessionPublicKey:r.publicKey});return this.authState={sessionPublicKey:r.publicKey,sessionPrivateKey:r.privateKey,expiresAt:o.expiresAt,user:{id:o.ownerUserId,address:o.agentAddress}},this.propagateSession(this.sessionFromAuthState(this.authState)),this.authState}getAuthState(){return this.authState}setAuthState(e){this.authState=e,this.propagateSession(this.sessionFromAuthState(e))}async logout(){if(this.authState)try{await this.auth.revokeSession()}catch(e){console.warn("Failed to revoke session on logout:",e)}this.authState=void 0,this.propagateSession(void 0),this.ws.disconnect()}async refreshAuth(){if(!this.authState)throw new cr("No active session to refresh",{endpoint:"auth/refresh",statusCode:dC.StatusCodes.UNAUTHORIZED});try{let e=await this.auth.refreshSession();return this.authState={...this.authState,expiresAt:e.expiresAt},this.authState}catch(e){throw this.authState=void 0,this.propagateSession(void 0),e}}isAuthenticated(){return!!this.authState}isConnected(){return!!this.walletClient&&!!this.publicClient}setWalletClient(e){if(e.chain?.id!==this.chain.id)throw new Ft(`Wallet client chain mismatch. Expected ${this.chain.id}, got ${e.chain?.id}`,"walletClient");this.walletClient=e,this.auth.setWalletClient(e),this.vault.setWalletClient(e)}getAccountAddress(){if(!this.walletClient)throw new hg("Wallet client not set","walletClient");if(this.walletClient.account)return this.walletClient.account.address;throw new hg("No account available","account")}getNetwork(){return this.network}getChainId(){return this.chain.id}async waitForTransaction(e,t,r){return this.publicClient.waitForTransactionReceipt({hash:e,confirmations:t,timeout:r})}}function fC(e){return new pC(e)}function wt(e){if(typeof e==="string")return{address:e,type:"json-rpc"};return e}var aS=256,sS;function cS(e=11){if(!sS||aS+e>512){sS="",aS=0;for(let t=0;t<256;t++)sS+=(256+Math.random()*256|0).toString(16).substring(1)}return sS.substring(aS,aS+++e)}function LZ(e){let{batch:t,chain:r,ccipRead:o,dataSuffix:n,key:i="base",name:a="Base Client",type:s="base"}=e,c=e.experimental_blockTag??(typeof r?.experimental_preconfirmationTime==="number"?"pending":void 0),u=r?.blockTime??12000,d=Math.min(Math.max(Math.floor(u/2),500),4000),p=e.pollingInterval??d,m=e.cacheTime??p,h=e.account?wt(e.account):void 0,{config:y,request:x,value:S}=e.transport({account:h,chain:r,pollingInterval:p}),v={...y,...S},E={account:h,batch:t,cacheTime:m,ccipRead:o,chain:r,dataSuffix:n,key:i,name:a,pollingInterval:p,request:x,transport:v,type:s,uid:cS(),...c?{experimental_blockTag:c}:{}};function w(_){return(T)=>{let k=T(_);for(let z in E)delete k[z];let O={..._,...k};return Object.assign(O,{extend:w(O)})}}return Object.assign(E,{extend:w(E)})}var jZ={gwei:9,wei:18},FZ={ether:-9,wei:9};function uS(e,t){let r=e.toString(),o=r.startsWith("-");if(o)r=r.slice(1);r=r.padStart(t,"0");let[n,i]=[r.slice(0,r.length-t),r.slice(r.length-t)];return i=i.replace(/(0+)$/,""),`${o?"-":""}${n||"0"}${i?`.${i}`:""}`}function Tn(e,t="wei"){return uS(e,FZ[t])}var mC="2.53.1";var hC={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${mC}`};class q extends Error{constructor(e,t={}){let r=(()=>{if(t.cause instanceof q)return t.cause.details;if(t.cause?.message)return t.cause.message;return t.details})(),o=(()=>{if(t.cause instanceof q)return t.cause.docsPath||t.docsPath;return t.docsPath})(),n=hC.getDocsUrl?.({...t,docsPath:o}),i=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...hC.version?[`Version: ${hC.version}`]:[]].join(`
|
|
146
|
+
- `)}`);this.name="ValidationError",this.issues=e.issues}getErrors(){let e={};for(let t of this.issues){let r=t.path.join(".");e[r||"root"]=t.message}return e}}function _e(e,t){let r=e.safeParse(t);if(!r.success)throw new GV(r.error);return r.data}var Yp=f.enum(["BUY","SELL"],{message:'Order side must be "BUY" or "SELL"'}),my=f.enum(["SPOT","MARGIN"],{message:'Trading mode must be "SPOT" or "MARGIN"'}),j1=f.enum(["ISOLATED","CROSS"],{message:'Margin mode must be "ISOLATED" or "CROSS"'}),hy=f.enum(["LONG","SHORT","NONE"],{message:'Position side must be "LONG", "SHORT", or "NONE"'}),VV=f.enum(["GTC","IOC","FOK"],{message:'Time in force must be "GTC", "IOC", or "FOK"'}),KO=f.enum(["GTC","IOC"],{message:'Conditional order time in force must be "GTC" or "IOC"'}),Qp=f.enum(["LIMIT","MARKET"],{message:'Order type must be "LIMIT" or "MARKET"'}),gt=f.string().trim().min(1,"Value cannot be empty").regex(/^\d+(\.\d+)?$/,"Value must be a positive decimal number (e.g., '1.5', '100')").refine((e)=>Number.parseFloat(e)>0,{message:"Value must be greater than 0"}),Ae=f.uuid({message:"Must be a valid UUID (e.g., '123e4567-e89b-12d3-a456-426614174000')"}),Ju=f.iso.datetime({message:"Must be a valid ISO 8601 date string (e.g., '2024-12-31T23:59:59Z')"}),ZV=f.number().min(0,"Slippage tolerance must be at least 0 (no slippage)").max(1,"Slippage tolerance cannot exceed 1 (100%)").optional(),gy=f.number().int().min(0,"Slippage tolerance must be at least 0 bps").max(1e4,"Slippage tolerance cannot exceed 10000 bps"),I0e=f.number().int().min(0,"Slippage tolerance must be at least 0 bps").max(500,"TWAP slippage tolerance cannot exceed 500 bps (5%)"),D1=f.object({triggerPrice:gt,orderType:Qp,limitPrice:gt.optional(),quantity:gt.optional(),closePosition:f.boolean().optional(),timeInForce:KO.optional(),slippageToleranceBps:gy.optional(),expiresAt:Ju.optional()}).refine((e)=>e.orderType!=="LIMIT"||e.limitPrice!==void 0,{message:"limitPrice is required for LIMIT parent TP/SL",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.limitPrice===void 0,{message:"limitPrice must not be provided for MARKET parent TP/SL",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce is only allowed for LIMIT parent TP/SL",path:["timeInForce"]}).refine((e)=>e.orderType!=="LIMIT"||e.slippageToleranceBps===void 0,{message:"slippageToleranceBps is only allowed for MARKET parent TP/SL",path:["slippageToleranceBps"]}).refine((e)=>e.closePosition!==!0||e.quantity===void 0,{message:"quantity must be omitted when closePosition is true",path:["quantity"]}).refine((e)=>e.quantity!==void 0||e.closePosition!==!1,{message:"quantity is required when closePosition is false",path:["closePosition"]}),U1=(e)=>e?.takeProfit!==void 0||e?.stopLoss!==void 0,JO=(e,t)=>t===void 0||t!=="NONE"&&(e==="BUY"&&t==="LONG"||e==="SELL"&&t==="SHORT"),WV=f.object({tradingPairId:Ae,side:Yp,quantity:gt,price:gt,options:f.object({tradingMode:my.optional(),useMasterBalance:f.boolean().optional(),expirationDate:Ju.optional(),timeInForce:VV.optional(),marginAccountId:Ae.optional(),marginMode:j1.optional(),riskBucketId:Ae.optional(),riskBucketCollateral:gt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:hy.optional(),leverage:gt.optional(),reduceOnly:f.boolean().optional(),postOnly:f.boolean().optional(),takeProfit:D1.optional(),stopLoss:D1.optional()}).optional()}).refine((e)=>JO(e.side,e.options?.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["options","positionSide"]}).refine((e)=>e.options?.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["options","leverage"]}).refine((e)=>!U1(e.options)||e.options?.tradingMode==="MARGIN",{message:"takeProfit/stopLoss are only supported for MARGIN orders",path:["options"]}).refine((e)=>!U1(e.options)||e.options?.reduceOnly!==!0,{message:"takeProfit/stopLoss cannot be attached to reduce-only orders",path:["options"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode===void 0||e.options?.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["options","marginAccountId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["options","riskBucketCollateral"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["options","reduceOnly"]}).refine((e)=>e.options?.postOnly!==!0||e.options?.timeInForce===void 0||e.options.timeInForce!=="IOC"&&e.options.timeInForce!=="FOK",{message:"postOnly cannot be combined with IOC/FOK time in force",path:["options","timeInForce"]}),KV=f.object({tradingPairId:Ae,side:Yp,quantity:gt,options:f.object({tradingMode:my.optional(),slippageTolerance:ZV,marginAccountId:Ae.optional(),marginMode:j1.optional(),riskBucketId:Ae.optional(),riskBucketCollateral:gt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:hy.optional(),leverage:gt.optional(),reduceOnly:f.boolean().optional(),takeProfit:D1.optional(),stopLoss:D1.optional()}).optional()}).refine((e)=>JO(e.side,e.options?.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["options","positionSide"]}).refine((e)=>e.options?.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["options","leverage"]}).refine((e)=>!U1(e.options)||e.options?.tradingMode==="MARGIN",{message:"takeProfit/stopLoss are only supported for MARGIN orders",path:["options"]}).refine((e)=>!U1(e.options)||e.options?.reduceOnly!==!0,{message:"takeProfit/stopLoss cannot be attached to reduce-only orders",path:["options"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode===void 0||e.options?.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["options","marginAccountId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["options","riskBucketCollateral"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["options","reduceOnly"]}),JV=f.object({orderId:Ae,remainingQuantityTarget:gt.optional()}),YV=f.object({orderId:Ae,newOrder:f.object({price:gt.optional(),quantity:gt.optional(),useMasterBalance:f.boolean().optional(),postOnly:f.boolean().optional()})}),QV=f.object({status:f.union([f.enum(B1),f.array(f.enum(B1)).min(1,"Status filter must list at least one status")]).optional(),tradingPairId:Ae.optional(),tradingMode:my.optional(),marginAccountId:Ae.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(1000,"Page size cannot exceed 1000").optional(),pageToken:f.string().optional()}).superRefine((e,t)=>{if(e.page!==void 0&&e.pageToken===void 0&&e.pageSize!==void 0&&e.pageSize>100)t.addIssue({code:f.ZodIssueCode.custom,message:"Page size cannot exceed 100 in page-number mode (page without pageToken)",path:["pageSize"]})}),t2t=f.enum(["STOP_LOSS","TAKE_PROFIT"],{message:'conditionType must be "STOP_LOSS" or "TAKE_PROFIT"'}),r2t=f.enum(["MARK_PRICE"],{message:'triggerSource must be "MARK_PRICE"'}),P0e=f.enum(["PENDING_PARENT","ACTIVE","TRIGGERING","TRIGGERED","CANCELLED","EXPIRED","FAILED"],{message:"Invalid conditional order state"}),n2t=f.enum(["LONG","SHORT"],{message:'Position side must be "LONG" or "SHORT"'}),YO=f.object({conditionalOrderId:Ae}),XV=f.object({marginAccountId:Ae.optional(),tradingPairId:Ae.optional(),state:P0e.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),k0e=f.enum(["PENDING","ACTIVE","COMPLETED","CANCELLED"],{message:"Invalid TWAP order state"}),A0e=f.union([f.number().int("durationSeconds must be a whole number of seconds").positive("durationSeconds must be greater than 0"),f.string().regex(/^[1-9]\d*$/,"durationSeconds must be a positive integer string (e.g., '3600')")]),eZ=f.object({tradingPairId:Ae,side:Yp,quantity:gt,options:f.object({durationSeconds:A0e.optional(),startTime:Ju.optional(),endTime:Ju.optional(),limitPrice:gt.optional(),slippageToleranceBps:I0e.optional(),randomize:f.boolean().optional(),reduceOnly:f.boolean().optional(),tradingMode:my.optional(),marginAccountId:Ae.optional(),riskBucketId:Ae.optional(),marginMode:j1.optional(),leverage:gt.optional(),strategyKey:f.string().min(1).max(128).optional(),useMasterBalance:f.boolean().optional(),clientTwapId:f.string().min(1).max(36,"clientTwapId cannot exceed 36 characters").optional()})}).refine((e)=>e.options.durationSeconds!==void 0!==(e.options.endTime!==void 0),{message:"Exactly one of durationSeconds or endTime must be set",path:["options","durationSeconds"]}).refine((e)=>e.options.startTime===void 0||e.options.endTime!==void 0,{message:"startTime is only valid together with endTime",path:["options","startTime"]}).refine((e)=>e.options.marginMode===void 0||e.options.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options.riskBucketId===void 0||e.options.tradingMode==="MARGIN",{message:"riskBucketId is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options.marginMode!=="CROSS"||e.options.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options.marginMode!=="CROSS"||e.options.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN TWAP orders",path:["options","leverage"]}),QO=f.object({twapOrderId:Ae}),tZ=f.object({state:k0e.optional(),tradingPairId:Ae.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),R0e=f.object({tradingPairId:Ae,orderType:Qp,side:Yp,price:gt.optional(),quantity:gt,tradingMode:my.optional(),slippageTolerance:ZV,useMasterBalance:f.boolean().optional(),expirationDate:Ju.optional(),timeInForce:VV.optional(),marginAccountId:Ae.optional(),marginMode:j1.optional(),riskBucketId:Ae.optional(),riskBucketCollateral:gt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:hy.optional(),leverage:gt.optional(),reduceOnly:f.boolean().optional(),postOnly:f.boolean().optional()}).refine((e)=>e.orderType!=="LIMIT"||e.price!==void 0,{message:"Price is required for LIMIT orders",path:["price"]}).refine((e)=>e.orderType!=="MARKET"||e.price===void 0,{message:"Price must not be provided for MARKET orders",path:["price"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce must not be provided for MARKET orders",path:["timeInForce"]}).refine((e)=>e.orderType!=="MARKET"||e.postOnly!==!0,{message:"postOnly must not be provided for MARKET orders",path:["postOnly"]}).refine((e)=>e.postOnly!==!0||e.timeInForce===void 0||e.timeInForce!=="IOC"&&e.timeInForce!=="FOK",{message:"postOnly cannot be combined with IOC/FOK time in force",path:["postOnly"]}).refine((e)=>e.riskBucketCollateral===void 0||e.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["tradingMode"]}).refine((e)=>e.marginMode===void 0||e.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["tradingMode"]}).refine((e)=>e.marginMode!=="CROSS"||e.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["marginAccountId"]}).refine((e)=>e.marginMode!=="CROSS"||e.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["riskBucketId"]}).refine((e)=>e.marginMode!=="CROSS"||e.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["riskBucketCollateral"]}).refine((e)=>e.marginMode!=="CROSS"||e.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["strategyKey"]}).refine((e)=>e.riskBucketCollateral===void 0||e.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["riskBucketId"]}).refine((e)=>e.riskBucketCollateral===void 0||e.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["reduceOnly"]}).refine((e)=>JO(e.side,e.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["positionSide"]}).refine((e)=>e.tradingMode!=="MARGIN"||e.reduceOnly===!0||e.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["leverage"]}),L1=100,rZ=f.object({orders:f.array(R0e).min(1,"At least one order is required").max(L1,`At most ${L1} orders per batch request`)}),$0e=f.object({orderId:Ae,price:gt.optional(),quantity:gt.optional(),useMasterBalance:f.boolean().optional(),postOnly:f.boolean().optional()}).refine((e)=>e.price!==void 0||e.quantity!==void 0,{message:"At least one of price or quantity must be provided"}),nZ=f.object({orders:f.array($0e).min(1,"At least one order is required").max(L1,`At most ${L1} orders per batch request`)});var XO=f.object({page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),oZ=XO.extend({state:f.string().trim().min(1,"State cannot be empty").optional(),tradingPairId:Ae.optional()}),iZ=f.object({marginAccountId:Ae,tradingPairId:Ae.optional()}),aZ=f.object({tradingPairId:Ae.optional()}).optional(),sZ=f.object({asset:f.string().trim().min(1,"Asset cannot be empty").optional()}).optional(),O0e=f.object({asset:f.string().trim().min(1,"Asset cannot be empty"),amount:gt,tradingPairId:Ae.optional(),strategyKey:f.string().trim().min(1,"Strategy key cannot be empty").optional(),marginMode:f.enum(["ISOLATED","CROSS"]).optional()}).refine((e)=>!(e.marginMode==="CROSS"&&e.tradingPairId!==void 0),{message:"tradingPairId is not supported for CROSS risk buckets",path:["tradingPairId"]}),F1=f.object({asset:f.string().trim().min(1,"Asset cannot be empty"),amount:gt}),C0e=f.object({tradingPairId:Ae,strategyKey:f.string().trim().min(1,"Strategy key cannot be empty").optional()}),z0e=f.array(Ae).min(1,"selectedTradingPairIds is required for CROSS risk buckets"),cZ=C0e.extend({marginMode:f.literal("ISOLATED").optional(),selectedTradingPairIds:f.never().optional()}),uZ=f.object({marginMode:f.literal("CROSS"),selectedTradingPairIds:z0e,strategyKey:f.never().optional()}),N0e=uZ.extend({tradingPairId:f.never().optional()}),eC=f.object({marginAccountId:Ae,request:O0e}),lZ=f.object({request:F1}),dZ=f.object({request:f.union([F1.merge(cZ).strict(),F1.merge(N0e).strict()])}),pZ=f.object({request:F1}),fZ=XO.extend({marginAccountId:Ae,movementType:f.string().trim().min(1,"Movement type cannot be empty").optional()}),mZ=XO.extend({movementType:f.string().trim().min(1,"Movement type cannot be empty").optional()}).optional(),tC=f.object({tradingPairId:Ae,side:Yp,positionSide:hy.optional(),orderType:Qp,price:gt.optional(),quantity:gt,leverage:gt.optional(),reduceOnly:f.boolean().optional()}),rC=(e,t)=>{if(e.positionSide!==void 0){let r=e.side==="BUY"?"LONG":"SHORT";if(e.positionSide!==r)t.addIssue({code:f.ZodIssueCode.custom,message:"positionSide must match side when provided (BUY=LONG, SELL=SHORT)",path:["positionSide"]})}if(e.reduceOnly!==!0&&e.leverage===void 0)t.addIssue({code:f.ZodIssueCode.custom,message:"leverage is required for normal margin orders",path:["leverage"]})},hZ=tC.strict().superRefine(rC),M0e=tC.merge(cZ).strict().superRefine(rC),B0e=tC.merge(uZ).strict().superRefine(rC).refine((e)=>e.selectedTradingPairIds.includes(e.tradingPairId),{message:"tradingPairId must be included in selectedTradingPairIds for CROSS risk buckets",path:["selectedTradingPairIds"]}),D0e=f.union([M0e,B0e]),gZ=f.object({marginAccountId:Ae,request:hZ}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]}),yZ=f.object({request:hZ}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]}),bZ=f.object({request:D0e}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]});var xZ=f.enum(["1m","5m","15m","30m","1h","4h","1d","1w","1M"],{message:'Interval must be one of: "1m", "5m", "15m", "30m", "1h", "4h", "1d", "1w", "1M"'}),U0e=31536000000,L0e=946684800000,q1=f.number().int().positive({message:"Timestamp must be a positive integer (milliseconds since epoch)"}).min(L0e,{message:"Timestamp must be at least Jan 1, 2000 (946684800000 ms). Did you pass seconds instead of milliseconds?"}).max(Number.MAX_SAFE_INTEGER,{message:"Timestamp must not exceed JavaScript's maximum safe integer"}).refine((e)=>e<=Date.now()+U0e,{message:"Timestamp must not be unreasonably far in the future (max 1 year ahead)"}),l2t=f.object({tradingPairId:Ae,interval:xZ,startTime:q1,endTime:q1}).refine((e)=>e.startTime<e.endTime,{message:"startTime must be less than endTime",path:["endTime"]}),d2t=f.string().min(1,"Trading pair symbol cannot be empty").regex(/^[A-Za-z0-9]{1,10}\/[A-Za-z0-9]{1,10}$/,{message:'Trading pair symbol must be in format "BASE/QUOTE" (e.g., "BTC/USDT", "ETH/USD")'}),j0e=f.number().int().positive({message:"Limit must be a positive integer"}).max(500,{message:"Limit cannot exceed 500 bars per request"}).optional(),vZ=f.object({tradingPairId:Ae,interval:xZ,startTime:q1.optional(),endTime:q1.optional(),limit:j0e,priceType:f.enum(["trade","mark"]).optional()}).refine((e)=>{if(e.startTime!==void 0&&e.endTime!==void 0)return e.startTime<e.endTime;return!0},{message:"startTime must be less than endTime",path:["endTime"]});var p2t=f.object({tradingPairId:Ae}),f2t=f.object({query:f.string().min(1,"Search query cannot be empty").optional(),pageSize:f.number().int().min(1).max(100).optional(),page:f.number().int().min(1).optional()}),Li=f.object({tradingPairId:Ae});var wZ=f.object({page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),F0e=f.enum(["OPEN","CLOSED","LIQUIDATING","LIQUIDATED"],{message:'Position status must be "OPEN", "CLOSED", "LIQUIDATING", or "LIQUIDATED"'}),q0e=f.enum(["MARKET","LIMIT","IOC"],{message:'Close type must be "MARKET", "LIMIT", or "IOC"'}),yy=f.object({positionId:Ae}),SZ=wZ.extend({marginAccountId:Ae.optional(),tradingPairId:Ae.optional(),status:F0e.optional()}),TZ=yy,EZ=yy.extend({request:f.object({closeType:q0e,limitPrice:gt.optional(),slippageToleranceBps:gy.optional(),quantity:gt.optional()})}).refine((e)=>e.request.closeType==="MARKET"||e.request.limitPrice!==void 0,{message:"limitPrice is required for LIMIT and IOC close requests",path:["request","limitPrice"]}).refine((e)=>e.request.closeType!=="MARKET"||e.request.limitPrice===void 0,{message:"limitPrice is not allowed for MARKET close requests",path:["request","limitPrice"]}),IZ=f.object({tradingPairId:Ae.optional(),slippageToleranceBps:gy.optional()}),PZ=yy,_Z=f.object({triggerPrice:gt,orderType:Qp,limitPrice:gt.optional(),quantity:gt.optional(),closePosition:f.boolean().optional(),timeInForce:KO.optional(),slippageToleranceBps:gy.optional(),expiresAt:Ju.optional()}).refine((e)=>e.orderType!=="LIMIT"||e.limitPrice!==void 0,{message:"limitPrice is required for LIMIT TP/SL legs",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.limitPrice===void 0,{message:"limitPrice must not be provided for MARKET TP/SL legs",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce is only allowed for LIMIT TP/SL legs",path:["timeInForce"]}).refine((e)=>e.orderType!=="LIMIT"||e.slippageToleranceBps===void 0,{message:"slippageToleranceBps is only allowed for MARKET TP/SL legs",path:["slippageToleranceBps"]}).refine((e)=>e.closePosition!==!0||e.quantity===void 0,{message:"quantity must be omitted when closePosition is true",path:["quantity"]}).refine((e)=>e.quantity!==void 0||e.closePosition!==!1,{message:"quantity is required when closePosition is false",path:["closePosition"]}),kZ=yy.extend({request:f.object({takeProfit:_Z.optional(),stopLoss:_Z.optional(),oco:f.boolean().optional()}).refine((e)=>e.takeProfit!==void 0||e.stopLoss!==void 0,{message:"At least one of takeProfit or stopLoss is required"}).refine((e)=>e.oco!==!0||e.takeProfit!==void 0&&e.stopLoss!==void 0,{message:"oco=true requires both takeProfit and stopLoss",path:["oco"]})}),AZ=wZ.extend({positionId:Ae.optional(),marginAccountId:Ae.optional(),tradingPairId:Ae.optional(),reductionOnly:f.boolean().optional()}),H0e=f.enum(["1m","5m","15m","1h","4h","1d"],{message:'Interval must be one of "1m", "5m", "15m", "1h", "4h", "1d"'}),RZ=yy.extend({params:f.object({interval:H0e,startTime:f.number().int().min(0,"startTime must be a non-negative millisecond timestamp").optional(),endTime:f.number().int().min(0,"endTime must be a non-negative millisecond timestamp").optional()}).refine((e)=>e.startTime===void 0||e.endTime===void 0||e.startTime<e.endTime,{message:"startTime must be less than endTime",path:["startTime"]})});var G0e=f.enum(["CREDIT","DEBIT","LOCK","UNLOCK","FEE"],{message:'Entry type must be "CREDIT", "DEBIT", "LOCK", "UNLOCK", or "FEE"'}),V0e=f.enum(["DEPOSIT","WITHDRAWAL","TRADE","FEE","FUNDING","LIQUIDATION","INTEREST","REWARD"],{message:'Transaction type must be "DEPOSIT", "WITHDRAWAL", "TRADE", "FEE", "FUNDING", "LIQUIDATION", "INTEREST", or "REWARD"'}),$Z=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional(),entryType:G0e.optional(),transactionType:V0e.optional(),assetId:Ae.optional()}),OZ=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(1000,"Page size cannot exceed 1000").optional(),tradingPairId:Ae.optional(),pageToken:f.string().optional()}).superRefine((e,t)=>{if(e.page!==void 0&&e.pageToken===void 0&&e.pageSize!==void 0&&e.pageSize>100)t.addIssue({code:f.ZodIssueCode.custom,message:"Page size cannot exceed 100 in page-number mode (page without pageToken)",path:["pageSize"]})}),CZ=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional(),tradingPairId:Ae.optional(),positionId:Ae.optional(),marginAccountId:Ae.optional()});var S2t=f.string().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Must be a valid Ethereum address (e.g., '0x1234...5678')"}),nC=f.union([f.string().regex(/^\d+$/,"Must be a positive integer string").refine((e)=>BigInt(e)>0n,{message:"Amount must be greater than 0"}),f.bigint().refine((e)=>e>0n,{message:"Amount must be greater than 0"})]),zZ=f.object({assetId:Ae,amount:nC,autoWait:f.boolean().optional()}),NZ=f.object({assetId:Ae,amount:nC,autoWait:f.boolean().optional(),target:f.enum(["spot","margin"]).optional()}),MZ=f.object({assetId:Ae,amount:nC,destination:f.string().regex(/^0x[a-fA-F0-9]{40}$/,"destination must be a 0x-prefixed 20-byte hex address"),autoWait:f.boolean().optional(),source:f.enum(["spot","margin"]).optional()}),T2t=f.object({assetId:Ae});class H1 extends tt{async simulateFees(e){let t=_e(GO,e),r=new URLSearchParams;if(r.append("tradingPairId",t.tradingPairId),r.append("side",t.side),r.append("price",t.price),r.append("quantity",t.quantity),t.orderType!==void 0)r.append("orderType",t.orderType);if(t.slippageToleranceBps!==void 0)r.append("slippageToleranceBps",String(t.slippageToleranceBps));let o=`/api/v1/fees/simulate?${r.toString()}`;return await this.makeAuthenticatedRequest(o,{method:"GET"})}async getMyFeeTier(e){let t=_e(VO,e),r=new URLSearchParams;r.append("tradingPairId",t.tradingPairId);let o=`/api/v1/fees/tier?${r.toString()}`;return await this.makeAuthenticatedRequest(o,{method:"GET"})}}class G1 extends tt{async listMarginAccounts(e){if(e)_e(oZ,e);return await this.makeAuthenticatedRequest(ce.marginAccounts.list(e?{page:e.page,pageSize:e.pageSize,state:e.state,tradingPairId:e.tradingPairId}:void 0))}async getMarginAccountSummary(e,t){return _e(iZ,{marginAccountId:e,...t}),await this.makeAuthenticatedRequest(ce.marginAccounts.summary(e,{tradingPairId:t?.tradingPairId}))}async getParentMarginAccountSummary(e){return _e(aZ,e),await this.makeAuthenticatedRequest(ce.marginAccounts.parentSummary({tradingPairId:e?.tradingPairId}))}async getAvailableCollateral(e){return _e(sZ,e),await this.makeAuthenticatedRequest(ce.marginAccounts.availableCollateral(e))}async transferCollateralToMarginAccount(e,t){return _e(eC,{marginAccountId:e,request:t}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferIn(e),{method:"POST",body:JSON.stringify({asset:t.asset,amount:t.amount,tradingPairId:t.tradingPairId,strategyKey:t.strategyKey})})}async transferCollateralToParentMarginAccount(e){return _e(lZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferInParent(),{method:"POST",body:JSON.stringify({asset:e.asset,amount:e.amount})})}async transferCollateralToRiskBucket(e){return _e(dZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferInRiskBucket(),{method:"POST",body:JSON.stringify({asset:e.asset,amount:e.amount,tradingPairId:e.tradingPairId,strategyKey:e.strategyKey,marginMode:e.marginMode,selectedTradingPairIds:e.selectedTradingPairIds})})}async transferCollateralFromMarginAccount(e,t){return _e(eC,{marginAccountId:e,request:t}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferOut(e),{method:"POST",body:JSON.stringify({asset:t.asset,amount:t.amount,tradingPairId:t.tradingPairId,strategyKey:t.strategyKey,marginMode:t.marginMode})})}async transferCollateralFromParentMarginAccount(e){return _e(pZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.transferOutParent(),{method:"POST",body:JSON.stringify({asset:e.asset,amount:e.amount})})}async getMarginAccountMovements(e,t){return _e(fZ,{marginAccountId:e,...t}),await this.makeAuthenticatedRequest(ce.marginAccounts.movements(e,t))}async getParentMarginAccountMovements(e){return _e(mZ,e),await this.makeAuthenticatedRequest(ce.marginAccounts.parentMovements(e))}async simulateOrderRisk(e,t){return _e(gZ,{marginAccountId:e,request:t}),await this.makeAuthenticatedRequest(ce.marginAccounts.simulateOrderRisk(e),{method:"POST",body:JSON.stringify({tradingPairId:t.tradingPairId,side:t.side,positionSide:t.positionSide,orderType:t.orderType,price:t.price,quantity:t.quantity,leverage:t.leverage,reduceOnly:t.reduceOnly})})}async simulateParentMarginOrderRisk(e){return _e(yZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.simulateParentMarginOrderRisk(),{method:"POST",body:JSON.stringify({tradingPairId:e.tradingPairId,side:e.side,positionSide:e.positionSide,orderType:e.orderType,price:e.price,quantity:e.quantity,leverage:e.leverage,reduceOnly:e.reduceOnly})})}async simulateRiskBucketOrderRisk(e){return _e(bZ,{request:e}),await this.makeAuthenticatedRequest(ce.marginAccounts.simulateRiskBucketOrderRisk(),{method:"POST",body:JSON.stringify({tradingPairId:e.tradingPairId,strategyKey:e.strategyKey,marginMode:e.marginMode,selectedTradingPairIds:e.selectedTradingPairIds,side:e.side,positionSide:e.positionSide,orderType:e.orderType,price:e.price,quantity:e.quantity,leverage:e.leverage,reduceOnly:e.reduceOnly})})}}class V1 extends tt{async getPaginatedTradingPairs(e){let t=new URLSearchParams;if(e?.page!==void 0)t.append("page",e.page.toString());if(e?.pageSize!==void 0)t.append("pageSize",e.pageSize.toString());if(e?.marketType)t.append("marketType",e.marketType);if(e?.baseToken)t.append("baseToken",e.baseToken);if(e?.quoteToken)t.append("quoteToken",e.quoteToken);if(e?.isActive!==void 0)t.append("isActive",e.isActive.toString());if(e?.category)t.append("category",e.category);let r=t.toString(),o=r?`/api/v1/market/pairs?${r}`:"/api/v1/market/pairs";return await this.makePublicRequest(o)}async getTradingPair(e){return _e(Li,{tradingPairId:e}),(await this.makePublicRequest(ce.market.getTradingPair(e))).tradingPair}async getTradingPairBySymbol(e,t){return(await this.getPaginatedTradingPairs({pageSize:100,marketType:t})).tradingPairs.find((o)=>o.symbol===e)}async getCandlesticks(e,t,r){_e(vZ,{tradingPairId:e,interval:t,startTime:r?.startTime,endTime:r?.endTime,limit:r?.limit,priceType:r?.priceType});let o=new URLSearchParams;if(r?.startTime!==void 0)o.append("startTime",r.startTime.toString());if(r?.endTime!==void 0)o.append("endTime",r.endTime.toString());if(r?.limit!==void 0)o.append("limit",r.limit.toString());if(r?.priceType!==void 0)o.append("priceType",r.priceType);let n=o.toString(),i=n?`/api/v1/market/pairs/charts/candlestick/${encodeURIComponent(e)}/${t}?${n}`:`/api/v1/market/pairs/charts/candlestick/${encodeURIComponent(e)}/${t}`;return(await this.makePublicRequest(i)).data||[]}async getMarketMetadata(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getMarketMetadata(e))}async getPerpMarketConfig(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getPerpMarketConfig(e))}async getPerpMarketSummary(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getPerpMarketSummary(e))}async getMarkPrice(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getMarkPrice(e))}async getIndexPrice(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getIndexPrice(e))}async getFundingState(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getFundingState(e))}async listFundingHistory(e,t){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.listFundingHistory(e,t))}async listAllFundingHistory(e){return await this.makePublicRequest(ce.market.listAllFundingHistory(e))}async getOpenInterest(e){return _e(Li,{tradingPairId:e}),await this.makePublicRequest(ce.market.getOpenInterest(e))}async getScreener(e){return await this.makePublicRequest(ce.market.getScreener(e))}async getMarketStats(){return await this.makePublicRequest(ce.market.getMarketStats())}}class Z1 extends tt{async getOrderbook(e,t={}){let{depth:r=10,tradingMode:o,magnitude:n,denomination:i}=t,a=new URLSearchParams;if(a.set("levels",String(r)),o)a.set("tradingMode",o);if(n!==void 0)a.set("magnitude",String(n));if(i)a.set("denomination",i.toLowerCase());let s=await this.makePublicRequest(`/api/v1/orderbook/${encodeURIComponent(e)}?${a.toString()}`);return{tradingPairId:s.tradingPairId,tradingMode:s.tradingMode,bids:s.data.bids.map((c)=>({price:c.price,quantity:c.quantity,orderCount:c.orderCount})),asks:s.data.asks.map((c)=>({price:c.price,quantity:c.quantity,orderCount:c.orderCount})),bestBid:s.data.bestBid,bestAsk:s.data.bestAsk,bidVolume:s.data.bidVolume,askVolume:s.data.askVolume,baseDecimals:s.baseDecimals,quoteDecimals:s.quoteDecimals,timestamp:s.timestamp,sequence:s.sequenceNumber}}}class W1 extends tt{async getMyTraderCode(){return await this.makeAuthenticatedRequest("/api/v1/pitpass/codes/me",{method:"GET"})}async setTraderCode(e){let t=_e(ZO,{code:e});return await this.makeAuthenticatedRequest("/api/v1/pitpass/codes/me/custom",{method:"PUT",body:JSON.stringify({code:t.code})})}async clearTraderCode(){return await this.makeAuthenticatedRequest("/api/v1/pitpass/codes/me/custom",{method:"DELETE"})}async checkTraderCodeAvailability(e){let t=new URLSearchParams({code:e.trim()}).toString(),r=await this.makePublicRequest(`/api/v1/pitpass/codes/available?${t}`,{method:"GET"});return{available:r.available,reason:r.reason?r.reason:void 0}}async getTraderCodeInfo(e){let t=encodeURIComponent(e.trim());return await this.makePublicRequest(`/api/v1/pitpass/codes/${t}`,{method:"GET"})}async getRewardsBalance(){return await this.makeAuthenticatedRequest("/api/v1/pitpass/rewards/balance",{method:"GET"})}async transferRewards(e){let t=_e(WO,e);return await this.makeAuthenticatedRequest("/api/v1/pitpass/rewards/transfer",{method:"POST",body:JSON.stringify({token:t.token,amount:t.amount})})}}var by="/api/v1/accounts/me/portfolio";function K1(e,t){if(!t?.period)return e;return`${e}?${new URLSearchParams({period:t.period})}`}class J1 extends tt{async getSummary(e){return await this.makeAuthenticatedRequest(K1(`${by}/summary`,e))}async getPerformance(e){return await this.makeAuthenticatedRequest(K1(`${by}/performance`,e))}async getRealizedPnl(e){return await this.makeAuthenticatedRequest(K1(`${by}/realized-pnl`,e))}async getAssets(e){return await this.makeAuthenticatedRequest(K1(`${by}/assets`,e))}async getMargin(){return await this.makeAuthenticatedRequest(`${by}/margin`)}}class Y1 extends tt{async listPositions(e){if(e)_e(SZ,e);return await this.makeAuthenticatedRequest(ce.positions.list(e))}async getPosition(e){return _e(TZ,{positionId:e}),await this.makeAuthenticatedRequest(ce.positions.get(e))}async closePosition(e,t){return _e(EZ,{positionId:e,request:t}),await this.makeAuthenticatedRequest(ce.positions.close(e),{method:"POST",body:JSON.stringify({closeType:t.closeType,limitPrice:t.limitPrice,slippageToleranceBps:t.slippageToleranceBps,quantity:t.quantity})})}async batchCloseAllPositions(e){if(e)_e(IZ,e);return await this.makeAuthenticatedRequest(ce.positions.batchCloseAll(),{method:"POST",body:JSON.stringify({tradingPairId:e?.tradingPairId,slippageToleranceBps:e?.slippageToleranceBps})})}async getPositionRisk(e){return _e(PZ,{positionId:e}),await this.makeAuthenticatedRequest(ce.positions.risk(e))}async attachPositionTpSl(e,t){return _e(kZ,{positionId:e,request:t}),await this.makeAuthenticatedRequest(ce.positions.attachTpSl(e),{method:"POST",body:JSON.stringify({takeProfit:t.takeProfit?{triggerPrice:t.takeProfit.triggerPrice,orderType:t.takeProfit.orderType,limitPrice:t.takeProfit.limitPrice,quantity:t.takeProfit.quantity,closePosition:t.takeProfit.closePosition,timeInForce:t.takeProfit.timeInForce,slippageToleranceBps:t.takeProfit.slippageToleranceBps,expiresAt:t.takeProfit.expiresAt}:void 0,stopLoss:t.stopLoss?{triggerPrice:t.stopLoss.triggerPrice,orderType:t.stopLoss.orderType,limitPrice:t.stopLoss.limitPrice,quantity:t.stopLoss.quantity,closePosition:t.stopLoss.closePosition,timeInForce:t.stopLoss.timeInForce,slippageToleranceBps:t.stopLoss.slippageToleranceBps,expiresAt:t.stopLoss.expiresAt}:void 0,oco:t.oco})})}async listPositionHistory(e){if(e)_e(AZ,e);return await this.makeAuthenticatedRequest(ce.positions.history(e))}async getPositionPnlHistory(e,t){return _e(RZ,{positionId:e,params:t}),await this.makeAuthenticatedRequest(ce.positions.pnlHistory(e,t))}}class oC extends tt{async getProfile(){return await this.makeAuthenticatedRequest("/api/v1/accounts/me")}async getPaginatedUserMovements(e){if(e)_e($Z,e);let t=new URLSearchParams;if(e?.page!==void 0)t.append("page",e.page.toString());if(e?.pageSize!==void 0)t.append("pageSize",e.pageSize.toString());if(e?.entryType!==void 0)t.append("entryType",e.entryType);if(e?.transactionType!==void 0)t.append("transactionType",e.transactionType);if(e?.assetId!==void 0)t.append("assetId",e.assetId);let r=t.toString(),o=r?`/api/v1/accounts/movements?${r}`:"/api/v1/accounts/movements";return await this.makeAuthenticatedRequest(o)}async getUserBalances(e){let t=new URLSearchParams;if(e?.page!==void 0)t.append("page",e.page.toString());if(e?.pageSize!==void 0)t.append("pageSize",e.pageSize.toString());let r=t.toString(),o=r?`/api/v1/accounts/balances?${r}`:"/api/v1/accounts/balances";return await this.makeAuthenticatedRequest(o)}async getUserBalanceByAssetId(e){if(!e||e.trim()==="")throw new cr("assetId is required and cannot be empty",{endpoint:"/api/v1/accounts/balances/{assetId}"});let t=`/api/v1/accounts/balances/${e}`;return await this.makeAuthenticatedRequest(t)}async getPortfolioStats(e){let t=new URLSearchParams({period:e});return await this.makeAuthenticatedRequest(`/api/v1/accounts/me/portfolio?${t}`)}async getPortfolioChart(e,t){let r=new URLSearchParams({period:e,metric:t});return await this.makeAuthenticatedRequest(`/api/v1/accounts/me/portfolio/chart?${r}`)}async getUserTrades(e){if(e)_e(OZ,e);let t=e?.page!==void 0&&e?.pageToken===void 0,r=new URLSearchParams;if(t&&e?.page!==void 0)r.append("page",e.page.toString());if(e?.pageSize!==void 0)r.append("pageSize",e.pageSize.toString());if(e?.tradingPairId!==void 0)r.append("tradingPairId",e.tradingPairId);if(!t)r.append("pageToken",e?.pageToken??"");let o=r.toString(),n=o?`/api/v1/accounts/trades?${o}`:"/api/v1/accounts/trades";return await this.makeAuthenticatedRequest(n)}async*iterateUserTrades(e){let t="";for(;;){let r=await this.getUserTrades({...e,pageToken:t});if(yield*r.trades,!r.nextPageToken)return;t=r.nextPageToken}}async listFundingPayments(e){if(e)_e(CZ,e);let t=new URLSearchParams;if(e?.page!==void 0)t.append("page",e.page.toString());if(e?.pageSize!==void 0)t.append("pageSize",e.pageSize.toString());if(e?.tradingPairId!==void 0)t.append("tradingPairId",e.tradingPairId);if(e?.positionId!==void 0)t.append("positionId",e.positionId);if(e?.marginAccountId!==void 0)t.append("marginAccountId",e.marginAccountId);let r=t.toString(),o=r?`/api/v1/accounts/funding-payments?${r}`:"/api/v1/accounts/funding-payments";return await this.makeAuthenticatedRequest(o)}}class Q1 extends tt{async getPulse(){return await this.makePublicRequest("/api/v1/pulse",{method:"GET"})}}class X1 extends tt{async list(){return await this.makeAuthenticatedRequest(ce.subAccounts.list())}async createLimit(e){return await this.makeAuthenticatedRequest(ce.subAccounts.createLimit(),{method:"POST",body:JSON.stringify(e)})}async getLimits(e){return await this.makeAuthenticatedRequest(ce.subAccounts.getLimits(e))}async updateLimit(e,t,r){return await this.makeAuthenticatedRequest(ce.subAccounts.limit(e,t),{method:"PUT",body:JSON.stringify(r)})}async deleteLimit(e,t){await this.makeAuthenticatedRequest(ce.subAccounts.limit(e,t),{method:"DELETE"})}}class eS extends tt{async register(e){return await this.makePublicRequest(ce.sweeper.register(),{method:"POST",body:JSON.stringify(e)})}}function BZ(e){return{eventType:"trade",tradingPairId:e.tradingPairId,tradingMode:e.tradingMode.toUpperCase(),data:{tradeId:e.data.tradeId,price:e.data.price,quantity:e.data.quantity,makerSide:e.data.makerSide.toUpperCase(),executedAt:e.data.executedAt??""}}}class iC extends tt{async getTrades(e,t={}){let{page:r=1}=t,o=t.pageSize!=null&&t.pageSize>0?Math.min(t.pageSize,100):25,n=new URLSearchParams;if(r>1)n.set("page",String(r));return n.set("pageSize",String(o)),(await this.makePublicRequest(`/api/v1/trades/${encodeURIComponent(e)}?${n.toString()}`)).trades.map(BZ)}async getTradeById(e){let t=await this.makePublicRequest(ce.trades.byId(e));return BZ(t)}}function tS(e){if(!e)return;return{triggerPrice:e.triggerPrice,orderType:e.orderType,limitPrice:e.limitPrice,timeInForce:e.timeInForce,slippageToleranceBps:e.slippageToleranceBps,expiresAt:e.expiresAt,quantity:e.quantity,closePosition:e.closePosition}}class rS extends tt{async placeLimitOrder(e,t,r,o,n){_e(WV,{tradingPairId:e,side:t,quantity:r,price:o,options:n});let i={tradingPairId:e,orderType:"LIMIT",side:t,price:o,quantity:r,tradingMode:n?.tradingMode||"SPOT",useMasterBalance:n?.useMasterBalance,expirationDate:n?.expirationDate,timeInForce:n?.timeInForce,marginAccountId:n?.marginAccountId,marginMode:n?.marginMode,riskBucketId:n?.riskBucketId,riskBucketCollateral:n?.riskBucketCollateral,strategyKey:n?.strategyKey,positionSide:n?.positionSide,leverage:n?.leverage,reduceOnly:n?.reduceOnly,postOnly:n?.postOnly,clientOrderId:n?.clientOrderId,takeProfit:tS(n?.takeProfit),stopLoss:tS(n?.stopLoss)};return await this.makeAuthenticatedRequest(ce.orders.create(),{method:"POST",body:JSON.stringify(i)})}async placeMarketOrder(e,t,r,o){_e(KV,{tradingPairId:e,side:t,quantity:r,options:o});let n={tradingPairId:e,orderType:"MARKET",side:t,slippageToleranceBps:o?.slippageTolerance!==void 0?Math.round(o.slippageTolerance*1e4):void 0,price:null,quantity:r,tradingMode:o?.tradingMode||"SPOT",marginAccountId:o?.marginAccountId,marginMode:o?.marginMode,riskBucketId:o?.riskBucketId,riskBucketCollateral:o?.riskBucketCollateral,strategyKey:o?.strategyKey,positionSide:o?.positionSide,leverage:o?.leverage,reduceOnly:o?.reduceOnly,takeProfit:tS(o?.takeProfit),stopLoss:tS(o?.stopLoss),clientOrderId:o?.clientOrderId};return await this.makeAuthenticatedRequest(ce.orders.create(),{method:"POST",body:JSON.stringify(n)})}async cancelOrder(e,t){_e(JV,{orderId:e,remainingQuantityTarget:t?.remainingQuantityTarget});let r={orderId:e,...t?.remainingQuantityTarget!==void 0&&{remainingQuantityTarget:t.remainingQuantityTarget}};return await this.makeAuthenticatedRequest(ce.orders.cancel(),{method:"POST",body:JSON.stringify(r)})}async cancelConditionalOrder(e){return _e(YO,{conditionalOrderId:e}),await this.makeAuthenticatedRequest(ce.orders.cancelConditional(e),{method:"DELETE"})}async getConditionalOrder(e){return _e(YO,{conditionalOrderId:e}),await this.makeAuthenticatedRequest(ce.orders.getConditional(e),{method:"GET"})}async listConditionalOrders(e){if(e)_e(XV,e);let{page:t=1,pageSize:r=20,marginAccountId:o,tradingPairId:n,state:i}=e||{};return await this.makeAuthenticatedRequest(ce.orders.listConditional({page:t,pageSize:Math.min(Math.max(r,1),100),marginAccountId:o,tradingPairId:n,state:i}),{method:"GET"})}async batchCancel(e){if(!e||e.length===0)throw Error("orderIds is required and must not be empty");return this.makeAuthenticatedRequest(ce.orders.batchCancel(),{method:"POST",body:JSON.stringify({orderIds:e})})}async batchCancelAll(e){let t=e?ce.orders.batchCancelAllByPair(e):ce.orders.batchCancelAll();return this.makeAuthenticatedRequest(t,{method:"POST"})}async replaceOrder(e,t){_e(YV,{orderId:e,newOrder:t});let r={useMasterBalance:t.useMasterBalance??!1};if(t.price!==void 0)r.price=t.price;if(t.quantity!==void 0)r.quantity=t.quantity;if(t.postOnly!==void 0)r.postOnly=t.postOnly;if(t.clientOrderId!==void 0)r.clientOrderId=t.clientOrderId;return await this.makeAuthenticatedRequest(ce.orders.replace(e),{method:"PUT",body:JSON.stringify(r)})}async batchCreate(e){_e(rZ,{orders:e});let t={orders:e.map((r)=>({tradingPairId:r.tradingPairId,orderType:r.orderType,side:r.side,price:r.price,quantity:r.quantity,tradingMode:r.tradingMode||"SPOT",slippageToleranceBps:r.slippageTolerance!==void 0?Math.round(r.slippageTolerance*1e4):void 0,useMasterBalance:r.useMasterBalance,expirationDate:r.expirationDate,timeInForce:r.timeInForce,marginAccountId:r.marginAccountId,marginMode:r.marginMode,riskBucketId:r.riskBucketId,riskBucketCollateral:r.riskBucketCollateral,strategyKey:r.strategyKey,positionSide:r.positionSide,leverage:r.leverage,reduceOnly:r.reduceOnly,postOnly:r.postOnly,clientOrderId:r.clientOrderId}))};return this.makeAuthenticatedRequest(ce.orders.batchCreate(),{method:"POST",body:JSON.stringify(t)})}async batchReplace(e){_e(nZ,{orders:e});let t={orders:e.map((r)=>({orderId:r.orderId,price:r.price,quantity:r.quantity,useMasterBalance:r.useMasterBalance,postOnly:r.postOnly,clientOrderId:r.clientOrderId}))};return this.makeAuthenticatedRequest(ce.orders.batchReplace(),{method:"POST",body:JSON.stringify(t)})}async getPaginatedOrders(e){if(e)_e(QV,e);let{page:t,pageSize:r=10,status:o,tradingPairId:n,tradingMode:i,marginAccountId:a,pageToken:s}=e||{},c=r>0?r:10,u=t!==void 0&&s===void 0,d=Math.min(c,u?100:1000),p=new URLSearchParams;if(u){let y=t>0?t:1;p.append("page",y.toString())}p.append("pageSize",d.toString());let m=typeof o==="string"?o:o?.join(",");if(m)p.append("status",m);if(n)p.append("tradingPairId",n);if(i)p.append("tradingMode",i);if(a)p.append("marginAccountId",a);if(!u)p.append("pageToken",s??"");let h=`/api/v1/orders?${p.toString()}`;return await this.makeAuthenticatedRequest(h,{method:"GET"})}async*iterateOrders(e){let t="";for(;;){let r=await this.getPaginatedOrders({...e,pageToken:t});if(yield*r.orders,!r.nextPageToken)return;t=r.nextPageToken}}async getOrder(e){return{order:await this.makeAuthenticatedRequest(ce.orders.get(e),{method:"GET"}),status:"SUCCESS"}}async createTwapOrder(e,t,r,o){_e(eZ,{tradingPairId:e,side:t,quantity:r,options:o});let n={tradingPairId:e,side:t,quantity:r,durationSeconds:o.durationSeconds!==void 0?Number(o.durationSeconds):void 0,startTime:o.startTime,endTime:o.endTime,limitPrice:o.limitPrice,slippageToleranceBps:o.slippageToleranceBps,randomize:o.randomize,reduceOnly:o.reduceOnly,tradingMode:o.tradingMode||"SPOT",marginAccountId:o.marginAccountId,riskBucketId:o.riskBucketId,marginMode:o.marginMode,leverage:o.leverage,strategyKey:o.strategyKey,useMasterBalance:o.useMasterBalance,clientTwapId:o.clientTwapId};return await this.makeAuthenticatedRequest(ce.orders.createTwap(),{method:"POST",body:JSON.stringify(n)})}async cancelTwapOrder(e){return _e(QO,{twapOrderId:e}),await this.makeAuthenticatedRequest(ce.orders.cancelTwap(e),{method:"POST"})}async getTwapOrder(e){return _e(QO,{twapOrderId:e}),await this.makeAuthenticatedRequest(ce.orders.getTwap(e),{method:"GET"})}async listTwapOrders(e){if(e)_e(tZ,e);let{page:t=1,pageSize:r=20,state:o,tradingPairId:n}=e||{};return await this.makeAuthenticatedRequest(ce.orders.listTwap({page:t,pageSize:Math.min(Math.max(r,1),100),state:o,tradingPairId:n}),{method:"GET"})}}var aC=[{inputs:[{internalType:"address",name:"rollup_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"InvalidAddress",type:"error"},{inputs:[],name:"NativeTransferFailed",type:"error"},{inputs:[],name:"NothingToSweep",type:"error"},{inputs:[],name:"OnlyClone",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"SafeERC20FailedOperation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Refunded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"RefundedNative",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Swept",type:"event"},{inputs:[],name:"config",outputs:[{internalType:"address",name:"user",type:"address"},{internalType:"string",name:"applicationId",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"refundNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rollup",outputs:[{internalType:"contract IRollup",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"sweep",outputs:[],stateMutability:"nonpayable",type:"function"}];var sC=[{inputs:[{internalType:"address",name:"rollup_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"CloneArgumentsTooLong",type:"error"},{inputs:[],name:"Create2EmptyBytecode",type:"error"},{inputs:[],name:"FailedDeployment",type:"error"},{inputs:[{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"sweeper",type:"address"},{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!1,internalType:"string",name:"applicationId",type:"string"}],name:"SweeperDeployed",type:"event"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"}],name:"deploy",outputs:[{internalType:"address",name:"sweeper",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"}],name:"isDeployed",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"}],name:"refundNative",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rollup",outputs:[{internalType:"contract IRollup",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"},{internalType:"address",name:"token",type:"address"}],name:"sweep",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"user",type:"address"}],name:"sweeperFor",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}];var cC=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AccessControlBadConfirmation",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bytes32",name:"neededRole",type:"bytes32"}],name:"AccessControlUnauthorizedAccount",type:"error"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[],name:"ECDSAInvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"length",type:"uint256"}],name:"ECDSAInvalidSignatureLength",type:"error"},{inputs:[{internalType:"bytes32",name:"s",type:"bytes32"}],name:"ECDSAInvalidSignatureS",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidAddress",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidSeed",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"InvalidTimestamp",type:"error"},{inputs:[],name:"NonceAlreadyUsed",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[],name:"ReentrancyGuardReentrantCall",type:"error"},{inputs:[],name:"TransferFailed",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newFeeCollector",type:"address"}],name:"FeeCollectorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newSettlementContract",type:"address"}],name:"SettlementContractChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"maker",type:"address"},{indexed:!0,internalType:"address",name:"taker",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"fee",type:"uint256"}],name:"SettlementTransfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Withdrawal",type:"event"},{inputs:[],name:"DEBUGGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"FEE_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PAUSER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"SETTLEMENT_MANAGER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPGRADER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"address",name:"token",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes",name:"seed",type:"bytes"}],name:"decodeSeed",outputs:[{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"destination",type:"address"},{internalType:"string",name:"applicationId",type:"string"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"depositERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"destination",type:"address"},{internalType:"string",name:"applicationId",type:"string"}],name:"depositNative",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"feeCollector",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getChainID",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_admin",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"callerConfirmation",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_newFeeCollector",type:"address"}],name:"setFeeCollector",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_settlementContract",type:"address"}],name:"setSettlementContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"settlementContract",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"maker",type:"address"},{internalType:"address",name:"taker",type:"address"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint256",name:"fee",type:"uint256"}],name:"transferOnSettlement",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"seed",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"seed",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"withdrawNative",outputs:[],stateMutability:"nonpayable",type:"function"}];var UCt=new Uint8Array(32);var uC={vault:cC,sweeper:aC,sweeperFactory:sC};var Z0e=5000,W0e=300000,K0e=(e)=>new Promise((t)=>setTimeout(t,e));function DZ(e,t){return t==="margin"?JSON.stringify({clientId:e,depositTarget:"MARGIN"}):e}class nS extends tt{publicClient;chain;applicationsAPI;profileAPI;walletClient;constructor(e,t,r,o,n,i){super(i);this.publicClient=e,this.chain=r,this.walletClient=t,this.applicationsAPI=o,this.profileAPI=n}setWalletClient(e){this.walletClient=e}async getVaultAddress(){return(await this.applicationsAPI.getApplicationConfig()).vaultContractAddress}async getClientId(){return(await this.applicationsAPI.getApplicationConfig()).clientId}async resolveAsset(e){let t,r;try{let o=await this.profileAPI.getUserBalanceByAssetId(e);t=o.token,r=o.wrappedNative===!0}catch(o){if(o instanceof cr){if(o.statusCode===404)throw new Ta(`Asset ID '${e}' does not exist`,{revertReason:"ASSET_NOT_FOUND",cause:o});throw new Ta(`Failed to resolve asset ID '${e}': ${o.retryable?"Network error occurred":"API request failed"}`,{revertReason:o.retryable?"NETWORK_ERROR":"API_ERROR",cause:o})}throw new Ta(`Failed to resolve asset ID '${e}': Unexpected error`,{revertReason:"UNKNOWN_ERROR",cause:o instanceof Error?o:void 0})}return{tokenAddress:t,isWrappedNative:r}}async approve(e,t,r=!0){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");_e(zZ,{assetId:e,amount:t,autoWait:r});let o=await this.getVaultAddress(),{tokenAddress:n}=await this.resolveAsset(e),i=this.walletClient.account;if(!i)throw new Ft("No account available in wallet client","account");let a=i.getNonce?await i.getNonce():0n,s=await this.walletClient.writeContract({address:n,abi:iw,functionName:"approve",args:[o,t],chain:this.chain,account:i}),c={nonce:a,hash:s,status:"pending"};return await this.waitForTransaction(c,r)}async deposit(e,t,r=!0,o="spot"){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");_e(NZ,{assetId:e,amount:t,autoWait:r,target:o});let n=await this.getVaultAddress(),i=await this.getClientId(),a=DZ(i,o),{tokenAddress:s,isWrappedNative:c}=await this.resolveAsset(e);if(!c){if(await this.needsApproval(e,t))throw new Ta(`Approval required before deposit. Please invoke approve() first for asset ${e} (token address: ${s}).`,{revertReason:"APPROVAL_REQUIRED"})}let u=this.walletClient.account;if(!u)throw new Ft("No account available in wallet client","account");let d;if(c)d=await this.walletClient.writeContract({address:n,abi:uC.vault,functionName:"depositNative",args:[u.address,a],account:u,chain:this.chain,value:t});else d=await this.walletClient.writeContract({address:n,abi:uC.vault,functionName:"depositERC20",args:[u.address,a,s,t],account:u,chain:this.chain});let p=u.getNonce?await u.getNonce():0n,m={hash:d,status:"pending",nonce:p};return await this.waitForTransaction(m,r)}async pollWithdrawalCalldata(e,t){let r=t?.pollIntervalMs??Z0e,o=t?.timeoutMs??W0e,n=Date.now()+o;for(;;){try{let{vaultAddress:i,calldata:a}=await this.makePublicRequest(`/api/v1/withdrawals/${e}`);if(a&&a!=="0x")return{vaultAddress:i,calldata:a}}catch(i){if(!(i instanceof cr&&(i.statusCode===404||i.statusCode===409)))throw i}if(Date.now()+r>n)return null;await K0e(r)}}async withdraw(e,t,r=!0,o,n){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let i=this.walletClient.account;if(!i)throw new Ft("No account available in wallet client","account");let a=i.address.toLowerCase(),s=typeof o==="string"?o:"spot",c=typeof o==="string"?n:o;_e(MZ,{assetId:e,amount:t,destination:a,autoWait:r,source:s});let{withdrawalIndex:u}=await this.makeAuthenticatedRequest("/api/v1/withdrawals",{method:"POST",body:JSON.stringify({assetId:e,amount:t.toString(),destination:a,source:s})});if(!r)return{withdrawalIndex:u,status:"awaiting_proof"};let d=await this.pollWithdrawalCalldata(u,c);if(!d)return{withdrawalIndex:u,status:"awaiting_proof"};let{vaultAddress:p,calldata:m}=d,h;try{h=await this.walletClient.sendTransaction({to:p,data:m,account:i,chain:this.chain})}catch(v){throw new Ta(`Failed to submit executeWithdrawal for withdrawal ${u}: ${v instanceof Error?v.message:"unknown error"}`,{cause:v instanceof Error?v:void 0})}let y=i.getNonce?await i.getNonce():0n,x={hash:h,status:"pending",nonce:y};return{...await this.waitForTransaction(x,r),withdrawalIndex:u}}async retryWithdrawal(e,t=!0,r){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let o=this.walletClient.account;if(!o)throw new Ft("No account available in wallet client","account");let n=await this.pollWithdrawalCalldata(e,r);if(!n)return{withdrawalIndex:e,status:"awaiting_proof"};let{vaultAddress:i,calldata:a}=n,s;try{s=await this.walletClient.sendTransaction({to:i,data:a,account:o,chain:this.chain})}catch(p){throw new Ta(`Failed to resubmit executeWithdrawal for withdrawal ${e}: ${p instanceof Error?p.message:"unknown error"}`,{cause:p instanceof Error?p:void 0})}let c=o.getNonce?await o.getNonce():0n,u={hash:s,status:"pending",nonce:c};return{...await this.waitForTransaction(u,t),withdrawalIndex:e}}async getBalance(e){throw new cr("getBalance() is deprecated and no longer supported. Please use profileAPI.getUserBalances() or profileAPI.getUserBalanceByAssetId() instead for balance data.",{statusCode:410})}async getAllowance(e){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let t=await this.getVaultAddress(),o=(await this.walletClient.getAddresses())[0];if(!o)throw new Ft("No account found in wallet client.","walletClient");let{tokenAddress:n}=await this.resolveAsset(e);return await this.publicClient.readContract({address:n,abi:iw,functionName:"allowance",args:[o,t]})}async needsApproval(e,t){let{isWrappedNative:r}=await this.resolveAsset(e);if(r)return!1;return await this.getAllowance(e)<t}async waitForTransaction(e,t=!0,r={}){if(!t)return e;let{confirmations:o=1,timeout:n=60000}=r;try{let i=await this.publicClient.waitForTransactionReceipt({hash:e.hash,confirmations:o,timeout:n});return{...e,status:i.status==="success"?"confirmed":"failed",receipt:i}}catch{return{...e,status:"failed"}}}}class oS extends tt{async submit(e){return await this.makePublicRequest(ce.whitelist.submit(),{method:"POST",body:JSON.stringify(e)})}}class lC extends tt{async initiateWithdrawal(e){return this.makeAuthenticatedRequest(ce.withdrawals.initiate(),{method:"POST",body:JSON.stringify({assetId:e.assetId,amount:e.amount,destination:e.destination,source:e.source??"spot"})})}async getWithdrawal(e){return this.makePublicRequest(ce.withdrawals.byIndex(e))}async listPendingWithdrawals(e){return this.makeAuthenticatedRequest(ce.withdrawals.list({page:e?.page,pageSize:e?.pageSize}))}}class iS extends tt{chain;walletClient;constructor(e,t,r){super(r);this.chain=t,this.walletClient=e}setWalletClient(e){this.walletClient=e}async authenticate(e,t){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let r=this.walletClient.account;if(!r)throw new Ft("No account available in wallet client","account");let o=W_(),n={publicKey:K_(o),privateKey:J_(o)},i=await this.createChallenge(r.address,e,n.publicKey),a=await this.signChallenge(i.message);return await this.verifySignature(r.address,a,i.nonce,e,n,t)}async signChallenge(e){if(!this.walletClient)throw new Ft("Wallet client not set. Connect a wallet first.","walletClient");let t=this.walletClient.account;if(!t)throw new Ft("No account available in wallet client","account");return await this.walletClient.signMessage({account:t,message:e})}async createChallenge(e,t,r){let o=await this.makePublicRequest("/api/v1/auth/challenge",{method:"POST",body:JSON.stringify({address:e,clientId:t,chainId:this.chain.id,sessionPublicKey:r})});return{nonce:o.nonce,message:o.message,expiresAt:o.expiresAt}}async verifySignature(e,t,r,o,n,i){let a=await this.makePublicRequest("/api/v1/auth/verify",{method:"POST",body:JSON.stringify({address:e,signature:t,nonce:r,clientId:o,chainId:this.chain.id,sessionPublicKey:n.publicKey,...i?{referralCode:i}:{}})});return{sessionPublicKey:n.publicKey,sessionPrivateKey:n.privateKey,expiresAt:a.expiresAt,user:{id:a.user.id,address:a.user.address,username:a.user.username}}}async refreshSession(){return{expiresAt:(await this.makeAuthenticatedRequest("/api/v1/auth/refresh",{method:"POST"})).expiresAt}}async revokeSession(){await this.makeAuthenticatedRequest("/api/v1/auth/revoke",{method:"POST"})}}var J0e=750;function UZ(e,t){try{new URL(e)}catch(r){throw new Ft(`${t} must be a valid URL, got: ${e}`,t)}return e}class pC{auth;delegatedAgents;applications;fees;pitpass;vault;withdrawals;trading;market;marginAccounts;positions;portfolio;subAccounts;faucet;sweeper;whitelist;profile;pulse;orderbook;trades;ws;walletClient;publicClient;authState;network;chain;propagateSession(e){this.auth.setSessionKeypair(e),this.delegatedAgents.setSessionKeypair(e),this.applications.setSessionKeypair(e),this.fees.setSessionKeypair(e),this.pitpass.setSessionKeypair(e),this.vault.setSessionKeypair(e),this.withdrawals.setSessionKeypair(e),this.trading.setSessionKeypair(e),this.market.setSessionKeypair(e),this.marginAccounts.setSessionKeypair(e),this.positions.setSessionKeypair(e),this.portfolio.setSessionKeypair(e),this.subAccounts.setSessionKeypair(e),this.faucet.setSessionKeypair(e),this.sweeper.setSessionKeypair(e),this.whitelist.setSessionKeypair(e),this.pulse.setSessionKeypair(e),this.profile.setSessionKeypair(e),this.orderbook.setSessionKeypair(e),this.trades.setSessionKeypair(e),this.ws.setSessionKeypair(e)}setServerKey(e){this.auth.setServerKey(e),this.delegatedAgents.setServerKey(e),this.applications.setServerKey(e),this.fees.setServerKey(e),this.pitpass.setServerKey(e),this.vault.setServerKey(e),this.withdrawals.setServerKey(e),this.trading.setServerKey(e),this.market.setServerKey(e),this.marginAccounts.setServerKey(e),this.positions.setServerKey(e),this.portfolio.setServerKey(e),this.subAccounts.setServerKey(e),this.faucet.setServerKey(e),this.sweeper.setServerKey(e),this.whitelist.setServerKey(e),this.pulse.setServerKey(e),this.profile.setServerKey(e),this.orderbook.setServerKey(e),this.trades.setServerKey(e)}sessionFromAuthState(e){return{publicKey:e.sessionPublicKey,privateKey:e.sessionPrivateKey}}constructor(e){let t=["mainnet","development","staging","local"];if(!e.network||!t.includes(e.network))throw new Ft(`network must be one of: ${t.join(", ")}. Got: ${e.network}`,"network");if(this.network=e.network,!e.seiRpcUrl)throw new Ft("seiRpcUrl is required","seiRpcUrl");try{new URL(e.seiRpcUrl)}catch(a){throw new Ft(`seiRpcUrl must be a valid URL, got: ${e.seiRpcUrl}`,"seiRpcUrl")}let r=e.wsUrl?UZ(e.wsUrl,"wsUrl"):GR(this.network),o=this.network==="mainnet"?LO:jO;if(this.chain=o,e.pollingInterval!==void 0&&(!Number.isFinite(e.pollingInterval)||e.pollingInterval<=0))throw new Ft(`pollingInterval must be a positive number of milliseconds, got: ${e.pollingInterval}`,"pollingInterval");let n=UO(e.seiRpcUrl);this.publicClient=MO({chain:o,transport:n,pollingInterval:e.pollingInterval??J0e});let i=e.apiUrl?UZ(e.apiUrl,"apiUrl"):HR(this.network);if(e.walletClient){if(e.walletClient.chain?.id!==o.id)throw new Ft(`Wallet client chain mismatch. Expected ${o.id}, got ${e.walletClient.chain?.id}`,"walletClient");this.walletClient=e.walletClient}this.applications=new N1(i),this.market=new V1(i),this.marginAccounts=new G1(i),this.positions=new Y1(i),this.portfolio=new J1(i),this.subAccounts=new X1(i),this.faucet=new M1(i),this.sweeper=new eS(i),this.whitelist=new oS(i),this.pulse=new Q1(i),this.auth=new iS(this.walletClient,this.chain,i),this.delegatedAgents=new HO(i),this.fees=new H1(i),this.pitpass=new W1(i),this.profile=new oC(i),this.vault=new nS(this.publicClient,this.walletClient,this.chain,this.applications,this.profile,i),this.withdrawals=new lC(i),this.trading=new rS(i),this.orderbook=new Z1(i),this.trades=new iC(i),this.ws=BR(r,e.ws),this.ws.connect().catch(console.error)}async login(e,t){if(this.authState=await this.auth.authenticate(e),this.propagateSession(this.sessionFromAuthState(this.authState)),t?.connectWebSocket)await this.ws.connect();return this.authState}async loginAsDelegatedOwner(e){if(!this.authState)throw new cr("No active agent session to create delegated session",{endpoint:"delegated-agents/sessions",statusCode:dC.StatusCodes.UNAUTHORIZED});let t=W_(),r={publicKey:K_(t),privateKey:J_(t)},o=await this.delegatedAgents.createDelegatedSession({ownerUserId:e,sessionPublicKey:r.publicKey});return this.authState={sessionPublicKey:r.publicKey,sessionPrivateKey:r.privateKey,expiresAt:o.expiresAt,user:{id:o.ownerUserId,address:o.agentAddress}},this.propagateSession(this.sessionFromAuthState(this.authState)),this.authState}getAuthState(){return this.authState}setAuthState(e){this.authState=e,this.propagateSession(this.sessionFromAuthState(e))}async logout(){if(this.authState)try{await this.auth.revokeSession()}catch(e){console.warn("Failed to revoke session on logout:",e)}this.authState=void 0,this.propagateSession(void 0),this.ws.disconnect()}async refreshAuth(){if(!this.authState)throw new cr("No active session to refresh",{endpoint:"auth/refresh",statusCode:dC.StatusCodes.UNAUTHORIZED});try{let e=await this.auth.refreshSession();return this.authState={...this.authState,expiresAt:e.expiresAt},this.authState}catch(e){throw this.authState=void 0,this.propagateSession(void 0),e}}isAuthenticated(){return!!this.authState}isConnected(){return!!this.walletClient&&!!this.publicClient}setWalletClient(e){if(e.chain?.id!==this.chain.id)throw new Ft(`Wallet client chain mismatch. Expected ${this.chain.id}, got ${e.chain?.id}`,"walletClient");this.walletClient=e,this.auth.setWalletClient(e),this.vault.setWalletClient(e)}getAccountAddress(){if(!this.walletClient)throw new hg("Wallet client not set","walletClient");if(this.walletClient.account)return this.walletClient.account.address;throw new hg("No account available","account")}getNetwork(){return this.network}getChainId(){return this.chain.id}async waitForTransaction(e,t,r){return this.publicClient.waitForTransactionReceipt({hash:e,confirmations:t,timeout:r})}}function fC(e){return new pC(e)}function wt(e){if(typeof e==="string")return{address:e,type:"json-rpc"};return e}var aS=256,sS;function cS(e=11){if(!sS||aS+e>512){sS="",aS=0;for(let t=0;t<256;t++)sS+=(256+Math.random()*256|0).toString(16).substring(1)}return sS.substring(aS,aS+++e)}function LZ(e){let{batch:t,chain:r,ccipRead:o,dataSuffix:n,key:i="base",name:a="Base Client",type:s="base"}=e,c=e.experimental_blockTag??(typeof r?.experimental_preconfirmationTime==="number"?"pending":void 0),u=r?.blockTime??12000,d=Math.min(Math.max(Math.floor(u/2),500),4000),p=e.pollingInterval??d,m=e.cacheTime??p,h=e.account?wt(e.account):void 0,{config:y,request:x,value:S}=e.transport({account:h,chain:r,pollingInterval:p}),v={...y,...S},E={account:h,batch:t,cacheTime:m,ccipRead:o,chain:r,dataSuffix:n,key:i,name:a,pollingInterval:p,request:x,transport:v,type:s,uid:cS(),...c?{experimental_blockTag:c}:{}};function w(_){return(T)=>{let k=T(_);for(let z in E)delete k[z];let O={..._,...k};return Object.assign(O,{extend:w(O)})}}return Object.assign(E,{extend:w(E)})}var jZ={gwei:9,wei:18},FZ={ether:-9,wei:9};function uS(e,t){let r=e.toString(),o=r.startsWith("-");if(o)r=r.slice(1);r=r.padStart(t,"0");let[n,i]=[r.slice(0,r.length-t),r.slice(r.length-t)];return i=i.replace(/(0+)$/,""),`${o?"-":""}${n||"0"}${i?`.${i}`:""}`}function Tn(e,t="wei"){return uS(e,FZ[t])}var mC="2.53.1";var hC={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${mC}`};class q extends Error{constructor(e,t={}){let r=(()=>{if(t.cause instanceof q)return t.cause.details;if(t.cause?.message)return t.cause.message;return t.details})(),o=(()=>{if(t.cause instanceof q)return t.cause.docsPath||t.docsPath;return t.docsPath})(),n=hC.getDocsUrl?.({...t,docsPath:o}),i=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...hC.version?[`Version: ${hC.version}`]:[]].join(`
|
|
147
147
|
`);super(i,t.cause?{cause:t.cause}:void 0);Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=mC}walk(e){return qZ(this,e)}}function qZ(e,t){if(t?.(e))return e;if(e&&typeof e==="object"&&"cause"in e&&e.cause!==void 0)return qZ(e.cause,t);return t?null:e}class xy extends q{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Yu extends q{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class gC extends q{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Tn(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class dc extends q{constructor({cause:e,message:t}={}){let r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(dc,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(dc,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class ii extends q{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${Tn(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(ii,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class vy extends q{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${Tn(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(vy,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class _y extends q{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(_y,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class wy extends q{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
|
|
148
148
|
`),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(wy,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Sy extends q{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(Sy,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Ty extends q{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
149
149
|
`),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(Ty,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class Ey extends q{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(Ey,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Iy extends q{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(Iy,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Py extends q{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(Py,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class qa extends q{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${Tn(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Tn(r)} gwei`:""}).`].join(`
|
|
@@ -166,4 +166,4 @@ ${t}`}function Y_(e,t){return lu(Z_.sign(jd(t),e))}var mg=[0.0001,0.001,0.01,0.1
|
|
|
166
166
|
`),{name:"ChainNotFoundError"})}}class If extends q{constructor({chainId:e}){super(typeof e==="number"?`Chain ID "${e}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}function Pf({chain:e,currentChainId:t}){if(!e)throw new WC;if(t!==e.id)throw new ZC({chain:e,currentChainId:t})}async function PS(e){let t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function oW(e,t){let{block:r,chain:o=e.chain,request:n}=t||{};try{let i=o?.fees?.maxPriorityFeePerGas??o?.fees?.defaultPriorityFee;if(typeof i==="function"){let s=r||await Le(e,si,"getBlock")({}),c=await i({block:s,client:e,request:n});if(c===null)throw Error();return c}if(typeof i<"u")return i;let a=await e.request({method:"eth_maxPriorityFeePerGas"});return Rr(a)}catch{let[i,a]=await Promise.all([r?Promise.resolve(r):Le(e,si,"getBlock")({}),Le(e,PS,"getGasPrice")({})]);if(typeof i.baseFeePerGas!=="bigint")throw new Yu;let s=a-i.baseFeePerGas;if(s<0n)return 0n;return s}}async function KC(e,t){let{block:r,chain:o=e.chain,request:n,type:i="eip1559"}=t||{},a=await(async()=>{if(typeof o?.fees?.baseFeeMultiplier==="function")return o.fees.baseFeeMultiplier({block:r,client:e,request:n});return o?.fees?.baseFeeMultiplier??1.2})();if(a<1)throw new xy;let c=10**(a.toString().split(".")[1]?.length??0),u=(m)=>m*BigInt(Math.ceil(a*c))/BigInt(c),d=r?r:await Le(e,si,"getBlock")({});if(typeof o?.fees?.estimateFeesPerGas==="function"){let m=await o.fees.estimateFeesPerGas({block:r,client:e,multiply:u,request:n,type:i});if(m!==null)return m}if(i==="eip1559"){if(typeof d.baseFeePerGas!=="bigint")throw new Yu;let m=typeof n?.maxPriorityFeePerGas==="bigint"?n.maxPriorityFeePerGas:await oW(e,{block:d,chain:o,request:n}),h=u(d.baseFeePerGas);return{maxFeePerGas:n?.maxFeePerGas??h+m,maxPriorityFeePerGas:m}}return{gasPrice:n?.gasPrice??u(await Le(e,PS,"getGasPrice")({}))}}class JC extends q{constructor(e,{account:t,docsPath:r,chain:o,data:n,gas:i,gasPrice:a,maxFeePerGas:s,maxPriorityFeePerGas:c,nonce:u,to:d,value:p}){let m=Xp({from:t?.address,to:d,value:typeof p<"u"&&`${lS(p)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:n,gas:i,gasPrice:typeof a<"u"&&`${Tn(a)} gwei`,maxFeePerGas:typeof s<"u"&&`${Tn(s)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Tn(c)} gwei`,nonce:u});super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",m].filter(Boolean),name:"EstimateGasExecutionError"});Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}function iW(e,{docsPath:t,...r}){let o=(()=>{let n=fS(e,r);if(n instanceof Qu)return e;return n})();return new JC(o,{docsPath:t,...r})}class YC extends q{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class QC extends q{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function aW(e){if(!e||e.length===0)return;return e.reduce((t,{slot:r,value:o})=>{if(r.length!==66)throw new gS({size:r.length,targetSize:66,type:"hex"});if(o.length!==66)throw new gS({size:o.length,targetSize:66,type:"hex"});return t[r]=o,t},{})}function _xe(e){let{balance:t,nonce:r,state:o,stateDiff:n,code:i}=e,a={};if(i!==void 0)a.code=i;if(t!==void 0)a.balance=ae(t);if(r!==void 0)a.nonce=ae(r);if(o!==void 0)a.state=aW(o);if(n!==void 0){if(a.state)throw new QC;a.stateDiff=aW(n)}return a}function sW(e){if(!e)return;let t={};for(let{address:r,...o}of e){if(!Nt(r,{strict:!1}))throw new Wt({address:r});if(t[r])throw new YC({address:r});t[r]=_xe(o)}return t}async function cW(e,t){let{account:r=e.account,prepare:o=!0}=t,n=r?wt(r):void 0,i=(()=>{if(Array.isArray(o))return o;if(n?.type!=="local")return["blobVersionedHashes"];return})();try{let a=await(async()=>{if(t.to)return t.to;if(t.authorizationList&&t.authorizationList.length>0)return await Ef({authorization:t.authorizationList[0]}).catch(()=>{throw new q("`to` is required. Could not infer from `authorizationList`")});return})(),{accessList:s,authorizationList:c,blobs:u,blobVersionedHashes:d,blockNumber:p,blockTag:m,data:h,gas:y,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:w,value:_,stateOverride:T,...k}=o?await _c(e,{...t,parameters:i,to:a}):t;if(y&&t.gas!==y)return y;let z=(typeof p==="bigint"?ae(p):void 0)||m,L=sW(T);Eo(t);let P=e.chain?.formatters?.transactionRequest?.format,G=(P||ji)({...bc(k,{format:P}),account:n,accessList:s,authorizationList:c,blobs:u,blobVersionedHashes:d,data:h,gasPrice:x,maxFeePerBlobGas:S,maxFeePerGas:v,maxPriorityFeePerGas:E,nonce:w,to:a,value:_},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:L?[G,z??e.experimental_blockTag??"latest",L]:z?[G,z]:[G]}))}catch(a){throw iW(a,{...t,account:n,chain:e.chain})}}function uW(e){let{blockHash:t,blockNumber:r,blockTag:o,requireCanonical:n}=e;if(n!==void 0&&!t)throw new q("`requireCanonical` can only be provided when `blockHash` is set.");if(t)return n?{blockHash:t,requireCanonical:n}:{blockHash:t};if(typeof r==="bigint")return ae(r);return o??"latest"}async function kS(e,{address:t,blockHash:r,blockNumber:o,blockTag:n="latest",requireCanonical:i}){let a=uW({blockHash:r,blockNumber:o,blockTag:n,requireCanonical:i}),s=await e.request({method:"eth_getTransactionCount",params:[t,a]},{dedupe:typeof o==="bigint"||r!==void 0});return $r(s)}function kf(e){let{kzg:t}=e,r=e.to??(typeof e.blobs[0]==="string"?"hex":"bytes"),o=typeof e.blobs[0]==="string"?e.blobs.map((i)=>vr(i)):e.blobs,n=[];for(let i of o)n.push(Uint8Array.from(t.blobToKzgCommitment(i)));return r==="bytes"?n:n.map((i)=>Ht(i))}function Af(e){let{kzg:t}=e,r=e.to??(typeof e.blobs[0]==="string"?"hex":"bytes"),o=typeof e.blobs[0]==="string"?e.blobs.map((a)=>vr(a)):e.blobs,n=typeof e.commitments[0]==="string"?e.commitments.map((a)=>vr(a)):e.commitments,i=[];for(let a=0;a<o.length;a++){let s=o[a],c=n[a];i.push(Uint8Array.from(t.computeBlobKzgProof(s,c)))}return r==="bytes"?i:i.map((a)=>Ht(a))}function lW(e,t){let r=t||"hex",o=d1(Wr(e,{strict:!1})?_f(e):e);if(r==="bytes")return o;return Kr(o)}function dW(e){let{commitment:t,version:r=1}=e,o=e.to??(typeof t==="string"?"hex":"bytes"),n=lW(t,"bytes");return n.set([r],0),o==="bytes"?n:Ht(n)}function AS(e){let{commitments:t,version:r}=e,o=e.to??(typeof t[0]==="string"?"hex":"bytes"),n=[];for(let i of t)n.push(dW({commitment:i,to:o,version:r}));return n}var pW=32,fW=4096,mW=131072,XC=761855;var RS=1;class e5 extends q{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`],name:"BlobSizeTooLargeError"})}}class Oy extends q{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class t5 extends q{constructor({hash:e,size:t}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${t}`],name:"InvalidVersionedHashSizeError"})}}class r5 extends q{constructor({hash:e,version:t}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${RS}`,`Received: ${t}`],name:"InvalidVersionedHashVersionError"})}}function hW(e){let t=e.to??(typeof e.data==="string"?"hex":"bytes"),r=typeof e.data==="string"?vr(e.data):e.data,o=St(r);if(!o)throw new Oy;if(o>XC)throw new e5({maxSize:XC,size:o});let n=[],i=!0,a=0;while(i){let s=Tf(new Uint8Array(mW)),c=0;while(c<fW){let u=r.slice(a,a+(pW-1));if(s.pushByte(0),s.pushBytes(u),u.length<31){s.pushByte(128),i=!1;break}c++,a+=31}n.push(s)}return t==="bytes"?n.map((s)=>s.bytes):n.map((s)=>Ht(s.bytes))}function $S(e){let{data:t,kzg:r,to:o}=e,n=e.blobs??hW({data:t,to:o}),i=e.commitments??kf({blobs:n,kzg:r,to:o}),a=e.proofs??Af({blobs:n,commitments:i,kzg:r,to:o}),s=[];for(let c=0;c<n.length;c++)s.push({blob:n[c],commitment:i[c],proof:a[c]});return s}function OS(e){if(e.type)return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u"){if(typeof e.accessList<"u")return"eip2930";return"legacy"}throw new bC({transaction:e})}var Cy=["blobVersionedHashes","chainId","fees","gas","nonce","type"],gW=new Map,n5=new Xn(128);async function _c(e,t){let r=t;r.account??=e.account,r.parameters??=Cy;let{account:o,chain:n=e.chain,nonceManager:i,parameters:a}=r,s=(()=>{if(typeof n?.prepareTransactionRequest==="function")return{fn:n.prepareTransactionRequest,runAt:["beforeFillTransaction"]};if(Array.isArray(n?.prepareTransactionRequest))return{fn:n.prepareTransactionRequest[0],runAt:n.prepareTransactionRequest[1].runAt};return})(),c;async function u(){if(c)return c;if(typeof r.chainId<"u")return r.chainId;if(n)return n.id;return c=await Le(e,rn,"getChainId")({}),c}let d=o?wt(o):o,p=r.nonce;if(a.includes("nonce")&&typeof p>"u"&&d&&i){let _=await u();p=await i.consume({address:d.address,chainId:_,client:e})}if(s?.fn&&s.runAt?.includes("beforeFillTransaction"))r=await s.fn({...r,chain:n},{client:e,phase:"beforeFillTransaction"}),p??=r.nonce;let h=(()=>{if((a.includes("blobVersionedHashes")||a.includes("sidecars"))&&r.kzg&&r.blobs)return!1;if(n5.get(e.uid)===!1)return!1;if(!["fees","gas"].some((T)=>a.includes(T)))return!1;if(a.includes("chainId")&&typeof r.chainId!=="number")return!0;if(a.includes("nonce")&&typeof p!=="number")return!0;if(a.includes("fees")&&typeof r.gasPrice!=="bigint"&&(typeof r.maxFeePerGas!=="bigint"||typeof r.maxPriorityFeePerGas!=="bigint"))return!0;if(a.includes("gas")&&typeof r.gas!=="bigint")return!0;return!1})()?await Le(e,yS,"fillTransaction")({...r,nonce:p}).then((_)=>{let{chainId:T,from:k,gas:O,gasPrice:z,nonce:L,maxFeePerBlobGas:P,maxFeePerGas:F,maxPriorityFeePerGas:G,type:ue,...W}=_.transaction;return n5.set(e.uid,!0),{...r,...k?{from:k}:{},...ue&&!r.type?{type:ue}:{},...typeof T<"u"?{chainId:T}:{},...typeof O<"u"?{gas:O}:{},...typeof z<"u"?{gasPrice:z}:{},...typeof L<"u"?{nonce:L}:{},...typeof P<"u"&&r.type!=="legacy"&&r.type!=="eip2930"?{maxFeePerBlobGas:P}:{},...typeof F<"u"&&r.type!=="legacy"&&r.type!=="eip2930"?{maxFeePerGas:F}:{},...typeof G<"u"&&r.type!=="legacy"&&r.type!=="eip2930"?{maxPriorityFeePerGas:G}:{},..."nonceKey"in W&&typeof W.nonceKey<"u"?{nonceKey:W.nonceKey}:{},..."keyAuthorization"in W&&typeof W.keyAuthorization<"u"&&W.keyAuthorization!==null&&!("keyAuthorization"in r)?{keyAuthorization:W.keyAuthorization}:{},..."feePayerSignature"in W&&typeof W.feePayerSignature<"u"&&W.feePayerSignature!==null?{feePayerSignature:W.feePayerSignature}:{},..."feeToken"in W&&typeof W.feeToken<"u"&&W.feeToken!==null&&!("feeToken"in r)?{feeToken:W.feeToken}:{},..._.capabilities?{_capabilities:_.capabilities}:{}}}).catch((_)=>{let T=_;if(T.name!=="TransactionExecutionError")return r;if(T.walk?.((z)=>z.name==="ExecutionRevertedError"))throw _;if(T.walk?.((z)=>{let L=z;return L.name==="MethodNotFoundRpcError"||L.name==="MethodNotSupportedRpcError"||L.message?.includes("eth_fillTransaction is not available")}))n5.set(e.uid,!1);return r}):r;p??=h.nonce,r={...h,...d?{from:d?.address}:{},...typeof p<"u"?{nonce:p}:{}};let{blobs:y,gas:x,kzg:S,type:v}=r;if(s?.fn&&s.runAt?.includes("beforeFillParameters"))r=await s.fn({...r,chain:n},{client:e,phase:"beforeFillParameters"});let E;async function w(){if(E)return E;return E=await Le(e,si,"getBlock")({blockTag:"latest"}),E}if(a.includes("nonce")&&typeof p>"u"&&d&&!i)r.nonce=await Le(e,kS,"getTransactionCount")({address:d.address,blockTag:"pending"});if((a.includes("blobVersionedHashes")||a.includes("sidecars"))&&y&&S){let _=kf({blobs:y,kzg:S});if(a.includes("blobVersionedHashes")){let T=AS({commitments:_,to:"hex"});r.blobVersionedHashes=T}if(a.includes("sidecars")){let T=Af({blobs:y,commitments:_,kzg:S}),k=$S({blobs:y,commitments:_,proofs:T,to:"hex"});r.sidecars=k}}if(a.includes("chainId"))r.chainId=await u();if((a.includes("fees")||a.includes("type"))&&typeof v>"u")try{r.type=OS(r)}catch{let _=gW.get(e.uid);if(typeof _>"u")_=typeof(await w())?.baseFeePerGas==="bigint",gW.set(e.uid,_);r.type=_?"eip1559":"legacy"}if(a.includes("fees"))if(r.type!=="legacy"&&r.type!=="eip2930"){if(typeof r.maxFeePerGas>"u"||typeof r.maxPriorityFeePerGas>"u"){let _=await w(),{maxFeePerGas:T,maxPriorityFeePerGas:k}=await KC(e,{block:_,chain:n,request:r});if(typeof r.maxPriorityFeePerGas>"u"&&r.maxFeePerGas&&r.maxFeePerGas<k)throw new gC({maxPriorityFeePerGas:k});r.maxPriorityFeePerGas=k,r.maxFeePerGas=T}}else{if(typeof r.maxFeePerGas<"u"||typeof r.maxPriorityFeePerGas<"u")throw new Yu;if(typeof r.gasPrice>"u"){let _=await w(),{gasPrice:T}=await KC(e,{block:_,chain:n,request:r,type:"legacy"});r.gasPrice=T}}if(a.includes("gas")&&typeof x>"u")r.gas=await Le(e,cW,"estimateGas")({...r,account:d,prepare:d?.type==="local"?[]:["blobVersionedHashes"]});if(s?.fn&&s.runAt?.includes("afterFillParameters"))r=await s.fn({...r,chain:n},{client:e,phase:"afterFillParameters"});return Eo(r),delete r.parameters,r}async function CS(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}var o5=new Xn(128);async function wc(e,t){let{account:r=e.account,assertChainId:o=!0,chain:n=e.chain,accessList:i,authorizationList:a,blobs:s,data:c,dataSuffix:u=typeof e.dataSuffix==="string"?e.dataSuffix:e.dataSuffix?.value,gas:d,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:h,maxPriorityFeePerGas:y,nonce:x,type:S,value:v,...E}=t;if(typeof r>"u")throw new Jr({docsPath:"/docs/actions/wallet/sendTransaction"});let w=r?wt(r):null,_;try{Eo(t);let T=await(async()=>{if(t.to)return t.to;if(t.to===null)return;if(a&&a.length>0)return await Ef({authorization:a[0]}).catch(()=>{throw new q("`to` is required. Could not infer from `authorizationList`.")});return})();if(w?.type==="json-rpc"||w===null){let k;if(n!==null){if(k=await Le(e,rn,"getChainId")({}),o)Pf({currentChainId:k,chain:n})}let O=e.chain?.formatters?.transactionRequest?.format,L=(O||ji)({...bc(E,{format:O}),accessList:i,account:w,authorizationList:a,blobs:s,chainId:k,data:u?gr([c??"0x",u]):c,gas:d,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:h,maxPriorityFeePerGas:y,nonce:x,to:T,type:S,value:v},"sendTransaction"),P=o5.get(e.uid),F=P?"wallet_sendTransaction":"eth_sendTransaction";try{return await e.request({method:F,params:[L]},{retryCount:0})}catch(G){if(P===!1)throw G;let ue=G;if(ue.name==="InvalidInputRpcError"||ue.name==="InvalidParamsRpcError"||ue.name==="MethodNotFoundRpcError"||ue.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[L]},{retryCount:0}).then((W)=>(o5.set(e.uid,!0),W)).catch((W)=>{let H=W;if(H.name==="MethodNotFoundRpcError"||H.name==="MethodNotSupportedRpcError")throw o5.set(e.uid,!1),ue;throw H});throw ue}}if(w?.type==="local"){if(w.nonceManager&&typeof x>"u"){let L=E.chainId,P=await(async()=>{if(typeof L==="number")return L;if(n)return n.id;return Le(e,rn,"getChainId")({})})();_={address:w.address,chainId:P}}let k=await Le(e,_c,"prepareTransactionRequest")({account:w,accessList:i,authorizationList:a,blobs:s,chain:n,data:u?gr([c??"0x",u]):c,gas:d,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:h,maxPriorityFeePerGas:y,nonce:x,nonceManager:w.nonceManager,parameters:[...Cy,"sidecars"],type:S,value:v,...E,to:T}),O=n?.serializers?.transaction,z=await w.signTransaction(k,{serializer:O});return await Le(e,CS,"sendRawTransaction")({serializedTransaction:z})}if(w?.type==="smart")throw new ci({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"});throw new ci({docsPath:"/docs/actions/wallet/sendTransaction",type:w?.type})}catch(T){if(T instanceof ci)throw T;if(_)w?.nonceManager?.reset(_);throw yc(T,{...t,account:w,chain:t.chain||void 0})}}function yW(e,t){let{abi:r,args:o,bytecode:n,...i}=t,a=QZ({abi:r,args:o,bytecode:n});return wc(e,{...i,...i.authorizationList?{to:null}:{},data:a})}async function bW(e){if(e.account?.type==="local")return[e.account.address];return(await e.request({method:"eth_accounts"},{dedupe:!0})).map((r)=>Wa(r))}function xW(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):e.blockTimestamp===null?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}var i5={"0x0":"reverted","0x1":"success"};function zS(e,t){let r={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map((o)=>xW(o)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?$r(e.transactionIndex):null,status:e.status?i5[e.status]:null,type:e.type?PC[e.type]||e.type:null};if(e.blobGasPrice)r.blobGasPrice=BigInt(e.blobGasPrice);if(e.blobGasUsed)r.blobGasUsed=BigInt(e.blobGasUsed);return r}var wxe=(e)=>hr(_f(e));function vW(e){return wxe(e)}rp();function _W(e){let t=!0,r="",o=0,n="",i=!1;for(let a=0;a<e.length;a++){let s=e[a];if(["(",")",","].includes(s))t=!0;if(s==="(")o++;if(s===")")o--;if(!t)continue;if(o===0){if(s===" "&&["event","function",""].includes(n))n="";else if(n+=s,s===")"){i=!0;break}continue}if(s===" "){if(e[a-1]!==","&&r!==","&&r!==",(")r="",t=!1;continue}n+=s,r+=s}if(!i)throw new q("Unable to normalize signature.");return n}var wW=(e)=>{let t=(()=>{if(typeof e==="string")return e;return Ca(e)})();return _W(t)};function NS(e){return vW(wW(e))}var Rf=(e)=>Ka(NS(e),0,4);var SW=NS;function MS(e){let{abi:t,args:r=[],name:o}=e,n=Wr(o,{strict:!1}),i=t.filter((s)=>{if(n){if(s.type==="function")return Rf(s)===o;if(s.type==="event")return SW(s)===o;return!1}return"name"in s&&s.name===o});if(i.length===0)return;if(i.length===1)return i[0];let a;for(let s of i){if(!("inputs"in s))continue;if(!r||r.length===0){if(!s.inputs||s.inputs.length===0)return s;continue}if(!s.inputs)continue;if(s.inputs.length===0)continue;if(s.inputs.length!==r.length)continue;if(r.every((u,d)=>{let p="inputs"in s&&s.inputs[d];if(!p)return!1;return a5(u,p)})){if(a&&"inputs"in a&&a.inputs){let u=TW(s.inputs,a.inputs,r);if(u)throw new MC({abiItem:s,type:u[0]},{abiItem:a,type:u[1]})}a=s}}if(a)return a;return i[0]}function a5(e,t){let r=typeof e,o=t.type;switch(o){case"address":return Nt(e,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:{if(o==="tuple"&&"components"in t)return Object.values(t.components).every((n,i)=>r==="object"&&a5(Object.values(e)[i],n));if(/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(o))return r==="number"||r==="bigint";if(/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(o))return r==="string"||e instanceof Uint8Array;if(/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(o))return Array.isArray(e)&&e.every((n)=>a5(n,{...t,type:o.replace(/(\[[0-9]{0,}\])$/,"")}));return!1}}}function TW(e,t,r){for(let o in e){let n=e[o],i=t[o];if(n.type==="tuple"&&i.type==="tuple"&&"components"in n&&"components"in i)return TW(n.components,i.components,r[o]);let a=[n.type,i.type];if((()=>{if(a.includes("address")&&a.includes("bytes20"))return!0;if(a.includes("address")&&a.includes("string"))return Nt(r[o],{strict:!1});if(a.includes("address")&&a.includes("bytes"))return Nt(r[o],{strict:!1});return!1})())return a}return}var EW="/docs/contract/encodeFunctionData";function IW(e){let{abi:t,args:r,functionName:o}=e,n=t[0];if(o){let i=MS({abi:t,args:r,name:o});if(!i)throw new vS(o,{docsPath:EW});n=i}if(n.type!=="function")throw new vS(void 0,{docsPath:EW});return{abi:[n],functionName:Rf(Fi(n))}}function BS(e){let{args:t}=e,{abi:r,functionName:o}=(()=>{if(e.abi.length===1&&e.functionName?.startsWith("0x"))return e;return IW(e)})(),n=r[0],i=o,a="inputs"in n&&n.inputs?ol(n.inputs,t??[]):void 0;return Io([i,a??"0x"])}var s5="0x5792579257925792579257925792579257925792579257925792579257925792",c5=ae(0,{size:32});async function DS(e,t){let{account:r=e.account,chain:o=e.chain,experimental_fallback:n,experimental_fallbackDelay:i=32,forceAtomic:a=!1,id:s,version:c="2.0.0"}=t,u=r?wt(r):null,d=t.capabilities;if(e.dataSuffix&&!t.capabilities?.dataSuffix)if(typeof e.dataSuffix==="string")d={...t.capabilities,dataSuffix:{value:e.dataSuffix,optional:!0}};else d={...t.capabilities,dataSuffix:{value:e.dataSuffix.value,...e.dataSuffix.required?{}:{optional:!0}}};let p=t.calls.map((m)=>{let h=m,y=h.abi?BS({abi:h.abi,functionName:h.functionName,args:h.args}):h.data;return{data:h.dataSuffix&&y?gr([y,h.dataSuffix]):y,to:h.to,value:h.value?ae(h.value):void 0}});try{let m=await e.request({method:"wallet_sendCalls",params:[{atomicRequired:a,calls:p,capabilities:d,chainId:ae(o.id),from:u?.address,id:s,version:c}]},{retryCount:0});if(typeof m==="string")return{id:m};return m}catch(m){let h=m;if(n&&(h.name==="MethodNotFoundRpcError"||h.name==="MethodNotSupportedRpcError"||h.name==="UnknownRpcError"||h.details.toLowerCase().includes("does not exist / is not available")||h.details.toLowerCase().includes("missing or invalid. request()")||h.details.toLowerCase().includes("did not match any variant of untagged enum")||h.details.toLowerCase().includes("account upgraded to unsupported contract")||h.details.toLowerCase().includes("eip-7702 not supported")||h.details.toLowerCase().includes("unsupported wc_ method")||h.details.toLowerCase().includes("feature toggled misconfigured")||h.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))){if(d){if(Object.values(d).some((v)=>!v.optional))throw new hc(new q("non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.",{details:"non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`."}))}if(a&&p.length>1)throw new gc(new q("`forceAtomic` is not supported on fallback to `eth_sendTransaction`.",{details:"`forceAtomic` is not supported on fallback to `eth_sendTransaction`."}));let y=[];for(let S of p){try{let v=await wc(e,{account:u,chain:o,data:S.data,to:S.to,value:S.value?Rr(S.value):void 0});y.push({status:"fulfilled",value:v})}catch(v){y.push({reason:v,status:"rejected"})}if(i>0)await new Promise((v)=>setTimeout(v,i))}if(y.every((S)=>S.status==="rejected"))throw y[0].reason;let x=y.map((S)=>{if(S.status==="fulfilled")return S.value;return c5});return{id:gr([...x,ae(o.id,{size:32}),s5])}}throw yc(m,{...t,account:u,chain:t.chain})}}async function US(e,t){async function r(d){if(d.endsWith(s5.slice(2))){let m=To(_S(d,-64,-32)),h=_S(d,0,-64).slice(2).match(/.{1,64}/g),y=await Promise.all(h.map((S)=>c5.slice(2)!==S?e.request({method:"eth_getTransactionReceipt",params:[`0x${S}`]},{dedupe:!0}):void 0)),x=(()=>{if(y.some((S)=>S===null))return 100;if(y.every((S)=>S?.status==="0x1"))return 200;if(y.every((S)=>S?.status==="0x0"))return 500;return 600})();return{atomic:!1,chainId:$r(m),receipts:y.filter(Boolean),status:x,version:"2.0.0"}}return e.request({method:"wallet_getCallsStatus",params:[d]})}let{atomic:o=!1,chainId:n,receipts:i,version:a="2.0.0",...s}=await r(t.id),[c,u]=(()=>{let d=s.status;if(d>=100&&d<200)return["pending",d];if(d>=200&&d<300)return["success",d];if(d>=300&&d<700)return["failure",d];if(d==="CONFIRMED")return["success",200];if(d==="PENDING")return["pending",100];return[void 0,d]})();return{...s,atomic:o,chainId:n?$r(n):void 0,receipts:i?.map((d)=>({...d,blockNumber:Rr(d.blockNumber),gasUsed:Rr(d.gasUsed),status:i5[d.status]}))??[],statusCode:u,status:c,version:a}}async function PW(e,t={}){let{account:r=e.account,chainId:o}=t,n=r?wt(r):void 0,i=o?[n?.address,[ae(o)]]:[n?.address],a=await e.request({method:"wallet_getCapabilities",params:i}),s={};for(let[c,u]of Object.entries(a)){s[Number(c)]={};for(let[d,p]of Object.entries(u)){if(d==="addSubAccount")d="unstable_addSubAccount";s[Number(c)][d]=p}}return typeof o==="number"?s[o]:s}async function kW(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}function AW(e,t){if(!Nt(e,{strict:!1}))throw new Wt({address:e});if(!Nt(t,{strict:!1}))throw new Wt({address:t});return e.toLowerCase()===t.toLowerCase()}async function LS(e,t){let{account:r=e.account,chainId:o,nonce:n}=t;if(!r)throw new Jr({docsPath:"/docs/eip7702/prepareAuthorization"});let i=wt(r),a=(()=>{if(!t.executor)return;if(t.executor==="self")return t.executor;return wt(t.executor)})(),s={address:t.contractAddress??t.address,chainId:o,nonce:n};if(typeof s.chainId>"u")s.chainId=e.chain?.id??await Le(e,rn,"getChainId")({});if(typeof s.nonce>"u"){if(s.nonce=await Le(e,kS,"getTransactionCount")({address:i.address,blockTag:"pending"}),a==="self"||a?.address&&AW(a.address,i.address))s.nonce+=1}return s}async function RW(e){return(await e.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map((r)=>VZ(r))}async function $W(e,t){return e.request({method:"wallet_requestPermissions",params:[t]},{retryCount:0})}class u5 extends q{constructor(e){super(`Call bundle failed with status: ${e.statusCode}`,{name:"BundleFailedError"});Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=e}}var jS=new Map,l5=new Map,Sxe=0;function il(e,t,r){let o=++Sxe,n=()=>jS.get(e)||[],i=()=>{let p=n().filter((m)=>m.id!==o);if(p.length===0){jS.delete(e),l5.delete(e);return}jS.set(e,p)},a=()=>{let d=n();if(!d.some((m)=>m.id===o))return;let p=l5.get(e);if(d.length===1&&p){let m=p();if(m instanceof Promise)m.catch(()=>{})}i()},s=n();if(jS.set(e,[...s,{id:o,fns:t}]),s&&s.length>0)return a;let c={};for(let d in t)c[d]=(...p)=>{let m=n();if(m.length===0)return;for(let h of m)h.fns[d]?.(...p)};let u=r(c);if(typeof u==="function")l5.set(e,u);return a}async function zy(e,{signal:t}={}){return new Promise((r,o)=>{if(t?.aborted){o(ai(t));return}let n=()=>t?.removeEventListener("abort",a),i=setTimeout(()=>{n(),r()},e),a=()=>{clearTimeout(i),n(),o(ai(t))};t?.addEventListener("abort",a,{once:!0})})}function FS(e,{emitOnBegin:t,initialWaitTime:r,interval:o}){let n=!0,i=()=>n=!1;return(async()=>{let s;if(t)s=await e({unpoll:i});let c=await r?.(s)??o;await zy(c);let u=async()=>{if(!n)return;await e({unpoll:i}),await zy(o),u()};u()})(),i}function $f(){let e=()=>{return},t=()=>{return};return{promise:new Promise((o,n)=>{e=o,t=n}),resolve:e,reject:t}}function al(e,{delay:t=100,retryCount:r=2,shouldRetry:o=()=>!0,signal:n}={}){return new Promise((i,a)=>{let s=async({count:c=0}={})=>{if(n?.aborted){a(ai(n));return}let u=async({error:d})=>{let p=typeof t==="function"?t({count:c,error:d}):t;if(p)try{await zy(p,{signal:n})}catch(m){a(m);return}s({count:c+1})};try{let d=await e();i(d)}catch(d){if(n?.aborted){a(ai(n));return}if(Ha(d)){a(d);return}if(c<r&&await o({count:c,error:d}))return u({error:d});a(d)}};s()})}async function qS(e,t){let{id:r,pollingInterval:o=e.pollingInterval,status:n=({statusCode:x})=>x===200||x>=300,retryCount:i=4,retryDelay:a=({count:x})=>~~(1<<x)*200,timeout:s=60000,throwOnFailure:c=!1}=t,u=rr(["waitForCallsStatus",e.uid,r]),{promise:d,resolve:p,reject:m}=$f(),h,y=il(u,{resolve:p,reject:m},(x)=>{let S=FS(async()=>{let v=(E)=>{clearTimeout(h),S(),E(),y()};try{let E=await al(async()=>{let w=await Le(e,US,"getCallsStatus")({id:r});if(c&&w.status==="failure")throw new u5(w);return w},{retryCount:i,delay:a});if(!n(E))return;v(()=>x.resolve(E))}catch(E){v(()=>x.reject(E))}},{interval:o,emitOnBegin:!0});return S});return h=s?setTimeout(()=>{y(),clearTimeout(h),m(new OW({id:r}))},s):void 0,await d}class OW extends q{constructor({id:e}){super(`Timed out while waiting for call bundle with id "${e}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}async function CW(e,t){let{chain:r=e.chain}=t,o=t.timeout??Math.max((r?.blockTime??0)*3,5000),n=await Le(e,DS,"sendCalls")(t);return await Le(e,qS,"waitForCallsStatus")({...t,id:n.id,timeout:o})}async function HS(e,{serializedTransaction:t,throwOnReceiptRevert:r,timeout:o}){let n=await e.request({method:"eth_sendRawTransactionSync",params:o?[t,o]:[t]},{retryCount:0}),a=(e.chain?.formatters?.transactionReceipt?.format||zS)(n);if(a.status==="reverted"&&r)throw new ef({receipt:a});return a}async function zW(e,{blockHash:t,blockNumber:r,blockTag:o,hash:n,index:i,sender:a,nonce:s}){let c=o||"latest",u=r!==void 0?ae(r):void 0,d=null;if(n)d=await e.request({method:"eth_getTransactionByHash",params:[n]},{dedupe:!0});else if(t)d=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,ae(i)]},{dedupe:!0});else if((u||c)&&typeof i==="number")d=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[u||c,ae(i)]},{dedupe:Boolean(u)});else if(a&&typeof s==="number")d=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[a,ae(s)]},{dedupe:!0});if(!d)throw new ky({blockHash:t,blockNumber:r,blockTag:c,hash:n,index:i});return(e.chain?.formatters?.transaction?.format||wf)(d,"getTransaction")}async function GS(e,{hash:t}){let r=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!r)throw new Ay({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||zS)(r,"getTransactionReceipt")}var Txe=new Map,Exe=new Map;function NW(e){let t=(n,i)=>({clear:()=>i.delete(n),get:()=>i.get(n),set:(a)=>i.set(n,a)}),r=t(e,Txe),o=t(e,Exe);return{clear:()=>{r.clear(),o.clear()},promise:r,response:o}}async function MW(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){let o=NW(t),n=o.response.get();if(n&&r>0){if(Date.now()-n.created.getTime()<r)return n.data}let i=o.promise.get();if(!i)i=e(),o.promise.set(i);try{let a=await i;return o.response.set({created:new Date,data:a}),a}finally{o.promise.clear()}}var Ixe=(e)=>`blockNumber.${e}`;async function BW(e,{cacheTime:t=e.cacheTime}={}){let r=await MW(()=>e.request({method:"eth_blockNumber"}),{cacheKey:Ixe(e.uid),cacheTime:t});return BigInt(r)}function DW(e,{emitOnBegin:t=!1,emitMissed:r=!1,onBlockNumber:o,onError:n,poll:i,pollingInterval:a=e.pollingInterval}){let s=(()=>{if(typeof i<"u")return i;if(e.transport.type==="webSocket"||e.transport.type==="ipc")return!1;if(e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc"))return!1;return!0})(),c;return s?(()=>{let p=rr(["watchBlockNumber",e.uid,t,r,a]);return il(p,{onBlockNumber:o,onError:n},(m)=>FS(async()=>{try{let h=await Le(e,BW,"getBlockNumber")({cacheTime:0});if(c!==void 0){if(h===c)return;if(h-c>1&&r)for(let y=c+1n;y<h;y++)m.onBlockNumber(y,c),c=y}if(c===void 0||h>c)m.onBlockNumber(h,c),c=h}catch(h){m.onError?.(h)}},{emitOnBegin:t,interval:a}))})():(()=>{let p=rr(["watchBlockNumber",e.uid,t,r]);return il(p,{onBlockNumber:o,onError:n},(m)=>{let h=!0,y=()=>h=!1;return(async()=>{try{let x=(()=>{if(e.transport.type==="fallback"){let v=e.transport.transports.find((E)=>E.config.type==="webSocket"||E.config.type==="ipc");if(!v)return e.transport;return v.value}return e.transport})(),{unsubscribe:S}=await x.subscribe({params:["newHeads"],onData(v){if(!h)return;let E=Rr(v.result?.number);m.onBlockNumber(E,c),c=E},onError(v){m.onError?.(v)}});if(y=S,!h)y()}catch(x){n?.(x)}})(),()=>y()})})()}async function UW(e,t){let{checkReplacement:r=!0,confirmations:o=1,hash:n,onReplaced:i,retryCount:a=6,retryDelay:s=({count:T})=>~~(1<<T)*200,timeout:c=180000}=t,u=rr(["waitForTransactionReceipt",e.uid,n]),d=(()=>{if(t.pollingInterval)return t.pollingInterval;if(e.chain?.experimental_preconfirmationTime)return e.chain.experimental_preconfirmationTime;return e.pollingInterval})(),p,m,h,y=!1,x,S,{promise:v,resolve:E,reject:w}=$f(),_=c?setTimeout(()=>{S?.(),x?.(),w(new _C({hash:n}))},c):void 0;return x=il(u,{onReplaced:i,resolve:E,reject:w},async(T)=>{if(h=await Le(e,GS,"getTransactionReceipt")({hash:n}).catch(()=>{return}),h&&o<=1){clearTimeout(_),T.resolve(h),x?.();return}S=Le(e,DW,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:d,async onBlockNumber(k){let O=(L)=>{clearTimeout(_),S?.(),L(),x?.()},z=k;if(y)return;try{if(h){if(o>1&&(!h.blockNumber||z-h.blockNumber+1n<o))return;O(()=>T.resolve(h));return}if(r&&!p)y=!0,await al(async()=>{if(p=await Le(e,zW,"getTransaction")({hash:n}),p.blockNumber)z=p.blockNumber},{delay:s,retryCount:a}),y=!1;if(h=await Le(e,GS,"getTransactionReceipt")({hash:n}),o>1&&(!h.blockNumber||z-h.blockNumber+1n<o))return;O(()=>T.resolve(h))}catch(L){if(L instanceof ky||L instanceof Ay){if(!p){y=!1;return}try{m=p,y=!0;let P=await al(()=>Le(e,si,"getBlock")({blockNumber:z,includeTransactions:!0}),{delay:s,retryCount:a,shouldRetry:({error:ue})=>ue instanceof Ry});y=!1;let F=P.transactions.find(({from:ue,nonce:W})=>ue===m.from&&W===m.nonce);if(!F)return;if(h=await Le(e,GS,"getTransactionReceipt")({hash:F.hash}),o>1&&(!h.blockNumber||z-h.blockNumber+1n<o))return;let G="replaced";if(F.to===m.to&&F.value===m.value&&F.input===m.input)G="repriced";else if(F.from===F.to&&F.value===0n)G="cancelled";O(()=>{T.onReplaced?.({reason:G,replacedTransaction:m,transaction:F,transactionReceipt:h}),T.resolve(h)})}catch(P){O(()=>T.reject(P))}}else O(()=>T.reject(L))}}})}),v}var d5=new Xn(128);async function VS(e,t){let{account:r=e.account,assertChainId:o=!0,chain:n=e.chain,accessList:i,authorizationList:a,blobs:s,data:c,dataSuffix:u=typeof e.dataSuffix==="string"?e.dataSuffix:e.dataSuffix?.value,gas:d,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:h,maxPriorityFeePerGas:y,nonce:x,pollingInterval:S,throwOnReceiptRevert:v,type:E,value:w,..._}=t,T=t.timeout??Math.max((n?.blockTime??0)*3,5000);if(typeof r>"u")throw new Jr({docsPath:"/docs/actions/wallet/sendTransactionSync"});let k=r?wt(r):null,O;try{Eo(t);let z=await(async()=>{if(t.to)return t.to;if(t.to===null)return;if(a&&a.length>0)return await Ef({authorization:a[0]}).catch(()=>{throw new q("`to` is required. Could not infer from `authorizationList`.")});return})();if(k?.type==="json-rpc"||k===null){let L;if(n!==null){if(L=await Le(e,rn,"getChainId")({}),o)Pf({currentChainId:L,chain:n})}let P=e.chain?.formatters?.transactionRequest?.format,G=(P||ji)({...bc(_,{format:P}),accessList:i,account:k,authorizationList:a,blobs:s,chainId:L,data:u?gr([c??"0x",u]):c,gas:d,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:h,maxPriorityFeePerGas:y,nonce:x,to:z,type:E,value:w},"sendTransaction"),ue=d5.get(e.uid),W=ue?"wallet_sendTransaction":"eth_sendTransaction",H=await(async()=>{try{return await e.request({method:W,params:[G]},{retryCount:0})}catch(Te){if(ue===!1)throw Te;let C=Te;if(C.name==="InvalidInputRpcError"||C.name==="InvalidParamsRpcError"||C.name==="MethodNotFoundRpcError"||C.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[G]},{retryCount:0}).then((B)=>(d5.set(e.uid,!0),B)).catch((B)=>{let Z=B;if(Z.name==="MethodNotFoundRpcError"||Z.name==="MethodNotSupportedRpcError")throw d5.set(e.uid,!1),C;throw Z});throw C}})(),fe=await Le(e,UW,"waitForTransactionReceipt")({checkReplacement:!1,hash:H,pollingInterval:S,timeout:T});if(v&&fe.status==="reverted")throw new ef({receipt:fe});return fe}if(k?.type==="local"){if(k.nonceManager&&typeof x>"u"){let G=_.chainId,ue=await(async()=>{if(typeof G==="number")return G;if(n)return n.id;return Le(e,rn,"getChainId")({})})();O={address:k.address,chainId:ue}}let L=await Le(e,_c,"prepareTransactionRequest")({account:k,accessList:i,authorizationList:a,blobs:s,chain:n,data:u?gr([c??"0x",u]):c,gas:d,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:h,maxPriorityFeePerGas:y,nonce:x,nonceManager:k.nonceManager,parameters:[...Cy,"sidecars"],type:E,value:w,..._,to:z}),P=n?.serializers?.transaction,F=await k.signTransaction(L,{serializer:P});return await Le(e,HS,"sendRawTransactionSync")({serializedTransaction:F,throwOnReceiptRevert:v,timeout:t.timeout})}if(k?.type==="smart")throw new ci({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"});throw new ci({docsPath:"/docs/actions/wallet/sendTransactionSync",type:k?.type})}catch(z){if(z instanceof ci)throw z;if(O&&!(z instanceof ef))k?.nonceManager?.reset(O);throw yc(z,{...t,account:k,chain:t.chain||void 0})}}async function LW(e,t){let{id:r}=t;await e.request({method:"wallet_showCallsStatus",params:[r]});return}async function jW(e,t){let{account:r=e.account}=t;if(!r)throw new Jr({docsPath:"/docs/eip7702/signAuthorization"});let o=wt(r);if(!o.signAuthorization)throw new ci({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:o.type});let n=await LS(e,t);return o.signAuthorization(n)}async function FW(e,{account:t=e.account,message:r}){if(!t)throw new Jr({docsPath:"/docs/actions/wallet/signMessage"});let o=wt(t);if(o.signMessage)return o.signMessage({message:r});let n=(()=>{if(typeof r==="string")return vc(r);if(r.raw instanceof Uint8Array)return Kr(r.raw);return r.raw})();return e.request({method:"personal_sign",params:[n,o.address]},{retryCount:0})}async function qW(e,t){let{account:r=e.account,chain:o=e.chain,...n}=t;if(!r)throw new Jr({docsPath:"/docs/actions/wallet/signTransaction"});let i=wt(r);Eo({account:i,...t});let a=await Le(e,rn,"getChainId")({});if(o!==null)Pf({currentChainId:a,chain:o});let c=(o?.formatters||e.chain?.formatters)?.transactionRequest?.format||ji;if(i.signTransaction)return i.signTransaction({...n,account:i,chainId:a},{serializer:e.chain?.serializers?.transaction});return await e.request({method:"eth_signTransaction",params:[{...c({...n,account:i},"signTransaction"),chainId:ae(a),from:i.address}]},{retryCount:0})}class p5 extends q{constructor({domain:e}){super(`Invalid domain "${rr(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class f5 extends q{constructor({primaryType:e,types:t}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(t))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class m5 extends q{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function HW(e){let{domain:t={},message:r,primaryType:o}=e,n={EIP712Domain:WS({domain:t}),...e.types};ZS({domain:t,message:r,primaryType:o,types:n});let i=["0x1901"];if(t)i.push(Pxe({domain:t,types:n}));if(o!=="EIP712Domain")i.push(GW({data:r,primaryType:o,types:n}));return hr(gr(i))}function Pxe({domain:e,types:t}){return GW({data:e,primaryType:"EIP712Domain",types:t})}function GW({data:e,primaryType:t,types:r}){let o=VW({data:e,primaryType:t,types:r});return hr(o)}function VW({data:e,primaryType:t,types:r}){let o=[{type:"bytes32"}],n=[kxe({primaryType:t,types:r})];for(let i of r[t]){let[a,s]=WW({types:r,name:i.name,type:i.type,value:e[i.name]});o.push(a),n.push(s)}return ol(o,n)}function kxe({primaryType:e,types:t}){let r=Kr(Axe({primaryType:e,types:t}));return hr(r)}function Axe({primaryType:e,types:t}){let r="",o=ZW({primaryType:e,types:t});o.delete(e);let n=[e,...Array.from(o).sort()];for(let i of n)r+=`${i}(${t[i].map(({name:a,type:s})=>`${s} ${a}`).join(",")})`;return r}function ZW({primaryType:e,types:t},r=new Set){let n=e.match(/^\w*/u)?.[0];if(r.has(n)||t[n]===void 0)return r;r.add(n);for(let i of t[n])ZW({primaryType:i.type,types:t},r);return r}function WW({types:e,name:t,type:r,value:o}){if(e[r]!==void 0)return[{type:"bytes32"},hr(VW({data:o,primaryType:r,types:e}))];if(r==="bytes")return[{type:"bytes32"},hr(o)];if(r==="string")return[{type:"bytes32"},hr(Kr(o))];if(r.lastIndexOf("]")===r.length-1){let n=r.slice(0,r.lastIndexOf("[")),i=o.map((a)=>WW({name:t,type:n,types:e,value:a}));return[{type:"bytes32"},hr(ol(i.map(([a])=>a),i.map(([,a])=>a)))]}return[{type:r},o]}function KW(e){let{domain:t,message:r,primaryType:o,types:n}=e,i=(c,u)=>{let d={...u};for(let p of c){let{name:m,type:h}=p;if(h==="address")d[m]=d[m].toLowerCase()}return d},a=(()=>{if(!n.EIP712Domain)return{};if(!t)return{};return i(n.EIP712Domain,t)})(),s=(()=>{if(o==="EIP712Domain")return;return i(n[o],r)})();return rr({domain:a,message:s,primaryType:o,types:n})}function ZS(e){let{domain:t,message:r,primaryType:o,types:n}=e,i=(a,s)=>{for(let c of a){let{name:u,type:d}=c,p=s[u],m=d.match(wS);if(m&&(typeof p==="number"||typeof p==="bigint")){let[x,S,v]=m;ae(p,{signed:S==="int",size:Number.parseInt(v,10)/8})}if(d==="address"&&typeof p==="string"&&!Nt(p))throw new Wt({address:p});let h=d.match(YZ);if(h){let[x,S]=h;if(S&&St(p)!==Number.parseInt(S,10))throw new BC({expectedSize:Number.parseInt(S,10),givenSize:St(p)})}let y=n[d];if(y)Rxe(d),i(y,p)}};if(n.EIP712Domain&&t){if(typeof t!=="object")throw new p5({domain:t});i(n.EIP712Domain,t)}if(o!=="EIP712Domain")if(n[o])i(n[o],r);else throw new f5({primaryType:o,types:n})}function WS({domain:e}){return[typeof e?.name==="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},(typeof e?.chainId==="number"||typeof e?.chainId==="bigint")&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function Rxe(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new m5({type:e})}async function JW(e,t){let{account:r=e.account,domain:o,message:n,primaryType:i}=t;if(!r)throw new Jr({docsPath:"/docs/actions/wallet/signTypedData"});let a=wt(r),s={EIP712Domain:WS({domain:o}),...t.types};if(ZS({domain:o,message:n,primaryType:i,types:s}),a.signTypedData)return a.signTypedData({domain:o,message:n,primaryType:i,types:s});let c=KW({domain:o,message:n,primaryType:i,types:s});return e.request({method:"eth_signTypedData_v4",params:[a.address,c]},{retryCount:0})}async function YW(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:ae(t)}]},{retryCount:0})}async function QW(e,t){return await e.request({method:"wallet_watchAsset",params:t},{retryCount:0})}var XW={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},eK={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},tK={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function rK(e,t={}){if(typeof t.size<"u")Qn(e,{size:t.size});let r=Ht(e,t);return Rr(r,t)}function nK(e,t={}){let r=e;if(typeof t.size<"u")Qn(r,{size:t.size}),r=To(r);if(r.length>1||r[0]>1)throw new SC(r);return Boolean(r[0])}function qi(e,t={}){if(typeof t.size<"u")Qn(e,{size:t.size});let r=Ht(e,t);return $r(r,t)}function oK(e,t={}){let r=e;if(typeof t.size<"u")Qn(r,{size:t.size}),r=To(r,{dir:"right"});return new TextDecoder().decode(r)}function aK(e,t){let r=typeof t==="string"?vr(t):t,o=Tf(r);if(St(r)===0&&e.length>0)throw new nl;if(St(t)&&St(t)<32)throw new OC({data:typeof t==="string"?t:Ht(t),params:e,size:St(t)});let n=0,i=[];for(let a=0;a<e.length;++a){let s=e[a];o.setPosition(n);let[c,u]=Of(o,s,{staticPosition:0});n+=u,i.push(c)}return i}function Of(e,t,{staticPosition:r}){let o=SS(t.type);if(o){let[n,i]=o;return Oxe(e,{...t,type:i},{length:n,staticPosition:r})}if(t.type==="tuple")return Mxe(e,t,{staticPosition:r});if(t.type==="address")return $xe(e);if(t.type==="bool")return Cxe(e);if(t.type.startsWith("bytes"))return zxe(e,t,{staticPosition:r});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Nxe(e,t);if(t.type==="string")return Bxe(e,{staticPosition:r});throw new UC(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}var iK=32,h5=32;function $xe(e){let t=e.readBytes(32);return[Wa(Ht(jC(t,-20))),32]}function Oxe(e,t,{length:r,staticPosition:o}){if(!r){let a=qi(e.readBytes(h5)),s=o+a,c=s+iK;e.setPosition(s);let u=qi(e.readBytes(iK)),d=Ny(t),p=0,m=[];for(let h=0;h<u;++h){e.setPosition(c+(d?h*32:p));let[y,x]=Of(e,t,{staticPosition:c});p+=x,m.push(y)}return e.setPosition(o+32),[m,32]}if(Ny(t)){let a=qi(e.readBytes(h5)),s=o+a,c=[];for(let u=0;u<r;++u){e.setPosition(s+u*32);let[d]=Of(e,t,{staticPosition:s});c.push(d)}return e.setPosition(o+32),[c,32]}let n=0,i=[];for(let a=0;a<r;++a){let[s,c]=Of(e,t,{staticPosition:o+n});n+=c,i.push(s)}return[i,n]}function Cxe(e){return[nK(e.readBytes(32),{size:32}),32]}function zxe(e,t,{staticPosition:r}){let[o,n]=t.type.split("bytes");if(!n){let a=qi(e.readBytes(32));e.setPosition(r+a);let s=qi(e.readBytes(32));if(s===0)return e.setPosition(r+32),["0x",32];let c=e.readBytes(s);return e.setPosition(r+32),[Ht(c),32]}return[Ht(e.readBytes(Number.parseInt(n,10),32)),32]}function Nxe(e,t){let r=t.type.startsWith("int"),o=Number.parseInt(t.type.split("int")[1]||"256",10),n=e.readBytes(32);return[o>48?rK(n,{signed:r}):qi(n,{signed:r}),32]}function Mxe(e,t,{staticPosition:r}){let o=t.components.length===0||t.components.some(({name:a})=>!a),n=o?[]:{},i=0;if(Ny(t)){let a=qi(e.readBytes(h5)),s=r+a;for(let c=0;c<t.components.length;++c){let u=t.components[c];e.setPosition(s+i);let[d,p]=Of(e,u,{staticPosition:s});i+=p,n[o?c:u?.name]=d}return e.setPosition(r+32),[n,32]}for(let a=0;a<t.components.length;++a){let s=t.components[a],[c,u]=Of(e,s,{staticPosition:r});n[o?a:s?.name]=c,i+=u}return[n,i]}function Bxe(e,{staticPosition:t}){let r=qi(e.readBytes(32)),o=t+r;e.setPosition(o);let n=qi(e.readBytes(32));if(n===0)return e.setPosition(t+32),["",32];let i=e.readBytes(n,32),a=oK(To(i));return e.setPosition(t+32),[a,32]}function Ny(e){let{type:t}=e;if(t==="string")return!0;if(t==="bytes")return!0;if(t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Ny);let r=SS(e.type);if(r&&Ny({...e,type:r[1]}))return!0;return!1}function sK(e){let{abi:t,data:r,cause:o}=e,n=Ka(r,0,4);if(n==="0x")throw new nl({cause:o});let a=[...t||[],eK,tK].find((s)=>s.type==="error"&&n===Rf(Fi(s)));if(!a)throw new $y(n,{docsPath:"/docs/contract/decodeErrorResult",cause:o});return{abiItem:a,args:"inputs"in a&&a.inputs&&a.inputs.length>0?aK(a.inputs,Ka(r,4)):void 0,errorName:a.name}}function g5({abiItem:e,args:t,includeFunctionName:r=!0,includeName:o=!1}){if(!("name"in e))return;if(!("inputs"in e))return;if(!e.inputs)return;return`${r?e.name:""}(${e.inputs.map((n,i)=>`${o&&n.name?`${n.name}: `:""}${typeof t[i]==="object"?rr(t[i]):t[i]}`).join(", ")})`}class y5 extends q{constructor(e,{abi:t,args:r,contractAddress:o,docsPath:n,functionName:i,sender:a}){let s=MS({abi:t,args:r,name:i}),c=s?g5({abiItem:s,args:r,includeFunctionName:!1,includeName:!1}):void 0,u=s?Fi(s,{includeName:!0}):void 0,d=Xp({address:o&&HZ(o),function:u,args:c&&c!=="()"&&`${[...Array(i?.length??0).keys()].map(()=>" ").join("")}${c}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:e,docsPath:n,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"});Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=o,this.functionName=i,this.sender=a}}class b5 extends q{constructor({abi:e,data:t,functionName:r,message:o,cause:n}){let i,a,s,c;if(t&&t!=="0x")try{a=sK({abi:e,data:t,cause:n});let{abiItem:d,errorName:p,args:m}=a;if(p==="Error")c=m[0];else if(p==="Panic"){let[h]=m;c=XW[h]}else{let h=d?Fi(d,{includeName:!0}):void 0,y=d&&m?g5({abiItem:d,args:m,includeFunctionName:!1,includeName:!1}):void 0;s=[h?`Error: ${h}`:"",y&&y!=="()"?` ${[...Array(p?.length??0).keys()].map(()=>" ").join("")}${y}`:""]}}catch(d){i=d}else if(o)c=o;let u;if(i instanceof $y)u=i.signature,s=[`Unable to decode signature "${u}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${u}.`];super(c&&c!=="execution reverted"||u?[`The contract function "${r}" reverted with the following ${u?"signature":"reason"}:`,c||u].join(`
|
|
167
167
|
`):`The contract function "${r}" reverted.`,{cause:i??n,metaMessages:s,name:"ContractFunctionRevertedError"});Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=a,this.raw=t,this.reason=c,this.signature=u}}class x5 extends q{constructor({functionName:e,cause:t}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError",cause:t})}}class v5 extends q{constructor({data:e,message:t}){super(t||"",{name:"RawContractError"});Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}var Dxe=3;function cK(e,{abi:t,address:r,args:o,docsPath:n,functionName:i,sender:a}){let s=e instanceof v5?e:e instanceof q?e.walk((y)=>("data"in y))||e.walk():{},{code:c,data:u,details:d,message:p,shortMessage:m}=s,h=(()=>{if(e instanceof nl)return new x5({functionName:i,cause:e});if([Dxe,Ga.code].includes(c)&&(u||d||p||m)||c===fc.code&&d==="execution reverted"&&u)return new b5({abi:t,data:typeof u==="object"?u.data:u,functionName:i,message:s instanceof Xu?d:m??p,cause:e});return e})();return new y5(h,{abi:t,args:o,contractAddress:r,docsPath:n,functionName:i,sender:a})}async function sl(e,t){return sl.internal(e,wc,"sendTransaction",t)}(function(e){async function t(r,o,n,i){let{abi:a,account:s=r.account,address:c,args:u,functionName:d,...p}=i;if(typeof s>"u")throw new Jr({docsPath:"/docs/contract/writeContract"});let m=s?wt(s):null,h=BS({abi:a,args:u,functionName:d});try{return await Le(r,o,n)({data:h,to:c,account:m,...p})}catch(y){throw cK(y,{abi:a,address:c,args:u,docsPath:"/docs/contract/writeContract",functionName:d,sender:m?.address})}}e.internal=t})(sl||(sl={}));async function uK(e,t){return sl.internal(e,VS,"sendTransactionSync",t)}function lK(e){return{addChain:(t)=>WZ(e,t),deployContract:(t)=>yW(e,t),fillTransaction:(t)=>yS(e,t),getAddresses:()=>bW(e),getCallsStatus:(t)=>US(e,t),getCapabilities:(t)=>PW(e,t),getChainId:()=>rn(e),getPermissions:()=>kW(e),prepareAuthorization:(t)=>LS(e,t),prepareTransactionRequest:(t)=>_c(e,t),requestAddresses:()=>RW(e),requestPermissions:(t)=>$W(e,t),sendCalls:(t)=>DS(e,t),sendCallsSync:(t)=>CW(e,t),sendRawTransaction:(t)=>CS(e,t),sendRawTransactionSync:(t)=>HS(e,t),sendTransaction:(t)=>wc(e,t),sendTransactionSync:(t)=>VS(e,t),showCallsStatus:(t)=>LW(e,t),signAuthorization:(t)=>jW(e,t),signMessage:(t)=>FW(e,t),signTransaction:(t)=>qW(e,t),signTypedData:(t)=>JW(e,t),switchChain:(t)=>YW(e,t),waitForCallsStatus:(t)=>qS(e,t),watchAsset:(t)=>QW(e,t),writeContract:(t)=>sl(e,t),writeContractSync:(t)=>uK(e,t)}}function _5(e){let{key:t="wallet",name:r="Wallet Client",transport:o}=e;return LZ({...e,key:t,name:r,transport:o,type:"walletClient"}).extend(lK)}class w5 extends q{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}var S5=new Map;function dK({fn:e,id:t,shouldSplitBatch:r,wait:o=0,sort:n}){let i=async()=>{let d=c();a();let p=d.map(({args:m})=>m);if(p.length===0)return;e(p).then((m)=>{if(n&&Array.isArray(m))m.sort(n);for(let h=0;h<d.length;h++){let{resolve:y}=d[h];y?.([m[h],m])}}).catch((m)=>{for(let h=0;h<d.length;h++){let{reject:y}=d[h];y?.(m)}})},a=()=>S5.delete(t),s=()=>c().map(({args:d})=>d),c=()=>S5.get(t)||[],u=(d)=>S5.set(t,[...c(),d]);return{flush:a,async schedule(d){let{promise:p,resolve:m,reject:h}=$f();if(r?.([...s(),d]))i();if(c().length>0)return u({args:d,resolve:m,reject:h}),p;return u({args:d,resolve:m,reject:h}),setTimeout(i,o),p}}}function pK(e,{errorInstance:t=Error("timed out"),timeout:r,signal:o}){return new Promise((n,i)=>{(async()=>{let a,s=new AbortController;try{if(r>0)a=setTimeout(()=>{if(o)s.abort();else i(t)},r);n(await e({signal:s?.signal||null}))}catch(c){if(s?.signal.aborted&&Ha(c)){i(t);return}i(c)}finally{clearTimeout(a)}})()})}function Uxe(){return{current:0,take(){return this.current++},reset(){this.current=0}}}var T5=Uxe();function fK(e,t={}){let{url:r,headers:o}=Lxe(e);return{async request(n){let{body:i,fetchFn:a=t.fetchFn??fetch,onRequest:s=t.onRequest,onResponse:c=t.onResponse,timeout:u=t.timeout??1e4}=n,d={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:p,method:m,signal:h}=d;try{let y=await pK(async({signal:S})=>{let v={...d,body:Array.isArray(i)?rr(i.map((T)=>({jsonrpc:"2.0",id:T.id??T5.take(),...T}))):rr({jsonrpc:"2.0",id:i.id??T5.take(),...i}),headers:{...o,"Content-Type":"application/json",...p},method:m||"POST",signal:h||(u>0?S:null)},E=new Request(r,v),w=await s?.(E,v)??{...v,url:r};return await a(w.url??r,w)},{errorInstance:new pS({body:i,url:r}),timeout:u,signal:!0});if(c)await c(y);let x;if(y.headers.get("Content-Type")?.startsWith("application/json"))x=await y.json();else{x=await y.text();try{x=JSON.parse(x||"{}")}catch(S){if(y.ok)throw S;x={error:x}}}if(!y.ok){if(typeof x.error?.code==="number"&&typeof x.error?.message==="string")return x;throw new pc({body:i,details:rr(x.error)||y.statusText,headers:y.headers,status:y.status,url:r})}return x}catch(y){if(h?.aborted)throw ai(h);if(Ha(y))throw y;if(y instanceof pc)throw y;if(y instanceof pS)throw y;throw new pc({body:i,cause:y,url:r})}}}}function Lxe(e){try{let t=new URL(e),r=(()=>{if(t.username){let o=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(o)}`}}}return})();return{url:t.toString(),...r}}catch{return{url:e}}}var KS=new Xn(8192);function mK(e,{enabled:t=!0,id:r}){if(!t||!r)return e();if(KS.get(r))return KS.get(r);let o=e().finally(()=>KS.delete(r));return KS.set(r,o),o}function hK(e,t={}){return async(r,o={})=>{let{dedupe:n=!1,methods:i,retryDelay:a=150,retryCount:s=3,signal:c,uid:u}={...t,...o},{method:d}=r;if(i?.exclude?.includes(d))throw new mc(Error("method not supported"),{method:d});if(i?.include&&!i.include.includes(d))throw new mc(Error("method not supported"),{method:d});if(c?.aborted)throw ai(c);let p=n?Fxe(`${u}.${rr(r)}`):void 0;return mK(()=>al(async()=>{try{return await e(r,c?{signal:c}:void 0)}catch(m){if(c?.aborted)throw ai(c);if(Ha(m))throw m;let h=m;switch(h.code){case tf.code:throw new tf(h);case rf.code:throw new rf(h);case nf.code:throw new nf(h,{method:r.method});case of.code:throw new of(h);case Ga.code:throw new Ga(h);case fc.code:throw new fc(h);case af.code:throw new af(h);case sf.code:throw new sf(h);case cf.code:throw new cf(h);case mc.code:throw new mc(h,{method:r.method});case el.code:throw new el(h);case uf.code:throw new uf(h);case tl.code:throw new tl(h);case lf.code:throw new lf(h);case df.code:throw new df(h);case pf.code:throw new pf(h);case ff.code:throw new ff(h);case mf.code:throw new mf(h);case hc.code:throw new hc(h);case hf.code:throw new hf(h);case gf.code:throw new gf(h);case yf.code:throw new yf(h);case bf.code:throw new bf(h);case xf.code:throw new xf(h);case gc.code:throw new gc(h);case 5000:throw new tl(h);case vf.code:throw new vf(h);default:if(m instanceof q)throw m;throw new wC(h)}}},{delay:({count:m,error:h})=>{if(h&&h instanceof pc){let y=h?.headers?.get("Retry-After");if(y?.match(/\d/))return Number.parseInt(y,10)*1000}return~~(1<<m)*a},retryCount:s,signal:c,shouldRetry:({error:m})=>jxe(m)}),{enabled:n,id:p})}}function jxe(e){if(Ha(e))return!1;if("code"in e&&typeof e.code==="number"){if(e.code===-1)return!0;if(e.code===el.code)return!0;if(e.code===Ga.code)return!0;if(e.code===429)return!0;return!1}if(e instanceof pc&&e.status){if(e.status===403)return!0;if(e.status===408)return!0;if(e.status===413)return!0;if(e.status===429)return!0;if(e.status===500)return!0;if(e.status===502)return!0;if(e.status===503)return!0;if(e.status===504)return!0;return!1}return!0}function Fxe(e,t=0){let r=3735928559^t,o=1103547991^t;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);r=Math.imul(r^i,2654435761),o=Math.imul(o^i,1597334677)}return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(o^o>>>16,3266489909),o=Math.imul(o^o>>>16,2246822507),o^=Math.imul(r^r>>>16,3266489909),(4294967296*(2097151&o)+(r>>>0)).toString(36)}function gK({key:e,methods:t,name:r,request:o,retryCount:n=3,retryDelay:i=150,timeout:a,type:s},c){let u=cS();return{config:{key:e,methods:t,name:r,request:o,retryCount:n,retryDelay:i,timeout:a,type:s},request:hK(o,{methods:t,retryCount:n,retryDelay:i,uid:u}),value:c}}var qxe=0,yK=new WeakMap;function Hxe(e){if(!e)return"default";let t=yK.get(e);if(t!==void 0)return t;let r=qxe++;return yK.set(e,r),r}function E5(e,t={}){let{batch:r,fetchFn:o,fetchOptions:n,key:i="http",methods:a,name:s="HTTP JSON-RPC",onFetchRequest:c,onFetchResponse:u,retryDelay:d,raw:p}=t;return({chain:m,retryCount:h,timeout:y})=>{let{batchSize:x=1000,wait:S=0}=typeof r==="object"?r:{},v=t.retryCount??h,E=y??t.timeout??1e4,w=e||m?.rpcUrls.default.http[0];if(!w)throw new w5;let _=fK(w,{fetchFn:o,fetchOptions:n,onRequest:c,onResponse:u,timeout:E});return gK({key:i,methods:a,name:s,async request({method:T,params:k},O){let z={method:T,params:k},L=O?.signal?{signal:O.signal}:void 0,{schedule:P}=dK({id:`${w}.${Hxe(O?.signal)}`,wait:S,shouldSplitBatch(W){return W.length>x},fn:(W)=>_.request({body:W,fetchOptions:L}),sort:(W,H)=>W.id-H.id}),F=async(W)=>r?P(W):[await _.request({body:W,fetchOptions:L})],[{error:G,result:ue}]=await F(z);if(p)return{error:G,result:ue};if(G)throw new Xu({body:z,error:G,url:w});return ue},retryCount:v,retryDelay:d,timeout:E,type:"http"},{fetchOptions:n,url:w})}}ic();function bK(e){if(typeof e==="string"){if(!Nt(e,{strict:!1}))throw new Wt({address:e});return{address:e,type:"json-rpc"}}if(!Nt(e.address,{strict:!1}))throw new Wt({address:e.address});return{address:e.address,nonceManager:e.nonceManager,sign:e.sign,signAuthorization:e.signAuthorization,signMessage:e.signMessage,signTransaction:e.signTransaction,signTypedData:e.signTypedData,source:"custom",type:"local"}}ic();ic();function xK({r:e,s:t,to:r="hex",v:o,yParity:n}){let i=(()=>{if(n===0||n===1)return n;if(o&&(o===27n||o===28n||o>=35n))return o%2n===0n?1:0;throw Error("Invalid `v` or `yParity` value")})(),a=`0x${new Sn.Signature(Rr(e),Rr(t)).toCompactHex()}${i===0?"1b":"1c"}`;if(r==="hex")return a;return vr(a)}var I5=!1;async function Hi({hash:e,privateKey:t,to:r="object"}){let{r:o,s:n,recovery:i}=Sn.sign(e.slice(2),t.slice(2),{lowS:!0,extraEntropy:Wr(I5,{strict:!1})?vr(I5):I5}),a={r:ae(o,{size:32}),s:ae(n,{size:32}),v:i?28n:27n,yParity:i};return(()=>{if(r==="bytes"||r==="hex")return xK({...a,to:r});return a})()}async function vK(e){let{chainId:t,nonce:r,privateKey:o,to:n="object"}=e,i=e.contractAddress??e.address,a=await Hi({hash:IS({address:i,chainId:t,nonce:r}),privateKey:o,to:n});if(n==="object")return{address:i,chainId:t,nonce:r,...a};return a}var _K=`\x19Ethereum Signed Message:
|
|
168
168
|
`;function wK(e){let t=(()=>{if(typeof e==="string")return vc(e);if(typeof e.raw==="string")return e.raw;return Ht(e.raw)})(),r=vc(`${_K}${St(t)}`);return gr([r,t])}function SK(e,t){return hr(wK(e),t)}async function TK({message:e,privateKey:t}){return await Hi({hash:SK(e),privateKey:t,to:"hex"})}function EK(e){if(!e||e.length===0)return[];let t=[];for(let r of e){let{chainId:o,nonce:n,...i}=r,a=r.address;t.push([o?Kr(o):"0x",a,n?Kr(n):"0x",...Cf({},i)])}return t}function IK(e){let{authorizationList:t}=e;if(t)for(let r of t){let{chainId:o}=r,n=r.address;if(!Nt(n))throw new Wt({address:n});if(o<0)throw new If({chainId:o})}JS(e)}function PK(e){let{blobVersionedHashes:t}=e;if(t){if(t.length===0)throw new Oy;for(let r of t){let o=St(r),n=$r(Ka(r,0,1));if(o!==32)throw new t5({hash:r,size:o});if(n!==RS)throw new r5({hash:r,version:n})}}JS(e)}function JS(e){let{chainId:t,maxPriorityFeePerGas:r,maxFeePerGas:o,to:n}=e;if(t<=0)throw new If({chainId:t});if(n&&!Nt(n))throw new Wt({address:n});if(o&&o>Sf)throw new ii({maxFeePerGas:o});if(r&&o&&r>o)throw new qa({maxFeePerGas:o,maxPriorityFeePerGas:r})}function kK(e){let{chainId:t,maxPriorityFeePerGas:r,gasPrice:o,maxFeePerGas:n,to:i}=e;if(t<=0)throw new If({chainId:t});if(i&&!Nt(i))throw new Wt({address:i});if(r||n)throw new q("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(o&&o>Sf)throw new ii({maxFeePerGas:o})}function AK(e){let{chainId:t,maxPriorityFeePerGas:r,gasPrice:o,maxFeePerGas:n,to:i}=e;if(i&&!Nt(i))throw new Wt({address:i});if(typeof t<"u"&&t<=0)throw new If({chainId:t});if(r||n)throw new q("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(o&&o>Sf)throw new ii({maxFeePerGas:o})}function My(e){if(!e||e.length===0)return[];let t=[];for(let r=0;r<e.length;r++){let{address:o,storageKeys:n}=e[r];for(let i=0;i<n.length;i++)if(n[i].length-2!==64)throw new xC({storageKey:n[i]});if(!Nt(o,{strict:!1}))throw new Wt({address:o});t.push([o,n])}return t}function RK(e,t){let r=OS(e);if(r==="eip1559")return Zxe(e,t);if(r==="eip2930")return Wxe(e,t);if(r==="eip4844")return Vxe(e,t);if(r==="eip7702")return Gxe(e,t);return Kxe(e,t)}function Gxe(e,t){let{authorizationList:r,chainId:o,gas:n,nonce:i,to:a,value:s,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:p}=e;IK(e);let m=My(d),h=EK(r);return Io(["0x04",Ja([ae(o),i?ae(i):"0x",u?ae(u):"0x",c?ae(c):"0x",n?ae(n):"0x",a??"0x",s?ae(s):"0x",p??"0x",m,h,...Cf(e,t)])])}function Vxe(e,t){let{chainId:r,gas:o,nonce:n,to:i,value:a,maxFeePerBlobGas:s,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:p}=e;PK(e);let{blobVersionedHashes:m,sidecars:h}=e;if(e.blobs&&(typeof m>"u"||typeof h>"u")){let w=typeof e.blobs[0]==="string"?e.blobs:e.blobs.map((k)=>Ht(k)),_=e.kzg,T=kf({blobs:w,kzg:_});if(typeof m>"u")m=AS({commitments:T});if(typeof h>"u"){let k=Af({blobs:w,commitments:T,kzg:_});h=$S({blobs:w,commitments:T,proofs:k})}}let y=My(d),x=[ae(r),n?ae(n):"0x",u?ae(u):"0x",c?ae(c):"0x",o?ae(o):"0x",i??"0x",a?ae(a):"0x",p??"0x",y,s?ae(s):"0x",m??[],...Cf(e,t)],S=[],v=[],E=[];if(h)for(let w=0;w<h.length;w++){let{blob:_,commitment:T,proof:k}=h[w];S.push(_),v.push(T),E.push(k)}return Io(["0x03",h?Ja([x,S,v,E]):Ja(x)])}function Zxe(e,t){let{chainId:r,gas:o,nonce:n,to:i,value:a,maxFeePerGas:s,maxPriorityFeePerGas:c,accessList:u,data:d}=e;JS(e);let p=My(u),m=[ae(r),n?ae(n):"0x",c?ae(c):"0x",s?ae(s):"0x",o?ae(o):"0x",i??"0x",a?ae(a):"0x",d??"0x",p,...Cf(e,t)];return Io(["0x02",Ja(m)])}function Wxe(e,t){let{chainId:r,gas:o,data:n,nonce:i,to:a,value:s,accessList:c,gasPrice:u}=e;kK(e);let d=My(c),p=[ae(r),i?ae(i):"0x",u?ae(u):"0x",o?ae(o):"0x",a??"0x",s?ae(s):"0x",n??"0x",d,...Cf(e,t)];return Io(["0x01",Ja(p)])}function Kxe(e,t){let{chainId:r=0,gas:o,data:n,nonce:i,to:a,value:s,gasPrice:c}=e;AK(e);let u=[i?ae(i):"0x",c?ae(c):"0x",o?ae(o):"0x",a??"0x",s?ae(s):"0x",n??"0x"];if(t){let d=(()=>{if(t.v>=35n){if((t.v-35n)/2n>0)return t.v;return 27n+(t.v===35n?0n:1n)}if(r>0)return BigInt(r*2)+BigInt(35n+t.v-27n);let h=27n+(t.v===27n?0n:1n);if(t.v!==h)throw new yC({v:t.v});return h})(),p=To(t.r),m=To(t.s);u=[...u,ae(d),p==="0x00"?"0x":p,m==="0x00"?"0x":m]}else if(r>0)u=[...u,ae(r),"0x","0x"];return Ja(u)}function Cf(e,t){let r=t??e,{v:o,yParity:n}=r;if(typeof r.r>"u")return[];if(typeof r.s>"u")return[];if(typeof o>"u"&&typeof n>"u")return[];let i=To(r.r),a=To(r.s);return[(()=>{if(typeof n==="number")return n?ae(1):"0x";if(o===0n)return"0x";if(o===1n)return ae(1);return o===27n?"0x":ae(1)})(),i==="0x00"?"0x":i,a==="0x00"?"0x":a]}async function $K(e){let{privateKey:t,transaction:r,serializer:o=RK}=e,n=(()=>{if(r.type==="eip4844")return{...r,sidecars:!1};return r})(),i=await Hi({hash:hr(await o(n)),privateKey:t});return await o(r,i)}async function OK(e){let{privateKey:t,...r}=e;return await Hi({hash:HW(r),privateKey:t,to:"hex"})}function P5(e,t={}){let{nonceManager:r}=t,o=Kr(Sn.getPublicKey(e.slice(2),!1)),n=TS(o);return{...bK({address:n,nonceManager:r,async sign({hash:a}){return Hi({hash:a,privateKey:e,to:"hex"})},async signAuthorization(a){return vK({...a,privateKey:e})},async signMessage({message:a}){return TK({message:a,privateKey:e})},async signTransaction(a,{serializer:s}={}){return $K({privateKey:e,transaction:a,serializer:s})},async signTypedData(a){return OK({...a,privateKey:e})}}),publicKey:o,source:"privateKey"}}function YS(e){let t={formatters:void 0,fees:void 0,serializers:void 0,...e};function r(o){return(n)=>{let i=typeof n==="function"?n(o):n,a={...o,...i};return Object.assign(a,{extend:r(a)})}}return Object.assign(t,{extend:r(t)})}var k5=YS({id:1329,name:"Sei Network",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc.sei-apis.com/"],webSocket:["wss://evm-ws.sei-apis.com/"]}},blockExplorers:{default:{name:"Seiscan",url:"https://seiscan.io",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11"}}});var A5=YS({id:1328,name:"Sei Testnet",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc-testnet.sei-apis.com"],webSocket:["wss://evm-ws-testnet.sei-apis.com"]}},blockExplorers:{default:{name:"Seiscan",url:"https://testnet.seiscan.io",apiUrl:"https://api.etherscan.io/v2/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:98697651}},testnet:!0});var R5=null;var Jxe={privateKeyToAccount:P5,createWalletClient:_5,http:E5,createMonacoSDK:fC,sei:k5,seiTestnet:A5};function Yxe(e,t=Jxe){let r=e.network==="mainnet"?t.sei:t.seiTestnet,o;if(e.privateKey){let n=t.privateKeyToAccount(e.privateKey);o=t.createWalletClient({account:n,chain:r,transport:t.http(e.seiRpcUrl)})}return t.createMonacoSDK({walletClient:o,network:e.network,seiRpcUrl:e.seiRpcUrl})}function We(e){if(!R5){let t=e??su();R5=Yxe(t)}return R5}var Qxe=60,QS=null;function Xxe(){return Math.floor(Date.now()/1000)}function CK(e){return e-Qxe<=Xxe()}function eve(e){for(let t=e,r=0;t instanceof Error&&r<5;r++){if(t instanceof cr&&t.statusCode===401)return!0;t=t.cause}return!1}function $5(e){if(!QS)QS=e().finally(()=>{QS=null});return QS}async function zK(e,t){if(await e.login(t.clientId),t.delegatedOwnerUserId){try{let r=await e.loginAsDelegatedOwner(t.delegatedOwnerUserId);console.error(`Adopted delegated owner ${r.user.id} (session expires at ${new Date(r.expiresAt*1000).toISOString()})`)}catch(r){throw await e.logout().catch(()=>{}),r}return}console.error(`Authenticated as ${e.getAccountAddress()}`)}async function NK(e,t){try{await e.refreshAuth()}catch{await zK(e,t)}}async function X(e){let t=We(e),r=e??su(),o=t.getAuthState(),n=r.delegatedOwnerUserId!=null&&o?.user?.id!==r.delegatedOwnerUserId;if(!o||n)return await $5(()=>zK(t,r)),t;if(CK(o.expiresAt))await $5(()=>NK(t,r));return t}async function tve(e){let t=e??su();if(!t.privateKey)return!1;let r=We(e);return await $5(()=>NK(r,t)),!0}function MK(e,t){async function r(...o){let n=We(t).getAuthState(),i=n!==void 0&&!CK(n.expiresAt);try{return await e(...o)}catch(a){if(!eve(a))throw a;if(!(i&&We(t).getAuthState()!==n)){if(!await tve(t))throw a}return await e(...o)}}return r}function U(e){return{content:[{type:"text",text:JSON.stringify(e,null,2)}]}}function XS(e){return{content:[{type:"text",text:e}]}}function BK(e,t){if(t.network==="mainnet")return;e.registerTool("get_faucet_info",{description:"Get the authenticated wallet's faucet quota: remaining requests in the rolling 24h window, when the next request becomes available, and the 5 most recent faucet requests. Check this before request_faucet to avoid rate-limit errors. Only available on non-mainnet networks (development, staging, local).",inputSchema:{}},async()=>{let o=await(await X()).faucet.getInfo();return U(o)})}function DK(e,t){if(t.network==="mainnet")return;e.registerTool("request_faucet",{description:"Request test funds from the faucet for all active trading pairs. Requires a Cloudflare Turnstile token (the faucet rejects requests without one). Only available on non-mainnet networks (development, staging, local).",inputSchema:f.object({turnstileToken:f.string().describe("Cloudflare Turnstile token proving the request came from a real client (required by the faucet).")})},async({turnstileToken:r})=>{let n=await(await X()).faucet.mint({turnstileToken:r});return U(n)})}function UK(e,t){DK(e,t),BK(e,t)}function LK(e){e.registerTool("get_my_fee_tier",{description:"Get the authenticated user's current fee tier, rolling 14-day volumes (with spot/perp breakdown), the volume needed to reach the next tier, and the requested pair's six-row fee schedule.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID whose fee schedule to return")})},async({tradingPairId:t})=>{let o=await(await X()).fees.getMyFeeTier({tradingPairId:t});return U(o)})}function jK(e){e.registerTool("simulate_fees",{description:"Simulate the fees for an order before placing it. Returns Monaco protocol fees, application fees, and total amounts.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),side:f.enum(["BUY","SELL"]).describe("Order side"),price:f.string().describe("Price per unit as a decimal string"),quantity:f.string().describe("Quantity to trade as a decimal string")})},async({tradingPairId:t,side:r,price:o,quantity:n})=>{let a=await(await X()).fees.simulateFees({tradingPairId:t,side:r,price:o,quantity:n});return U(a)})}function FK(e){jK(e),LK(e)}function qK(e){e.registerTool("get_available_collateral",{description:"Get available (unlocked) collateral for allocating to margin accounts or risk buckets.",inputSchema:f.object({asset:f.string().optional().describe("Optional collateral asset symbol or ID to scope the query")})},async({asset:t})=>{let o=await(await X()).marginAccounts.getAvailableCollateral({asset:t});return U(o)})}function HK(e){e.registerTool("get_margin_accounts",{description:"List your margin accounts with optional filters (state, trading pair).",inputSchema:f.object({page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page"),state:f.string().optional().describe("Filter by margin account state"),tradingPairId:f.string().optional().describe("Filter by trading pair UUID")})},async({page:t,pageSize:r,state:o,tradingPairId:n})=>{let a=await(await X()).marginAccounts.listMarginAccounts({page:t,pageSize:r,state:o,tradingPairId:n});return U(a)})}function GK(e){e.registerTool("get_parent_margin_account_movements",{description:"List collateral movements for your parent (cross) margin account.",inputSchema:f.object({movementType:f.string().optional().describe("Filter by movement type"),page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page")})},async({movementType:t,page:r,pageSize:o})=>{let i=await(await X()).marginAccounts.getParentMarginAccountMovements({movementType:t,page:r,pageSize:o});return U(i)})}function VK(e){e.registerTool("get_parent_margin_account_summary",{description:"Get your parent (cross) margin account summary.",inputSchema:f.object({tradingPairId:f.string().optional().describe("Optional trading pair UUID to scope the summary")})},async({tradingPairId:t})=>{let o=await(await X()).marginAccounts.getParentMarginAccountSummary({tradingPairId:t});return U(o)})}function ZK(e){e.registerTool("simulate_parent_margin_order_risk",{description:"Preview the risk impact of a prospective order against your parent (cross) margin account (read-only simulation).",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),side:f.enum(["BUY","SELL"]).describe("Order side (authoritative: BUY=LONG, SELL=SHORT)"),orderType:f.enum(["LIMIT","MARKET"]).describe("Order type"),quantity:f.string().describe("Order quantity as a decimal string"),price:f.string().optional().describe("Limit price as a decimal string — required for LIMIT"),leverage:f.string().optional().describe("Leverage as a decimal string — required unless reduceOnly is true"),reduceOnly:f.boolean().optional().describe("Whether the order can only reduce exposure")}).refine((t)=>t.orderType!=="LIMIT"||t.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["price"]}).refine((t)=>t.reduceOnly===!0||t.leverage!==void 0,{message:"leverage is required for normal (non-reduce-only) margin orders",path:["leverage"]})},async({tradingPairId:t,side:r,orderType:o,quantity:n,price:i,leverage:a,reduceOnly:s})=>{let u=await(await X()).marginAccounts.simulateParentMarginOrderRisk({tradingPairId:t,side:r,orderType:o,quantity:n,price:i,leverage:a,reduceOnly:s});return U(u)})}function WK(e){e.registerTool("simulate_risk_bucket_order_risk",{description:"Preview the risk impact of a prospective order for a new or existing risk bucket (read-only simulation).",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),side:f.enum(["BUY","SELL"]).describe("Order side (authoritative: BUY=LONG, SELL=SHORT)"),orderType:f.enum(["LIMIT","MARKET"]).describe("Order type"),quantity:f.string().describe("Order quantity as a decimal string"),price:f.string().optional().describe("Limit price as a decimal string — required for LIMIT"),leverage:f.string().optional().describe("Leverage as a decimal string — required unless reduceOnly is true"),reduceOnly:f.boolean().optional().describe("Whether the order can only reduce exposure"),marginMode:f.enum(["ISOLATED","CROSS"]).optional().describe("Risk bucket margin mode (default ISOLATED)"),strategyKey:f.string().optional().describe("Isolated risk bucket strategy key (ISOLATED only)"),selectedTradingPairIds:f.array(f.string()).optional().describe("Cross risk bucket trading pair UUIDs (CROSS only; must include tradingPairId)")}).refine((t)=>t.orderType!=="LIMIT"||t.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["price"]}).refine((t)=>t.reduceOnly===!0||t.leverage!==void 0,{message:"leverage is required for normal (non-reduce-only) margin orders",path:["leverage"]}).refine((t)=>t.marginMode!=="CROSS"||t.selectedTradingPairIds!==void 0&&t.selectedTradingPairIds.length>0,{message:"selectedTradingPairIds is required for CROSS risk buckets",path:["selectedTradingPairIds"]}).refine((t)=>t.marginMode!=="CROSS"||t.selectedTradingPairIds?.includes(t.tradingPairId),{message:"selectedTradingPairIds must include tradingPairId for CROSS risk buckets",path:["selectedTradingPairIds"]}).refine((t)=>t.marginMode!=="CROSS"||t.strategyKey===void 0,{message:"strategyKey is not allowed for CROSS risk buckets",path:["strategyKey"]}).refine((t)=>t.marginMode==="CROSS"||t.selectedTradingPairIds===void 0,{message:"selectedTradingPairIds is only allowed for CROSS risk buckets",path:["selectedTradingPairIds"]})},async({tradingPairId:t,side:r,orderType:o,quantity:n,price:i,leverage:a,reduceOnly:s,marginMode:c,strategyKey:u,selectedTradingPairIds:d})=>{let p=await X(),m={tradingPairId:t,side:r,orderType:o,quantity:n,price:i,leverage:a,reduceOnly:s},h=c==="CROSS"?await p.marginAccounts.simulateRiskBucketOrderRisk({...m,marginMode:c,selectedTradingPairIds:d??[]}):await p.marginAccounts.simulateRiskBucketOrderRisk({...m,marginMode:c,strategyKey:u});return U(h)})}function KK(e){e.registerTool("transfer_collateral_from_parent_margin_account",{description:"Move collateral out of your parent (cross) margin account back to spot.",inputSchema:f.object({asset:f.string().describe("Collateral asset symbol or ID"),amount:f.string().describe("Amount to transfer as a decimal string")})},async({asset:t,amount:r})=>{let n=await(await X()).marginAccounts.transferCollateralFromParentMarginAccount({asset:t,amount:r});return U(n)})}function JK(e){e.registerTool("transfer_collateral_to_parent_margin_account",{description:"Move collateral from spot into your parent (cross) margin account.",inputSchema:f.object({asset:f.string().describe("Collateral asset symbol or ID"),amount:f.string().describe("Amount to transfer as a decimal string")})},async({asset:t,amount:r})=>{let n=await(await X()).marginAccounts.transferCollateralToParentMarginAccount({asset:t,amount:r});return U(n)})}function YK(e){e.registerTool("transfer_collateral_to_risk_bucket",{description:"Allocate collateral into an isolated or cross risk bucket.",inputSchema:f.object({asset:f.string().describe("Collateral asset symbol or ID"),amount:f.string().describe("Amount to transfer as a decimal string"),marginMode:f.enum(["ISOLATED","CROSS"]).optional().describe("Risk bucket margin mode (default ISOLATED)"),tradingPairId:f.string().optional().describe("Trading pair UUID (required for ISOLATED; not allowed for CROSS)"),strategyKey:f.string().optional().describe("Isolated risk bucket strategy key (ISOLATED only)"),selectedTradingPairIds:f.array(f.string()).optional().describe("Trading pair UUIDs (required for CROSS; not allowed for ISOLATED)")}).refine((t)=>t.marginMode==="CROSS"||t.tradingPairId!==void 0,{message:"tradingPairId is required for ISOLATED risk buckets",path:["tradingPairId"]}).refine((t)=>t.marginMode!=="CROSS"||t.selectedTradingPairIds!==void 0&&t.selectedTradingPairIds.length>0,{message:"selectedTradingPairIds is required for CROSS risk buckets",path:["selectedTradingPairIds"]}).refine((t)=>t.marginMode!=="CROSS"||t.tradingPairId===void 0,{message:"tradingPairId is not allowed for CROSS risk buckets",path:["tradingPairId"]}).refine((t)=>t.marginMode!=="CROSS"||t.strategyKey===void 0,{message:"strategyKey is not allowed for CROSS risk buckets",path:["strategyKey"]}).refine((t)=>t.marginMode==="CROSS"||t.selectedTradingPairIds===void 0,{message:"selectedTradingPairIds is only allowed for CROSS risk buckets",path:["selectedTradingPairIds"]})},async({asset:t,amount:r,marginMode:o,tradingPairId:n,strategyKey:i,selectedTradingPairIds:a})=>{let s=await X(),c=o==="CROSS"?await s.marginAccounts.transferCollateralToRiskBucket({asset:t,amount:r,marginMode:o,selectedTradingPairIds:a??[]}):await s.marginAccounts.transferCollateralToRiskBucket({asset:t,amount:r,marginMode:o,tradingPairId:n??"",strategyKey:i});return U(c)})}function QK(e){HK(e),VK(e),qK(e),GK(e),ZK(e),WK(e),JK(e),KK(e),YK(e)}function XK(e){e.registerTool("get_candlesticks",{description:"Get OHLCV candlestick data for a trading pair. Useful for charting and price analysis.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),interval:f.enum(["1m","5m","15m","1h","4h","1d"]).describe("Candlestick interval"),startTime:f.number().optional().describe("Start time as Unix timestamp (seconds)"),endTime:f.number().optional().describe("End time as Unix timestamp (seconds)"),limit:f.number().optional().describe("Max number of candlesticks to return")})},async({tradingPairId:t,interval:r,startTime:o,endTime:n,limit:i})=>{let s=await We().market.getCandlesticks(t,r,{startTime:o,endTime:n,limit:i});return U(s)})}function eJ(e){e.registerTool("get_market_metadata",{description:"Get metadata for a specific trading pair including tick size, min order size, and trading rules.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID")})},async({tradingPairId:t})=>{let o=await We().market.getMarketMetadata(t);return U(o)})}function tJ(e){e.registerTool("get_market_stats",{description:"Get exchange-wide life-to-date cumulative volume and trade count across all markets."},async()=>{let r=await We().market.getMarketStats();return U(r)})}function rJ(e){e.registerTool("get_screener",{description:"Screen trading pairs with market stats (price, volume, change), filtered by market type, category, and active status.",inputSchema:f.object({page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page"),marketType:f.enum(["SPOT","MARGIN"]).optional().describe("Filter by market type"),isActive:f.boolean().optional().describe("Filter by active status"),category:f.string().optional().describe("Filter by category (e.g. crypto, equities, commodities)")})},async({page:t,pageSize:r,marketType:o,isActive:n,category:i})=>{let s=await We().market.getScreener({page:t,pageSize:r,marketType:o,isActive:n,category:i});return U(s)})}function nJ(e){e.registerTool("get_trading_pair_by_symbol",{description:"Look up a specific trading pair by its symbol (e.g. 'BTC/USDC'). Returns the pair's full details including its UUID.",inputSchema:f.object({symbol:f.string().describe("Trading pair symbol (e.g. 'BTC/USDC')")})},async({symbol:t})=>{let o=await We().market.getTradingPairBySymbol(t);if(!o)return XS(`Trading pair '${t}' not found.`);return U(o)})}function oJ(e){e.registerTool("get_trading_pairs",{description:"Get a paginated list of trading pairs available on Monaco. Returns pair IDs, symbols, base/quote tokens, and status.",inputSchema:f.object({page:f.number().optional().describe("Page number (starts from 1)"),pageSize:f.number().optional().describe("Number of items per page (max 100)"),marketType:f.enum(["SPOT","MARGIN"]).optional().describe("Filter by market type"),baseToken:f.string().optional().describe("Filter by base token"),quoteToken:f.string().optional().describe("Filter by quote token"),isActive:f.boolean().optional().describe("Filter by active status"),category:f.string().optional().describe("Filter by category (e.g. crypto, equities, commodities)")})},async(t)=>{let o=await We().market.getPaginatedTradingPairs(t);return U(o)})}function iJ(e){oJ(e),nJ(e),XK(e),eJ(e),rJ(e),tJ(e)}function aJ(e){e.registerTool("get_orderbook",{description:"Get the current orderbook snapshot for a trading pair. Shows bids, asks, best bid/ask, and volumes.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),depth:f.number().optional().describe("Number of price levels to return (max 100, default 10)"),tradingMode:f.enum(["SPOT"]).optional().describe("Trading mode (default: SPOT)"),magnitude:f.number().optional().describe("Price grouping magnitude (e.g. 0.01, 0.1, 1, 10, 100)"),denomination:f.enum(["BASE","QUOTE"]).optional().describe("Quantity denomination: BASE or QUOTE")})},async({tradingPairId:t,depth:r,tradingMode:o,magnitude:n,denomination:i})=>{let s=await We().orderbook.getOrderbook(t,{depth:r,tradingMode:o,magnitude:n,denomination:i});return U(s)})}function sJ(e){aJ(e)}function cJ(e){e.registerTool("get_all_funding_history",{description:"List historical funding-rate records across all perpetual markets.",inputSchema:f.object({startTime:f.string().optional().describe('Start time as a Unix millisecond-epoch timestamp string (e.g. "1717200000000"); ISO 8601 is rejected by the API'),endTime:f.string().optional().describe('End time as a Unix millisecond-epoch timestamp string (e.g. "1717200000000"); ISO 8601 is rejected by the API'),page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page"),orderBy:f.enum(["ASC","DESC"]).optional().describe("Sort order by time")})},async({startTime:t,endTime:r,page:o,pageSize:n,orderBy:i})=>{let s=await We().market.listAllFundingHistory({startTime:t,endTime:r,page:o,pageSize:n,orderBy:i});return U(s)})}function uJ(e){e.registerTool("get_funding_history",{description:"List historical funding-rate records for a perpetual market.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),startTime:f.string().optional().describe('Start time as a Unix millisecond-epoch timestamp string (e.g. "1717200000000"); ISO 8601 is rejected by the API'),endTime:f.string().optional().describe('End time as a Unix millisecond-epoch timestamp string (e.g. "1717200000000"); ISO 8601 is rejected by the API'),page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page"),orderBy:f.enum(["ASC","DESC"]).optional().describe("Sort order by time")})},async({tradingPairId:t,startTime:r,endTime:o,page:n,pageSize:i,orderBy:a})=>{let c=await We().market.listFundingHistory(t,{startTime:r,endTime:o,page:n,pageSize:i,orderBy:a});return U(c)})}function lJ(e){e.registerTool("get_funding_state",{description:"Get the current funding rate and next funding time for a perpetual market.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID")})},async({tradingPairId:t})=>{let o=await We().market.getFundingState(t);return U(o)})}function dJ(e){e.registerTool("get_index_price",{description:"Get the current index (oracle) price for a perpetual market.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID")})},async({tradingPairId:t})=>{let o=await We().market.getIndexPrice(t);return U(o)})}function pJ(e){e.registerTool("get_mark_price",{description:"Get the current mark price for a perpetual market.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID")})},async({tradingPairId:t})=>{let o=await We().market.getMarkPrice(t);return U(o)})}function fJ(e){e.registerTool("get_open_interest",{description:"Get the current open interest for a perpetual market.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID")})},async({tradingPairId:t})=>{let o=await We().market.getOpenInterest(t);return U(o)})}function mJ(e){e.registerTool("get_perp_market_config",{description:"Get a perpetual market's configuration (leverage limits, margin requirements, funding parameters).",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID")})},async({tradingPairId:t})=>{let o=await We().market.getPerpMarketConfig(t);return U(o)})}function hJ(e){e.registerTool("get_perp_market_summary",{description:"Get a perpetual market's live summary (mark/index price, funding rate, open interest, 24h stats).",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID")})},async({tradingPairId:t})=>{let o=await We().market.getPerpMarketSummary(t);return U(o)})}function gJ(e){mJ(e),hJ(e),pJ(e),dJ(e),lJ(e),fJ(e),uJ(e),cJ(e)}function yJ(e){e.registerTool("check_trader_code_availability",{description:"Public advisory check of whether a custom PitPass TraderCode handle is available. Returns `available` and, when unavailable, a `reason` (one of taken, too_short, too_long, reserved, invalid_char, looks_like_address). Advisory only — the authoritative gate is the atomic claim in set_trader_code, so a positive result is not a reservation.",inputSchema:f.object({code:f.string().describe("The custom handle to check for availability.")})},async({code:t})=>{let o=await We().pitpass.checkTraderCodeAvailability(t);return U(o)})}function bJ(e){e.registerTool("clear_trader_code",{description:"Clear the authenticated caller's custom PitPass TraderCode handle, reverting to the wallet-derived default. The freed handle enters a cooldown before anyone else can claim it. Returns the caller's TraderCode identity after the revert.",inputSchema:f.object({})},async()=>{let r=await(await X()).pitpass.clearTraderCode();return U(r)})}function xJ(e){e.registerTool("get_my_trader_code",{description:"Return the authenticated caller's PitPass TraderCode — their normalized wallet address. Clients render it as `Monaco - <address>`. Never 404s; ensures the backing row so referrals attributed to this wallet link correctly.",inputSchema:f.object({})},async()=>{let r=await(await X()).pitpass.getMyTraderCode();return U(r)})}function vJ(e){e.registerTool("get_rewards_balance",{description:"Return the authenticated caller's current PitPass rewards-bucket balances across all reward tokens. Returns an empty list when no rewards have been earned yet. Use transfer_rewards to move earned rewards into a tradeable balance.",inputSchema:f.object({})},async()=>{let r=await(await X()).pitpass.getRewardsBalance();return U(r)})}function _J(e){e.registerTool("get_trader_code_info",{description:"Public lookup of a PitPass TraderCode (wallet address or 'Monaco - <address>' form). Returns the resolved normalized code when it belongs to a known wallet, or a 404 error if not found. Use this to validate a referral code before sign-up.",inputSchema:f.object({code:f.string().describe("The TraderCode to look up — a wallet address (0x-prefixed) or the 'Monaco - <address>' display form.")})},async({code:t})=>{let o=await We().pitpass.getTraderCodeInfo(t);return U(o)})}function wJ(e){e.registerTool("set_trader_code",{description:"Claim or edit the authenticated caller's custom (vanity) PitPass TraderCode handle. Stored exactly as entered (case preserved); uniqueness is case-insensitive. Must start with a letter and be 5–20 characters of letters, digits, or underscores. The server is the authoritative gate: 409 if the handle is taken, 422 on validation failure, 429 when the per-hour edit limit is hit, 403 when the feature is disabled.",inputSchema:f.object({code:f.string().describe("The custom handle to claim or edit to — letter-first [A-Za-z0-9_], 5–20 characters. Case is preserved.")})},async({code:t})=>{let o=await(await X()).pitpass.setTraderCode(t);return U(o)})}function SJ(e){e.registerTool("transfer_rewards",{description:"Transfer earned PitPass rewards from your rewards bucket into your trading balance, making them immediately tradeable. Ledger-only — no on-chain transaction. Fails if the rewards balance is insufficient.",inputSchema:f.object({token:f.string().describe("Reward token contract address (0x-prefixed EVM address) to transfer."),amount:f.string().describe("Amount to transfer in RAW atomic units of the token (positive integer string).")})},async({token:t,amount:r})=>{let n=await(await X()).pitpass.transferRewards({token:t,amount:r});return U(n)})}function TJ(e){_J(e),yJ(e)}function EJ(e){xJ(e),vJ(e),SJ(e),wJ(e),bJ(e)}function IJ(e){e.registerTool("get_portfolio_assets",{description:"Get your per-asset portfolio allocation and balances over a period.",inputSchema:f.object({period:f.enum(["1d","1w","1m","all"]).optional().describe("Analytics period (default: all)")})},async({period:t})=>{let o=await(await X()).portfolio.getAssets({period:t});return U(o)})}function PJ(e){e.registerTool("get_portfolio_margin",{description:"Get your portfolio margin overview (collateral, maintenance margin, health)."},async()=>{let r=await(await X()).portfolio.getMargin();return U(r)})}function kJ(e){e.registerTool("get_portfolio_performance",{description:"Get your portfolio performance time series over a period.",inputSchema:f.object({period:f.enum(["1d","1w","1m","all"]).optional().describe("Analytics period (default: all)")})},async({period:t})=>{let o=await(await X()).portfolio.getPerformance({period:t});return U(o)})}function AJ(e){e.registerTool("get_portfolio_realized_pnl",{description:"Get your realized PnL breakdown over a period.",inputSchema:f.object({period:f.enum(["1d","1w","1m","all"]).optional().describe("Analytics period (default: all)")})},async({period:t})=>{let o=await(await X()).portfolio.getRealizedPnl({period:t});return U(o)})}function RJ(e){e.registerTool("get_portfolio_summary",{description:"Get your authoritative portfolio summary (equity, PnL, exposure) over a period.",inputSchema:f.object({period:f.enum(["1d","1w","1m","all"]).optional().describe("Analytics period (default: all)")})},async({period:t})=>{let o=await(await X()).portfolio.getSummary({period:t});return U(o)})}function $J(e){RJ(e),kJ(e),AJ(e),IJ(e),PJ(e)}function OJ(e){e.registerTool("close_position",{description:"Close a perpetual position with a market, limit, or IOC reduce order.",inputSchema:f.object({positionId:f.string().describe("Position UUID"),closeType:f.enum(["MARKET","LIMIT","IOC"]).describe("Close order type"),limitPrice:f.string().optional().describe("Limit price as a decimal string — required for LIMIT and IOC, not allowed for MARKET"),slippageToleranceBps:f.number().optional().describe("Slippage tolerance in basis points (MARKET/IOC)"),quantity:f.string().optional().describe("Quantity to close as a decimal string (defaults to full position)")}).refine((t)=>t.closeType==="MARKET"||t.limitPrice!==void 0,{message:"limitPrice is required for LIMIT and IOC close requests",path:["limitPrice"]}).refine((t)=>t.closeType!=="MARKET"||t.limitPrice===void 0,{message:"limitPrice is not allowed for MARKET close requests",path:["limitPrice"]})},async({positionId:t,closeType:r,limitPrice:o,slippageToleranceBps:n,quantity:i})=>{let s=await(await X()).positions.closePosition(t,{closeType:r,limitPrice:o,slippageToleranceBps:n,quantity:i});return U(s)})}function CJ(e){e.registerTool("get_position",{description:"Get details for a specific perpetual position by ID.",inputSchema:f.object({positionId:f.string().describe("Position UUID")})},async({positionId:t})=>{let o=await(await X()).positions.getPosition(t);return U(o)})}function zJ(e){e.registerTool("get_position_history",{description:"List historical (closed/reduced) perpetual position records with optional filters.",inputSchema:f.object({positionId:f.string().optional().describe("Filter by position UUID"),marginAccountId:f.string().optional().describe("Filter by margin account UUID"),tradingPairId:f.string().optional().describe("Filter by trading pair UUID"),page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page"),reductionOnly:f.boolean().optional().describe("Only include reduction events")})},async({positionId:t,marginAccountId:r,tradingPairId:o,page:n,pageSize:i,reductionOnly:a})=>{let c=await(await X()).positions.listPositionHistory({positionId:t,marginAccountId:r,tradingPairId:o,page:n,pageSize:i,reductionOnly:a});return U(c)})}function NJ(e){e.registerTool("get_position_pnl_history",{description:"Get the PnL history time series for a perpetual position over an interval.",inputSchema:f.object({positionId:f.string().describe("Position UUID"),interval:f.enum(["1m","5m","15m","1h","4h","1d"]).describe("Sampling interval"),startTime:f.number().int().min(0).optional().describe("Start time as a Unix timestamp in milliseconds"),endTime:f.number().int().min(0).optional().describe("End time as a Unix timestamp in milliseconds")}).refine((t)=>t.startTime===void 0||t.endTime===void 0||t.startTime<t.endTime,{message:"startTime must be less than endTime",path:["startTime"]})},async({positionId:t,interval:r,startTime:o,endTime:n})=>{let a=await(await X()).positions.getPositionPnlHistory(t,{interval:r,startTime:o,endTime:n});return U(a)})}function MJ(e){e.registerTool("get_position_risk",{description:"Get liquidation price, margin ratio, and risk metrics for a perpetual position.",inputSchema:f.object({positionId:f.string().describe("Position UUID")})},async({positionId:t})=>{let o=await(await X()).positions.getPositionRisk(t);return U(o)})}function BJ(e){e.registerTool("get_positions",{description:"List your perpetual positions with optional filters (margin account, trading pair, status).",inputSchema:f.object({marginAccountId:f.string().optional().describe("Filter by margin account UUID"),tradingPairId:f.string().optional().describe("Filter by trading pair UUID"),status:f.enum(["OPEN","CLOSED","LIQUIDATING","LIQUIDATED"]).optional().describe("Filter by position status"),page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page")})},async({marginAccountId:t,tradingPairId:r,status:o,page:n,pageSize:i})=>{let s=await(await X()).positions.listPositions({marginAccountId:t,tradingPairId:r,status:o,page:n,pageSize:i});return U(s)})}function DJ(e){BJ(e),CJ(e),MJ(e),zJ(e),NJ(e),OJ(e)}function UJ(e){e.registerTool("get_balance_by_asset",{description:"Get the authenticated user's balance for a specific asset by its UUID.",inputSchema:f.object({assetId:f.string().describe("The asset UUID")})},async({assetId:t})=>{let o=await(await X()).profile.getUserBalanceByAssetId(t);return U(o)})}function LJ(e){e.registerTool("get_balances",{description:"Get the authenticated user's token balances with pagination.",inputSchema:f.object({page:f.number().optional().describe("Page number (starts from 1, default: 1)"),pageSize:f.number().optional().describe("Number of items per page (default: 20, max: 100)")})},async({page:t,pageSize:r})=>{let n=await(await X()).profile.getUserBalances({page:t,pageSize:r});return U(n)})}function jJ(e){e.registerTool("get_funding_payments",{description:"List your perpetual funding payments with optional filters (trading pair, position, margin account).",inputSchema:f.object({tradingPairId:f.string().optional().describe("Filter by trading pair UUID"),positionId:f.string().optional().describe("Filter by position UUID"),marginAccountId:f.string().optional().describe("Filter by margin account UUID"),page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page")})},async({tradingPairId:t,positionId:r,marginAccountId:o,page:n,pageSize:i})=>{let s=await(await X()).profile.listFundingPayments({tradingPairId:t,positionId:r,marginAccountId:o,page:n,pageSize:i});return U(s)})}function FJ(e){e.registerTool("get_movements",{description:"Get the authenticated user's ledger movements (transaction history) with pagination.",inputSchema:f.object({page:f.number().int().min(1).optional().describe("Page number (starts from 1, default: 1)"),pageSize:f.number().int().min(1).max(100).optional().describe("Items per page (default: 20, max: 100)"),entryType:f.enum(["CREDIT","DEBIT","LOCK","UNLOCK","FEE"]).optional().describe("Filter by entry type (e.g. CREDIT, DEBIT, LOCK, UNLOCK, FEE)"),transactionType:f.enum(["DEPOSIT","WITHDRAWAL","TRADE","FEE","FUNDING","LIQUIDATION","INTEREST","REWARD"]).optional().describe("Filter by transaction type (e.g. DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD)"),assetId:f.string().uuid().optional().describe("Filter by asset ID (UUID)")})},async({page:t,pageSize:r,entryType:o,transactionType:n,assetId:i})=>{let s=await(await X()).profile.getPaginatedUserMovements({page:t,pageSize:r,entryType:o,transactionType:n,assetId:i});return U(s)})}function qJ(e){e.registerTool("get_profile",{description:"Get the authenticated user's profile including address, username, account type, and withdrawal status. Use get_balances, get_movements, and get_orders for detailed account data."},async()=>{let r=await(await X()).profile.getProfile();return U(r)})}function HJ(e){e.registerTool("get_user_trades",{description:"List your own trade fills with optional filters and cursor pagination.",inputSchema:f.object({tradingPairId:f.string().optional().describe("Filter by trading pair UUID"),pageSize:f.number().optional().describe("Items per page"),pageToken:f.string().optional().describe("Cursor for the next page"),page:f.number().optional().describe("Page number (legacy offset mode; prefer pageToken)")})},async({tradingPairId:t,pageSize:r,pageToken:o,page:n})=>{let a=await(await X()).profile.getUserTrades({tradingPairId:t,pageSize:r,pageToken:o,page:n});return U(a)})}function GJ(e){qJ(e),LJ(e),UJ(e),FJ(e),HJ(e),jJ(e)}function VJ(e){e.registerTool("get_pulse",{description:"Get the latest market-pulse news feed: AI-synthesized, per-asset headlines with sentiment tags."},async()=>{let r=await We().pulse.getPulse();return U(r)})}function ZJ(e){VJ(e)}var rve="https://docs.0xmonaco.com/mcp",nve="SearchMonacoDocs",eT=null;async function WJ(e,t,r){let o=await fetch(rve,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, text/event-stream",...eT?{"Mcp-Session-Id":eT}:{}},body:JSON.stringify({jsonrpc:"2.0",id:r,method:e,params:t})});if(!o.ok)throw Error(`Mintlify MCP error: ${o.status}`);let n=o.headers.get("mcp-session-id");if(n)eT=n;let a=(await o.text()).split(`
|
|
169
|
-
`).find((s)=>s.startsWith("data: "));if(!a)throw Error("No data in Mintlify MCP response");return JSON.parse(a.slice(6))}async function ove(){if(eT)return;await WJ("initialize",{protocolVersion:"2025-03-26",capabilities:{},clientInfo:{name:"monaco-mcp-server",version:N_.version}},0)}async function ive(e){return await ove(),(await WJ("tools/call",{name:nve,arguments:{query:e}},1))?.result}function KJ(e){e.registerTool("search_docs",{description:"Search the Monaco documentation for information about the protocol, SDK, trading, and development guides.",inputSchema:f.object({query:f.string().describe("The search query")})},async({query:t})=>{try{let r=await ive(t);if(r?.content&&Array.isArray(r.content))return{content:r.content};return U(r)}catch(r){return XS(`Search failed: ${r instanceof Error?r.message:String(r)}`)}})}function JJ(e){KJ(e)}function YJ(e){e.registerTool("get_trades",{description:"Get historical trades for a trading pair. Returns recent trades sorted by execution time (newest first).",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),page:f.number().optional().describe("Page number (starts from 1, default: 1)"),pageSize:f.number().optional().describe("Max number of records to return (default: 25, max: 100)")})},async({tradingPairId:t,page:r,pageSize:o})=>{let i=await We().trades.getTrades(t,{page:r,pageSize:o});return U(i)})}function QJ(e){YJ(e)}function XJ(e){e.registerTool("batch_cancel_all_orders",{description:"Cancel EVERY one of your open orders in one call. Destructive and unfiltered by default — with no tradingPairId it cancels your entire open-order book across all pairs; pass a tradingPairId to limit it to that pair.",inputSchema:f.object({tradingPairId:f.string().optional().describe("Optional trading pair UUID to limit cancellation to")})},async({tradingPairId:t})=>{let o=await(await X()).trading.batchCancelAll(t);return U(o)})}function eY(e){e.registerTool("batch_cancel_orders",{description:"Cancel multiple orders by their IDs in a single request. Non-atomic and best-effort: each order is cancelled independently, so a failed leg does not stop the others. Inspect the per-order results and reconcile (retry or re-check) any that did not cancel.",inputSchema:f.object({orderIds:f.array(f.string()).describe("Array of order IDs to cancel")})},async({orderIds:t})=>{let o=await(await X()).trading.batchCancel(t);return U(o)})}function tY(e){e.registerTool("batch_close_all_positions",{description:"Close all open perpetual positions with MARKET reduce-only orders ('panic close'), optionally filtered to a specific trading pair. Best-effort: each position closes independently and per-position failures are reported in the result.",inputSchema:f.object({tradingPairId:f.string().optional().describe("Optional trading pair UUID to limit the close to"),slippageToleranceBps:f.number().int().optional().describe("Optional slippage tolerance (basis points) applied to each close")})},async({tradingPairId:t,slippageToleranceBps:r})=>{let n=await(await X()).positions.batchCloseAllPositions({tradingPairId:t,slippageToleranceBps:r});return U(n)})}function rY(e){e.registerTool("cancel_order",{description:"Cancel an open order by its ID.",inputSchema:f.object({orderId:f.string().describe("The order ID to cancel")})},async({orderId:t})=>{let o=await(await X()).trading.cancelOrder(t);return U(o)})}function nY(e){e.registerTool("get_order",{description:"Get detailed information about a specific order by its ID.",inputSchema:f.object({orderId:f.string().describe("The order ID to look up")})},async({orderId:t})=>{let o=await(await X()).trading.getOrder(t);return U(o)})}var ave=f.object({tradingPairId:f.string().trim().min(1,"Trading pair ID is required and cannot be empty"),side:f.enum(["BUY","SELL"],{message:"Order side is required and must be either 'BUY' or 'SELL'"}),price:f.string().trim().min(1,"Price is required and cannot be empty").refine((e)=>!Number.isNaN(Number(e)),"Price must be a valid number").refine((e)=>Number(e)>0,"Price must be greater than 0"),quantity:f.string().trim().min(1,"Quantity is required and cannot be empty").refine((e)=>!Number.isNaN(Number(e)),"Quantity must be a valid number").refine((e)=>Number(e)>0,"Quantity must be greater than 0"),orderType:f.enum(["LIMIT","MARKET"]).optional(),slippageToleranceBps:f.number().int().min(0,"Slippage tolerance must be between 0 and 1000 bps").max(1000,"Slippage tolerance must be between 0 and 1000 bps").optional()}).superRefine((e,t)=>{if(e.slippageToleranceBps!==void 0&&e.orderType!=="MARKET")t.addIssue({code:f.ZodIssueCode.custom,message:"slippageToleranceBps is only valid when orderType is MARKET",path:["slippageToleranceBps"]})}),sve=f.object({applicationName:f.string().nullable().optional(),applicationTakerFee:f.string(),applicationTakerFeeBps:f.number(),buyOrderLockAmount:f.string().nullable().optional(),makerTotalReceipt:f.string(),monacoMakerRebate:f.string(),monacoMakerRebateBps:f.number(),monacoMakerRebateBpsExact:f.string(),monacoTakerFee:f.string(),monacoTakerFeeBps:f.number(),monacoTakerFeeBpsExact:f.string(),notional:f.string(),takerTotalPayment:f.string(),totalTakerFees:f.string(),maxQuantity:f.string().nullable(),maxQuantityRaw:f.string().nullable(),slippageToleranceBps:f.number().nullable()}),cve=f.object({tradingPairId:f.string().trim().min(1,"Trading pair ID is required and cannot be empty")}),oY=f.object({tierLevel:f.number().int(),minVolumeThreshold:f.string(),makerFeeBps:f.string(),takerFeeBps:f.string()}),uve=f.object({currentTierLevel:f.number().int(),weightedVolume14d:f.string(),spotVolume14d:f.string(),perpVolume14d:f.string(),volumeToNextTier:f.string().nullable().optional(),nextTierLevel:f.number().int().nullable().optional(),feeSchedule:f.array(oY)});var iY=f.object({token:f.string(),available:f.string()}),lve=f.object({balances:f.array(iY)}),dve=f.object({code:f.string(),createdAt:f.string(),customCode:f.string(),isCustom:f.boolean(),display:f.string()}),aY=f.enum(["taken","too_short","too_long","reserved","invalid_char","looks_like_address"]),pve=f.object({available:f.boolean(),reason:f.preprocess((e)=>e===""||e===null?void 0:e,aY.optional())}),fve=f.object({code:f.string().trim().min(1,"code is required").regex(/^[A-Za-z][A-Za-z0-9_]{4,19}$/,"code must start with a letter and be 5–20 chars of letters, digits, or underscores")}),mve=f.object({code:f.string()}),hve=f.object({token:f.string().trim().min(1,"token is required").regex(/^0x[0-9a-fA-F]{40}$/,"token must be a 0x-prefixed EVM address"),amount:f.string().trim().min(1,"amount is required").refine((e)=>/^\d+$/.test(e)&&BigInt(e)>0n,"amount must be a positive integer string")}),gve=f.object({rewardsBalance:f.string(),tradingBalance:f.string()});var zf=["SUBMITTED","PARTIALLY_FILLED","FILLED","SETTLED_ON_CHAIN","SETTLED","CANCELLED","REJECTED","EXPIRED"];var Nf=f.enum(["BUY","SELL"],{message:'Order side must be "BUY" or "SELL"'}),By=f.enum(["SPOT","MARGIN"],{message:'Trading mode must be "SPOT" or "MARGIN"'}),oT=f.enum(["ISOLATED","CROSS"],{message:'Margin mode must be "ISOLATED" or "CROSS"'}),Dy=f.enum(["LONG","SHORT","NONE"],{message:'Position side must be "LONG", "SHORT", or "NONE"'}),sY=f.enum(["GTC","IOC","FOK"],{message:'Time in force must be "GTC", "IOC", or "FOK"'}),O5=f.enum(["GTC","IOC"],{message:'Conditional order time in force must be "GTC" or "IOC"'}),Mf=f.enum(["LIMIT","MARKET"],{message:'Order type must be "LIMIT" or "MARKET"'}),xt=f.string().trim().min(1,"Value cannot be empty").regex(/^\d+(\.\d+)?$/,"Value must be a positive decimal number (e.g., '1.5', '100')").refine((e)=>Number.parseFloat(e)>0,{message:"Value must be greater than 0"}),Re=f.uuid({message:"Must be a valid UUID (e.g., '123e4567-e89b-12d3-a456-426614174000')"}),cl=f.iso.datetime({message:"Must be a valid ISO 8601 date string (e.g., '2024-12-31T23:59:59Z')"}),cY=f.number().min(0,"Slippage tolerance must be at least 0 (no slippage)").max(1,"Slippage tolerance cannot exceed 1 (100%)").optional(),Uy=f.number().int().min(0,"Slippage tolerance must be at least 0 bps").max(1e4,"Slippage tolerance cannot exceed 10000 bps"),yve=f.number().int().min(0,"Slippage tolerance must be at least 0 bps").max(500,"TWAP slippage tolerance cannot exceed 500 bps (5%)"),tT=f.object({triggerPrice:xt,orderType:Mf,limitPrice:xt.optional(),quantity:xt.optional(),closePosition:f.boolean().optional(),timeInForce:O5.optional(),slippageToleranceBps:Uy.optional(),expiresAt:cl.optional()}).refine((e)=>e.orderType!=="LIMIT"||e.limitPrice!==void 0,{message:"limitPrice is required for LIMIT parent TP/SL",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.limitPrice===void 0,{message:"limitPrice must not be provided for MARKET parent TP/SL",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce is only allowed for LIMIT parent TP/SL",path:["timeInForce"]}).refine((e)=>e.orderType!=="LIMIT"||e.slippageToleranceBps===void 0,{message:"slippageToleranceBps is only allowed for MARKET parent TP/SL",path:["slippageToleranceBps"]}).refine((e)=>e.closePosition!==!0||e.quantity===void 0,{message:"quantity must be omitted when closePosition is true",path:["quantity"]}).refine((e)=>e.quantity!==void 0||e.closePosition!==!1,{message:"quantity is required when closePosition is false",path:["closePosition"]}),rT=(e)=>e?.takeProfit!==void 0||e?.stopLoss!==void 0,C5=(e,t)=>t===void 0||t!=="NONE"&&(e==="BUY"&&t==="LONG"||e==="SELL"&&t==="SHORT"),x$r=f.object({tradingPairId:Re,side:Nf,quantity:xt,price:xt,options:f.object({tradingMode:By.optional(),useMasterBalance:f.boolean().optional(),expirationDate:cl.optional(),timeInForce:sY.optional(),marginAccountId:Re.optional(),marginMode:oT.optional(),riskBucketId:Re.optional(),riskBucketCollateral:xt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:Dy.optional(),leverage:xt.optional(),reduceOnly:f.boolean().optional(),postOnly:f.boolean().optional(),takeProfit:tT.optional(),stopLoss:tT.optional()}).optional()}).refine((e)=>C5(e.side,e.options?.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["options","positionSide"]}).refine((e)=>e.options?.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["options","leverage"]}).refine((e)=>!rT(e.options)||e.options?.tradingMode==="MARGIN",{message:"takeProfit/stopLoss are only supported for MARGIN orders",path:["options"]}).refine((e)=>!rT(e.options)||e.options?.reduceOnly!==!0,{message:"takeProfit/stopLoss cannot be attached to reduce-only orders",path:["options"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode===void 0||e.options?.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["options","marginAccountId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["options","riskBucketCollateral"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["options","reduceOnly"]}).refine((e)=>e.options?.postOnly!==!0||e.options?.timeInForce===void 0||e.options.timeInForce!=="IOC"&&e.options.timeInForce!=="FOK",{message:"postOnly cannot be combined with IOC/FOK time in force",path:["options","timeInForce"]}),v$r=f.object({tradingPairId:Re,side:Nf,quantity:xt,options:f.object({tradingMode:By.optional(),slippageTolerance:cY,marginAccountId:Re.optional(),marginMode:oT.optional(),riskBucketId:Re.optional(),riskBucketCollateral:xt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:Dy.optional(),leverage:xt.optional(),reduceOnly:f.boolean().optional(),takeProfit:tT.optional(),stopLoss:tT.optional()}).optional()}).refine((e)=>C5(e.side,e.options?.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["options","positionSide"]}).refine((e)=>e.options?.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["options","leverage"]}).refine((e)=>!rT(e.options)||e.options?.tradingMode==="MARGIN",{message:"takeProfit/stopLoss are only supported for MARGIN orders",path:["options"]}).refine((e)=>!rT(e.options)||e.options?.reduceOnly!==!0,{message:"takeProfit/stopLoss cannot be attached to reduce-only orders",path:["options"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode===void 0||e.options?.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["options","marginAccountId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["options","riskBucketCollateral"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["options","reduceOnly"]}),_$r=f.object({orderId:Re}),w$r=f.object({orderId:Re,newOrder:f.object({price:xt.optional(),quantity:xt.optional(),useMasterBalance:f.boolean().optional(),postOnly:f.boolean().optional()})}),S$r=f.object({status:f.union([f.enum(zf),f.array(f.enum(zf)).min(1,"Status filter must list at least one status")]).optional(),tradingPairId:Re.optional(),tradingMode:By.optional(),marginAccountId:Re.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(1000,"Page size cannot exceed 1000").optional(),pageToken:f.string().optional()}).superRefine((e,t)=>{if(e.page!==void 0&&e.pageToken===void 0&&e.pageSize!==void 0&&e.pageSize>100)t.addIssue({code:f.ZodIssueCode.custom,message:"Page size cannot exceed 100 in page-number mode (page without pageToken)",path:["pageSize"]})}),T$r=f.enum(["STOP_LOSS","TAKE_PROFIT"],{message:'conditionType must be "STOP_LOSS" or "TAKE_PROFIT"'}),E$r=f.enum(["MARK_PRICE"],{message:'triggerSource must be "MARK_PRICE"'}),bve=f.enum(["PENDING_PARENT","ACTIVE","TRIGGERING","TRIGGERED","CANCELLED","EXPIRED","FAILED"],{message:"Invalid conditional order state"}),I$r=f.enum(["LONG","SHORT"],{message:'Position side must be "LONG" or "SHORT"'}),P$r=f.object({conditionalOrderId:Re}),k$r=f.object({marginAccountId:Re.optional(),tradingPairId:Re.optional(),state:bve.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),xve=f.enum(["PENDING","ACTIVE","COMPLETED","CANCELLED"],{message:"Invalid TWAP order state"}),vve=f.union([f.number().int("durationSeconds must be a whole number of seconds").positive("durationSeconds must be greater than 0"),f.string().regex(/^[1-9]\d*$/,"durationSeconds must be a positive integer string (e.g., '3600')")]),A$r=f.object({tradingPairId:Re,side:Nf,quantity:xt,options:f.object({durationSeconds:vve.optional(),startTime:cl.optional(),endTime:cl.optional(),limitPrice:xt.optional(),slippageToleranceBps:yve.optional(),randomize:f.boolean().optional(),reduceOnly:f.boolean().optional(),tradingMode:By.optional(),marginAccountId:Re.optional(),riskBucketId:Re.optional(),marginMode:oT.optional(),leverage:xt.optional(),strategyKey:f.string().min(1).max(128).optional(),useMasterBalance:f.boolean().optional(),clientTwapId:f.string().min(1).max(36,"clientTwapId cannot exceed 36 characters").optional()})}).refine((e)=>e.options.durationSeconds!==void 0!==(e.options.endTime!==void 0),{message:"Exactly one of durationSeconds or endTime must be set",path:["options","durationSeconds"]}).refine((e)=>e.options.startTime===void 0||e.options.endTime!==void 0,{message:"startTime is only valid together with endTime",path:["options","startTime"]}).refine((e)=>e.options.marginMode===void 0||e.options.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options.riskBucketId===void 0||e.options.tradingMode==="MARGIN",{message:"riskBucketId is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options.marginMode!=="CROSS"||e.options.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options.marginMode!=="CROSS"||e.options.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN TWAP orders",path:["options","leverage"]}),R$r=f.object({twapOrderId:Re}),$$r=f.object({state:xve.optional(),tradingPairId:Re.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),_ve=f.object({tradingPairId:Re,orderType:Mf,side:Nf,price:xt.optional(),quantity:xt,tradingMode:By.optional(),slippageTolerance:cY,useMasterBalance:f.boolean().optional(),expirationDate:cl.optional(),timeInForce:sY.optional(),marginAccountId:Re.optional(),marginMode:oT.optional(),riskBucketId:Re.optional(),riskBucketCollateral:xt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:Dy.optional(),leverage:xt.optional(),reduceOnly:f.boolean().optional(),postOnly:f.boolean().optional()}).refine((e)=>e.orderType!=="LIMIT"||e.price!==void 0,{message:"Price is required for LIMIT orders",path:["price"]}).refine((e)=>e.orderType!=="MARKET"||e.price===void 0,{message:"Price must not be provided for MARKET orders",path:["price"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce must not be provided for MARKET orders",path:["timeInForce"]}).refine((e)=>e.orderType!=="MARKET"||e.postOnly!==!0,{message:"postOnly must not be provided for MARKET orders",path:["postOnly"]}).refine((e)=>e.postOnly!==!0||e.timeInForce===void 0||e.timeInForce!=="IOC"&&e.timeInForce!=="FOK",{message:"postOnly cannot be combined with IOC/FOK time in force",path:["postOnly"]}).refine((e)=>e.riskBucketCollateral===void 0||e.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["tradingMode"]}).refine((e)=>e.marginMode===void 0||e.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["tradingMode"]}).refine((e)=>e.marginMode!=="CROSS"||e.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["marginAccountId"]}).refine((e)=>e.marginMode!=="CROSS"||e.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["riskBucketId"]}).refine((e)=>e.marginMode!=="CROSS"||e.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["riskBucketCollateral"]}).refine((e)=>e.marginMode!=="CROSS"||e.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["strategyKey"]}).refine((e)=>e.riskBucketCollateral===void 0||e.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["riskBucketId"]}).refine((e)=>e.riskBucketCollateral===void 0||e.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["reduceOnly"]}).refine((e)=>C5(e.side,e.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["positionSide"]}).refine((e)=>e.tradingMode!=="MARGIN"||e.reduceOnly===!0||e.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["leverage"]}),nT=100,O$r=f.object({orders:f.array(_ve).min(1,"At least one order is required").max(nT,`At most ${nT} orders per batch request`)}),wve=f.object({orderId:Re,price:xt.optional(),quantity:xt.optional(),useMasterBalance:f.boolean().optional(),postOnly:f.boolean().optional()}).refine((e)=>e.price!==void 0||e.quantity!==void 0,{message:"At least one of price or quantity must be provided"}),C$r=f.object({orders:f.array(wve).min(1,"At least one order is required").max(nT,`At most ${nT} orders per batch request`)});var z5=f.object({page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),B$r=z5.extend({state:f.string().trim().min(1,"State cannot be empty").optional(),tradingPairId:Re.optional()}),D$r=f.object({marginAccountId:Re,tradingPairId:Re.optional()}),U$r=f.object({tradingPairId:Re.optional()}).optional(),L$r=f.object({asset:f.string().trim().min(1,"Asset cannot be empty").optional()}).optional(),Sve=f.object({asset:f.string().trim().min(1,"Asset cannot be empty"),amount:xt,tradingPairId:Re.optional(),strategyKey:f.string().trim().min(1,"Strategy key cannot be empty").optional(),marginMode:f.enum(["ISOLATED","CROSS"]).optional()}).refine((e)=>!(e.marginMode==="CROSS"&&e.tradingPairId!==void 0),{message:"tradingPairId is not supported for CROSS risk buckets",path:["tradingPairId"]}),iT=f.object({asset:f.string().trim().min(1,"Asset cannot be empty"),amount:xt}),Tve=f.object({tradingPairId:Re,strategyKey:f.string().trim().min(1,"Strategy key cannot be empty").optional()}),Eve=f.array(Re).min(1,"selectedTradingPairIds is required for CROSS risk buckets"),uY=Tve.extend({marginMode:f.literal("ISOLATED").optional(),selectedTradingPairIds:f.never().optional()}),lY=f.object({marginMode:f.literal("CROSS"),selectedTradingPairIds:Eve,strategyKey:f.never().optional()}),Ive=lY.extend({tradingPairId:f.never().optional()}),j$r=f.object({marginAccountId:Re,request:Sve}),F$r=f.object({request:iT}),q$r=f.object({request:f.union([iT.merge(uY).strict(),iT.merge(Ive).strict()])}),H$r=f.object({request:iT}),G$r=z5.extend({marginAccountId:Re,movementType:f.string().trim().min(1,"Movement type cannot be empty").optional()}),V$r=z5.extend({movementType:f.string().trim().min(1,"Movement type cannot be empty").optional()}).optional(),N5=f.object({tradingPairId:Re,side:Nf,positionSide:Dy.optional(),orderType:Mf,price:xt.optional(),quantity:xt,leverage:xt.optional(),reduceOnly:f.boolean().optional()}),M5=(e,t)=>{if(e.positionSide!==void 0){let r=e.side==="BUY"?"LONG":"SHORT";if(e.positionSide!==r)t.addIssue({code:f.ZodIssueCode.custom,message:"positionSide must match side when provided (BUY=LONG, SELL=SHORT)",path:["positionSide"]})}if(e.reduceOnly!==!0&&e.leverage===void 0)t.addIssue({code:f.ZodIssueCode.custom,message:"leverage is required for normal margin orders",path:["leverage"]})},dY=N5.strict().superRefine(M5),Pve=N5.merge(uY).strict().superRefine(M5),kve=N5.merge(lY).strict().superRefine(M5).refine((e)=>e.selectedTradingPairIds.includes(e.tradingPairId),{message:"tradingPairId must be included in selectedTradingPairIds for CROSS risk buckets",path:["selectedTradingPairIds"]}),Ave=f.union([Pve,kve]),Z$r=f.object({marginAccountId:Re,request:dY}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]}),W$r=f.object({request:dY}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]}),K$r=f.object({request:Ave}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]});var pY=f.enum(["1m","5m","15m","30m","1h","4h","1d","1w","1M"],{message:'Interval must be one of: "1m", "5m", "15m", "30m", "1h", "4h", "1d", "1w", "1M"'}),Rve=31536000000,$ve=946684800000,aT=f.number().int().positive({message:"Timestamp must be a positive integer (milliseconds since epoch)"}).min($ve,{message:"Timestamp must be at least Jan 1, 2000 (946684800000 ms). Did you pass seconds instead of milliseconds?"}).max(Number.MAX_SAFE_INTEGER,{message:"Timestamp must not exceed JavaScript's maximum safe integer"}).refine((e)=>e<=Date.now()+Rve,{message:"Timestamp must not be unreasonably far in the future (max 1 year ahead)"}),X$r=f.object({tradingPairId:Re,interval:pY,startTime:aT,endTime:aT}).refine((e)=>e.startTime<e.endTime,{message:"startTime must be less than endTime",path:["endTime"]}),e2r=f.string().min(1,"Trading pair symbol cannot be empty").regex(/^[A-Za-z0-9]{1,10}\/[A-Za-z0-9]{1,10}$/,{message:'Trading pair symbol must be in format "BASE/QUOTE" (e.g., "BTC/USDT", "ETH/USD")'}),Ove=f.number().int().positive({message:"Limit must be a positive integer"}).max(500,{message:"Limit cannot exceed 500 bars per request"}).optional(),t2r=f.object({tradingPairId:Re,interval:pY,startTime:aT.optional(),endTime:aT.optional(),limit:Ove,priceType:f.enum(["trade","mark"]).optional()}).refine((e)=>{if(e.startTime!==void 0&&e.endTime!==void 0)return e.startTime<e.endTime;return!0},{message:"startTime must be less than endTime",path:["endTime"]});var r2r=f.object({tradingPairId:Re}),n2r=f.object({query:f.string().min(1,"Search query cannot be empty").optional(),pageSize:f.number().int().min(1).max(100).optional(),page:f.number().int().min(1).optional()}),o2r=f.object({tradingPairId:Re});var mY=f.object({page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),Cve=f.enum(["OPEN","CLOSED","LIQUIDATING","LIQUIDATED"],{message:'Position status must be "OPEN", "CLOSED", "LIQUIDATING", or "LIQUIDATED"'}),zve=f.enum(["MARKET","LIMIT","IOC"],{message:'Close type must be "MARKET", "LIMIT", or "IOC"'}),B5=f.object({positionId:Re}),c2r=mY.extend({marginAccountId:Re.optional(),tradingPairId:Re.optional(),status:Cve.optional()});var u2r=B5.extend({request:f.object({closeType:zve,limitPrice:xt.optional(),slippageToleranceBps:Uy.optional(),quantity:xt.optional()})}).refine((e)=>e.request.closeType==="MARKET"||e.request.limitPrice!==void 0,{message:"limitPrice is required for LIMIT and IOC close requests",path:["request","limitPrice"]}).refine((e)=>e.request.closeType!=="MARKET"||e.request.limitPrice===void 0,{message:"limitPrice is not allowed for MARKET close requests",path:["request","limitPrice"]}),l2r=f.object({tradingPairId:Re.optional(),slippageToleranceBps:Uy.optional()});var fY=f.object({triggerPrice:xt,orderType:Mf,limitPrice:xt.optional(),quantity:xt.optional(),closePosition:f.boolean().optional(),timeInForce:O5.optional(),slippageToleranceBps:Uy.optional(),expiresAt:cl.optional()}).refine((e)=>e.orderType!=="LIMIT"||e.limitPrice!==void 0,{message:"limitPrice is required for LIMIT TP/SL legs",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.limitPrice===void 0,{message:"limitPrice must not be provided for MARKET TP/SL legs",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce is only allowed for LIMIT TP/SL legs",path:["timeInForce"]}).refine((e)=>e.orderType!=="LIMIT"||e.slippageToleranceBps===void 0,{message:"slippageToleranceBps is only allowed for MARKET TP/SL legs",path:["slippageToleranceBps"]}).refine((e)=>e.closePosition!==!0||e.quantity===void 0,{message:"quantity must be omitted when closePosition is true",path:["quantity"]}).refine((e)=>e.quantity!==void 0||e.closePosition!==!1,{message:"quantity is required when closePosition is false",path:["closePosition"]}),d2r=B5.extend({request:f.object({takeProfit:fY.optional(),stopLoss:fY.optional(),oco:f.boolean().optional()}).refine((e)=>e.takeProfit!==void 0||e.stopLoss!==void 0,{message:"At least one of takeProfit or stopLoss is required"}).refine((e)=>e.oco!==!0||e.takeProfit!==void 0&&e.stopLoss!==void 0,{message:"oco=true requires both takeProfit and stopLoss",path:["oco"]})}),p2r=mY.extend({positionId:Re.optional(),marginAccountId:Re.optional(),tradingPairId:Re.optional(),reductionOnly:f.boolean().optional()}),Nve=f.enum(["1m","5m","15m","1h","4h","1d"],{message:'Interval must be one of "1m", "5m", "15m", "1h", "4h", "1d"'}),f2r=B5.extend({params:f.object({interval:Nve,startTime:f.number().int().min(0,"startTime must be a non-negative millisecond timestamp").optional(),endTime:f.number().int().min(0,"endTime must be a non-negative millisecond timestamp").optional()}).refine((e)=>e.startTime===void 0||e.endTime===void 0||e.startTime<e.endTime,{message:"startTime must be less than endTime",path:["startTime"]})});var Mve=f.enum(["CREDIT","DEBIT","LOCK","UNLOCK","FEE"],{message:'Entry type must be "CREDIT", "DEBIT", "LOCK", "UNLOCK", or "FEE"'}),Bve=f.enum(["DEPOSIT","WITHDRAWAL","TRADE","FEE","FUNDING","LIQUIDATION","INTEREST","REWARD"],{message:'Transaction type must be "DEPOSIT", "WITHDRAWAL", "TRADE", "FEE", "FUNDING", "LIQUIDATION", "INTEREST", or "REWARD"'}),y2r=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional(),entryType:Mve.optional(),transactionType:Bve.optional(),assetId:Re.optional()}),b2r=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(1000,"Page size cannot exceed 1000").optional(),tradingPairId:Re.optional(),pageToken:f.string().optional()}).superRefine((e,t)=>{if(e.page!==void 0&&e.pageToken===void 0&&e.pageSize!==void 0&&e.pageSize>100)t.addIssue({code:f.ZodIssueCode.custom,message:"Page size cannot exceed 100 in page-number mode (page without pageToken)",path:["pageSize"]})}),x2r=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional(),tradingPairId:Re.optional(),positionId:Re.optional(),marginAccountId:Re.optional()});var S2r=f.string().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Must be a valid Ethereum address (e.g., '0x1234...5678')"}),D5=f.union([f.string().regex(/^\d+$/,"Must be a positive integer string").refine((e)=>BigInt(e)>0n,{message:"Amount must be greater than 0"}),f.bigint().refine((e)=>e>0n,{message:"Amount must be greater than 0"})]),T2r=f.object({assetId:Re,amount:D5,autoWait:f.boolean().optional()}),E2r=f.object({assetId:Re,amount:D5,autoWait:f.boolean().optional(),target:f.enum(["spot","margin"]).optional()}),I2r=f.object({assetId:Re,amount:D5,destination:f.string().regex(/^0x[a-fA-F0-9]{40}$/,"destination must be a 0x-prefixed 20-byte hex address"),autoWait:f.boolean().optional(),source:f.enum(["spot","margin"]).optional()}),P2r=f.object({assetId:Re});function hY(e){e.registerTool("get_orders",{description:"Get a cursor-paginated list of orders with optional filters by status and trading pair. Omit both page and pageToken for the newest orders; pass the previous response's nextPageToken to fetch the next page. A response with zero orders and an empty nextPageToken means the walk is exhausted. Cursor responses have no exact totals (total/totalPages are 0).",inputSchema:f.object({status:f.enum(zf).optional().describe("Filter by order status (e.g. SUBMITTED, FILLED, CANCELLED)"),tradingPairId:f.string().optional().describe("Filter by trading pair UUID"),page:f.number().optional().describe("Deprecated: page number for legacy offset pagination, which only sees recent history. Use pageToken instead."),pageSize:f.number().optional().describe("Orders per page (default: 10; max 100 in legacy page mode, up to 1000 with pageToken)"),pageToken:f.string().optional().describe("Pagination cursor from a previous response's nextPageToken. Omit it (and page) to start from the newest orders.")})},async({status:t,tradingPairId:r,page:o,pageSize:n,pageToken:i})=>{let s=await(await X()).trading.getPaginatedOrders({status:t,tradingPairId:r,page:o,pageSize:n,pageToken:i});return U(s)})}function gY(e){e.registerTool("place_limit_order",{description:"Place a limit order on Monaco. Limit orders execute only when the market reaches the specified price. "+"Not idempotent: if the call fails with an ambiguous outcome (timeout, network error, or a 5xx with no order returned), do NOT blindly retry — the order may already be live. First reconcile with get_orders (match the order's pair/side/price/quantity among your recent orders, including filled ones) or get_order, then resubmit only if it did not land.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),side:f.enum(["BUY","SELL"]).describe("Order side"),quantity:f.string().describe("Order quantity as a decimal string"),price:f.string().describe("Limit price as a decimal string"),tradingMode:f.enum(["SPOT","MARGIN"]).optional().describe("Trading mode (default: SPOT)"),timeInForce:f.enum(["GTC","IOC","FOK"]).optional().describe("Time in force (default: GTC)"),expirationDate:f.string().optional().describe("Expiration date for GTC orders (ISO 8601)"),marginAccountId:f.string().optional().describe("Parent margin account UUID for MARGIN orders"),marginMode:f.enum(["ISOLATED","CROSS"]).optional().describe("Risk bucket mode for MARGIN orders: ISOLATED (default) or CROSS"),riskBucketId:f.string().optional().describe("Existing isolated risk bucket UUID for risk-bucket-scoped MARGIN orders"),riskBucketCollateral:f.string().optional().describe("Collateral to allocate into a new isolated risk bucket"),strategyKey:f.string().optional().describe("Optional client strategy key"),positionSide:f.enum(["LONG","SHORT"]).optional().describe("Deprecated compatibility field; order side is authoritative (BUY=LONG, SELL=SHORT)"),leverage:f.string().optional().describe("Leverage as a decimal string, required for normal MARGIN orders (ignored for reduce-only)"),reduceOnly:f.boolean().optional().describe("Whether the order can only reduce existing exposure"),postOnly:f.boolean().optional().describe("Maker-only: rejected with a 400 carrying the structured error code 'POST_ONLY_WOULD_CROSS' if this order would cross the book. GTC time in force only; rejected with IOC/FOK."),clientOrderId:f.string().optional().describe("Client-assigned correlation handle, echoed back on order reads and order WebSocket events. Up to 64 characters from A-Za-z0-9._:-. Not an idempotency key: not de-duplicated and not unique — reconcile a lost response via get_orders before resubmitting.")})},async({tradingPairId:t,side:r,quantity:o,price:n,tradingMode:i,timeInForce:a,expirationDate:s,marginAccountId:c,marginMode:u,riskBucketId:d,riskBucketCollateral:p,strategyKey:m,positionSide:h,leverage:y,reduceOnly:x,postOnly:S,clientOrderId:v})=>{let w=await(await X()).trading.placeLimitOrder(t,r,o,n,{tradingMode:i,timeInForce:a,expirationDate:s,marginAccountId:c,marginMode:u,riskBucketId:d,riskBucketCollateral:p,strategyKey:m,positionSide:h,leverage:y,reduceOnly:x,postOnly:S,clientOrderId:v});return U(w)})}function yY(e){e.registerTool("place_market_order",{description:"Place a market order on Monaco. It executes immediately against resting liquidity, but only inside a mandatory 1,000 bps (10%) server-side protective price band anchored to the mark/last-trade reference price. Fills stop at the edge of the band, so a market order may partially fill and cancel the remainder, be rejected when no liquidity sits inside the band, or be rejected when the market has no trustworthy price anchor. Optional slippageTolerance is merged tighter-wins with this band: it can only TIGHTEN execution, never widen past the mandatory band; omitting it applies the full 1,000 bps band. Not idempotent: if the call fails with an ambiguous outcome (timeout, network error, or a 5xx with no order returned), do NOT blindly retry — the order may already be live. First reconcile with get_orders (match the order's pair/side/quantity among your recent orders, including filled ones) or get_order, then resubmit only if it did not land.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),side:f.enum(["BUY","SELL"]).describe("Order side"),quantity:f.string().describe("Order quantity as a decimal string"),tradingMode:f.enum(["SPOT","MARGIN"]).optional().describe("Trading mode (default: SPOT)"),slippageTolerance:f.number().optional().describe("Tightens the mandatory 1,000 bps band, as a decimal (e.g. 0.01 for 1%; 0 for best price only). Can only tighten, never widen; omit to apply the full band."),marginAccountId:f.string().optional().describe("Parent margin account UUID for MARGIN orders"),marginMode:f.enum(["ISOLATED","CROSS"]).optional().describe("Risk bucket mode for MARGIN orders: ISOLATED (default) or CROSS"),riskBucketId:f.string().optional().describe("Existing isolated risk bucket UUID for risk-bucket-scoped MARGIN orders"),riskBucketCollateral:f.string().optional().describe("Collateral to allocate into a new isolated risk bucket"),strategyKey:f.string().optional().describe("Optional client strategy key"),positionSide:f.enum(["LONG","SHORT"]).optional().describe("Deprecated compatibility field; order side is authoritative (BUY=LONG, SELL=SHORT)"),leverage:f.string().optional().describe("Leverage as a decimal string, required for normal MARGIN orders (ignored for reduce-only)"),reduceOnly:f.boolean().optional().describe("Whether the order can only reduce existing exposure"),clientOrderId:f.string().optional().describe("Client-assigned correlation handle, echoed back on order reads and order WebSocket events. Up to 64 characters from A-Za-z0-9._:-. Not an idempotency key: not de-duplicated and not unique — reconcile a lost response via get_orders before resubmitting.")})},async({tradingPairId:t,side:r,quantity:o,tradingMode:n,slippageTolerance:i,marginAccountId:a,marginMode:s,riskBucketId:c,riskBucketCollateral:u,strategyKey:d,positionSide:p,leverage:m,reduceOnly:h,clientOrderId:y})=>{let S=await(await X()).trading.placeMarketOrder(t,r,o,{tradingMode:n,slippageTolerance:i,marginAccountId:a,marginMode:s,riskBucketId:c,riskBucketCollateral:u,strategyKey:d,positionSide:p,leverage:m,reduceOnly:h,clientOrderId:y});return U(S)})}function bY(e){e.registerTool("replace_order",{description:"Replace an existing order with new price and/or quantity. The order must be open. "+"Not idempotent: if the call fails with an ambiguous outcome (timeout, network error, or a 5xx with no order returned), do NOT blindly retry — read the order back with get_order and compare its price/quantity before replacing again.",inputSchema:f.object({orderId:f.string().describe("The order ID to replace"),price:f.string().optional().describe("New price as a decimal string"),quantity:f.string().optional().describe("New quantity as a decimal string"),postOnly:f.boolean().optional().describe("Re-states maker-only intent for the replacement (nothing is inherited from the original order): rejected with a 400 carrying the structured error code 'POST_ONLY_WOULD_CROSS' if it would cross the book."),clientOrderId:f.string().optional().describe("Client-assigned correlation handle for the replacement order, echoed back on order reads and order WebSocket events. Nothing is inherited from the original order — re-state it here to keep the handle across a requote. Up to 64 characters from A-Za-z0-9._:-. Not an idempotency key: not de-duplicated and not unique.")})},async({orderId:t,price:r,quantity:o,postOnly:n,clientOrderId:i})=>{let s=await(await X()).trading.replaceOrder(t,{price:r,quantity:o,postOnly:n,clientOrderId:i});return U(s)})}function xY(e){gY(e),yY(e),rY(e),eY(e),XJ(e),tY(e),bY(e),hY(e),nY(e)}function vY(e){e.registerTool("vault_get_allowance",{description:"Check the current token allowance granted to the Monaco vault for a specific asset.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to check allowance for")})},async({assetId:t})=>{let o=await(await X()).vault.getAllowance(t);return U({assetId:t,allowance:o.toString()})})}function _Y(e){e.registerTool("vault_approve",{description:"Approve the Monaco vault contract to spend tokens on your behalf. Required before depositing ERC20 tokens.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to approve"),amount:f.string().regex(/^\d+$/,"Must be a non-negative integer string").describe("Max amount to approve as a raw integer string (e.g. '1000000' for 1 USDC with 6 decimals)")})},async({assetId:t,amount:r})=>{let n=await(await X()).vault.approve(t,BigInt(r));return U({hash:n.hash,status:n.status})})}function wY(e){e.registerTool("vault_deposit",{description:"Deposit tokens into the Monaco vault. Requires prior approval for ERC20 tokens (use vault_approve first). Set target to 'margin' to route the deposit straight into margin collateral instead of the spot wallet.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to deposit"),amount:f.string().regex(/^\d+$/,"Must be a non-negative integer string").describe("Amount to deposit as a raw integer string (e.g. '1000000' for 1 USDC with 6 decimals)"),target:f.enum(["spot","margin"]).optional().describe("Destination ledger: 'spot' (default) or 'margin' to route into margin collateral")})},async({assetId:t,amount:r,target:o})=>{let i=await(await X()).vault.deposit(t,BigInt(r),void 0,o);return U({hash:i.hash,status:i.status})})}function SY(e){e.registerTool("get_pending_withdrawals",{description:"List your pending withdrawals still awaiting on-chain root confirmation.",inputSchema:f.object({page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page")})},async({page:t,pageSize:r})=>{let n=await(await X()).withdrawals.listPendingWithdrawals({page:t,pageSize:r});return U(n)})}function TY(e){e.registerTool("vault_needs_approval",{description:"Check if approval is needed before depositing a specific amount of tokens.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to check"),amount:f.string().regex(/^\d+$/,"Must be a non-negative integer string").describe("Amount to check as a raw integer string")})},async({assetId:t,amount:r})=>{let n=await(await X()).vault.needsApproval(t,BigInt(r));return U({assetId:t,amount:r,needs_approval:n})})}function EY(e){e.registerTool("vault_withdraw",{description:"Withdraw tokens from the Monaco vault back to your wallet.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to withdraw"),amount:f.string().regex(/^\d+$/,"Must be a non-negative integer string").describe("Amount to withdraw as a raw integer string (e.g. '1000000' for 1 USDC with 6 decimals)")})},async({assetId:t,amount:r})=>{let n=await(await X()).vault.withdraw(t,BigInt(r));return U({withdrawalIndex:n.withdrawalIndex,status:n.status,hash:n.hash})})}function IY(e){_Y(e),wY(e),EY(e),vY(e),TY(e),SY(e)}function Dve(e){let t=e.length-1,r=e[t];if(typeof r!=="function")return e;let o=MK(r);return[...e.slice(0,t),o]}function Uve(e,t){let[r,...o]=t;if(!r||typeof r!=="object")return t;let n=q3(e);if(!n)return t;let i=r.annotations;return[{...r,annotations:{...n,...i}},...o]}function PY(e,t,r){return new Proxy(e,{get(o,n,i){if(n==="registerTool")return(s,...c)=>{if(!W3(s,t))return;let u=Uve(s,c);if(r&&Z3(s))u=Dve(u);return o.registerTool(s,...u)};let a=Reflect.get(o,n,i);return typeof a==="function"?a.bind(o):a}})}function kY(e,t){let r={authenticated:t.authenticated,capability:t.capability,allow:t.allow??[],deny:t.deny??[],network:t.network},o=PY(e,r,!1);if(JJ(o),iJ(o),gJ(o),sJ(o),QJ(o),TJ(o),ZJ(o),t.authenticated){let n=PY(e,r,!0);xY(n),DJ(n),GJ(n),$J(n),QK(n),FK(n),IY(n),UK(n,{network:t.network}),EJ(n)}}if(typeof globalThis.crypto?.getRandomValues!=="function")globalThis.crypto=Lve;if(!globalThis.fetch)globalThis.fetch=wb,globalThis.Headers=an,globalThis.Request=ea,globalThis.Response=Cr;if(!globalThis.WebSocket)globalThis.WebSocket=cE.default;async function jve(){let e=su(),t=e.privateKey!==null,r=new pR({name:"monaco-mcp-server",version:N_.version});kY(r,{authenticated:t,network:e.network,capability:e.capability,allow:e.allow,deny:e.deny});let o=new mR;await r.connect(o),console.error(t?`Monaco MCP server running on stdio (network=${e.network}, capability=${e.capability}). Fund-movement and privilege tools require MONACO_CAPABILITY=full or an explicit MONACO_TOOL_ALLOWLIST entry.`:"Monaco MCP server running on stdio (public read-only mode — set MONACO_PRIVATE_KEY, MONACO_CLIENT_ID and MONACO_NETWORK to enable authenticated tools).")}jve().catch((e)=>{console.error("Fatal error:",e),process.exit(1)});
|
|
169
|
+
`).find((s)=>s.startsWith("data: "));if(!a)throw Error("No data in Mintlify MCP response");return JSON.parse(a.slice(6))}async function ove(){if(eT)return;await WJ("initialize",{protocolVersion:"2025-03-26",capabilities:{},clientInfo:{name:"monaco-mcp-server",version:N_.version}},0)}async function ive(e){return await ove(),(await WJ("tools/call",{name:nve,arguments:{query:e}},1))?.result}function KJ(e){e.registerTool("search_docs",{description:"Search the Monaco documentation for information about the protocol, SDK, trading, and development guides.",inputSchema:f.object({query:f.string().describe("The search query")})},async({query:t})=>{try{let r=await ive(t);if(r?.content&&Array.isArray(r.content))return{content:r.content};return U(r)}catch(r){return XS(`Search failed: ${r instanceof Error?r.message:String(r)}`)}})}function JJ(e){KJ(e)}function YJ(e){e.registerTool("get_trades",{description:"Get historical trades for a trading pair. Returns recent trades sorted by execution time (newest first).",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),page:f.number().optional().describe("Page number (starts from 1, default: 1)"),pageSize:f.number().optional().describe("Max number of records to return (default: 25, max: 100)")})},async({tradingPairId:t,page:r,pageSize:o})=>{let i=await We().trades.getTrades(t,{page:r,pageSize:o});return U(i)})}function QJ(e){YJ(e)}function XJ(e){e.registerTool("batch_cancel_all_orders",{description:"Cancel EVERY one of your open orders in one call. Destructive and unfiltered by default — with no tradingPairId it cancels your entire open-order book across all pairs; pass a tradingPairId to limit it to that pair.",inputSchema:f.object({tradingPairId:f.string().optional().describe("Optional trading pair UUID to limit cancellation to")})},async({tradingPairId:t})=>{let o=await(await X()).trading.batchCancelAll(t);return U(o)})}function eY(e){e.registerTool("batch_cancel_orders",{description:"Cancel multiple orders by their IDs in a single request. Non-atomic and best-effort: each order is cancelled independently, so a failed leg does not stop the others. Inspect the per-order results and reconcile (retry or re-check) any that did not cancel.",inputSchema:f.object({orderIds:f.array(f.string()).describe("Array of order IDs to cancel")})},async({orderIds:t})=>{let o=await(await X()).trading.batchCancel(t);return U(o)})}function tY(e){e.registerTool("batch_close_all_positions",{description:"Close all open perpetual positions with MARKET reduce-only orders ('panic close'), optionally filtered to a specific trading pair. Best-effort: each position closes independently and per-position failures are reported in the result.",inputSchema:f.object({tradingPairId:f.string().optional().describe("Optional trading pair UUID to limit the close to"),slippageToleranceBps:f.number().int().optional().describe("Optional slippage tolerance (basis points) applied to each close")})},async({tradingPairId:t,slippageToleranceBps:r})=>{let n=await(await X()).positions.batchCloseAllPositions({tradingPairId:t,slippageToleranceBps:r});return U(n)})}function rY(e){e.registerTool("cancel_order",{description:"Cancel an open order by its ID.",inputSchema:f.object({orderId:f.string().describe("The order ID to cancel")})},async({orderId:t})=>{let o=await(await X()).trading.cancelOrder(t);return U(o)})}function nY(e){e.registerTool("get_order",{description:"Get detailed information about a specific order by its ID.",inputSchema:f.object({orderId:f.string().describe("The order ID to look up")})},async({orderId:t})=>{let o=await(await X()).trading.getOrder(t);return U(o)})}var ave=f.object({tradingPairId:f.string().trim().min(1,"Trading pair ID is required and cannot be empty"),side:f.enum(["BUY","SELL"],{message:"Order side is required and must be either 'BUY' or 'SELL'"}),price:f.string().trim().min(1,"Price is required and cannot be empty").refine((e)=>!Number.isNaN(Number(e)),"Price must be a valid number").refine((e)=>Number(e)>0,"Price must be greater than 0"),quantity:f.string().trim().min(1,"Quantity is required and cannot be empty").refine((e)=>!Number.isNaN(Number(e)),"Quantity must be a valid number").refine((e)=>Number(e)>0,"Quantity must be greater than 0"),orderType:f.enum(["LIMIT","MARKET"]).optional(),slippageToleranceBps:f.number().int().min(0,"Slippage tolerance must be between 0 and 1000 bps").max(1000,"Slippage tolerance must be between 0 and 1000 bps").optional()}).superRefine((e,t)=>{if(e.slippageToleranceBps!==void 0&&e.orderType!=="MARKET")t.addIssue({code:f.ZodIssueCode.custom,message:"slippageToleranceBps is only valid when orderType is MARKET",path:["slippageToleranceBps"]})}),sve=f.object({applicationName:f.string().nullable().optional(),applicationTakerFee:f.string(),applicationTakerFeeBps:f.number(),buyOrderLockAmount:f.string().nullable().optional(),makerTotalReceipt:f.string(),monacoMakerRebate:f.string(),monacoMakerRebateBps:f.number(),monacoMakerRebateBpsExact:f.string(),monacoTakerFee:f.string(),monacoTakerFeeBps:f.number(),monacoTakerFeeBpsExact:f.string(),notional:f.string(),takerTotalPayment:f.string(),totalTakerFees:f.string(),maxQuantity:f.string().nullable(),maxQuantityRaw:f.string().nullable(),slippageToleranceBps:f.number().nullable()}),cve=f.object({tradingPairId:f.string().trim().min(1,"Trading pair ID is required and cannot be empty")}),oY=f.object({tierLevel:f.number().int(),minVolumeThreshold:f.string(),makerFeeBps:f.string(),takerFeeBps:f.string()}),uve=f.object({currentTierLevel:f.number().int(),weightedVolume14d:f.string(),spotVolume14d:f.string(),perpVolume14d:f.string(),volumeToNextTier:f.string().nullable().optional(),nextTierLevel:f.number().int().nullable().optional(),feeSchedule:f.array(oY)});var iY=f.object({token:f.string(),available:f.string()}),lve=f.object({balances:f.array(iY)}),dve=f.object({code:f.string(),createdAt:f.string(),customCode:f.string(),isCustom:f.boolean(),display:f.string()}),aY=f.enum(["taken","too_short","too_long","reserved","invalid_char","looks_like_address"]),pve=f.object({available:f.boolean(),reason:f.preprocess((e)=>e===""||e===null?void 0:e,aY.optional())}),fve=f.object({code:f.string().trim().min(1,"code is required").regex(/^[A-Za-z][A-Za-z0-9_]{4,19}$/,"code must start with a letter and be 5–20 chars of letters, digits, or underscores")}),mve=f.object({code:f.string()}),hve=f.object({token:f.string().trim().min(1,"token is required").regex(/^0x[0-9a-fA-F]{40}$/,"token must be a 0x-prefixed EVM address"),amount:f.string().trim().min(1,"amount is required").refine((e)=>/^\d+$/.test(e)&&BigInt(e)>0n,"amount must be a positive integer string")}),gve=f.object({rewardsBalance:f.string(),tradingBalance:f.string()});var zf=["SUBMITTED","PARTIALLY_FILLED","FILLED","SETTLED_ON_CHAIN","SETTLED","CANCELLED","REJECTED","EXPIRED"];var Nf=f.enum(["BUY","SELL"],{message:'Order side must be "BUY" or "SELL"'}),By=f.enum(["SPOT","MARGIN"],{message:'Trading mode must be "SPOT" or "MARGIN"'}),oT=f.enum(["ISOLATED","CROSS"],{message:'Margin mode must be "ISOLATED" or "CROSS"'}),Dy=f.enum(["LONG","SHORT","NONE"],{message:'Position side must be "LONG", "SHORT", or "NONE"'}),sY=f.enum(["GTC","IOC","FOK"],{message:'Time in force must be "GTC", "IOC", or "FOK"'}),O5=f.enum(["GTC","IOC"],{message:'Conditional order time in force must be "GTC" or "IOC"'}),Mf=f.enum(["LIMIT","MARKET"],{message:'Order type must be "LIMIT" or "MARKET"'}),yt=f.string().trim().min(1,"Value cannot be empty").regex(/^\d+(\.\d+)?$/,"Value must be a positive decimal number (e.g., '1.5', '100')").refine((e)=>Number.parseFloat(e)>0,{message:"Value must be greater than 0"}),Re=f.uuid({message:"Must be a valid UUID (e.g., '123e4567-e89b-12d3-a456-426614174000')"}),cl=f.iso.datetime({message:"Must be a valid ISO 8601 date string (e.g., '2024-12-31T23:59:59Z')"}),cY=f.number().min(0,"Slippage tolerance must be at least 0 (no slippage)").max(1,"Slippage tolerance cannot exceed 1 (100%)").optional(),Uy=f.number().int().min(0,"Slippage tolerance must be at least 0 bps").max(1e4,"Slippage tolerance cannot exceed 10000 bps"),yve=f.number().int().min(0,"Slippage tolerance must be at least 0 bps").max(500,"TWAP slippage tolerance cannot exceed 500 bps (5%)"),tT=f.object({triggerPrice:yt,orderType:Mf,limitPrice:yt.optional(),quantity:yt.optional(),closePosition:f.boolean().optional(),timeInForce:O5.optional(),slippageToleranceBps:Uy.optional(),expiresAt:cl.optional()}).refine((e)=>e.orderType!=="LIMIT"||e.limitPrice!==void 0,{message:"limitPrice is required for LIMIT parent TP/SL",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.limitPrice===void 0,{message:"limitPrice must not be provided for MARKET parent TP/SL",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce is only allowed for LIMIT parent TP/SL",path:["timeInForce"]}).refine((e)=>e.orderType!=="LIMIT"||e.slippageToleranceBps===void 0,{message:"slippageToleranceBps is only allowed for MARKET parent TP/SL",path:["slippageToleranceBps"]}).refine((e)=>e.closePosition!==!0||e.quantity===void 0,{message:"quantity must be omitted when closePosition is true",path:["quantity"]}).refine((e)=>e.quantity!==void 0||e.closePosition!==!1,{message:"quantity is required when closePosition is false",path:["closePosition"]}),rT=(e)=>e?.takeProfit!==void 0||e?.stopLoss!==void 0,C5=(e,t)=>t===void 0||t!=="NONE"&&(e==="BUY"&&t==="LONG"||e==="SELL"&&t==="SHORT"),x$r=f.object({tradingPairId:Re,side:Nf,quantity:yt,price:yt,options:f.object({tradingMode:By.optional(),useMasterBalance:f.boolean().optional(),expirationDate:cl.optional(),timeInForce:sY.optional(),marginAccountId:Re.optional(),marginMode:oT.optional(),riskBucketId:Re.optional(),riskBucketCollateral:yt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:Dy.optional(),leverage:yt.optional(),reduceOnly:f.boolean().optional(),postOnly:f.boolean().optional(),takeProfit:tT.optional(),stopLoss:tT.optional()}).optional()}).refine((e)=>C5(e.side,e.options?.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["options","positionSide"]}).refine((e)=>e.options?.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["options","leverage"]}).refine((e)=>!rT(e.options)||e.options?.tradingMode==="MARGIN",{message:"takeProfit/stopLoss are only supported for MARGIN orders",path:["options"]}).refine((e)=>!rT(e.options)||e.options?.reduceOnly!==!0,{message:"takeProfit/stopLoss cannot be attached to reduce-only orders",path:["options"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode===void 0||e.options?.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["options","marginAccountId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["options","riskBucketCollateral"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["options","reduceOnly"]}).refine((e)=>e.options?.postOnly!==!0||e.options?.timeInForce===void 0||e.options.timeInForce!=="IOC"&&e.options.timeInForce!=="FOK",{message:"postOnly cannot be combined with IOC/FOK time in force",path:["options","timeInForce"]}),v$r=f.object({tradingPairId:Re,side:Nf,quantity:yt,options:f.object({tradingMode:By.optional(),slippageTolerance:cY,marginAccountId:Re.optional(),marginMode:oT.optional(),riskBucketId:Re.optional(),riskBucketCollateral:yt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:Dy.optional(),leverage:yt.optional(),reduceOnly:f.boolean().optional(),takeProfit:tT.optional(),stopLoss:tT.optional()}).optional()}).refine((e)=>C5(e.side,e.options?.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["options","positionSide"]}).refine((e)=>e.options?.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["options","leverage"]}).refine((e)=>!rT(e.options)||e.options?.tradingMode==="MARGIN",{message:"takeProfit/stopLoss are only supported for MARGIN orders",path:["options"]}).refine((e)=>!rT(e.options)||e.options?.reduceOnly!==!0,{message:"takeProfit/stopLoss cannot be attached to reduce-only orders",path:["options"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode===void 0||e.options?.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["options","marginAccountId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["options","riskBucketCollateral"]}).refine((e)=>e.options?.marginMode!=="CROSS"||e.options?.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options?.riskBucketCollateral===void 0||e.options?.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["options","reduceOnly"]}),_$r=f.object({orderId:Re,remainingQuantityTarget:yt.optional()}),w$r=f.object({orderId:Re,newOrder:f.object({price:yt.optional(),quantity:yt.optional(),useMasterBalance:f.boolean().optional(),postOnly:f.boolean().optional()})}),S$r=f.object({status:f.union([f.enum(zf),f.array(f.enum(zf)).min(1,"Status filter must list at least one status")]).optional(),tradingPairId:Re.optional(),tradingMode:By.optional(),marginAccountId:Re.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(1000,"Page size cannot exceed 1000").optional(),pageToken:f.string().optional()}).superRefine((e,t)=>{if(e.page!==void 0&&e.pageToken===void 0&&e.pageSize!==void 0&&e.pageSize>100)t.addIssue({code:f.ZodIssueCode.custom,message:"Page size cannot exceed 100 in page-number mode (page without pageToken)",path:["pageSize"]})}),T$r=f.enum(["STOP_LOSS","TAKE_PROFIT"],{message:'conditionType must be "STOP_LOSS" or "TAKE_PROFIT"'}),E$r=f.enum(["MARK_PRICE"],{message:'triggerSource must be "MARK_PRICE"'}),bve=f.enum(["PENDING_PARENT","ACTIVE","TRIGGERING","TRIGGERED","CANCELLED","EXPIRED","FAILED"],{message:"Invalid conditional order state"}),I$r=f.enum(["LONG","SHORT"],{message:'Position side must be "LONG" or "SHORT"'}),P$r=f.object({conditionalOrderId:Re}),k$r=f.object({marginAccountId:Re.optional(),tradingPairId:Re.optional(),state:bve.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),xve=f.enum(["PENDING","ACTIVE","COMPLETED","CANCELLED"],{message:"Invalid TWAP order state"}),vve=f.union([f.number().int("durationSeconds must be a whole number of seconds").positive("durationSeconds must be greater than 0"),f.string().regex(/^[1-9]\d*$/,"durationSeconds must be a positive integer string (e.g., '3600')")]),A$r=f.object({tradingPairId:Re,side:Nf,quantity:yt,options:f.object({durationSeconds:vve.optional(),startTime:cl.optional(),endTime:cl.optional(),limitPrice:yt.optional(),slippageToleranceBps:yve.optional(),randomize:f.boolean().optional(),reduceOnly:f.boolean().optional(),tradingMode:By.optional(),marginAccountId:Re.optional(),riskBucketId:Re.optional(),marginMode:oT.optional(),leverage:yt.optional(),strategyKey:f.string().min(1).max(128).optional(),useMasterBalance:f.boolean().optional(),clientTwapId:f.string().min(1).max(36,"clientTwapId cannot exceed 36 characters").optional()})}).refine((e)=>e.options.durationSeconds!==void 0!==(e.options.endTime!==void 0),{message:"Exactly one of durationSeconds or endTime must be set",path:["options","durationSeconds"]}).refine((e)=>e.options.startTime===void 0||e.options.endTime!==void 0,{message:"startTime is only valid together with endTime",path:["options","startTime"]}).refine((e)=>e.options.marginMode===void 0||e.options.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options.riskBucketId===void 0||e.options.tradingMode==="MARGIN",{message:"riskBucketId is only supported for MARGIN orders",path:["options","tradingMode"]}).refine((e)=>e.options.marginMode!=="CROSS"||e.options.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["options","riskBucketId"]}).refine((e)=>e.options.marginMode!=="CROSS"||e.options.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["options","strategyKey"]}).refine((e)=>e.options.tradingMode!=="MARGIN"||e.options.reduceOnly===!0||e.options.leverage!==void 0,{message:"leverage is required for normal MARGIN TWAP orders",path:["options","leverage"]}),R$r=f.object({twapOrderId:Re}),$$r=f.object({state:xve.optional(),tradingPairId:Re.optional(),page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),_ve=f.object({tradingPairId:Re,orderType:Mf,side:Nf,price:yt.optional(),quantity:yt,tradingMode:By.optional(),slippageTolerance:cY,useMasterBalance:f.boolean().optional(),expirationDate:cl.optional(),timeInForce:sY.optional(),marginAccountId:Re.optional(),marginMode:oT.optional(),riskBucketId:Re.optional(),riskBucketCollateral:yt.optional(),strategyKey:f.string().min(1).max(128).optional(),positionSide:Dy.optional(),leverage:yt.optional(),reduceOnly:f.boolean().optional(),postOnly:f.boolean().optional()}).refine((e)=>e.orderType!=="LIMIT"||e.price!==void 0,{message:"Price is required for LIMIT orders",path:["price"]}).refine((e)=>e.orderType!=="MARKET"||e.price===void 0,{message:"Price must not be provided for MARKET orders",path:["price"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce must not be provided for MARKET orders",path:["timeInForce"]}).refine((e)=>e.orderType!=="MARKET"||e.postOnly!==!0,{message:"postOnly must not be provided for MARKET orders",path:["postOnly"]}).refine((e)=>e.postOnly!==!0||e.timeInForce===void 0||e.timeInForce!=="IOC"&&e.timeInForce!=="FOK",{message:"postOnly cannot be combined with IOC/FOK time in force",path:["postOnly"]}).refine((e)=>e.riskBucketCollateral===void 0||e.tradingMode==="MARGIN",{message:"riskBucketCollateral is only supported for MARGIN orders",path:["tradingMode"]}).refine((e)=>e.marginMode===void 0||e.tradingMode==="MARGIN",{message:"marginMode is only supported for MARGIN orders",path:["tradingMode"]}).refine((e)=>e.marginMode!=="CROSS"||e.marginAccountId!==void 0,{message:"marginAccountId is required for CROSS margin orders",path:["marginAccountId"]}).refine((e)=>e.marginMode!=="CROSS"||e.riskBucketId===void 0,{message:"marginMode CROSS cannot be combined with riskBucketId",path:["riskBucketId"]}).refine((e)=>e.marginMode!=="CROSS"||e.riskBucketCollateral===void 0,{message:"marginMode CROSS cannot be combined with riskBucketCollateral",path:["riskBucketCollateral"]}).refine((e)=>e.marginMode!=="CROSS"||e.strategyKey===void 0,{message:"marginMode CROSS cannot be combined with strategyKey",path:["strategyKey"]}).refine((e)=>e.riskBucketCollateral===void 0||e.riskBucketId===void 0,{message:"riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",path:["riskBucketId"]}).refine((e)=>e.riskBucketCollateral===void 0||e.reduceOnly!==!0,{message:"reduceOnly orders cannot create a new risk bucket",path:["reduceOnly"]}).refine((e)=>C5(e.side,e.positionSide),{message:"positionSide is deprecated; when supplied BUY requires LONG and SELL requires SHORT",path:["positionSide"]}).refine((e)=>e.tradingMode!=="MARGIN"||e.reduceOnly===!0||e.leverage!==void 0,{message:"leverage is required for normal MARGIN orders",path:["leverage"]}),nT=100,O$r=f.object({orders:f.array(_ve).min(1,"At least one order is required").max(nT,`At most ${nT} orders per batch request`)}),wve=f.object({orderId:Re,price:yt.optional(),quantity:yt.optional(),useMasterBalance:f.boolean().optional(),postOnly:f.boolean().optional()}).refine((e)=>e.price!==void 0||e.quantity!==void 0,{message:"At least one of price or quantity must be provided"}),C$r=f.object({orders:f.array(wve).min(1,"At least one order is required").max(nT,`At most ${nT} orders per batch request`)});var z5=f.object({page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),B$r=z5.extend({state:f.string().trim().min(1,"State cannot be empty").optional(),tradingPairId:Re.optional()}),D$r=f.object({marginAccountId:Re,tradingPairId:Re.optional()}),U$r=f.object({tradingPairId:Re.optional()}).optional(),L$r=f.object({asset:f.string().trim().min(1,"Asset cannot be empty").optional()}).optional(),Sve=f.object({asset:f.string().trim().min(1,"Asset cannot be empty"),amount:yt,tradingPairId:Re.optional(),strategyKey:f.string().trim().min(1,"Strategy key cannot be empty").optional(),marginMode:f.enum(["ISOLATED","CROSS"]).optional()}).refine((e)=>!(e.marginMode==="CROSS"&&e.tradingPairId!==void 0),{message:"tradingPairId is not supported for CROSS risk buckets",path:["tradingPairId"]}),iT=f.object({asset:f.string().trim().min(1,"Asset cannot be empty"),amount:yt}),Tve=f.object({tradingPairId:Re,strategyKey:f.string().trim().min(1,"Strategy key cannot be empty").optional()}),Eve=f.array(Re).min(1,"selectedTradingPairIds is required for CROSS risk buckets"),uY=Tve.extend({marginMode:f.literal("ISOLATED").optional(),selectedTradingPairIds:f.never().optional()}),lY=f.object({marginMode:f.literal("CROSS"),selectedTradingPairIds:Eve,strategyKey:f.never().optional()}),Ive=lY.extend({tradingPairId:f.never().optional()}),j$r=f.object({marginAccountId:Re,request:Sve}),F$r=f.object({request:iT}),q$r=f.object({request:f.union([iT.merge(uY).strict(),iT.merge(Ive).strict()])}),H$r=f.object({request:iT}),G$r=z5.extend({marginAccountId:Re,movementType:f.string().trim().min(1,"Movement type cannot be empty").optional()}),V$r=z5.extend({movementType:f.string().trim().min(1,"Movement type cannot be empty").optional()}).optional(),N5=f.object({tradingPairId:Re,side:Nf,positionSide:Dy.optional(),orderType:Mf,price:yt.optional(),quantity:yt,leverage:yt.optional(),reduceOnly:f.boolean().optional()}),M5=(e,t)=>{if(e.positionSide!==void 0){let r=e.side==="BUY"?"LONG":"SHORT";if(e.positionSide!==r)t.addIssue({code:f.ZodIssueCode.custom,message:"positionSide must match side when provided (BUY=LONG, SELL=SHORT)",path:["positionSide"]})}if(e.reduceOnly!==!0&&e.leverage===void 0)t.addIssue({code:f.ZodIssueCode.custom,message:"leverage is required for normal margin orders",path:["leverage"]})},dY=N5.strict().superRefine(M5),Pve=N5.merge(uY).strict().superRefine(M5),kve=N5.merge(lY).strict().superRefine(M5).refine((e)=>e.selectedTradingPairIds.includes(e.tradingPairId),{message:"tradingPairId must be included in selectedTradingPairIds for CROSS risk buckets",path:["selectedTradingPairIds"]}),Ave=f.union([Pve,kve]),Z$r=f.object({marginAccountId:Re,request:dY}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]}),W$r=f.object({request:dY}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]}),K$r=f.object({request:Ave}).refine((e)=>e.request.orderType!=="LIMIT"||e.request.price!==void 0,{message:"price is required for LIMIT risk simulations",path:["request","price"]});var pY=f.enum(["1m","5m","15m","30m","1h","4h","1d","1w","1M"],{message:'Interval must be one of: "1m", "5m", "15m", "30m", "1h", "4h", "1d", "1w", "1M"'}),Rve=31536000000,$ve=946684800000,aT=f.number().int().positive({message:"Timestamp must be a positive integer (milliseconds since epoch)"}).min($ve,{message:"Timestamp must be at least Jan 1, 2000 (946684800000 ms). Did you pass seconds instead of milliseconds?"}).max(Number.MAX_SAFE_INTEGER,{message:"Timestamp must not exceed JavaScript's maximum safe integer"}).refine((e)=>e<=Date.now()+Rve,{message:"Timestamp must not be unreasonably far in the future (max 1 year ahead)"}),X$r=f.object({tradingPairId:Re,interval:pY,startTime:aT,endTime:aT}).refine((e)=>e.startTime<e.endTime,{message:"startTime must be less than endTime",path:["endTime"]}),e2r=f.string().min(1,"Trading pair symbol cannot be empty").regex(/^[A-Za-z0-9]{1,10}\/[A-Za-z0-9]{1,10}$/,{message:'Trading pair symbol must be in format "BASE/QUOTE" (e.g., "BTC/USDT", "ETH/USD")'}),Ove=f.number().int().positive({message:"Limit must be a positive integer"}).max(500,{message:"Limit cannot exceed 500 bars per request"}).optional(),t2r=f.object({tradingPairId:Re,interval:pY,startTime:aT.optional(),endTime:aT.optional(),limit:Ove,priceType:f.enum(["trade","mark"]).optional()}).refine((e)=>{if(e.startTime!==void 0&&e.endTime!==void 0)return e.startTime<e.endTime;return!0},{message:"startTime must be less than endTime",path:["endTime"]});var r2r=f.object({tradingPairId:Re}),n2r=f.object({query:f.string().min(1,"Search query cannot be empty").optional(),pageSize:f.number().int().min(1).max(100).optional(),page:f.number().int().min(1).optional()}),o2r=f.object({tradingPairId:Re});var mY=f.object({page:f.number().int().min(1,"Page must be at least 1").optional(),pageSize:f.number().int().min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional()}),Cve=f.enum(["OPEN","CLOSED","LIQUIDATING","LIQUIDATED"],{message:'Position status must be "OPEN", "CLOSED", "LIQUIDATING", or "LIQUIDATED"'}),zve=f.enum(["MARKET","LIMIT","IOC"],{message:'Close type must be "MARKET", "LIMIT", or "IOC"'}),B5=f.object({positionId:Re}),c2r=mY.extend({marginAccountId:Re.optional(),tradingPairId:Re.optional(),status:Cve.optional()});var u2r=B5.extend({request:f.object({closeType:zve,limitPrice:yt.optional(),slippageToleranceBps:Uy.optional(),quantity:yt.optional()})}).refine((e)=>e.request.closeType==="MARKET"||e.request.limitPrice!==void 0,{message:"limitPrice is required for LIMIT and IOC close requests",path:["request","limitPrice"]}).refine((e)=>e.request.closeType!=="MARKET"||e.request.limitPrice===void 0,{message:"limitPrice is not allowed for MARKET close requests",path:["request","limitPrice"]}),l2r=f.object({tradingPairId:Re.optional(),slippageToleranceBps:Uy.optional()});var fY=f.object({triggerPrice:yt,orderType:Mf,limitPrice:yt.optional(),quantity:yt.optional(),closePosition:f.boolean().optional(),timeInForce:O5.optional(),slippageToleranceBps:Uy.optional(),expiresAt:cl.optional()}).refine((e)=>e.orderType!=="LIMIT"||e.limitPrice!==void 0,{message:"limitPrice is required for LIMIT TP/SL legs",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.limitPrice===void 0,{message:"limitPrice must not be provided for MARKET TP/SL legs",path:["limitPrice"]}).refine((e)=>e.orderType!=="MARKET"||e.timeInForce===void 0,{message:"timeInForce is only allowed for LIMIT TP/SL legs",path:["timeInForce"]}).refine((e)=>e.orderType!=="LIMIT"||e.slippageToleranceBps===void 0,{message:"slippageToleranceBps is only allowed for MARKET TP/SL legs",path:["slippageToleranceBps"]}).refine((e)=>e.closePosition!==!0||e.quantity===void 0,{message:"quantity must be omitted when closePosition is true",path:["quantity"]}).refine((e)=>e.quantity!==void 0||e.closePosition!==!1,{message:"quantity is required when closePosition is false",path:["closePosition"]}),d2r=B5.extend({request:f.object({takeProfit:fY.optional(),stopLoss:fY.optional(),oco:f.boolean().optional()}).refine((e)=>e.takeProfit!==void 0||e.stopLoss!==void 0,{message:"At least one of takeProfit or stopLoss is required"}).refine((e)=>e.oco!==!0||e.takeProfit!==void 0&&e.stopLoss!==void 0,{message:"oco=true requires both takeProfit and stopLoss",path:["oco"]})}),p2r=mY.extend({positionId:Re.optional(),marginAccountId:Re.optional(),tradingPairId:Re.optional(),reductionOnly:f.boolean().optional()}),Nve=f.enum(["1m","5m","15m","1h","4h","1d"],{message:'Interval must be one of "1m", "5m", "15m", "1h", "4h", "1d"'}),f2r=B5.extend({params:f.object({interval:Nve,startTime:f.number().int().min(0,"startTime must be a non-negative millisecond timestamp").optional(),endTime:f.number().int().min(0,"endTime must be a non-negative millisecond timestamp").optional()}).refine((e)=>e.startTime===void 0||e.endTime===void 0||e.startTime<e.endTime,{message:"startTime must be less than endTime",path:["startTime"]})});var Mve=f.enum(["CREDIT","DEBIT","LOCK","UNLOCK","FEE"],{message:'Entry type must be "CREDIT", "DEBIT", "LOCK", "UNLOCK", or "FEE"'}),Bve=f.enum(["DEPOSIT","WITHDRAWAL","TRADE","FEE","FUNDING","LIQUIDATION","INTEREST","REWARD"],{message:'Transaction type must be "DEPOSIT", "WITHDRAWAL", "TRADE", "FEE", "FUNDING", "LIQUIDATION", "INTEREST", or "REWARD"'}),y2r=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional(),entryType:Mve.optional(),transactionType:Bve.optional(),assetId:Re.optional()}),b2r=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(1000,"Page size cannot exceed 1000").optional(),tradingPairId:Re.optional(),pageToken:f.string().optional()}).superRefine((e,t)=>{if(e.page!==void 0&&e.pageToken===void 0&&e.pageSize!==void 0&&e.pageSize>100)t.addIssue({code:f.ZodIssueCode.custom,message:"Page size cannot exceed 100 in page-number mode (page without pageToken)",path:["pageSize"]})}),x2r=f.object({page:f.number().int("Page must be an integer").min(1,"Page must be at least 1").optional(),pageSize:f.number().int("Page size must be an integer").min(1,"Page size must be at least 1").max(100,"Page size cannot exceed 100").optional(),tradingPairId:Re.optional(),positionId:Re.optional(),marginAccountId:Re.optional()});var S2r=f.string().regex(/^0x[a-fA-F0-9]{40}$/,{message:"Must be a valid Ethereum address (e.g., '0x1234...5678')"}),D5=f.union([f.string().regex(/^\d+$/,"Must be a positive integer string").refine((e)=>BigInt(e)>0n,{message:"Amount must be greater than 0"}),f.bigint().refine((e)=>e>0n,{message:"Amount must be greater than 0"})]),T2r=f.object({assetId:Re,amount:D5,autoWait:f.boolean().optional()}),E2r=f.object({assetId:Re,amount:D5,autoWait:f.boolean().optional(),target:f.enum(["spot","margin"]).optional()}),I2r=f.object({assetId:Re,amount:D5,destination:f.string().regex(/^0x[a-fA-F0-9]{40}$/,"destination must be a 0x-prefixed 20-byte hex address"),autoWait:f.boolean().optional(),source:f.enum(["spot","margin"]).optional()}),P2r=f.object({assetId:Re});function hY(e){e.registerTool("get_orders",{description:"Get a cursor-paginated list of orders with optional filters by status and trading pair. Omit both page and pageToken for the newest orders; pass the previous response's nextPageToken to fetch the next page. A response with zero orders and an empty nextPageToken means the walk is exhausted. Cursor responses have no exact totals (total/totalPages are 0).",inputSchema:f.object({status:f.enum(zf).optional().describe("Filter by order status (e.g. SUBMITTED, FILLED, CANCELLED)"),tradingPairId:f.string().optional().describe("Filter by trading pair UUID"),page:f.number().optional().describe("Deprecated: page number for legacy offset pagination, which only sees recent history. Use pageToken instead."),pageSize:f.number().optional().describe("Orders per page (default: 10; max 100 in legacy page mode, up to 1000 with pageToken)"),pageToken:f.string().optional().describe("Pagination cursor from a previous response's nextPageToken. Omit it (and page) to start from the newest orders.")})},async({status:t,tradingPairId:r,page:o,pageSize:n,pageToken:i})=>{let s=await(await X()).trading.getPaginatedOrders({status:t,tradingPairId:r,page:o,pageSize:n,pageToken:i});return U(s)})}function gY(e){e.registerTool("place_limit_order",{description:"Place a limit order on Monaco. Limit orders execute only when the market reaches the specified price. "+"Not idempotent: if the call fails with an ambiguous outcome (timeout, network error, or a 5xx with no order returned), do NOT blindly retry — the order may already be live. First reconcile with get_orders (match the order's pair/side/price/quantity among your recent orders, including filled ones) or get_order, then resubmit only if it did not land.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),side:f.enum(["BUY","SELL"]).describe("Order side"),quantity:f.string().describe("Order quantity as a decimal string"),price:f.string().describe("Limit price as a decimal string"),tradingMode:f.enum(["SPOT","MARGIN"]).optional().describe("Trading mode (default: SPOT)"),timeInForce:f.enum(["GTC","IOC","FOK"]).optional().describe("Time in force (default: GTC)"),expirationDate:f.string().optional().describe("Expiration date for GTC orders (ISO 8601)"),marginAccountId:f.string().optional().describe("Parent margin account UUID for MARGIN orders"),marginMode:f.enum(["ISOLATED","CROSS"]).optional().describe("Risk bucket mode for MARGIN orders: ISOLATED (default) or CROSS"),riskBucketId:f.string().optional().describe("Existing isolated risk bucket UUID for risk-bucket-scoped MARGIN orders"),riskBucketCollateral:f.string().optional().describe("Collateral to allocate into a new isolated risk bucket"),strategyKey:f.string().optional().describe("Optional client strategy key"),positionSide:f.enum(["LONG","SHORT"]).optional().describe("Deprecated compatibility field; order side is authoritative (BUY=LONG, SELL=SHORT)"),leverage:f.string().optional().describe("Leverage as a decimal string, required for normal MARGIN orders (ignored for reduce-only)"),reduceOnly:f.boolean().optional().describe("Whether the order can only reduce existing exposure"),postOnly:f.boolean().optional().describe("Maker-only: rejected with a 400 carrying the structured error code 'POST_ONLY_WOULD_CROSS' if this order would cross the book. GTC time in force only; rejected with IOC/FOK."),clientOrderId:f.string().optional().describe("Client-assigned correlation handle, echoed back on order reads and order WebSocket events. Up to 64 characters from A-Za-z0-9._:-. Not an idempotency key: not de-duplicated and not unique — reconcile a lost response via get_orders before resubmitting.")})},async({tradingPairId:t,side:r,quantity:o,price:n,tradingMode:i,timeInForce:a,expirationDate:s,marginAccountId:c,marginMode:u,riskBucketId:d,riskBucketCollateral:p,strategyKey:m,positionSide:h,leverage:y,reduceOnly:x,postOnly:S,clientOrderId:v})=>{let w=await(await X()).trading.placeLimitOrder(t,r,o,n,{tradingMode:i,timeInForce:a,expirationDate:s,marginAccountId:c,marginMode:u,riskBucketId:d,riskBucketCollateral:p,strategyKey:m,positionSide:h,leverage:y,reduceOnly:x,postOnly:S,clientOrderId:v});return U(w)})}function yY(e){e.registerTool("place_market_order",{description:"Place a market order on Monaco. It executes immediately against resting liquidity, but only inside a mandatory 1,000 bps (10%) server-side protective price band anchored to the mark/last-trade reference price. Fills stop at the edge of the band, so a market order may partially fill and cancel the remainder, be rejected when no liquidity sits inside the band, or be rejected when the market has no trustworthy price anchor. Optional slippageTolerance is merged tighter-wins with this band: it can only TIGHTEN execution, never widen past the mandatory band; omitting it applies the full 1,000 bps band. Not idempotent: if the call fails with an ambiguous outcome (timeout, network error, or a 5xx with no order returned), do NOT blindly retry — the order may already be live. First reconcile with get_orders (match the order's pair/side/quantity among your recent orders, including filled ones) or get_order, then resubmit only if it did not land.",inputSchema:f.object({tradingPairId:f.string().describe("Trading pair UUID"),side:f.enum(["BUY","SELL"]).describe("Order side"),quantity:f.string().describe("Order quantity as a decimal string"),tradingMode:f.enum(["SPOT","MARGIN"]).optional().describe("Trading mode (default: SPOT)"),slippageTolerance:f.number().optional().describe("Tightens the mandatory 1,000 bps band, as a decimal (e.g. 0.01 for 1%; 0 for best price only). Can only tighten, never widen; omit to apply the full band."),marginAccountId:f.string().optional().describe("Parent margin account UUID for MARGIN orders"),marginMode:f.enum(["ISOLATED","CROSS"]).optional().describe("Risk bucket mode for MARGIN orders: ISOLATED (default) or CROSS"),riskBucketId:f.string().optional().describe("Existing isolated risk bucket UUID for risk-bucket-scoped MARGIN orders"),riskBucketCollateral:f.string().optional().describe("Collateral to allocate into a new isolated risk bucket"),strategyKey:f.string().optional().describe("Optional client strategy key"),positionSide:f.enum(["LONG","SHORT"]).optional().describe("Deprecated compatibility field; order side is authoritative (BUY=LONG, SELL=SHORT)"),leverage:f.string().optional().describe("Leverage as a decimal string, required for normal MARGIN orders (ignored for reduce-only)"),reduceOnly:f.boolean().optional().describe("Whether the order can only reduce existing exposure"),clientOrderId:f.string().optional().describe("Client-assigned correlation handle, echoed back on order reads and order WebSocket events. Up to 64 characters from A-Za-z0-9._:-. Not an idempotency key: not de-duplicated and not unique — reconcile a lost response via get_orders before resubmitting.")})},async({tradingPairId:t,side:r,quantity:o,tradingMode:n,slippageTolerance:i,marginAccountId:a,marginMode:s,riskBucketId:c,riskBucketCollateral:u,strategyKey:d,positionSide:p,leverage:m,reduceOnly:h,clientOrderId:y})=>{let S=await(await X()).trading.placeMarketOrder(t,r,o,{tradingMode:n,slippageTolerance:i,marginAccountId:a,marginMode:s,riskBucketId:c,riskBucketCollateral:u,strategyKey:d,positionSide:p,leverage:m,reduceOnly:h,clientOrderId:y});return U(S)})}function bY(e){e.registerTool("replace_order",{description:"Replace an existing order with new price and/or quantity. The order must be open. "+"Not idempotent: if the call fails with an ambiguous outcome (timeout, network error, or a 5xx with no order returned), do NOT blindly retry — read the order back with get_order and compare its price/quantity before replacing again.",inputSchema:f.object({orderId:f.string().describe("The order ID to replace"),price:f.string().optional().describe("New price as a decimal string"),quantity:f.string().optional().describe("New quantity as a decimal string"),postOnly:f.boolean().optional().describe("Re-states maker-only intent for the replacement (nothing is inherited from the original order): rejected with a 400 carrying the structured error code 'POST_ONLY_WOULD_CROSS' if it would cross the book."),clientOrderId:f.string().optional().describe("Client-assigned correlation handle for the replacement order, echoed back on order reads and order WebSocket events. Nothing is inherited from the original order — re-state it here to keep the handle across a requote. Up to 64 characters from A-Za-z0-9._:-. Not an idempotency key: not de-duplicated and not unique.")})},async({orderId:t,price:r,quantity:o,postOnly:n,clientOrderId:i})=>{let s=await(await X()).trading.replaceOrder(t,{price:r,quantity:o,postOnly:n,clientOrderId:i});return U(s)})}function xY(e){gY(e),yY(e),rY(e),eY(e),XJ(e),tY(e),bY(e),hY(e),nY(e)}function vY(e){e.registerTool("vault_get_allowance",{description:"Check the current token allowance granted to the Monaco vault for a specific asset.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to check allowance for")})},async({assetId:t})=>{let o=await(await X()).vault.getAllowance(t);return U({assetId:t,allowance:o.toString()})})}function _Y(e){e.registerTool("vault_approve",{description:"Approve the Monaco vault contract to spend tokens on your behalf. Required before depositing ERC20 tokens.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to approve"),amount:f.string().regex(/^\d+$/,"Must be a non-negative integer string").describe("Max amount to approve as a raw integer string (e.g. '1000000' for 1 USDC with 6 decimals)")})},async({assetId:t,amount:r})=>{let n=await(await X()).vault.approve(t,BigInt(r));return U({hash:n.hash,status:n.status})})}function wY(e){e.registerTool("vault_deposit",{description:"Deposit tokens into the Monaco vault. Requires prior approval for ERC20 tokens (use vault_approve first). Set target to 'margin' to route the deposit straight into margin collateral instead of the spot wallet.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to deposit"),amount:f.string().regex(/^\d+$/,"Must be a non-negative integer string").describe("Amount to deposit as a raw integer string (e.g. '1000000' for 1 USDC with 6 decimals)"),target:f.enum(["spot","margin"]).optional().describe("Destination ledger: 'spot' (default) or 'margin' to route into margin collateral")})},async({assetId:t,amount:r,target:o})=>{let i=await(await X()).vault.deposit(t,BigInt(r),void 0,o);return U({hash:i.hash,status:i.status})})}function SY(e){e.registerTool("get_pending_withdrawals",{description:"List your pending withdrawals still awaiting on-chain root confirmation.",inputSchema:f.object({page:f.number().optional().describe("Page number (1-based)"),pageSize:f.number().optional().describe("Items per page")})},async({page:t,pageSize:r})=>{let n=await(await X()).withdrawals.listPendingWithdrawals({page:t,pageSize:r});return U(n)})}function TY(e){e.registerTool("vault_needs_approval",{description:"Check if approval is needed before depositing a specific amount of tokens.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to check"),amount:f.string().regex(/^\d+$/,"Must be a non-negative integer string").describe("Amount to check as a raw integer string")})},async({assetId:t,amount:r})=>{let n=await(await X()).vault.needsApproval(t,BigInt(r));return U({assetId:t,amount:r,needs_approval:n})})}function EY(e){e.registerTool("vault_withdraw",{description:"Withdraw tokens from the Monaco vault back to your wallet.",inputSchema:f.object({assetId:f.string().describe("The asset UUID to withdraw"),amount:f.string().regex(/^\d+$/,"Must be a non-negative integer string").describe("Amount to withdraw as a raw integer string (e.g. '1000000' for 1 USDC with 6 decimals)")})},async({assetId:t,amount:r})=>{let n=await(await X()).vault.withdraw(t,BigInt(r));return U({withdrawalIndex:n.withdrawalIndex,status:n.status,hash:n.hash})})}function IY(e){_Y(e),wY(e),EY(e),vY(e),TY(e),SY(e)}function Dve(e){let t=e.length-1,r=e[t];if(typeof r!=="function")return e;let o=MK(r);return[...e.slice(0,t),o]}function Uve(e,t){let[r,...o]=t;if(!r||typeof r!=="object")return t;let n=q3(e);if(!n)return t;let i=r.annotations;return[{...r,annotations:{...n,...i}},...o]}function PY(e,t,r){return new Proxy(e,{get(o,n,i){if(n==="registerTool")return(s,...c)=>{if(!W3(s,t))return;let u=Uve(s,c);if(r&&Z3(s))u=Dve(u);return o.registerTool(s,...u)};let a=Reflect.get(o,n,i);return typeof a==="function"?a.bind(o):a}})}function kY(e,t){let r={authenticated:t.authenticated,capability:t.capability,allow:t.allow??[],deny:t.deny??[],network:t.network},o=PY(e,r,!1);if(JJ(o),iJ(o),gJ(o),sJ(o),QJ(o),TJ(o),ZJ(o),t.authenticated){let n=PY(e,r,!0);xY(n),DJ(n),GJ(n),$J(n),QK(n),FK(n),IY(n),UK(n,{network:t.network}),EJ(n)}}if(typeof globalThis.crypto?.getRandomValues!=="function")globalThis.crypto=Lve;if(!globalThis.fetch)globalThis.fetch=wb,globalThis.Headers=an,globalThis.Request=ea,globalThis.Response=Cr;if(!globalThis.WebSocket)globalThis.WebSocket=cE.default;async function jve(){let e=su(),t=e.privateKey!==null,r=new pR({name:"monaco-mcp-server",version:N_.version});kY(r,{authenticated:t,network:e.network,capability:e.capability,allow:e.allow,deny:e.deny});let o=new mR;await r.connect(o),console.error(t?`Monaco MCP server running on stdio (network=${e.network}, capability=${e.capability}). Fund-movement and privilege tools require MONACO_CAPABILITY=full or an explicit MONACO_TOOL_ALLOWLIST entry.`:"Monaco MCP server running on stdio (public read-only mode — set MONACO_PRIVATE_KEY, MONACO_CLIENT_ID and MONACO_NETWORK to enable authenticated tools).")}jve().catch((e)=>{console.error("Fatal error:",e),process.exit(1)});
|