@toolprint/sdk
Version:
<div align="center"> <img src="../../assets/toolprint.png" alt="Toolprint Logo" width="200"/>
1 lines • 153 kB
JavaScript
var Nr=Object.defineProperty;var Mi=Object.getOwnPropertyDescriptor;var $i=(o,e,t)=>e in o?Nr(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t;var Z=(o,e,t,n)=>{for(var i=n>1?void 0:n?Mi(e,t):e,s=o.length-1,a;s>=0;s--)(a=o[s])&&(i=(n?a(e,t,i):a(i))||i);return n&&i&&Nr(e,t,i),i};var Mr=(o,e,t)=>$i(o,typeof e!="symbol"?e+"":e,t);import{z as ga}from"zod";import Xr from"os";import or from"path";import It from"fs";import qi from"crypto";import Se from"chalk";var P;(function(o){o.assertEqual=i=>i;function e(i){}o.assertIs=e;function t(i){throw new Error}o.assertNever=t,o.arrayToEnum=i=>{let s={};for(let a of i)s[a]=a;return s},o.getValidEnumValues=i=>{let s=o.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),a={};for(let l of s)a[l]=i[l];return o.objectValues(a)},o.objectValues=i=>o.objectKeys(i).map(function(s){return i[s]}),o.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let s=[];for(let a in i)Object.prototype.hasOwnProperty.call(i,a)&&s.push(a);return s},o.find=(i,s)=>{for(let a of i)if(s(a))return a},o.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function n(i,s=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(s)}o.joinValues=n,o.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(P||(P={}));var Ht;(function(o){o.mergeShapes=(e,t)=>({...e,...t})})(Ht||(Ht={}));var f=P.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),se=o=>{switch(typeof o){case"undefined":return f.undefined;case"string":return f.string;case"number":return isNaN(o)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(o)?f.array:o===null?f.null:o.then&&typeof o.then=="function"&&o.catch&&typeof o.catch=="function"?f.promise:typeof Map<"u"&&o instanceof Map?f.map:typeof Set<"u"&&o instanceof Set?f.set:typeof Date<"u"&&o instanceof Date?f.date:f.object;default:return f.unknown}},d=P.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"]),Li=o=>JSON.stringify(o,null,2).replace(/"([^"]+)":/g,"$1:"),U=class o extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};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},n={_errors:[]},i=s=>{for(let a of s.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let l=n,p=0;for(;p<a.path.length;){let u=a.path[p];p===a.path.length-1?(l[u]=l[u]||{_errors:[]},l[u]._errors.push(t(a))):l[u]=l[u]||{_errors:[]},l=l[u],p++}}};return i(this),n}static assert(e){if(!(e instanceof o))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,P.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};U.create=o=>new U(o);var Fe=(o,e)=>{let t;switch(o.code){case d.invalid_type:o.received===f.undefined?t="Required":t=`Expected ${o.expected}, received ${o.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(o.expected,P.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${P.joinValues(o.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${P.joinValues(o.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${P.joinValues(o.options)}, received '${o.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof o.validation=="object"?"includes"in o.validation?(t=`Invalid input: must include "${o.validation.includes}"`,typeof o.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${o.validation.position}`)):"startsWith"in o.validation?t=`Invalid input: must start with "${o.validation.startsWith}"`:"endsWith"in o.validation?t=`Invalid input: must end with "${o.validation.endsWith}"`:P.assertNever(o.validation):o.validation!=="regex"?t=`Invalid ${o.validation}`:t="Invalid";break;case d.too_small:o.type==="array"?t=`Array must contain ${o.exact?"exactly":o.inclusive?"at least":"more than"} ${o.minimum} element(s)`:o.type==="string"?t=`String must contain ${o.exact?"exactly":o.inclusive?"at least":"over"} ${o.minimum} character(s)`:o.type==="number"?t=`Number must be ${o.exact?"exactly equal to ":o.inclusive?"greater than or equal to ":"greater than "}${o.minimum}`:o.type==="date"?t=`Date must be ${o.exact?"exactly equal to ":o.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(o.minimum))}`:t="Invalid input";break;case d.too_big:o.type==="array"?t=`Array must contain ${o.exact?"exactly":o.inclusive?"at most":"less than"} ${o.maximum} element(s)`:o.type==="string"?t=`String must contain ${o.exact?"exactly":o.inclusive?"at most":"under"} ${o.maximum} character(s)`:o.type==="number"?t=`Number must be ${o.exact?"exactly":o.inclusive?"less than or equal to":"less than"} ${o.maximum}`:o.type==="bigint"?t=`BigInt must be ${o.exact?"exactly":o.inclusive?"less than or equal to":"less than"} ${o.maximum}`:o.type==="date"?t=`Date must be ${o.exact?"exactly":o.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(o.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${o.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,P.assertNever(o)}return{message:t}},Qr=Fe;function Ki(o){Qr=o}function Rt(){return Qr}var Et=o=>{let{data:e,path:t,errorMaps:n,issueData:i}=o,s=[...t,...i.path||[]],a={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let l="",p=n.filter(u=>!!u).slice().reverse();for(let u of p)l=u(a,{data:e,defaultError:l}).message;return{...i,path:s,message:l}},Bi=[];function h(o,e){let t=Rt(),n=Et({issueData:e,data:o.data,path:o.path,errorMaps:[o.common.contextualErrorMap,o.schemaErrorMap,t,t===Fe?void 0:Fe].filter(i=>!!i)});o.common.issues.push(n)}var N=class o{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let i of t){if(i.status==="aborted")return S;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let i of t){let s=await i.key,a=await i.value;n.push({key:s,value:a})}return o.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let i of t){let{key:s,value:a}=i;if(s.status==="aborted"||a.status==="aborted")return S;s.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(n[s.value]=a.value)}return{status:e.value,value:n}}},S=Object.freeze({status:"aborted"}),Ue=o=>({status:"dirty",value:o}),$=o=>({status:"valid",value:o}),Xt=o=>o.status==="aborted",Qt=o=>o.status==="dirty",Ae=o=>o.status==="valid",dt=o=>typeof Promise<"u"&&o instanceof Promise;function kt(o,e,t,n){if(typeof e=="function"?o!==e||!0:!e.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(o)}function eo(o,e,t,n,i){if(typeof e=="function"?o!==e||!0:!e.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(o,t),t}var g;(function(o){o.errToObj=e=>typeof e=="string"?{message:e}:e||{},o.toString=e=>typeof e=="string"?e:e?.message})(g||(g={}));var pt,ut,J=class{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},$r=(o,e)=>{if(Ae(e))return{success:!0,data:e.value};if(!o.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 U(o.common.issues);return this._error=t,this._error}}};function C(o){if(!o)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:i}=o;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(a,l)=>{var p,u;let{message:m}=o;return a.code==="invalid_enum_value"?{message:m??l.defaultError}:typeof l.data>"u"?{message:(p=m??n)!==null&&p!==void 0?p:l.defaultError}:a.code!=="invalid_type"?{message:l.defaultError}:{message:(u=m??t)!==null&&u!==void 0?u:l.defaultError}},description:i}}var w=class{get description(){return this._def.description}_getType(e){return se(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:se(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new N,ctx:{common:e.parent.common,data:e.data,parsedType:se(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let i={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:se(e)},s=this._parseSync({data:e,path:i.path,parent:i});return $r(i,s)}"~validate"(e){var t,n;let i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:se(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:i});return Ae(s)?{value:s.value}:{issues:i.common.issues}}catch(s){!((n=(t=s?.message)===null||t===void 0?void 0:t.toLowerCase())===null||n===void 0)&&n.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:i}).then(s=>Ae(s)?{value:s.value}:{issues:i.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:se(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(dt(i)?i:Promise.resolve(i));return $r(n,s)}refine(e,t){let n=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{let a=e(i),l=()=>s.addIssue({code:d.custom,...n(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(p=>p?!0:(l(),!1)):a?!0:(l(),!1)})}refinement(e,t){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof t=="function"?t(n,i):t),!1))}_refinement(e){return new F({schema:this,typeName:_.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 W.create(this,this._def)}nullable(){return re.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return le.create(this)}promise(){return fe.create(this,this._def)}or(e){return Re.create([this,e],this._def)}and(e){return Ee.create(this,e,this._def)}transform(e){return new F({...C(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ze({...C(this._def),innerType:this,defaultValue:t,typeName:_.ZodDefault})}brand(){return new mt({typeName:_.ZodBranded,type:this,...C(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new De({...C(this._def),innerType:this,catchValue:t,typeName:_.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ht.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ui=/^c[^\s-]{8,}$/i,Fi=/^[0-9a-z]+$/,Yi=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zi=/^[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,Wi=/^[a-z0-9_-]{21}$/i,Ji=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hi=/^[-+]?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)?)??$/,Xi=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Qi="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Zt,es=/^(?:(?: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])$/,ts=/^(?:(?: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])$/,rs=/^(([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]))$/,os=/^(([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])$/,ns=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,is=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,to="((\\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])))",ss=new RegExp(`^${to}$`);function ro(o){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return o.precision?e=`${e}\\.\\d{${o.precision}}`:o.precision==null&&(e=`${e}(\\.\\d+)?`),e}function as(o){return new RegExp(`^${ro(o)}$`)}function oo(o){let e=`${to}T${ro(o)}`,t=[];return t.push(o.local?"Z?":"Z"),o.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ls(o,e){return!!((e==="v4"||!e)&&es.test(o)||(e==="v6"||!e)&&rs.test(o))}function cs(o,e){if(!Ji.test(o))return!1;try{let[t]=o.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||!i.typ||!i.alg||e&&i.alg!==e)}catch{return!1}}function ps(o,e){return!!((e==="v4"||!e)&&ts.test(o)||(e==="v6"||!e)&&os.test(o))}var me=class o extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:f.string,received:s.parsedType}),S}let n=new N,i;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(i=this._getOrReturnCtx(e,i),h(i,{code:d.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(i=this._getOrReturnCtx(e,i),h(i,{code:d.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let a=e.data.length>s.value,l=e.data.length<s.value;(a||l)&&(i=this._getOrReturnCtx(e,i),a?h(i,{code:d.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&h(i,{code:d.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Xi.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"email",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Zt||(Zt=new RegExp(Qi,"u")),Zt.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"emoji",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Zi.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"uuid",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Wi.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"nanoid",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Ui.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"cuid",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Fi.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"cuid2",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Yi.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"ulid",code:d.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),h(i,{validation:"url",code:d.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"regex",code:d.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(i=this._getOrReturnCtx(e,i),h(i,{code:d.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.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)||(i=this._getOrReturnCtx(e,i),h(i,{code:d.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(i=this._getOrReturnCtx(e,i),h(i,{code:d.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?oo(s).test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{code:d.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?ss.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{code:d.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?as(s).test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{code:d.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Hi.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"duration",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?ls(e.data,s.version)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"ip",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?cs(e.data,s.alg)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"jwt",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?ps(e.data,s.version)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"cidr",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?ns.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"base64",code:d.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?is.test(e.data)||(i=this._getOrReturnCtx(e,i),h(i,{validation:"base64url",code:d.invalid_string,message:s.message}),n.dirty()):P.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(i=>e.test(i),{validation:t,code:d.invalid_string,...g.errToObj(n)})}_addCheck(e){return new o({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...g.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...g.errToObj(e)})}datetime(e){var t,n;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:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...g.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,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...g.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new o({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new o({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new o({...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}};me.create=o=>{var e;return new me({checks:[],typeName:_.ZodString,coerce:(e=o?.coerce)!==null&&e!==void 0?e:!1,...C(o)})};function us(o,e){let t=(o.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=t>n?t:n,s=parseInt(o.toFixed(i).replace(".","")),a=parseInt(e.toFixed(i).replace(".",""));return s%a/Math.pow(10,i)}var be=class o extends w{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)!==f.number){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:f.number,received:s.parsedType}),S}let n,i=new N;for(let s of this._def.checks)s.kind==="int"?P.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:d.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?us(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:d.not_finite,message:s.message}),i.dirty()):P.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,n,i){return new o({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:g.toString(i)}]})}_addCheck(e){return new o({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.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"&&P.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};be.create=o=>new be({checks:[],typeName:_.ZodNumber,coerce:o?.coerce||!1,...C(o)});var Ce=class o extends w{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)!==f.bigint)return this._getInvalidInput(e);let n,i=new N;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),h(n,{code:d.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):P.assertNever(s);return{status:i.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:f.bigint,received:t.parsedType}),S}gte(e,t){return this.setLimit("min",e,!0,g.toString(t))}gt(e,t){return this.setLimit("min",e,!1,g.toString(t))}lte(e,t){return this.setLimit("max",e,!0,g.toString(t))}lt(e,t){return this.setLimit("max",e,!1,g.toString(t))}setLimit(e,t,n,i){return new o({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:g.toString(i)}]})}_addCheck(e){return new o({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:g.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}};Ce.create=o=>{var e;return new Ce({checks:[],typeName:_.ZodBigInt,coerce:(e=o?.coerce)!==null&&e!==void 0?e:!1,...C(o)})};var we=class extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.boolean,received:n.parsedType}),S}return $(e.data)}};we.create=o=>new we({typeName:_.ZodBoolean,coerce:o?.coerce||!1,...C(o)});var xe=class o extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_type,expected:f.date,received:s.parsedType}),S}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return h(s,{code:d.invalid_date}),S}let n=new N,i;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(i=this._getOrReturnCtx(e,i),h(i,{code:d.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(i=this._getOrReturnCtx(e,i),h(i,{code:d.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):P.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new o({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:g.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}};xe.create=o=>new xe({checks:[],coerce:o?.coerce||!1,typeName:_.ZodDate,...C(o)});var Ye=class extends w{_parse(e){if(this._getType(e)!==f.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.symbol,received:n.parsedType}),S}return $(e.data)}};Ye.create=o=>new Ye({typeName:_.ZodSymbol,...C(o)});var Pe=class extends w{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.undefined,received:n.parsedType}),S}return $(e.data)}};Pe.create=o=>new Pe({typeName:_.ZodUndefined,...C(o)});var Ie=class extends w{_parse(e){if(this._getType(e)!==f.null){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.null,received:n.parsedType}),S}return $(e.data)}};Ie.create=o=>new Ie({typeName:_.ZodNull,...C(o)});var he=class extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return $(e.data)}};he.create=o=>new he({typeName:_.ZodAny,...C(o)});var ae=class extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $(e.data)}};ae.create=o=>new ae({typeName:_.ZodUnknown,...C(o)});var X=class extends w{_parse(e){let t=this._getOrReturnCtx(e);return h(t,{code:d.invalid_type,expected:f.never,received:t.parsedType}),S}};X.create=o=>new X({typeName:_.ZodNever,...C(o)});var Ze=class extends w{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:d.invalid_type,expected:f.void,received:n.parsedType}),S}return $(e.data)}};Ze.create=o=>new Ze({typeName:_.ZodVoid,...C(o)});var le=class o extends w{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),i=this._def;if(t.parsedType!==f.array)return h(t,{code:d.invalid_type,expected:f.array,received:t.parsedType}),S;if(i.exactLength!==null){let a=t.data.length>i.exactLength.value,l=t.data.length<i.exactLength.value;(a||l)&&(h(t,{code:a?d.too_big:d.too_small,minimum:l?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&t.data.length<i.minLength.value&&(h(t,{code:d.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&t.data.length>i.maxLength.value&&(h(t,{code:d.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((a,l)=>i.type._parseAsync(new J(t,a,t.path,l)))).then(a=>N.mergeArray(n,a));let s=[...t.data].map((a,l)=>i.type._parseSync(new J(t,a,t.path,l)));return N.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new o({...this._def,minLength:{value:e,message:g.toString(t)}})}max(e,t){return new o({...this._def,maxLength:{value:e,message:g.toString(t)}})}length(e,t){return new o({...this._def,exactLength:{value:e,message:g.toString(t)}})}nonempty(e){return this.min(1,e)}};le.create=(o,e)=>new le({type:o,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...C(e)});function Be(o){if(o instanceof q){let e={};for(let t in o.shape){let n=o.shape[t];e[t]=W.create(Be(n))}return new q({...o._def,shape:()=>e})}else return o instanceof le?new le({...o._def,type:Be(o.element)}):o instanceof W?W.create(Be(o.unwrap())):o instanceof re?re.create(Be(o.unwrap())):o instanceof te?te.create(o.items.map(e=>Be(e))):o}var q=class o extends w{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=P.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==f.object){let u=this._getOrReturnCtx(e);return h(u,{code:d.invalid_type,expected:f.object,received:u.parsedType}),S}let{status:n,ctx:i}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),l=[];if(!(this._def.catchall instanceof X&&this._def.unknownKeys==="strip"))for(let u in i.data)a.includes(u)||l.push(u);let p=[];for(let u of a){let m=s[u],R=i.data[u];p.push({key:{status:"valid",value:u},value:m._parse(new J(i,R,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof X){let u=this._def.unknownKeys;if(u==="passthrough")for(let m of l)p.push({key:{status:"valid",value:m},value:{status:"valid",value:i.data[m]}});else if(u==="strict")l.length>0&&(h(i,{code:d.unrecognized_keys,keys:l}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let m of l){let R=i.data[m];p.push({key:{status:"valid",value:m},value:u._parse(new J(i,R,i.path,m)),alwaysSet:m in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let m of p){let R=await m.key,D=await m.value;u.push({key:R,value:D,alwaysSet:m.alwaysSet})}return u}).then(u=>N.mergeObjectSync(n,u)):N.mergeObjectSync(n,p)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new o({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,s,a,l;let p=(a=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(l=g.errToObj(e).message)!==null&&l!==void 0?l:p}:{message:p}}}:{}})}strip(){return new o({...this._def,unknownKeys:"strip"})}passthrough(){return new o({...this._def,unknownKeys:"passthrough"})}extend(e){return new o({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new o({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new o({...this._def,catchall:e})}pick(e){let t={};return P.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new o({...this._def,shape:()=>t})}omit(e){let t={};return P.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new o({...this._def,shape:()=>t})}deepPartial(){return Be(this)}partial(e){let t={};return P.objectKeys(this.shape).forEach(n=>{let i=this.shape[n];e&&!e[n]?t[n]=i:t[n]=i.optional()}),new o({...this._def,shape:()=>t})}required(e){let t={};return P.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof W;)s=s._def.innerType;t[n]=s}}),new o({...this._def,shape:()=>t})}keyof(){return no(P.objectKeys(this.shape))}};q.create=(o,e)=>new q({shape:()=>o,unknownKeys:"strip",catchall:X.create(),typeName:_.ZodObject,...C(e)});q.strictCreate=(o,e)=>new q({shape:()=>o,unknownKeys:"strict",catchall:X.create(),typeName:_.ZodObject,...C(e)});q.lazycreate=(o,e)=>new q({shape:o,unknownKeys:"strip",catchall:X.create(),typeName:_.ZodObject,...C(e)});var Re=class extends w{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function i(s){for(let l of s)if(l.result.status==="valid")return l.result;for(let l of s)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;let a=s.map(l=>new U(l.ctx.common.issues));return h(t,{code:d.invalid_union,unionErrors:a}),S}if(t.common.async)return Promise.all(n.map(async s=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(i);{let s,a=[];for(let p of n){let u={...t,common:{...t.common,issues:[]},parent:null},m=p._parseSync({data:t.data,path:t.path,parent:u});if(m.status==="valid")return m;m.status==="dirty"&&!s&&(s={result:m,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let l=a.map(p=>new U(p));return h(t,{code:d.invalid_union,unionErrors:l}),S}}get options(){return this._def.options}};Re.create=(o,e)=>new Re({options:o,typeName:_.ZodUnion,...C(e)});var ie=o=>o instanceof ke?ie(o.schema):o instanceof F?ie(o.innerType()):o instanceof Ve?[o.value]:o instanceof Oe?o.options:o instanceof je?P.objectValues(o.enum):o instanceof ze?ie(o._def.innerType):o instanceof Pe?[void 0]:o instanceof Ie?[null]:o instanceof W?[void 0,...ie(o.unwrap())]:o instanceof re?[null,...ie(o.unwrap())]:o instanceof mt||o instanceof Ge?ie(o.unwrap()):o instanceof De?ie(o._def.innerType):[],Vt=class o extends w{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return h(t,{code:d.invalid_type,expected:f.object,received:t.parsedType}),S;let n=this.discriminator,i=t.data[n],s=this.optionsMap.get(i);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}):(h(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),S)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let i=new Map;for(let s of t){let a=ie(s.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let l of a){if(i.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);i.set(l,s)}}return new o({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...C(n)})}};function er(o,e){let t=se(o),n=se(e);if(o===e)return{valid:!0,data:o};if(t===f.object&&n===f.object){let i=P.objectKeys(e),s=P.objectKeys(o).filter(l=>i.indexOf(l)!==-1),a={...o,...e};for(let l of s){let p=er(o[l],e[l]);if(!p.valid)return{valid:!1};a[l]=p.data}return{valid:!0,data:a}}else if(t===f.array&&n===f.array){if(o.length!==e.length)return{valid:!1};let i=[];for(let s=0;s<o.length;s++){let a=o[s],l=e[s],p=er(a,l);if(!p.valid)return{valid:!1};i.push(p.data)}return{valid:!0,data:i}}else return t===f.date&&n===f.date&&+o==+e?{valid:!0,data:o}:{valid:!1}}var Ee=class extends w{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),i=(s,a)=>{if(Xt(s)||Xt(a))return S;let l=er(s.value,a.value);return l.valid?((Qt(s)||Qt(a))&&t.dirty(),{status:t.value,value:l.data}):(h(n,{code:d.invalid_intersection_types}),S)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,a])=>i(s,a)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ee.create=(o,e,t)=>new Ee({left:o,right:e,typeName:_.ZodIntersection,...C(t)});var te=class o extends w{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return h(n,{code:d.invalid_type,expected:f.array,received:n.parsedType}),S;if(n.data.length<this._def.items.length)return h(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),S;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...n.data].map((a,l)=>{let p=this._def.items[l]||this._def.rest;return p?p._parse(new J(n,a,n.path,l)):null}).filter(a=>!!a);return n.common.async?Promise.all(s).then(a=>N.mergeArray(t,a)):N.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new o({...this._def,rest:e})}};te.create=(o,e)=>{if(!Array.isArray(o))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new te({items:o,typeName:_.ZodTuple,rest:null,...C(e)})};var Ot=class o extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return h(n,{code:d.invalid_type,expected:f.object,received:n.parsedType}),S;let i=[],s=this._def.keyType,a=this._def.valueType;for(let l in n.data)i.push({key:s._parse(new J(n,l,n.path,l)),value:a._parse(new J(n,n.data[l],n.path,l)),alwaysSet:l in n.data});return n.common.async?N.mergeObjectAsync(t,i):N.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof w?new o({keyType:e,valueType:t,typeName:_.ZodRecord,...C(n)}):new o({keyType:me.create(),valueType:e,typeName:_.ZodRecord,...C(t)})}},We=class extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return h(n,{code:d.invalid_type,expected:f.map,received:n.parsedType}),S;let i=this._def.keyType,s=this._def.valueType,a=[...n.data.entries()].map(([l,p],u)=>({key:i._parse(new J(n,l,n.path,[u,"key"])),value:s._parse(new J(n,p,n.path,[u,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let p of a){let u=await p.key,m=await p.value;if(u.status==="aborted"||m.status==="aborted")return S;(u.status==="dirty"||m.status==="dirty")&&t.dirty(),l.set(u.value,m.value)}return{status:t.value,value:l}})}else{let l=new Map;for(let p of a){let u=p.key,m=p.value;if(u.status==="aborted"||m.status==="aborted")return S;(u.status==="dirty"||m.status==="dirty")&&t.dirty(),l.set(u.value,m.value)}return{status:t.value,value:l}}}};We.create=(o,e,t)=>new We({valueType:e,keyType:o,typeName:_.ZodMap,...C(t)});var Je=class o extends w{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return h(n,{code:d.invalid_type,expected:f.set,received:n.parsedType}),S;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(h(n,{code:d.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(h(n,{code:d.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let s=this._def.valueType;function a(p){let u=new Set;for(let m of p){if(m.status==="aborted")return S;m.status==="dirty"&&t.dirty(),u.add(m.value)}return{status:t.value,value:u}}let l=[...n.data.values()].map((p,u)=>s._parse(new J(n,p,n.path,u)));return n.common.async?Promise.all(l).then(p=>a(p)):a(l)}min(e,t){return new o({...this._def,minSize:{value:e,message:g.toString(t)}})}max(e,t){return new o({...this._def,maxSize:{value:e,message:g.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Je.create=(o,e)=>new Je({valueType:o,minSize:null,maxSize:null,typeName:_.ZodSet,...C(e)});var jt=class o extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return h(t,{code:d.invalid_type,expected:f.function,received:t.parsedType}),S;function n(l,p){return Et({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rt(),Fe].filter(u=>!!u),issueData:{code:d.invalid_arguments,argumentsError:p}})}function i(l,p){return Et({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Rt(),Fe].filter(u=>!!u),issueData:{code:d.invalid_return_type,returnTypeError:p}})}let s={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof fe){let l=this;return $(async function(...p){let u=new U([]),m=await l._def.args.parseAsync(p,s).catch(K=>{throw u.addIssue(n(p,K)),u}),R=await Reflect.apply(a,this,m);return await l._def.returns._def.type.parseAsync(R,s).catch(K=>{throw u.addIssue(i(R,K)),u})})}else{let l=this;return $(function(...p){let u=l._def.args.safeParse(p,s);if(!u.success)throw new U([n(p,u.error)]);let m=Reflect.apply(a,this,u.data),R=l._def.returns.safeParse(m,s);if(!R.success)throw new U([i(m,R.error)]);return R.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new o({...this._def,args:te.create(e).rest(ae.create())})}returns(e){return new o({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new o({args:e||te.create([]).rest(ae.create()),returns:t||ae.create(),typeName:_.ZodFunction,...C(n)})}},ke=class extends w{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})}};ke.create=(o,e)=>new ke({getter:o,typeName:_.ZodLazy,...C(e)});var Ve=class extends w{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),S}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ve.create=(o,e)=>new Ve({value:o,typeName:_.ZodLiteral,...C(e)});function no(o,e){return new Oe({values:o,typeName:_.ZodEnum,...C(e)})}var Oe=class o extends w{constructor(){super(...arguments),pt.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return h(t,{expected:P.joinValues(n),received:t.parsedType,code:d.invalid_type}),S