@fern-api/typescript-dynamic-snippets 3.107.8 → 3.108.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -16,7 +16,7 @@ ${s}`);this.isAtStartOfLine()&&(u=s+u),r&&(u+=`
16
16
  ${e}`)}return e}toString(){let e=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(e)}catch(t){throw new Error(`Failed to format TypeScript file: ${t}
17
17
  ${e}`)}return e}getContent(){let e=this.stringifyImports();return e.length>0?e+`
18
18
  `+this.buffer:this.buffer}stringifyImports(){let e="";for(let[t,r]of Object.entries(this.imports)){let a=this.defaultImports[t],s="",u=r.filter(x=>x.importFrom?.type==="named"),h=this.starImportAliases[t];if(u.length>0||a!=null||h!=null){if(e+="import",a!=null&&(e+=` ${a.name}`),u.length>0){for(let E of u.slice(0,-1))s+=`${E.name}, `;let x=u[u.length-1];x!=null&&(s+=`${x.name}`),a!=null&&(e+=","),e+=` { ${s} }`}h!=null&&((a!=null||u.length>0)&&(e+=", "),e+=` * as ${h}`),e+=` from "${t}";
19
- `}}return e}};var W=class extends $e{async toStringAsync({customConfig:e,formatter:t}){let r=new $t({customConfig:e,formatter:t});return this.write(r),await r.toStringAsync()}toString({customConfig:e,formatter:t}){let r=new $t({customConfig:e,formatter:t});return this.write(r),r.toString()}};p();f();d();p();f();d();var m={};re(m,{BRAND:()=>qu,DIRTY:()=>De,EMPTY_PATH:()=>_u,INVALID:()=>F,NEVER:()=>Rl,OK:()=>ee,ParseStatus:()=>X,Schema:()=>P,ZodAny:()=>Oe,ZodArray:()=>Ie,ZodBigInt:()=>We,ZodBoolean:()=>qe,ZodBranded:()=>Vt,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>ir,ZodEffects:()=>pe,ZodEnum:()=>Xe,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>or,ZodIntersection:()=>Ye,ZodIssueCode:()=>T,ZodLazy:()=>Je,ZodLiteral:()=>Ke,ZodMap:()=>yt,ZodNaN:()=>xt,ZodNativeEnum:()=>Qe,ZodNever:()=>me,ZodNull:()=>Ge,ZodNullable:()=>ve,ZodNumber:()=>Ve,ZodObject:()=>se,ZodOptional:()=>le,ZodParsedType:()=>R,ZodPipeline:()=>Wt,ZodPromise:()=>Be,ZodReadonly:()=>rt,ZodRecord:()=>ar,ZodSchema:()=>P,ZodSet:()=>gt,ZodString:()=>Fe,ZodSymbol:()=>mt,ZodTransformer:()=>pe,ZodTuple:()=>xe,ZodType:()=>P,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Ae,ZodVoid:()=>ht,addIssueToContext:()=>k,any:()=>Qu,array:()=>nl,bigint:()=>Hu,boolean:()=>Ca,coerce:()=>kl,custom:()=>Ra,date:()=>Yu,datetimeRegex:()=>Ia,defaultErrorMap:()=>Te,discriminatedUnion:()=>sl,effect:()=>vl,enum:()=>yl,function:()=>fl,getErrorMap:()=>pt,getParsedType:()=>ge,instanceof:()=>Zu,intersection:()=>ul,isAborted:()=>rr,isAsync:()=>dt,isDirty:()=>nr,isValid:()=>Ce,late:()=>zu,lazy:()=>ml,literal:()=>hl,makeIssue:()=>Dt,map:()=>pl,nan:()=>Gu,nativeEnum:()=>gl,never:()=>tl,null:()=>Xu,nullable:()=>wl,number:()=>Sa,object:()=>il,objectUtil:()=>Tr,oboolean:()=>Il,onumber:()=>Al,optional:()=>bl,ostring:()=>El,pipeline:()=>Tl,preprocess:()=>_l,promise:()=>xl,quotelessJson:()=>vu,record:()=>cl,set:()=>dl,setErrorMap:()=>wu,strictObject:()=>al,string:()=>Na,symbol:()=>Ju,transformer:()=>vl,tuple:()=>ll,undefined:()=>Ku,union:()=>ol,unknown:()=>el,util:()=>U,void:()=>rl});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var U;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let s={};for(let u of a)s[u]=u;return s},n.getValidEnumValues=a=>{let s=n.objectKeys(a).filter(h=>typeof a[a[h]]!="number"),u={};for(let h of s)u[h]=a[h];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(s){return a[s]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&s.push(u);return s},n.find=(a,s)=>{for(let u of a)if(s(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,s=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(s)}n.joinValues=r,n.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(U||(U={}));var Tr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Tr||(Tr={}));var R=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ge=n=>{switch(typeof n){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(n)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(n)?R.array:n===null?R.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?R.promise:typeof Map<"u"&&n instanceof Map?R.map:typeof Set<"u"&&n instanceof Set?R.set:typeof Date<"u"&&n instanceof Date?R.date:R.object;default:return R.unknown}};var T=U.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"]),vu=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),oe=class n 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;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},r={_errors:[]},a=s=>{for(let u of s.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let h=r,x=0;for(;x<u.path.length;){let E=u.path[x];x===u.path.length-1?(h[E]=h[E]||{_errors:[]},h[E]._errors.push(t(u))):h[E]=h[E]||{_errors:[]},h=h[E],x++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let s=a.path[0];t[s]=t[s]||[],t[s].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};oe.create=n=>new oe(n);var bu=(n,e)=>{let t;switch(n.code){case T.invalid_type:n.received===R.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,U.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${U.joinValues(n.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${U.joinValues(n.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${U.joinValues(n.options)}, received '${n.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:U.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case T.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case T.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,U.assertNever(n)}return{message:t}},Te=bu;var wa=Te;function wu(n){wa=n}function pt(){return wa}p();f();d();var Dt=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,s=[...t,...a.path||[]],u={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let h="",x=r.filter(E=>!!E).slice().reverse();for(let E of x)h=E(u,{data:e,defaultError:h}).message;return{...a,path:s,message:h}},_u=[];function k(n,e){let t=pt(),r=Dt({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Te?void 0:Te].filter(a=>!!a)});n.common.issues.push(r)}var X=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return F;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let s=await a.key,u=await a.value;r.push({key:s,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:s,value:u}=a;if(s.status==="aborted"||u.status==="aborted")return F;s.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[s.value]=u.value)}return{status:e.value,value:r}}},F=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),ee=n=>({status:"valid",value:n}),rr=n=>n.status==="aborted",nr=n=>n.status==="dirty",Ce=n=>n.status==="valid",dt=n=>typeof Promise<"u"&&n instanceof Promise;p();f();d();p();f();d();var S;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(S||(S={}));var ce=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},_a=(n,e)=>{if(Ce(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new oe(n.common.issues);return this._error=t,this._error}}};function L(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(u,h)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??h.defaultError}:typeof h.data>"u"?{message:x??r??h.defaultError}:u.code!=="invalid_type"?{message:h.defaultError}:{message:x??t??h.defaultError}},description:a}}var P=class{get description(){return this._def.description}_getType(e){return ge(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(dt(t))throw new 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:ge(e)},a=this._parseSync({data:e,path:r.path,parent:r});return _a(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ce(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Ce(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:ge(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(dt(a)?a:Promise.resolve(a));return _a(r,s)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,s)=>{let u=e(a),h=()=>s.addIssue({code:T.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(h(),!1)):u?!0:(h(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new pe({schema:this,typeName:B.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 le.create(this,this._def)}nullable(){return ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Be.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Ye.create(this,e,this._def)}transform(e){return new pe({...L(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...L(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Vt({typeName:B.ZodBranded,type:this,...L(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...L(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Wt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Tu=/^c[^\s-]{8,}$/i,Eu=/^[0-9a-z]+$/,Au=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Iu=/^[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,ku=/^[a-z0-9_-]{21}$/i,Ru=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nu=/^[-+]?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)?)??$/,Su=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Cu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Er,Fu=/^(?:(?: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])$/,Ou=/^(?:(?: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])$/,Bu=/^(([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]))$/,Lu=/^(([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])$/,Pu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ju=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ea="((\\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])))",Mu=new RegExp(`^${Ea}$`);function Aa(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Uu(n){return new RegExp(`^${Aa(n)}$`)}function Ia(n){let e=`${Ea}T${Aa(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function $u(n,e){return!!((e==="v4"||!e)&&Fu.test(n)||(e==="v6"||!e)&&Bu.test(n))}function Du(n,e){if(!Ru.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Vu(n,e){return!!((e==="v4"||!e)&&Ou.test(n)||(e==="v6"||!e)&&Lu.test(n))}var Fe=class n extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_type,expected:R.string,received:s.parsedType}),F}let r=new X,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let u=e.data.length>s.value,h=e.data.length<s.value;(u||h)&&(a=this._getOrReturnCtx(e,a),u?k(a,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):h&&k(a,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Su.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"email",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Er||(Er=new RegExp(Cu,"u")),Er.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"emoji",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Iu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"uuid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")ku.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"nanoid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Tu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Eu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid2",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Au.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ulid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),k(a,{validation:"url",code:T.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"regex",code:T.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Ia(s).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Mu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Uu(s).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Nu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"duration",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?$u(e.data,s.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ip",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Du(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"jwt",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Vu(e.data,s.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cidr",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Pu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?ju.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64url",code:T.invalid_string,message:s.message}),r.dirty()):U.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:T.invalid_string,...S.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...S.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...S.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...S.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...S.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...S.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...S.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...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)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Fe.create=n=>new Fe({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...L(n)});function Wu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,s=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return s%u/10**a}var Ve=class n extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_type,expected:R.number,received:s.parsedType}),F}let r,a=new X;for(let s of this._def.checks)s.kind==="int"?U.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:T.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Wu(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_finite,message:s.message}),a.dirty()):U.assertNever(s);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&U.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;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ve.create=n=>new Ve({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...L(n)});var We=class n extends P{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)!==R.bigint)return this._getInvalidInput(e);let r,a=new X;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):U.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return k(t,{code:T.invalid_type,expected:R.bigint,received:t.parsedType}),F}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};We.create=n=>new We({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...L(n)});var qe=class extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.boolean,received:r.parsedType}),F}return ee(e.data)}};qe.create=n=>new qe({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...L(n)});var ze=class n extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_type,expected:R.date,received:s.parsedType}),F}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_date}),F}let r=new X,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):U.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(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)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:B.ZodDate,...L(n)});var mt=class extends P{_parse(e){if(this._getType(e)!==R.symbol){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.symbol,received:r.parsedType}),F}return ee(e.data)}};mt.create=n=>new mt({typeName:B.ZodSymbol,...L(n)});var Ze=class extends P{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.undefined,received:r.parsedType}),F}return ee(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...L(n)});var Ge=class extends P{_parse(e){if(this._getType(e)!==R.null){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.null,received:r.parsedType}),F}return ee(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...L(n)});var Oe=class extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Oe.create=n=>new Oe({typeName:B.ZodAny,...L(n)});var Ae=class extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};Ae.create=n=>new Ae({typeName:B.ZodUnknown,...L(n)});var me=class extends P{_parse(e){let t=this._getOrReturnCtx(e);return k(t,{code:T.invalid_type,expected:R.never,received:t.parsedType}),F}};me.create=n=>new me({typeName:B.ZodNever,...L(n)});var ht=class extends P{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.void,received:r.parsedType}),F}return ee(e.data)}};ht.create=n=>new ht({typeName:B.ZodVoid,...L(n)});var Ie=class n extends P{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==R.array)return k(t,{code:T.invalid_type,expected:R.array,received:t.parsedType}),F;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,h=t.data.length<a.exactLength.value;(u||h)&&(k(t,{code:u?T.too_big:T.too_small,minimum:h?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(k(t,{code:T.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(k(t,{code:T.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,h)=>a.type._parseAsync(new ce(t,u,t.path,h)))).then(u=>X.mergeArray(r,u));let s=[...t.data].map((u,h)=>a.type._parseSync(new ce(t,u,t.path,h)));return X.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:S.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:S.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:S.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...L(e)});function ft(n){if(n instanceof se){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=le.create(ft(r))}return new se({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:ft(n.element)}):n instanceof le?le.create(ft(n.unwrap())):n instanceof ve?ve.create(ft(n.unwrap())):n instanceof xe?xe.create(n.items.map(e=>ft(e))):n}var se=class n extends P{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=U.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==R.object){let E=this._getOrReturnCtx(e);return k(E,{code:T.invalid_type,expected:R.object,received:E.parsedType}),F}let{status:r,ctx:a}=this._processInputParams(e),{shape:s,keys:u}=this._getCached(),h=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(let E in a.data)u.includes(E)||h.push(E);let x=[];for(let E of u){let N=s[E],O=a.data[E];x.push({key:{status:"valid",value:E},value:N._parse(new ce(a,O,a.path,E)),alwaysSet:E in a.data})}if(this._def.catchall instanceof me){let E=this._def.unknownKeys;if(E==="passthrough")for(let N of h)x.push({key:{status:"valid",value:N},value:{status:"valid",value:a.data[N]}});else if(E==="strict")h.length>0&&(k(a,{code:T.unrecognized_keys,keys:h}),r.dirty());else if(E!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let E=this._def.catchall;for(let N of h){let O=a.data[N];x.push({key:{status:"valid",value:N},value:E._parse(new ce(a,O,a.path,N)),alwaysSet:N in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let E=[];for(let N of x){let O=await N.key,J=await N.value;E.push({key:O,value:J,alwaysSet:N.alwaysSet})}return E}).then(E=>X.mergeObjectSync(r,E)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:S.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of U.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of U.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return ft(this)}partial(e){let t={};for(let r of U.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of U.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof le;)s=s._def.innerType;t[r]=s}return new n({...this._def,shape:()=>t})}keyof(){return ka(U.objectKeys(this.shape))}};se.create=(n,e)=>new se({shape:()=>n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...L(e)});se.strictCreate=(n,e)=>new se({shape:()=>n,unknownKeys:"strict",catchall:me.create(),typeName:B.ZodObject,...L(e)});se.lazycreate=(n,e)=>new se({shape:n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...L(e)});var He=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(s){for(let h of s)if(h.result.status==="valid")return h.result;for(let h of s)if(h.result.status==="dirty")return t.common.issues.push(...h.ctx.common.issues),h.result;let u=s.map(h=>new oe(h.ctx.common.issues));return k(t,{code:T.invalid_union,unionErrors:u}),F}if(t.common.async)return Promise.all(r.map(async s=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let s,u=[];for(let x of r){let E={...t,common:{...t.common,issues:[]},parent:null},N=x._parseSync({data:t.data,path:t.path,parent:E});if(N.status==="valid")return N;N.status==="dirty"&&!s&&(s={result:N,ctx:E}),E.common.issues.length&&u.push(E.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let h=u.map(x=>new oe(x));return k(t,{code:T.invalid_union,unionErrors:h}),F}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...L(e)});var Ee=n=>n instanceof Je?Ee(n.schema):n instanceof pe?Ee(n.innerType()):n instanceof Ke?[n.value]:n instanceof Xe?n.options:n instanceof Qe?U.objectValues(n.enum):n instanceof et?Ee(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof le?[void 0,...Ee(n.unwrap())]:n instanceof ve?[null,...Ee(n.unwrap())]:n instanceof Vt||n instanceof rt?Ee(n.unwrap()):n instanceof tt?Ee(n._def.innerType):[],ir=class n extends P{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.object)return k(t,{code:T.invalid_type,expected:R.object,received:t.parsedType}),F;let r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(k(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let s of t){let u=Ee(s.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let h of u){if(a.has(h))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(h)}`);a.set(h,s)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...L(r)})}};function Ar(n,e){let t=ge(n),r=ge(e);if(n===e)return{valid:!0,data:n};if(t===R.object&&r===R.object){let a=U.objectKeys(e),s=U.objectKeys(n).filter(h=>a.indexOf(h)!==-1),u={...n,...e};for(let h of s){let x=Ar(n[h],e[h]);if(!x.valid)return{valid:!1};u[h]=x.data}return{valid:!0,data:u}}else if(t===R.array&&r===R.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<n.length;s++){let u=n[s],h=e[s],x=Ar(u,h);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===R.date&&r===R.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Ye=class extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(s,u)=>{if(rr(s)||rr(u))return F;let h=Ar(s.value,u.value);return h.valid?((nr(s)||nr(u))&&t.dirty(),{status:t.value,value:h.data}):(k(r,{code:T.invalid_intersection_types}),F)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,u])=>a(s,u)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ye.create=(n,e,t)=>new Ye({left:n,right:e,typeName:B.ZodIntersection,...L(t)});var xe=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.array)return k(r,{code:T.invalid_type,expected:R.array,received:r.parsedType}),F;if(r.data.length<this._def.items.length)return k(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&r.data.length>this._def.items.length&&(k(r,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...r.data].map((u,h)=>{let x=this._def.items[h]||this._def.rest;return x?x._parse(new ce(r,u,r.path,h)):null}).filter(u=>!!u);return r.common.async?Promise.all(s).then(u=>X.mergeArray(t,u)):X.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};xe.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:n,typeName:B.ZodTuple,rest:null,...L(e)})};var ar=class n extends P{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!==R.object)return k(r,{code:T.invalid_type,expected:R.object,received:r.parsedType}),F;let a=[],s=this._def.keyType,u=this._def.valueType;for(let h in r.data)a.push({key:s._parse(new ce(r,h,r.path,h)),value:u._parse(new ce(r,r.data[h],r.path,h)),alwaysSet:h in r.data});return r.common.async?X.mergeObjectAsync(t,a):X.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof P?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...L(r)}):new n({keyType:Fe.create(),valueType:e,typeName:B.ZodRecord,...L(t)})}},yt=class extends P{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!==R.map)return k(r,{code:T.invalid_type,expected:R.map,received:r.parsedType}),F;let a=this._def.keyType,s=this._def.valueType,u=[...r.data.entries()].map(([h,x],E)=>({key:a._parse(new ce(r,h,r.path,[E,"key"])),value:s._parse(new ce(r,x,r.path,[E,"value"]))}));if(r.common.async){let h=new Map;return Promise.resolve().then(async()=>{for(let x of u){let E=await x.key,N=await x.value;if(E.status==="aborted"||N.status==="aborted")return F;(E.status==="dirty"||N.status==="dirty")&&t.dirty(),h.set(E.value,N.value)}return{status:t.value,value:h}})}else{let h=new Map;for(let x of u){let E=x.key,N=x.value;if(E.status==="aborted"||N.status==="aborted")return F;(E.status==="dirty"||N.status==="dirty")&&t.dirty(),h.set(E.value,N.value)}return{status:t.value,value:h}}}};yt.create=(n,e,t)=>new yt({valueType:e,keyType:n,typeName:B.ZodMap,...L(t)});var gt=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.set)return k(r,{code:T.invalid_type,expected:R.set,received:r.parsedType}),F;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(k(r,{code:T.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(k(r,{code:T.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let s=this._def.valueType;function u(x){let E=new Set;for(let N of x){if(N.status==="aborted")return F;N.status==="dirty"&&t.dirty(),E.add(N.value)}return{status:t.value,value:E}}let h=[...r.data.values()].map((x,E)=>s._parse(new ce(r,x,r.path,E)));return r.common.async?Promise.all(h).then(x=>u(x)):u(h)}min(e,t){return new n({...this._def,minSize:{value:e,message:S.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:S.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};gt.create=(n,e)=>new gt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...L(e)});var or=class n extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.function)return k(t,{code:T.invalid_type,expected:R.function,received:t.parsedType}),F;function r(h,x){return Dt({data:h,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(E=>!!E),issueData:{code:T.invalid_arguments,argumentsError:x}})}function a(h,x){return Dt({data:h,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(E=>!!E),issueData:{code:T.invalid_return_type,returnTypeError:x}})}let s={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Be){let h=this;return ee(async function(...x){let E=new oe([]),N=await h._def.args.parseAsync(x,s).catch(C=>{throw E.addIssue(r(x,C)),E}),O=await Reflect.apply(u,this,N);return await h._def.returns._def.type.parseAsync(O,s).catch(C=>{throw E.addIssue(a(O,C)),E})})}else{let h=this;return ee(function(...x){let E=h._def.args.safeParse(x,s);if(!E.success)throw new oe([r(x,E.error)]);let N=Reflect.apply(u,this,E.data),O=h._def.returns.safeParse(N,s);if(!O.success)throw new oe([a(N,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:xe.create(e).rest(Ae.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||xe.create([]).rest(Ae.create()),returns:t||Ae.create(),typeName:B.ZodFunction,...L(r)})}},Je=class extends P{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})}};Je.create=(n,e)=>new Je({getter:n,typeName:B.ZodLazy,...L(e)});var Ke=class extends P{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return k(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...L(e)});function ka(n,e){return new Xe({values:n,typeName:B.ZodEnum,...L(e)})}var Xe=class n extends P{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{expected:U.joinValues(r),received:t.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{received:t.data,code:T.invalid_enum_value,options:r}),F}return ee(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 n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Xe.create=ka;var Qe=class extends P{_parse(e){let t=U.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==R.string&&r.parsedType!==R.number){let a=U.objectValues(t);return k(r,{expected:U.joinValues(a),received:r.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(U.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=U.objectValues(t);return k(r,{received:r.data,code:T.invalid_enum_value,options:a}),F}return ee(e.data)}get enum(){return this._def.values}};Qe.create=(n,e)=>new Qe({values:n,typeName:B.ZodNativeEnum,...L(e)});var Be=class extends P{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.promise&&t.common.async===!1)return k(t,{code:T.invalid_type,expected:R.promise,received:t.parsedType}),F;let r=t.parsedType===R.promise?t.data:Promise.resolve(t.data);return ee(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Be.create=(n,e)=>new Be({type:n,typeName:B.ZodPromise,...L(e)});var pe=class extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:u=>{k(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let u=a.transform(r.data,s);if(r.common.async)return Promise.resolve(u).then(async h=>{if(t.value==="aborted")return F;let x=await this._def.schema._parseAsync({data:h,path:r.path,parent:r});return x.status==="aborted"?F:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return F;let h=this._def.schema._parseSync({data:u,path:r.path,parent:r});return h.status==="aborted"?F:h.status==="dirty"?De(h.value):t.value==="dirty"?De(h.value):h}}if(a.type==="refinement"){let u=h=>{let x=a.refinement(h,s);if(r.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(r.common.async===!1){let h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return h.status==="aborted"?F:(h.status==="dirty"&&t.dirty(),u(h.value),{status:t.value,value:h.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>h.status==="aborted"?F:(h.status==="dirty"&&t.dirty(),u(h.value).then(()=>({status:t.value,value:h.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ce(u))return F;let h=a.transform(u.value,s);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:h}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Ce(u)?Promise.resolve(a.transform(u.value,s)).then(h=>({status:t.value,value:h})):F);U.assertNever(a)}};pe.create=(n,e,t)=>new pe({schema:n,typeName:B.ZodEffects,effect:e,...L(t)});pe.createWithPreprocess=(n,e,t)=>new pe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...L(t)});var le=class extends P{_parse(e){return this._getType(e)===R.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};le.create=(n,e)=>new le({innerType:n,typeName:B.ZodOptional,...L(e)});var ve=class extends P{_parse(e){return this._getType(e)===R.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(n,e)=>new ve({innerType:n,typeName:B.ZodNullable,...L(e)});var et=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===R.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:B.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});var tt=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return dt(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});var xt=class extends P{_parse(e){if(this._getType(e)!==R.nan){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.nan,received:r.parsedType}),F}return{status:"valid",value:e.data}}};xt.create=n=>new xt({typeName:B.ZodNaN,...L(n)});var qu=Symbol("zod_brand"),Vt=class extends P{_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}},Wt=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?F:s.status==="dirty"?(t.dirty(),De(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?F:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:B.ZodPipeline})}},rt=class extends P{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return dt(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...L(e)});function Ta(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ra(n,e={},t){return n?Oe.create().superRefine((r,a)=>{let s=n(r);if(s instanceof Promise)return s.then(u=>{if(!u){let h=Ta(e,r),x=h.fatal??t??!0;a.addIssue({code:"custom",...h,fatal:x})}});if(!s){let u=Ta(e,r),h=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:h})}}):Oe.create()}var zu={object:se.lazycreate},B;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(B||(B={}));var Zu=(n,e={message:`Input not instance of ${n.name}`})=>Ra(t=>t instanceof n,e),Na=Fe.create,Sa=Ve.create,Gu=xt.create,Hu=We.create,Ca=qe.create,Yu=ze.create,Ju=mt.create,Ku=Ze.create,Xu=Ge.create,Qu=Oe.create,el=Ae.create,tl=me.create,rl=ht.create,nl=Ie.create,il=se.create,al=se.strictCreate,ol=He.create,sl=ir.create,ul=Ye.create,ll=xe.create,cl=ar.create,pl=yt.create,dl=gt.create,fl=or.create,ml=Je.create,hl=Ke.create,yl=Xe.create,gl=Qe.create,xl=Be.create,vl=pe.create,bl=le.create,wl=ve.create,_l=pe.createWithPreprocess,Tl=Wt.create,El=()=>Na().optional(),Al=()=>Sa().optional(),Il=()=>Ca().optional(),kl={string:(n=>Fe.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>qe.create({...n,coerce:!0})),bigint:(n=>We.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Rl=F;p();f();d();var Fa=m.strictObject({title:m.string(),content:m.string()});var Nl=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Oa=m.string().refine(n=>Nl.test(n),{message:"Must be a valid JavaScript identifier (e.g., 'acme', 'MySDK')"}),Ba=m.strictObject({namespace:m.optional(Oa),client:m.optional(m.string()),error:m.optional(m.string()),timeoutError:m.optional(m.string()),environment:m.optional(m.string()),environmentUrls:m.optional(m.string()),version:m.optional(m.string())}),La=m.union([Oa,Ba]),Sl=m.strictObject({neverThrowErrors:m.optional(m.boolean()),outputEsm:m.optional(m.boolean()),esmOnly:m.optional(m.boolean()),outputSourceFiles:m.optional(m.boolean()),outputSrcOnly:m.optional(m.boolean()),includeCredentialsOnCrossOriginRequests:m.optional(m.boolean()),bundle:m.optional(m.boolean()),allowCustomFetcher:m.optional(m.boolean()),generateWebSocketClients:m.optional(m.boolean()),defaultTimeout:m.optional(m.union([m.literal("infinity"),m.number()])),skipResponseValidation:m.optional(m.boolean()),extraDependencies:m.optional(m.record(m.string())),extraDevDependencies:m.optional(m.record(m.string())),extraPeerDependencies:m.optional(m.record(m.string())),extraPeerDependenciesMeta:m.optional(m.record(m.any())),treatUnknownAsAny:m.optional(m.boolean()),noOptionalProperties:m.optional(m.boolean()),tolerateRepublish:m.optional(m.boolean()),packageJson:m.optional(m.record(m.any())),packageJsonMergeStrategy:m.optional(m.enum(["shallow","deep"])),exactOptionalPropertyTypes:m.optional(m.boolean()),publishToJsr:m.optional(m.boolean()),omitUndefined:m.optional(m.boolean()),useLegacyExports:m.optional(m.boolean()),streamType:m.optional(m.enum(["wrapper","web"])),fileResponseType:m.optional(m.enum(["stream","binary-response"])),formDataSupport:m.optional(m.enum(["Node16","Node18"])),fetchSupport:m.optional(m.enum(["node-fetch","native"])),packagePath:m.optional(m.string()),omitFernHeaders:m.optional(m.boolean()),includePlatformHeaders:m.optional(m.boolean()),userAgentOnly:m.optional(m.boolean()),allowUserAgentAppInfo:m.optional(m.boolean()),useDefaultRequestParameterValues:m.optional(m.boolean()),packageManager:m.optional(m.enum(["pnpm","yarn"])),flattenRequestParameters:m.optional(m.boolean()),respectOptionalRequestBody:m.optional(m.boolean()),deepObjectMapQueryParameters:m.optional(m.boolean()),exportAllRequestsAtRoot:m.optional(m.boolean()),customReadmeSections:m.optional(m.array(Fa)),testFramework:m.optional(m.enum(["jest","vitest"])),consolidateTypeFiles:m.optional(m.boolean()),generateEndpointMetadata:m.optional(m.boolean()),wireTestsFallbackToAutoGeneratedErrorExamples:m.boolean().optional(),linter:m.optional(m.enum(["biome","oxlint","none"])),formatter:m.optional(m.enum(["prettier","biome","oxfmt","none"])),enableForwardCompatibleEnums:m.optional(m.boolean()),parameterNaming:m.optional(m.enum(["originalName","wireValue","camelCase","snakeCase","default"])),generateSubpackageExports:m.optional(m.boolean()),allowExtraFields:m.optional(m.boolean()),enableInlineTypes:m.optional(m.boolean()),inlineFileProperties:m.optional(m.boolean()),inlinePathParameters:m.optional(m.boolean()),naming:m.optional(La),namespaceExport:m.optional(m.string()),noSerdeLayer:m.optional(m.boolean()),serdeLayer:m.optional(m.boolean()),private:m.optional(m.boolean()),requireDefaultEnvironment:m.optional(m.boolean()),requireBaseUrl:m.optional(m.boolean()),retainOriginalCasing:m.optional(m.boolean()),useBigInt:m.optional(m.boolean()),useBrandedStringAliases:m.optional(m.boolean()),offsetSemantics:m.optional(m.enum(["item-index","page-index"])),customPagerName:m.optional(m.string()),resolveQueryParameterNameConflicts:m.optional(m.boolean()),alwaysSendAuth:m.optional(m.boolean()),"optional-auth":m.optional(m.boolean()),guardProcessEnvAccess:m.optional(m.boolean()),flattenAnyAuthOptions:m.optional(m.boolean()),generateReactQueryHooks:m.optional(m.boolean()),websocketHandlerMode:m.optional(m.enum(["replace","accumulate"])),includeContentHeadersOnFileDownloadResponse:m.optional(m.boolean()),includeUtilsOnUnionMembers:m.optional(m.boolean()),includeOtherInUnionTypes:m.optional(m.boolean()),writeUnitTests:m.optional(m.boolean()),generateWireTests:m.optional(m.boolean()),noScripts:m.optional(m.boolean()),skipNpmPkgFix:m.optional(m.boolean()),experimentalGenerateReadWriteOnlyTypes:m.optional(m.boolean()),defaultTimeoutInSeconds:m.optional(m.union([m.literal("infinity"),m.number()])),timeoutInSeconds:m.optional(m.union([m.literal("infinity"),m.number()])),includeApiReference:m.optional(m.boolean()),shouldGenerateWebsocketClients:m.optional(m.boolean()),_fernLicenseName:m.optional(m.string()),maxRetries:m.optional(m.number().int().min(0)),retryStatusCodes:m.optional(m.enum(["legacy","recommended"]))});function vt(n){return n?.serdeLayer!=null?!n.serdeLayer:n?.noSerdeLayer??!0}var I={};re(I,{AstNode:()=>W,ClassInstantiation:()=>bt,CodeBlock:()=>wt,Comment:()=>Le,Function:()=>_t,FunctionInvocation:()=>Tt,MethodInvocation:()=>Et,Parameter:()=>At,Reference:()=>it,Type:()=>nt,TypeLiteral:()=>ke,Types:()=>nt,Variable:()=>It,Writer:()=>ct,codeblock:()=>Ll,function_:()=>Pl,instantiateClass:()=>jl,invokeFunction:()=>Ml,invokeMethod:()=>Ul,parameter:()=>$l,reference:()=>Dl,variable:()=>Vl});p();f();d();p();f();d();p();f();d();var bt=class extends W{constructor({class_:t,arguments_:r}){super();A(this,"class_");A(this,"arguments_");this.class_=t,this.arguments_=r}write(t){t.write("new "),t.writeNode(this.class_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var wt=class extends W{constructor(t){super();A(this,"args");this.args=t}write(t){return new de(this.args).write(t)}};p();f();d();var Le=class extends W{constructor({docs:t}={docs:void 0}){super();A(this,"docs");this.docs=t}write(t){this.docs!=null&&(t.writeLine("/**"),this.docs.split(`
19
+ `}}return e}};var W=class extends $e{async toStringAsync({customConfig:e,formatter:t}){let r=new $t({customConfig:e,formatter:t});return this.write(r),await r.toStringAsync()}toString({customConfig:e,formatter:t}){let r=new $t({customConfig:e,formatter:t});return this.write(r),r.toString()}};p();f();d();p();f();d();var m={};re(m,{BRAND:()=>qu,DIRTY:()=>De,EMPTY_PATH:()=>_u,INVALID:()=>F,NEVER:()=>Rl,OK:()=>ee,ParseStatus:()=>X,Schema:()=>P,ZodAny:()=>Oe,ZodArray:()=>Ie,ZodBigInt:()=>We,ZodBoolean:()=>qe,ZodBranded:()=>Vt,ZodCatch:()=>tt,ZodDate:()=>ze,ZodDefault:()=>et,ZodDiscriminatedUnion:()=>ir,ZodEffects:()=>pe,ZodEnum:()=>Xe,ZodError:()=>oe,ZodFirstPartyTypeKind:()=>B,ZodFunction:()=>or,ZodIntersection:()=>Ye,ZodIssueCode:()=>T,ZodLazy:()=>Je,ZodLiteral:()=>Ke,ZodMap:()=>yt,ZodNaN:()=>xt,ZodNativeEnum:()=>Qe,ZodNever:()=>me,ZodNull:()=>Ge,ZodNullable:()=>ve,ZodNumber:()=>Ve,ZodObject:()=>se,ZodOptional:()=>le,ZodParsedType:()=>R,ZodPipeline:()=>Wt,ZodPromise:()=>Be,ZodReadonly:()=>rt,ZodRecord:()=>ar,ZodSchema:()=>P,ZodSet:()=>gt,ZodString:()=>Fe,ZodSymbol:()=>mt,ZodTransformer:()=>pe,ZodTuple:()=>xe,ZodType:()=>P,ZodUndefined:()=>Ze,ZodUnion:()=>He,ZodUnknown:()=>Ae,ZodVoid:()=>ht,addIssueToContext:()=>k,any:()=>Qu,array:()=>nl,bigint:()=>Hu,boolean:()=>Ca,coerce:()=>kl,custom:()=>Ra,date:()=>Yu,datetimeRegex:()=>Ia,defaultErrorMap:()=>Te,discriminatedUnion:()=>sl,effect:()=>vl,enum:()=>yl,function:()=>fl,getErrorMap:()=>pt,getParsedType:()=>ge,instanceof:()=>Zu,intersection:()=>ul,isAborted:()=>rr,isAsync:()=>dt,isDirty:()=>nr,isValid:()=>Ce,late:()=>zu,lazy:()=>ml,literal:()=>hl,makeIssue:()=>Dt,map:()=>pl,nan:()=>Gu,nativeEnum:()=>gl,never:()=>tl,null:()=>Xu,nullable:()=>wl,number:()=>Sa,object:()=>il,objectUtil:()=>Tr,oboolean:()=>Il,onumber:()=>Al,optional:()=>bl,ostring:()=>El,pipeline:()=>Tl,preprocess:()=>_l,promise:()=>xl,quotelessJson:()=>vu,record:()=>cl,set:()=>dl,setErrorMap:()=>wu,strictObject:()=>al,string:()=>Na,symbol:()=>Ju,transformer:()=>vl,tuple:()=>ll,undefined:()=>Ku,union:()=>ol,unknown:()=>el,util:()=>U,void:()=>rl});p();f();d();p();f();d();p();f();d();p();f();d();p();f();d();var U;(function(n){n.assertEqual=a=>{};function e(a){}n.assertIs=e;function t(a){throw new Error}n.assertNever=t,n.arrayToEnum=a=>{let s={};for(let u of a)s[u]=u;return s},n.getValidEnumValues=a=>{let s=n.objectKeys(a).filter(h=>typeof a[a[h]]!="number"),u={};for(let h of s)u[h]=a[h];return n.objectValues(u)},n.objectValues=a=>n.objectKeys(a).map(function(s){return a[s]}),n.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let u in a)Object.prototype.hasOwnProperty.call(a,u)&&s.push(u);return s},n.find=(a,s)=>{for(let u of a)if(s(u))return u},n.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,s=" | "){return a.map(u=>typeof u=="string"?`'${u}'`:u).join(s)}n.joinValues=r,n.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(U||(U={}));var Tr;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(Tr||(Tr={}));var R=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ge=n=>{switch(typeof n){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(n)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(n)?R.array:n===null?R.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?R.promise:typeof Map<"u"&&n instanceof Map?R.map:typeof Set<"u"&&n instanceof Set?R.set:typeof Date<"u"&&n instanceof Date?R.date:R.object;default:return R.unknown}};var T=U.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"]),vu=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:"),oe=class n 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;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},r={_errors:[]},a=s=>{for(let u of s.issues)if(u.code==="invalid_union")u.unionErrors.map(a);else if(u.code==="invalid_return_type")a(u.returnTypeError);else if(u.code==="invalid_arguments")a(u.argumentsError);else if(u.path.length===0)r._errors.push(t(u));else{let h=r,x=0;for(;x<u.path.length;){let E=u.path[x];x===u.path.length-1?(h[E]=h[E]||{_errors:[]},h[E]._errors.push(t(u))):h[E]=h[E]||{_errors:[]},h=h[E],x++}}};return a(this),r}static assert(e){if(!(e instanceof n))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let a of this.issues)if(a.path.length>0){let s=a.path[0];t[s]=t[s]||[],t[s].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};oe.create=n=>new oe(n);var bu=(n,e)=>{let t;switch(n.code){case T.invalid_type:n.received===R.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case T.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,U.jsonStringifyReplacer)}`;break;case T.unrecognized_keys:t=`Unrecognized key(s) in object: ${U.joinValues(n.keys,", ")}`;break;case T.invalid_union:t="Invalid input";break;case T.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${U.joinValues(n.options)}`;break;case T.invalid_enum_value:t=`Invalid enum value. Expected ${U.joinValues(n.options)}, received '${n.received}'`;break;case T.invalid_arguments:t="Invalid function arguments";break;case T.invalid_return_type:t="Invalid function return type";break;case T.invalid_date:t="Invalid date";break;case T.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:U.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case T.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case T.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case T.custom:t="Invalid input";break;case T.invalid_intersection_types:t="Intersection results could not be merged";break;case T.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case T.not_finite:t="Number must be finite";break;default:t=e.defaultError,U.assertNever(n)}return{message:t}},Te=bu;var wa=Te;function wu(n){wa=n}function pt(){return wa}p();f();d();var Dt=n=>{let{data:e,path:t,errorMaps:r,issueData:a}=n,s=[...t,...a.path||[]],u={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let h="",x=r.filter(E=>!!E).slice().reverse();for(let E of x)h=E(u,{data:e,defaultError:h}).message;return{...a,path:s,message:h}},_u=[];function k(n,e){let t=pt(),r=Dt({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Te?void 0:Te].filter(a=>!!a)});n.common.issues.push(r)}var X=class n{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if(a.status==="aborted")return F;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let a of t){let s=await a.key,u=await a.value;r.push({key:s,value:u})}return n.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:s,value:u}=a;if(s.status==="aborted"||u.status==="aborted")return F;s.status==="dirty"&&e.dirty(),u.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof u.value<"u"||a.alwaysSet)&&(r[s.value]=u.value)}return{status:e.value,value:r}}},F=Object.freeze({status:"aborted"}),De=n=>({status:"dirty",value:n}),ee=n=>({status:"valid",value:n}),rr=n=>n.status==="aborted",nr=n=>n.status==="dirty",Ce=n=>n.status==="valid",dt=n=>typeof Promise<"u"&&n instanceof Promise;p();f();d();p();f();d();var S;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(S||(S={}));var ce=class{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},_a=(n,e)=>{if(Ce(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new oe(n.common.issues);return this._error=t,this._error}}};function L(n){if(!n)return{};let{errorMap:e,invalid_type_error:t,required_error:r,description:a}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(u,h)=>{let{message:x}=n;return u.code==="invalid_enum_value"?{message:x??h.defaultError}:typeof h.data>"u"?{message:x??r??h.defaultError}:u.code!=="invalid_type"?{message:h.defaultError}:{message:x??t??h.defaultError}},description:a}}var P=class{get description(){return this._def.description}_getType(e){return ge(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new X,ctx:{common:e.parent.common,data:e.data,parsedType:ge(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(dt(t))throw new 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:ge(e)},a=this._parseSync({data:e,path:r.path,parent:r});return _a(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ge(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return Ce(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>Ce(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:ge(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(dt(a)?a:Promise.resolve(a));return _a(r,s)}refine(e,t){let r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,s)=>{let u=e(a),h=()=>s.addIssue({code:T.custom,...r(a)});return typeof Promise<"u"&&u instanceof Promise?u.then(x=>x?!0:(h(),!1)):u?!0:(h(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new pe({schema:this,typeName:B.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 le.create(this,this._def)}nullable(){return ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return Be.create(this,this._def)}or(e){return He.create([this,e],this._def)}and(e){return Ye.create(this,e,this._def)}transform(e){return new pe({...L(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new et({...L(this._def),innerType:this,defaultValue:t,typeName:B.ZodDefault})}brand(){return new Vt({typeName:B.ZodBranded,type:this,...L(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new tt({...L(this._def),innerType:this,catchValue:t,typeName:B.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Wt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Tu=/^c[^\s-]{8,}$/i,Eu=/^[0-9a-z]+$/,Au=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Iu=/^[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,ku=/^[a-z0-9_-]{21}$/i,Ru=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Nu=/^[-+]?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)?)??$/,Su=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Cu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Er,Fu=/^(?:(?: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])$/,Ou=/^(?:(?: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])$/,Bu=/^(([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]))$/,Lu=/^(([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])$/,Pu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ju=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ea="((\\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])))",Mu=new RegExp(`^${Ea}$`);function Aa(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);let t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Uu(n){return new RegExp(`^${Aa(n)}$`)}function Ia(n){let e=`${Ea}T${Aa(n)}`,t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function $u(n,e){return!!((e==="v4"||!e)&&Fu.test(n)||(e==="v6"||!e)&&Bu.test(n))}function Du(n,e){if(!Ru.test(n))return!1;try{let[t]=n.split(".");if(!t)return!1;let r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Vu(n,e){return!!((e==="v4"||!e)&&Ou.test(n)||(e==="v6"||!e)&&Lu.test(n))}var Fe=class n extends P{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_type,expected:R.string,received:s.parsedType}),F}let r=new X,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let u=e.data.length>s.value,h=e.data.length<s.value;(u||h)&&(a=this._getOrReturnCtx(e,a),u?k(a,{code:T.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):h&&k(a,{code:T.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")Su.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"email",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="emoji")Er||(Er=new RegExp(Cu,"u")),Er.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"emoji",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")Iu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"uuid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="nanoid")ku.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"nanoid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")Tu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid2")Eu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid2",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="ulid")Au.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ulid",code:T.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),k(a,{validation:"url",code:T.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"regex",code:T.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?Ia(s).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"datetime",message:s.message}),r.dirty()):s.kind==="date"?Mu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"date",message:s.message}),r.dirty()):s.kind==="time"?Uu(s).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:T.invalid_string,validation:"time",message:s.message}),r.dirty()):s.kind==="duration"?Nu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"duration",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="ip"?$u(e.data,s.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ip",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="jwt"?Du(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"jwt",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="cidr"?Vu(e.data,s.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cidr",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="base64"?Pu.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64",code:T.invalid_string,message:s.message}),r.dirty()):s.kind==="base64url"?ju.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64url",code:T.invalid_string,message:s.message}),r.dirty()):U.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:T.invalid_string,...S.errToObj(r)})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...S.errToObj(e)})}url(e){return this._addCheck({kind:"url",...S.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...S.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...S.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...S.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...S.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...S.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...S.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...S.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...S.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...S.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...S.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...S.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...S.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...S.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...S.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...S.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...S.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...S.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...S.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...S.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...S.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...S.errToObj(t)})}nonempty(e){return this.min(1,S.errToObj(e))}trim(){return new n({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n({...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)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Fe.create=n=>new Fe({checks:[],typeName:B.ZodString,coerce:n?.coerce??!1,...L(n)});function Wu(n,e){let t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,s=Number.parseInt(n.toFixed(a).replace(".","")),u=Number.parseInt(e.toFixed(a).replace(".",""));return s%u/10**a}var Ve=class n extends P{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_type,expected:R.number,received:s.parsedType}),F}let r,a=new X;for(let s of this._def.checks)s.kind==="int"?U.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:T.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?Wu(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_finite,message:s.message}),a.dirty()):U.assertNever(s);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:S.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:S.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:S.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:S.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&U.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;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ve.create=n=>new Ve({checks:[],typeName:B.ZodNumber,coerce:n?.coerce||!1,...L(n)});var We=class n extends P{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)!==R.bigint)return this._getInvalidInput(e);let r,a=new X;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),k(r,{code:T.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):U.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return k(t,{code:T.invalid_type,expected:R.bigint,received:t.parsedType}),F}gte(e,t){return this.setLimit("min",e,!0,S.toString(t))}gt(e,t){return this.setLimit("min",e,!1,S.toString(t))}lte(e,t){return this.setLimit("max",e,!0,S.toString(t))}lt(e,t){return this.setLimit("max",e,!1,S.toString(t))}setLimit(e,t,r,a){return new n({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:S.toString(a)}]})}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:S.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:S.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:S.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:S.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:S.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};We.create=n=>new We({checks:[],typeName:B.ZodBigInt,coerce:n?.coerce??!1,...L(n)});var qe=class extends P{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.boolean,received:r.parsedType}),F}return ee(e.data)}};qe.create=n=>new qe({typeName:B.ZodBoolean,coerce:n?.coerce||!1,...L(n)});var ze=class n extends P{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_type,expected:R.date,received:s.parsedType}),F}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return k(s,{code:T.invalid_date}),F}let r=new X,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:T.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):U.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new n({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:S.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:S.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(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)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ze.create=n=>new ze({checks:[],coerce:n?.coerce||!1,typeName:B.ZodDate,...L(n)});var mt=class extends P{_parse(e){if(this._getType(e)!==R.symbol){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.symbol,received:r.parsedType}),F}return ee(e.data)}};mt.create=n=>new mt({typeName:B.ZodSymbol,...L(n)});var Ze=class extends P{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.undefined,received:r.parsedType}),F}return ee(e.data)}};Ze.create=n=>new Ze({typeName:B.ZodUndefined,...L(n)});var Ge=class extends P{_parse(e){if(this._getType(e)!==R.null){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.null,received:r.parsedType}),F}return ee(e.data)}};Ge.create=n=>new Ge({typeName:B.ZodNull,...L(n)});var Oe=class extends P{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}};Oe.create=n=>new Oe({typeName:B.ZodAny,...L(n)});var Ae=class extends P{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}};Ae.create=n=>new Ae({typeName:B.ZodUnknown,...L(n)});var me=class extends P{_parse(e){let t=this._getOrReturnCtx(e);return k(t,{code:T.invalid_type,expected:R.never,received:t.parsedType}),F}};me.create=n=>new me({typeName:B.ZodNever,...L(n)});var ht=class extends P{_parse(e){if(this._getType(e)!==R.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.void,received:r.parsedType}),F}return ee(e.data)}};ht.create=n=>new ht({typeName:B.ZodVoid,...L(n)});var Ie=class n extends P{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==R.array)return k(t,{code:T.invalid_type,expected:R.array,received:t.parsedType}),F;if(a.exactLength!==null){let u=t.data.length>a.exactLength.value,h=t.data.length<a.exactLength.value;(u||h)&&(k(t,{code:u?T.too_big:T.too_small,minimum:h?a.exactLength.value:void 0,maximum:u?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(k(t,{code:T.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(k(t,{code:T.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((u,h)=>a.type._parseAsync(new ce(t,u,t.path,h)))).then(u=>X.mergeArray(r,u));let s=[...t.data].map((u,h)=>a.type._parseSync(new ce(t,u,t.path,h)));return X.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new n({...this._def,minLength:{value:e,message:S.toString(t)}})}max(e,t){return new n({...this._def,maxLength:{value:e,message:S.toString(t)}})}length(e,t){return new n({...this._def,exactLength:{value:e,message:S.toString(t)}})}nonempty(e){return this.min(1,e)}};Ie.create=(n,e)=>new Ie({type:n,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...L(e)});function ft(n){if(n instanceof se){let e={};for(let t in n.shape){let r=n.shape[t];e[t]=le.create(ft(r))}return new se({...n._def,shape:()=>e})}else return n instanceof Ie?new Ie({...n._def,type:ft(n.element)}):n instanceof le?le.create(ft(n.unwrap())):n instanceof ve?ve.create(ft(n.unwrap())):n instanceof xe?xe.create(n.items.map(e=>ft(e))):n}var se=class n extends P{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=U.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==R.object){let E=this._getOrReturnCtx(e);return k(E,{code:T.invalid_type,expected:R.object,received:E.parsedType}),F}let{status:r,ctx:a}=this._processInputParams(e),{shape:s,keys:u}=this._getCached(),h=[];if(!(this._def.catchall instanceof me&&this._def.unknownKeys==="strip"))for(let E in a.data)u.includes(E)||h.push(E);let x=[];for(let E of u){let N=s[E],O=a.data[E];x.push({key:{status:"valid",value:E},value:N._parse(new ce(a,O,a.path,E)),alwaysSet:E in a.data})}if(this._def.catchall instanceof me){let E=this._def.unknownKeys;if(E==="passthrough")for(let N of h)x.push({key:{status:"valid",value:N},value:{status:"valid",value:a.data[N]}});else if(E==="strict")h.length>0&&(k(a,{code:T.unrecognized_keys,keys:h}),r.dirty());else if(E!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let E=this._def.catchall;for(let N of h){let O=a.data[N];x.push({key:{status:"valid",value:N},value:E._parse(new ce(a,O,a.path,N)),alwaysSet:N in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let E=[];for(let N of x){let O=await N.key,J=await N.value;E.push({key:O,value:J,alwaysSet:N.alwaysSet})}return E}).then(E=>X.mergeObjectSync(r,E)):X.mergeObjectSync(r,x)}get shape(){return this._def.shape()}strict(e){return S.errToObj,new n({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:S.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new n({...this._def,unknownKeys:"strip"})}passthrough(){return new n({...this._def,unknownKeys:"passthrough"})}extend(e){return new n({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new n({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new n({...this._def,catchall:e})}pick(e){let t={};for(let r of U.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}omit(e){let t={};for(let r of U.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new n({...this._def,shape:()=>t})}deepPartial(){return ft(this)}partial(e){let t={};for(let r of U.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new n({...this._def,shape:()=>t})}required(e){let t={};for(let r of U.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof le;)s=s._def.innerType;t[r]=s}return new n({...this._def,shape:()=>t})}keyof(){return ka(U.objectKeys(this.shape))}};se.create=(n,e)=>new se({shape:()=>n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...L(e)});se.strictCreate=(n,e)=>new se({shape:()=>n,unknownKeys:"strict",catchall:me.create(),typeName:B.ZodObject,...L(e)});se.lazycreate=(n,e)=>new se({shape:n,unknownKeys:"strip",catchall:me.create(),typeName:B.ZodObject,...L(e)});var He=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function a(s){for(let h of s)if(h.result.status==="valid")return h.result;for(let h of s)if(h.result.status==="dirty")return t.common.issues.push(...h.ctx.common.issues),h.result;let u=s.map(h=>new oe(h.ctx.common.issues));return k(t,{code:T.invalid_union,unionErrors:u}),F}if(t.common.async)return Promise.all(r.map(async s=>{let u={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:u}),ctx:u}})).then(a);{let s,u=[];for(let x of r){let E={...t,common:{...t.common,issues:[]},parent:null},N=x._parseSync({data:t.data,path:t.path,parent:E});if(N.status==="valid")return N;N.status==="dirty"&&!s&&(s={result:N,ctx:E}),E.common.issues.length&&u.push(E.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let h=u.map(x=>new oe(x));return k(t,{code:T.invalid_union,unionErrors:h}),F}}get options(){return this._def.options}};He.create=(n,e)=>new He({options:n,typeName:B.ZodUnion,...L(e)});var Ee=n=>n instanceof Je?Ee(n.schema):n instanceof pe?Ee(n.innerType()):n instanceof Ke?[n.value]:n instanceof Xe?n.options:n instanceof Qe?U.objectValues(n.enum):n instanceof et?Ee(n._def.innerType):n instanceof Ze?[void 0]:n instanceof Ge?[null]:n instanceof le?[void 0,...Ee(n.unwrap())]:n instanceof ve?[null,...Ee(n.unwrap())]:n instanceof Vt||n instanceof rt?Ee(n.unwrap()):n instanceof tt?Ee(n._def.innerType):[],ir=class n extends P{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.object)return k(t,{code:T.invalid_type,expected:R.object,received:t.parsedType}),F;let r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(k(t,{code:T.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),F)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let s of t){let u=Ee(s.shape[e]);if(!u.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let h of u){if(a.has(h))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(h)}`);a.set(h,s)}}return new n({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...L(r)})}};function Ar(n,e){let t=ge(n),r=ge(e);if(n===e)return{valid:!0,data:n};if(t===R.object&&r===R.object){let a=U.objectKeys(e),s=U.objectKeys(n).filter(h=>a.indexOf(h)!==-1),u={...n,...e};for(let h of s){let x=Ar(n[h],e[h]);if(!x.valid)return{valid:!1};u[h]=x.data}return{valid:!0,data:u}}else if(t===R.array&&r===R.array){if(n.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<n.length;s++){let u=n[s],h=e[s],x=Ar(u,h);if(!x.valid)return{valid:!1};a.push(x.data)}return{valid:!0,data:a}}else return t===R.date&&r===R.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}var Ye=class extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(s,u)=>{if(rr(s)||rr(u))return F;let h=Ar(s.value,u.value);return h.valid?((nr(s)||nr(u))&&t.dirty(),{status:t.value,value:h.data}):(k(r,{code:T.invalid_intersection_types}),F)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,u])=>a(s,u)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Ye.create=(n,e,t)=>new Ye({left:n,right:e,typeName:B.ZodIntersection,...L(t)});var xe=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.array)return k(r,{code:T.invalid_type,expected:R.array,received:r.parsedType}),F;if(r.data.length<this._def.items.length)return k(r,{code:T.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),F;!this._def.rest&&r.data.length>this._def.items.length&&(k(r,{code:T.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...r.data].map((u,h)=>{let x=this._def.items[h]||this._def.rest;return x?x._parse(new ce(r,u,r.path,h)):null}).filter(u=>!!u);return r.common.async?Promise.all(s).then(u=>X.mergeArray(t,u)):X.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new n({...this._def,rest:e})}};xe.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xe({items:n,typeName:B.ZodTuple,rest:null,...L(e)})};var ar=class n extends P{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!==R.object)return k(r,{code:T.invalid_type,expected:R.object,received:r.parsedType}),F;let a=[],s=this._def.keyType,u=this._def.valueType;for(let h in r.data)a.push({key:s._parse(new ce(r,h,r.path,h)),value:u._parse(new ce(r,r.data[h],r.path,h)),alwaysSet:h in r.data});return r.common.async?X.mergeObjectAsync(t,a):X.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof P?new n({keyType:e,valueType:t,typeName:B.ZodRecord,...L(r)}):new n({keyType:Fe.create(),valueType:e,typeName:B.ZodRecord,...L(t)})}},yt=class extends P{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!==R.map)return k(r,{code:T.invalid_type,expected:R.map,received:r.parsedType}),F;let a=this._def.keyType,s=this._def.valueType,u=[...r.data.entries()].map(([h,x],E)=>({key:a._parse(new ce(r,h,r.path,[E,"key"])),value:s._parse(new ce(r,x,r.path,[E,"value"]))}));if(r.common.async){let h=new Map;return Promise.resolve().then(async()=>{for(let x of u){let E=await x.key,N=await x.value;if(E.status==="aborted"||N.status==="aborted")return F;(E.status==="dirty"||N.status==="dirty")&&t.dirty(),h.set(E.value,N.value)}return{status:t.value,value:h}})}else{let h=new Map;for(let x of u){let E=x.key,N=x.value;if(E.status==="aborted"||N.status==="aborted")return F;(E.status==="dirty"||N.status==="dirty")&&t.dirty(),h.set(E.value,N.value)}return{status:t.value,value:h}}}};yt.create=(n,e,t)=>new yt({valueType:e,keyType:n,typeName:B.ZodMap,...L(t)});var gt=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==R.set)return k(r,{code:T.invalid_type,expected:R.set,received:r.parsedType}),F;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(k(r,{code:T.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(k(r,{code:T.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let s=this._def.valueType;function u(x){let E=new Set;for(let N of x){if(N.status==="aborted")return F;N.status==="dirty"&&t.dirty(),E.add(N.value)}return{status:t.value,value:E}}let h=[...r.data.values()].map((x,E)=>s._parse(new ce(r,x,r.path,E)));return r.common.async?Promise.all(h).then(x=>u(x)):u(h)}min(e,t){return new n({...this._def,minSize:{value:e,message:S.toString(t)}})}max(e,t){return new n({...this._def,maxSize:{value:e,message:S.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};gt.create=(n,e)=>new gt({valueType:n,minSize:null,maxSize:null,typeName:B.ZodSet,...L(e)});var or=class n extends P{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.function)return k(t,{code:T.invalid_type,expected:R.function,received:t.parsedType}),F;function r(h,x){return Dt({data:h,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(E=>!!E),issueData:{code:T.invalid_arguments,argumentsError:x}})}function a(h,x){return Dt({data:h,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,pt(),Te].filter(E=>!!E),issueData:{code:T.invalid_return_type,returnTypeError:x}})}let s={errorMap:t.common.contextualErrorMap},u=t.data;if(this._def.returns instanceof Be){let h=this;return ee(async function(...x){let E=new oe([]),N=await h._def.args.parseAsync(x,s).catch(C=>{throw E.addIssue(r(x,C)),E}),O=await Reflect.apply(u,this,N);return await h._def.returns._def.type.parseAsync(O,s).catch(C=>{throw E.addIssue(a(O,C)),E})})}else{let h=this;return ee(function(...x){let E=h._def.args.safeParse(x,s);if(!E.success)throw new oe([r(x,E.error)]);let N=Reflect.apply(u,this,E.data),O=h._def.returns.safeParse(N,s);if(!O.success)throw new oe([a(N,O.error)]);return O.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new n({...this._def,args:xe.create(e).rest(Ae.create())})}returns(e){return new n({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new n({args:e||xe.create([]).rest(Ae.create()),returns:t||Ae.create(),typeName:B.ZodFunction,...L(r)})}},Je=class extends P{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})}};Je.create=(n,e)=>new Je({getter:n,typeName:B.ZodLazy,...L(e)});var Ke=class extends P{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return k(t,{received:t.data,code:T.invalid_literal,expected:this._def.value}),F}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ke.create=(n,e)=>new Ke({value:n,typeName:B.ZodLiteral,...L(e)});function ka(n,e){return new Xe({values:n,typeName:B.ZodEnum,...L(e)})}var Xe=class n extends P{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{expected:U.joinValues(r),received:t.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{received:t.data,code:T.invalid_enum_value,options:r}),F}return ee(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 n.create(e,{...this._def,...t})}exclude(e,t=this._def){return n.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}};Xe.create=ka;var Qe=class extends P{_parse(e){let t=U.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==R.string&&r.parsedType!==R.number){let a=U.objectValues(t);return k(r,{expected:U.joinValues(a),received:r.parsedType,code:T.invalid_type}),F}if(this._cache||(this._cache=new Set(U.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=U.objectValues(t);return k(r,{received:r.data,code:T.invalid_enum_value,options:a}),F}return ee(e.data)}get enum(){return this._def.values}};Qe.create=(n,e)=>new Qe({values:n,typeName:B.ZodNativeEnum,...L(e)});var Be=class extends P{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==R.promise&&t.common.async===!1)return k(t,{code:T.invalid_type,expected:R.promise,received:t.parsedType}),F;let r=t.parsedType===R.promise?t.data:Promise.resolve(t.data);return ee(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Be.create=(n,e)=>new Be({type:n,typeName:B.ZodPromise,...L(e)});var pe=class extends P{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:u=>{k(r,u),u.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let u=a.transform(r.data,s);if(r.common.async)return Promise.resolve(u).then(async h=>{if(t.value==="aborted")return F;let x=await this._def.schema._parseAsync({data:h,path:r.path,parent:r});return x.status==="aborted"?F:x.status==="dirty"?De(x.value):t.value==="dirty"?De(x.value):x});{if(t.value==="aborted")return F;let h=this._def.schema._parseSync({data:u,path:r.path,parent:r});return h.status==="aborted"?F:h.status==="dirty"?De(h.value):t.value==="dirty"?De(h.value):h}}if(a.type==="refinement"){let u=h=>{let x=a.refinement(h,s);if(r.common.async)return Promise.resolve(x);if(x instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return h};if(r.common.async===!1){let h=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return h.status==="aborted"?F:(h.status==="dirty"&&t.dirty(),u(h.value),{status:t.value,value:h.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(h=>h.status==="aborted"?F:(h.status==="dirty"&&t.dirty(),u(h.value).then(()=>({status:t.value,value:h.value}))))}if(a.type==="transform")if(r.common.async===!1){let u=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ce(u))return F;let h=a.transform(u.value,s);if(h instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:h}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(u=>Ce(u)?Promise.resolve(a.transform(u.value,s)).then(h=>({status:t.value,value:h})):F);U.assertNever(a)}};pe.create=(n,e,t)=>new pe({schema:n,typeName:B.ZodEffects,effect:e,...L(t)});pe.createWithPreprocess=(n,e,t)=>new pe({schema:e,effect:{type:"preprocess",transform:n},typeName:B.ZodEffects,...L(t)});var le=class extends P{_parse(e){return this._getType(e)===R.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};le.create=(n,e)=>new le({innerType:n,typeName:B.ZodOptional,...L(e)});var ve=class extends P{_parse(e){return this._getType(e)===R.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ve.create=(n,e)=>new ve({innerType:n,typeName:B.ZodNullable,...L(e)});var et=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===R.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};et.create=(n,e)=>new et({innerType:n,typeName:B.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});var tt=class extends P{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return dt(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};tt.create=(n,e)=>new tt({innerType:n,typeName:B.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});var xt=class extends P{_parse(e){if(this._getType(e)!==R.nan){let r=this._getOrReturnCtx(e);return k(r,{code:T.invalid_type,expected:R.nan,received:r.parsedType}),F}return{status:"valid",value:e.data}}};xt.create=n=>new xt({typeName:B.ZodNaN,...L(n)});var qu=Symbol("zod_brand"),Vt=class extends P{_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}},Wt=class n extends P{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?F:s.status==="dirty"?(t.dirty(),De(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{let a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?F:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new n({in:e,out:t,typeName:B.ZodPipeline})}},rt=class extends P{_parse(e){let t=this._def.innerType._parse(e),r=a=>(Ce(a)&&(a.value=Object.freeze(a.value)),a);return dt(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}};rt.create=(n,e)=>new rt({innerType:n,typeName:B.ZodReadonly,...L(e)});function Ta(n,e){let t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function Ra(n,e={},t){return n?Oe.create().superRefine((r,a)=>{let s=n(r);if(s instanceof Promise)return s.then(u=>{if(!u){let h=Ta(e,r),x=h.fatal??t??!0;a.addIssue({code:"custom",...h,fatal:x})}});if(!s){let u=Ta(e,r),h=u.fatal??t??!0;a.addIssue({code:"custom",...u,fatal:h})}}):Oe.create()}var zu={object:se.lazycreate},B;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(B||(B={}));var Zu=(n,e={message:`Input not instance of ${n.name}`})=>Ra(t=>t instanceof n,e),Na=Fe.create,Sa=Ve.create,Gu=xt.create,Hu=We.create,Ca=qe.create,Yu=ze.create,Ju=mt.create,Ku=Ze.create,Xu=Ge.create,Qu=Oe.create,el=Ae.create,tl=me.create,rl=ht.create,nl=Ie.create,il=se.create,al=se.strictCreate,ol=He.create,sl=ir.create,ul=Ye.create,ll=xe.create,cl=ar.create,pl=yt.create,dl=gt.create,fl=or.create,ml=Je.create,hl=Ke.create,yl=Xe.create,gl=Qe.create,xl=Be.create,vl=pe.create,bl=le.create,wl=ve.create,_l=pe.createWithPreprocess,Tl=Wt.create,El=()=>Na().optional(),Al=()=>Sa().optional(),Il=()=>Ca().optional(),kl={string:(n=>Fe.create({...n,coerce:!0})),number:(n=>Ve.create({...n,coerce:!0})),boolean:(n=>qe.create({...n,coerce:!0})),bigint:(n=>We.create({...n,coerce:!0})),date:(n=>ze.create({...n,coerce:!0}))};var Rl=F;p();f();d();var Fa=m.strictObject({title:m.string(),content:m.string()});var Nl=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Oa=m.string().refine(n=>Nl.test(n),{message:"Must be a valid JavaScript identifier (e.g., 'acme', 'MySDK')"}),Ba=m.strictObject({namespace:m.optional(Oa),client:m.optional(m.string()),error:m.optional(m.string()),timeoutError:m.optional(m.string()),environment:m.optional(m.string()),environmentUrls:m.optional(m.string()),version:m.optional(m.string())}),La=m.union([Oa,Ba]),Sl=m.strictObject({neverThrowErrors:m.optional(m.boolean()),outputEsm:m.optional(m.boolean()),esmOnly:m.optional(m.boolean()),outputSourceFiles:m.optional(m.boolean()),outputSrcOnly:m.optional(m.boolean()),includeCredentialsOnCrossOriginRequests:m.optional(m.boolean()),bundle:m.optional(m.boolean()),allowCustomFetcher:m.optional(m.boolean()),generateWebSocketClients:m.optional(m.boolean()),defaultTimeout:m.optional(m.union([m.literal("infinity"),m.number()])),skipResponseValidation:m.optional(m.boolean()),extraDependencies:m.optional(m.record(m.string())),extraDevDependencies:m.optional(m.record(m.string())),extraPeerDependencies:m.optional(m.record(m.string())),extraPeerDependenciesMeta:m.optional(m.record(m.any())),treatUnknownAsAny:m.optional(m.boolean()),noOptionalProperties:m.optional(m.boolean()),tolerateRepublish:m.optional(m.boolean()),packageJson:m.optional(m.record(m.any())),packageJsonMergeStrategy:m.optional(m.enum(["shallow","deep"])),exactOptionalPropertyTypes:m.optional(m.boolean()),publishToJsr:m.optional(m.boolean()),omitUndefined:m.optional(m.boolean()),useLegacyExports:m.optional(m.boolean()),streamType:m.optional(m.enum(["wrapper","web"])),fileResponseType:m.optional(m.enum(["stream","binary-response"])),formDataSupport:m.optional(m.enum(["Node16","Node18"])),fetchSupport:m.optional(m.enum(["node-fetch","native"])),packagePath:m.optional(m.string()),omitFernHeaders:m.optional(m.boolean()),includePlatformHeaders:m.optional(m.boolean()),userAgentOnly:m.optional(m.boolean()),allowUserAgentAppInfo:m.optional(m.boolean()),useDefaultRequestParameterValues:m.optional(m.boolean()),packageManager:m.optional(m.enum(["pnpm","yarn"])),flattenRequestParameters:m.optional(m.boolean()),respectOptionalRequestBody:m.optional(m.boolean()),deepObjectMapQueryParameters:m.optional(m.boolean()),includeMultipartPartContentType:m.optional(m.boolean()),exportAllRequestsAtRoot:m.optional(m.boolean()),customReadmeSections:m.optional(m.array(Fa)),testFramework:m.optional(m.enum(["jest","vitest"])),consolidateTypeFiles:m.optional(m.boolean()),generateEndpointMetadata:m.optional(m.boolean()),wireTestsFallbackToAutoGeneratedErrorExamples:m.boolean().optional(),linter:m.optional(m.enum(["biome","oxlint","none"])),formatter:m.optional(m.enum(["prettier","biome","oxfmt","none"])),enableForwardCompatibleEnums:m.optional(m.boolean()),parameterNaming:m.optional(m.enum(["originalName","wireValue","camelCase","snakeCase","default"])),generateSubpackageExports:m.optional(m.boolean()),allowExtraFields:m.optional(m.boolean()),enableInlineTypes:m.optional(m.boolean()),inlineFileProperties:m.optional(m.boolean()),inlinePathParameters:m.optional(m.boolean()),naming:m.optional(La),namespaceExport:m.optional(m.string()),noSerdeLayer:m.optional(m.boolean()),serdeLayer:m.optional(m.boolean()),private:m.optional(m.boolean()),requireDefaultEnvironment:m.optional(m.boolean()),requireBaseUrl:m.optional(m.boolean()),retainOriginalCasing:m.optional(m.boolean()),useBigInt:m.optional(m.boolean()),useBrandedStringAliases:m.optional(m.boolean()),offsetSemantics:m.optional(m.enum(["item-index","page-index"])),customPagerName:m.optional(m.string()),resolveQueryParameterNameConflicts:m.optional(m.boolean()),alwaysSendAuth:m.optional(m.boolean()),"optional-auth":m.optional(m.boolean()),guardProcessEnvAccess:m.optional(m.boolean()),flattenAnyAuthOptions:m.optional(m.boolean()),generateReactQueryHooks:m.optional(m.boolean()),websocketHandlerMode:m.optional(m.enum(["replace","accumulate"])),includeContentHeadersOnFileDownloadResponse:m.optional(m.boolean()),includeUtilsOnUnionMembers:m.optional(m.boolean()),includeOtherInUnionTypes:m.optional(m.boolean()),writeUnitTests:m.optional(m.boolean()),generateWireTests:m.optional(m.boolean()),noScripts:m.optional(m.boolean()),skipNpmPkgFix:m.optional(m.boolean()),experimentalGenerateReadWriteOnlyTypes:m.optional(m.boolean()),defaultTimeoutInSeconds:m.optional(m.union([m.literal("infinity"),m.number()])),timeoutInSeconds:m.optional(m.union([m.literal("infinity"),m.number()])),includeApiReference:m.optional(m.boolean()),shouldGenerateWebsocketClients:m.optional(m.boolean()),_fernLicenseName:m.optional(m.string()),maxRetries:m.optional(m.number().int().min(0)),retryStatusCodes:m.optional(m.enum(["legacy","recommended"]))});function vt(n){return n?.serdeLayer!=null?!n.serdeLayer:n?.noSerdeLayer??!0}var I={};re(I,{AstNode:()=>W,ClassInstantiation:()=>bt,CodeBlock:()=>wt,Comment:()=>Le,Function:()=>_t,FunctionInvocation:()=>Tt,MethodInvocation:()=>Et,Parameter:()=>At,Reference:()=>it,Type:()=>nt,TypeLiteral:()=>ke,Types:()=>nt,Variable:()=>It,Writer:()=>ct,codeblock:()=>Ll,function_:()=>Pl,instantiateClass:()=>jl,invokeFunction:()=>Ml,invokeMethod:()=>Ul,parameter:()=>$l,reference:()=>Dl,variable:()=>Vl});p();f();d();p();f();d();p();f();d();var bt=class extends W{constructor({class_:t,arguments_:r}){super();A(this,"class_");A(this,"arguments_");this.class_=t,this.arguments_=r}write(t){t.write("new "),t.writeNode(this.class_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var wt=class extends W{constructor(t){super();A(this,"args");this.args=t}write(t){return new de(this.args).write(t)}};p();f();d();var Le=class extends W{constructor({docs:t}={docs:void 0}){super();A(this,"docs");this.docs=t}write(t){this.docs!=null&&(t.writeLine("/**"),this.docs.split(`
20
20
  `).forEach(r=>{t.writeLine(` * ${r}`)}),t.writeLine("*/"))}};p();f();d();p();f();d();var nt=class extends W{constructor(t){super();A(this,"internalType");this.internalType=t}write(t){switch(this.internalType.type){case"string":t.write("string");break;case"number":t.write("number");break;case"bigint":t.write("bigint");break;case"boolean":t.write("boolean");break;case"array":this.internalType.valueType.write(t),t.write("[]");break;case"map":t.write("Record<"),this.internalType.keyType.write(t),t.write(", "),this.internalType.valueType.write(t),t.write(">");break;case"object":t.write("{"),t.indent();for(let[r,a]of Object.entries(this.internalType.fields))t.write(`${r}: `),a.write(t),t.writeLine(",");t.dedent(),t.write("}");break;case"enum":t.write("enum");break;case"any":t.write("any");break;case"promise":t.write("Promise<"),this.internalType.value.write(t),t.write(">");break;case"unknown":t.write("unknown");break;case"void":t.write("void");break;case"undefined":t.write("undefined");break;case"null":t.write("null");break;case"never":t.write("never");break;case"nop":break;default:q(this.internalType)}}static string(){return new this({type:"string"})}static number(){return new this({type:"number"})}static bigint(){return new this({type:"bigint"})}static boolean(){return new this({type:"boolean"})}static array(t){return new this({type:"array",valueType:t})}static object(t){return new this({type:"object",fields:t})}static enum(t){return new this({type:"enum",values:t})}static any(){return new this({type:"any"})}static promise(t){return t.internalType.type==="promise"?t:new this({type:"promise",value:t})}static unknown(){return new this({type:"unknown"})}static void(){return new this({type:"void"})}static undefined(){return new this({type:"undefined"})}static null(){return new this({type:"null"})}static never(){return new this({type:"never"})}static nop(){return new this({type:"nop"})}};var _t=class extends W{constructor({name:t,parameters:r,async:a,body:s,return_:u,docs:h}){super();A(this,"name");A(this,"parameters");A(this,"async");A(this,"body");A(this,"return_");A(this,"docs");this.name=t,this.parameters=r,this.async=a??!1,this.body=s,this.return_=u,this.docs=h}write(t){t.writeNode(new Le({docs:this.docs})),this.async&&t.write("async "),t.write("function "),t.write(`${this.name}`),this.writeParameters(t),this.return_!=null&&(t.write(": "),t.writeNode(this.async?nt.promise(this.return_):this.return_)),t.writeLine(" {"),t.indent(),this.body?.write(t),t.dedent(),t.writeNewLineIfLastLineNot(),t.writeLine("}")}writeParameters(t){if(this.parameters.length===0){t.write("()");return}t.indent(),t.writeLine("(");for(let r of this.parameters)t.writeNode(r),t.writeLine(",");t.dedent(),t.write(")")}};p();f();d();var Tt=class extends W{constructor({function_:t,arguments_:r}){super();A(this,"function_");A(this,"arguments_");this.function_=t,this.arguments_=r}write(t){t.writeNode(this.function_),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var Et=class extends W{constructor({on:t,method:r,arguments_:a,async:s}){super();A(this,"on");A(this,"method");A(this,"arguments_");A(this,"async");this.on=t,this.method=r,this.arguments_=a,this.async=s}write(t){this.async&&t.write("await "),this.on.write(t),t.write("."),t.write(this.method),t.write("("),t.delimit({nodes:this.arguments_,delimiter:", ",writeFunction:r=>r.write(t)}),t.write(")")}};p();f();d();var At=class extends W{constructor({name:t,type:r,docs:a}){super();A(this,"name");A(this,"type");A(this,"docs");this.name=t,this.type=r,this.docs=a}write(t){this.docs!=null&&t.writeNode(new Le({docs:this.docs})),t.write(`${this.name}: `),this.type.write(t)}};p();f();d();var it=class extends W{constructor({name:t,importFrom:r,memberName:a}){super();A(this,"name");A(this,"importFrom");A(this,"memberName");this.name=t,this.importFrom=r,this.memberName=a}write(t){this.importFrom!=null&&t.addImport(this);let r=this.importFrom?.type==="star"?`${this.importFrom.starImportAlias}.`:"",a=this.memberName!=null?`.${this.memberName}`:"";t.write(`${r}${this.name}${a}`)}};p();f();d();var ke=class n extends W{constructor(t){super();A(this,"internalType");this.internalType=t}write(t){let r=vt(t.customConfig),a=!!t.customConfig?.useBigInt;switch(this.internalType.type){case"array":{this.writeIterable({writer:t,iterable:this.internalType});break}case"blob":{t.write("new Blob(["),t.writeNode(n.string(this.internalType.value)),t.write("])");break}case"boolean":{t.write(this.internalType.value.toString());break}case"bigint":{if(a){t.write(`BigInt("${this.internalType.value.toString()}")`);return}t.write(`"${this.internalType.value.toString()}"`);return}case"datetime":{if(r){t.writeNode(n.string(this.internalType.value));return}t.write("new Date("),t.writeNode(n.string(this.internalType.value)),t.write(")");break}case"number":{t.write(this.internalType.value.toString());break}case"object":{this.writeObject({writer:t,object:this.internalType});break}case"record":{this.writeRecord({writer:t,record:this.internalType});break}case"reference":{t.writeNode(this.internalType.value);break}case"set":{if(r||this.isSetOfObjects()){t.writeNode(n.array({values:this.internalType.values}));return}t.write("new Set("),this.writeIterable({writer:t,iterable:this.internalType}),t.write(")");break}case"string":{this.internalType.value.includes(`
21
21
  `)?this.writeStringWithBackticks({writer:t,value:this.internalType.value}):t.write(`"${this.internalType.value.replaceAll('"','\\"')}"`);break}case"tuple":{this.writeIterable({writer:t,iterable:this.internalType});break}case"unknown":{this.writeUnknown({writer:t,value:this.internalType.value});break}case"null":{t.write("null");break}case"nop":break;default:q(this.internalType)}}isObject(){return this.internalType.type==="object"}asObjectOrThrow(){if(this.isObject())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not an object")}isSet(){return this.internalType.type==="set"}asSetOrThrow(){if(this.isSet())return this.internalType;throw new Error("Internal error; ts.TypeLiteral is not a set")}isSetOfObjects(){return this.isSet()&&this.asSetOrThrow().values.every(t=>t.isObject())}writeStringWithBackticks({writer:t,value:r}){t.write("`");let a=r.split(`
22
22
  `),s=a[0]+`