mcp-server-vue-hook-optimizer
Version:
MCP server for vue-hook-optimizer
2 lines • 1.81 MB
JavaScript
#!/usr/bin/env node
import{createRequire as e}from"node:module";import{readFile as t}from"node:fs/promises";import n from"node:process";var r=Object.create,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,s=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,l=(e,t)=>()=>(e&&(t=e(e=0)),t),u=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),d=(e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})},f=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var s=o(t),l=0,u=s.length,d;l<u;l++)d=s[l],!c.call(e,d)&&d!==n&&i(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=a(t,d))||r.enumerable});return e},p=(e,t,n)=>(n=e==null?{}:r(s(e)),f(t||!e||!e.__esModule?i(n,`default`,{value:e,enumerable:!0}):n,e)),m=e=>f(i({},`__esModule`,{value:!0}),e),h=e(import.meta.url),g;(function(e){e.assertEqual=e=>e;function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(g||={});var _;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(_||={});const v=g.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),y=e=>{let t=typeof e;switch(t){case`undefined`:return v.undefined;case`string`:return v.string;case`number`:return isNaN(e)?v.nan:v.number;case`boolean`:return v.boolean;case`function`:return v.function;case`bigint`:return v.bigint;case`symbol`:return v.symbol;case`object`:return Array.isArray(e)?v.array:e===null?v.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?v.promise:typeof Map<`u`&&e instanceof Map?v.map:typeof Set<`u`&&e instanceof Set?v.set:typeof Date<`u`&&e instanceof Date?v.date:v.object;default:return v.unknown}},b=g.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`]),x=e=>{let t=JSON.stringify(e,null,2);return t.replace(/"([^"]+)":/g,`$1:`)};var S=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};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(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r],a=r===i.path.length-1;a?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,g.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};S.create=e=>{let t=new S(e);return t};const C=(e,t)=>{let n;switch(e.code){case b.invalid_type:n=e.received===v.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,g.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:n=`Unrecognized key(s) in object: ${g.joinValues(e.keys,`, `)}`;break;case b.invalid_union:n=`Invalid input`;break;case b.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${g.joinValues(e.options)}`;break;case b.invalid_enum_value:n=`Invalid enum value. Expected ${g.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:n=`Invalid function arguments`;break;case b.invalid_return_type:n=`Invalid function return type`;break;case b.invalid_date:n=`Invalid date`;break;case b.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:g.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case b.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`Date must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(e.minimum))}`:`Invalid input`;break;case b.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case b.custom:n=`Invalid input`;break;case b.invalid_intersection_types:n=`Intersection results could not be merged`;break;case b.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,g.assertNever(e)}return{message:n}};let w=C;function T(e){w=e}function E(){return w}const D=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},O=[];function k(e,t){let n=E(),r=D({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===C?void 0:C].filter(e=>!!e)});e.common.issues.push(r)}var A=class e{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 r of t){if(r.status===`aborted`)return j;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return j;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};const j=Object.freeze({status:`aborted`}),M=e=>({status:`dirty`,value:e}),N=e=>({status:`valid`,value:e}),P=e=>e.status===`aborted`,F=e=>e.status===`dirty`,I=e=>e.status===`valid`,L=e=>typeof Promise<`u`&&e instanceof Promise;function ee(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function R(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var z;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(z||={});var B,V,te=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const ne=(e,t)=>{if(I(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new S(e.common.issues);return this._error=t,this._error}}};function H(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:i};let a=(t,i)=>{var a,o;let{message:s}=e;return t.code===`invalid_enum_value`?{message:s??i.defaultError}:i.data===void 0?{message:(a=s??r)??i.defaultError}:t.code===`invalid_type`?{message:(o=s??n)??i.defaultError}:{message:i.defaultError}};return{errorMap:a,description:i}}var U=class{get description(){return this._def.description}_getType(e){return y(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new A,ctx:{common:e.parent.common,data:e.data,parsedType:y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(L(t))throw 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 r={common:{issues:[],async:(n=t?.async)??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:y(e)},i=this._parseSync({data:e,path:r.path,parent:r});return ne(r,i)}"~validate"(e){var t,n;let r={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:y(e)};if(!this[`~standard`].async)try{let t=this._parseSync({data:e,path:[],parent:r});return I(t)?{value:t.value}:{issues:r.common.issues}}catch(e){(n=(t=e?.message)?.toLowerCase())?.includes(`encountered`)&&(this[`~standard`].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>I(e)?{value:e.value}:{issues:r.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:y(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(L(r)?r:Promise.resolve(r));return ne(n,i)}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:b.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new tt({schema:this,typeName:q.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:e=>this[`~validate`](e)}}optional(){return nt.create(this,this._def)}nullable(){return rt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ie.create(this)}promise(){return et.create(this,this._def)}or(e){return ze.create([this,e],this._def)}and(e){return Ue.create(this,e,this._def)}transform(e){return new tt({...H(this._def),schema:this,typeName:q.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new it({...H(this._def),innerType:this,defaultValue:t,typeName:q.ZodDefault})}brand(){return new ct({typeName:q.ZodBranded,type:this,...H(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new at({...H(this._def),innerType:this,catchValue:t,typeName:q.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return lt.create(this,e)}readonly(){return ut.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const re=/^c[^\s-]{8,}$/i,ie=/^[0-9a-z]+$/,ae=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oe=/^[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,se=/^[a-z0-9_-]{21}$/i,ce=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,le=/^[-+]?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)?)??$/,ue=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let W;const G=/^(?:(?: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])$/,K=/^(?:(?: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])$/,de=/^(([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]))$/,fe=/^(([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])$/,pe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,me=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,he=`((\\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])))`,ge=RegExp(`^${he}$`);function _e(e){let t=`([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`),t}function ve(e){return RegExp(`^${_e(e)}$`)}function ye(e){let t=`${he}T${_e(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function be(e,t){return!!((t===`v4`||!t)&&G.test(e)||(t===`v6`||!t)&&de.test(e))}function xe(e,t){if(!ce.test(e))return!1;try{let[n]=e.split(`.`),r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function Se(e,t){return!!((t===`v4`||!t)&&K.test(e)||(t===`v6`||!t)&&fe.test(e))}var Ce=class e extends U{_parse(e){this._def.coerce&&(e.data=String(e.data));let t=this._getType(e);if(t!==v.string){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.string,received:t.parsedType}),j}let n=new A,r;for(let t of this._def.checks)if(t.kind===`min`)e.data.length<t.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:b.too_small,minimum:t.value,type:`string`,inclusive:!0,exact:!1,message:t.message}),n.dirty());else if(t.kind===`max`)e.data.length>t.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:b.too_big,maximum:t.value,type:`string`,inclusive:!0,exact:!1,message:t.message}),n.dirty());else if(t.kind===`length`){let i=e.data.length>t.value,a=e.data.length<t.value;(i||a)&&(r=this._getOrReturnCtx(e,r),i?k(r,{code:b.too_big,maximum:t.value,type:`string`,inclusive:!0,exact:!0,message:t.message}):a&&k(r,{code:b.too_small,minimum:t.value,type:`string`,inclusive:!0,exact:!0,message:t.message}),n.dirty())}else if(t.kind===`email`)ue.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`email`,code:b.invalid_string,message:t.message}),n.dirty());else if(t.kind===`emoji`)W||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),W.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`emoji`,code:b.invalid_string,message:t.message}),n.dirty());else if(t.kind===`uuid`)oe.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`uuid`,code:b.invalid_string,message:t.message}),n.dirty());else if(t.kind===`nanoid`)se.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`nanoid`,code:b.invalid_string,message:t.message}),n.dirty());else if(t.kind===`cuid`)re.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`cuid`,code:b.invalid_string,message:t.message}),n.dirty());else if(t.kind===`cuid2`)ie.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`cuid2`,code:b.invalid_string,message:t.message}),n.dirty());else if(t.kind===`ulid`)ae.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`ulid`,code:b.invalid_string,message:t.message}),n.dirty());else if(t.kind===`url`)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),k(r,{validation:`url`,code:b.invalid_string,message:t.message}),n.dirty()}else if(t.kind===`regex`){t.regex.lastIndex=0;let i=t.regex.test(e.data);i||(r=this._getOrReturnCtx(e,r),k(r,{validation:`regex`,code:b.invalid_string,message:t.message}),n.dirty())}else if(t.kind===`trim`)e.data=e.data.trim();else if(t.kind===`includes`)e.data.includes(t.value,t.position)||(r=this._getOrReturnCtx(e,r),k(r,{code:b.invalid_string,validation:{includes:t.value,position:t.position},message:t.message}),n.dirty());else if(t.kind===`toLowerCase`)e.data=e.data.toLowerCase();else if(t.kind===`toUpperCase`)e.data=e.data.toUpperCase();else if(t.kind===`startsWith`)e.data.startsWith(t.value)||(r=this._getOrReturnCtx(e,r),k(r,{code:b.invalid_string,validation:{startsWith:t.value},message:t.message}),n.dirty());else if(t.kind===`endsWith`)e.data.endsWith(t.value)||(r=this._getOrReturnCtx(e,r),k(r,{code:b.invalid_string,validation:{endsWith:t.value},message:t.message}),n.dirty());else if(t.kind===`datetime`){let i=ye(t);i.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:b.invalid_string,validation:`datetime`,message:t.message}),n.dirty())}else if(t.kind===`date`){let i=ge;i.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:b.invalid_string,validation:`date`,message:t.message}),n.dirty())}else if(t.kind===`time`){let i=ve(t);i.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:b.invalid_string,validation:`time`,message:t.message}),n.dirty())}else t.kind===`duration`?le.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`duration`,code:b.invalid_string,message:t.message}),n.dirty()):t.kind===`ip`?be(e.data,t.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`ip`,code:b.invalid_string,message:t.message}),n.dirty()):t.kind===`jwt`?xe(e.data,t.alg)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`jwt`,code:b.invalid_string,message:t.message}),n.dirty()):t.kind===`cidr`?Se(e.data,t.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`cidr`,code:b.invalid_string,message:t.message}),n.dirty()):t.kind===`base64`?pe.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`base64`,code:b.invalid_string,message:t.message}),n.dirty()):t.kind===`base64url`?me.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:`base64url`,code:b.invalid_string,message:t.message}),n.dirty()):g.assertNever(t);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:b.invalid_string,...z.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...z.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...z.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...z.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...z.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...z.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...z.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...z.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...z.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...z.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...z.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...z.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...z.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...z.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:e?.precision===void 0?null:e?.precision,offset:(t=e?.offset)??!1,local:(n=e?.local)??!1,...z.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:e?.precision===void 0?null:e?.precision,...z.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...z.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...z.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...z.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...z.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...z.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...z.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...z.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...z.errToObj(t)})}nonempty(e){return this.min(1,z.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...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}};Ce.create=e=>{var t;return new Ce({checks:[],typeName:q.ZodString,coerce:(t=e?.coerce)??!1,...H(e)})};function we(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r,a=parseInt(e.toFixed(i).replace(`.`,``)),o=parseInt(t.toFixed(i).replace(`.`,``));return a%o/10**i}var Te=class e extends U{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));let t=this._getType(e);if(t!==v.number){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.number,received:t.parsedType}),j}let n,r=new A;for(let t of this._def.checks)if(t.kind===`int`)g.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_type,expected:`integer`,received:`float`,message:t.message}),r.dirty());else if(t.kind===`min`){let i=t.inclusive?e.data<t.value:e.data<=t.value;i&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,minimum:t.value,type:`number`,inclusive:t.inclusive,exact:!1,message:t.message}),r.dirty())}else if(t.kind===`max`){let i=t.inclusive?e.data>t.value:e.data>=t.value;i&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,maximum:t.value,type:`number`,inclusive:t.inclusive,exact:!1,message:t.message}),r.dirty())}else t.kind===`multipleOf`?we(e.data,t.value)!==0&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.not_multiple_of,multipleOf:t.value,message:t.message}),r.dirty()):t.kind===`finite`?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),k(n,{code:b.not_finite,message:t.message}),r.dirty()):g.assertNever(t);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:z.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:z.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:z.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:z.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:z.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`&&g.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;else 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)}};Te.create=e=>new Te({checks:[],typeName:q.ZodNumber,coerce:e?.coerce||!1,...H(e)});var Ee=class e extends U{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)}let t=this._getType(e);if(t!==v.bigint)return this._getInvalidInput(e);let n,r=new A;for(let t of this._def.checks)if(t.kind===`min`){let i=t.inclusive?e.data<t.value:e.data<=t.value;i&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,type:`bigint`,minimum:t.value,inclusive:t.inclusive,message:t.message}),r.dirty())}else if(t.kind===`max`){let i=t.inclusive?e.data>t.value:e.data>=t.value;i&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,type:`bigint`,maximum:t.value,inclusive:t.inclusive,message:t.message}),r.dirty())}else t.kind===`multipleOf`?e.data%t.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),k(n,{code:b.not_multiple_of,multipleOf:t.value,message:t.message}),r.dirty()):g.assertNever(t);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.bigint,received:t.parsedType}),j}gte(e,t){return this.setLimit(`min`,e,!0,z.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,z.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,z.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,z.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:z.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:z.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:z.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:z.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:z.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:z.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}};Ee.create=e=>{var t;return new Ee({checks:[],typeName:q.ZodBigInt,coerce:(t=e?.coerce)??!1,...H(e)})};var De=class extends U{_parse(e){this._def.coerce&&(e.data=!!e.data);let t=this._getType(e);if(t!==v.boolean){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.boolean,received:t.parsedType}),j}return N(e.data)}};De.create=e=>new De({typeName:q.ZodBoolean,coerce:e?.coerce||!1,...H(e)});var Oe=class e extends U{_parse(e){this._def.coerce&&(e.data=new Date(e.data));let t=this._getType(e);if(t!==v.date){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.date,received:t.parsedType}),j}if(isNaN(e.data.getTime())){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_date}),j}let n=new A,r;for(let t of this._def.checks)t.kind===`min`?e.data.getTime()<t.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:b.too_small,message:t.message,inclusive:!0,exact:!1,minimum:t.value,type:`date`}),n.dirty()):t.kind===`max`?e.data.getTime()>t.value&&(r=this._getOrReturnCtx(e,r),k(r,{code:b.too_big,message:t.message,inclusive:!0,exact:!1,maximum:t.value,type:`date`}),n.dirty()):g.assertNever(t);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:z.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:z.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?null:new Date(e)}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?null:new Date(e)}};Oe.create=e=>new Oe({checks:[],coerce:e?.coerce||!1,typeName:q.ZodDate,...H(e)});var ke=class extends U{_parse(e){let t=this._getType(e);if(t!==v.symbol){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.symbol,received:t.parsedType}),j}return N(e.data)}};ke.create=e=>new ke({typeName:q.ZodSymbol,...H(e)});var Ae=class extends U{_parse(e){let t=this._getType(e);if(t!==v.undefined){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.undefined,received:t.parsedType}),j}return N(e.data)}};Ae.create=e=>new Ae({typeName:q.ZodUndefined,...H(e)});var je=class extends U{_parse(e){let t=this._getType(e);if(t!==v.null){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.null,received:t.parsedType}),j}return N(e.data)}};je.create=e=>new je({typeName:q.ZodNull,...H(e)});var Me=class extends U{constructor(){super(...arguments),this._any=!0}_parse(e){return N(e.data)}};Me.create=e=>new Me({typeName:q.ZodAny,...H(e)});var Ne=class extends U{constructor(){super(...arguments),this._unknown=!0}_parse(e){return N(e.data)}};Ne.create=e=>new Ne({typeName:q.ZodUnknown,...H(e)});var Pe=class extends U{_parse(e){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.never,received:t.parsedType}),j}};Pe.create=e=>new Pe({typeName:q.ZodNever,...H(e)});var Fe=class extends U{_parse(e){let t=this._getType(e);if(t!==v.undefined){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.void,received:t.parsedType}),j}return N(e.data)}};Fe.create=e=>new Fe({typeName:q.ZodVoid,...H(e)});var Ie=class e extends U{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==v.array)return k(t,{code:b.invalid_type,expected:v.array,received:t.parsedType}),j;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(k(t,{code:e?b.too_big:b.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(k(t,{code:b.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(k(t,{code:b.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new te(t,e,t.path,n)))).then(e=>A.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new te(t,e,t.path,n)));return A.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:z.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:z.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:z.toString(n)}})}nonempty(e){return this.min(1,e)}};Ie.create=(e,t)=>new Ie({type:e,minLength:null,maxLength:null,exactLength:null,typeName:q.ZodArray,...H(t)});function Le(e){if(e instanceof Re){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=nt.create(Le(r))}return new Re({...e._def,shape:()=>t})}else if(e instanceof Ie)return new Ie({...e._def,type:Le(e.element)});else if(e instanceof nt)return nt.create(Le(e.unwrap()));else if(e instanceof rt)return rt.create(Le(e.unwrap()));else if(e instanceof We)return We.create(e.items.map(e=>Le(e)));else return e}var Re=class e extends U{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=g.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){let t=this._getType(e);if(t!==v.object){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:v.object,received:t.parsedType}),j}let{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof Pe&&this._def.unknownKeys===`strip`))for(let e in r.data)a.includes(e)||o.push(e);let s=[];for(let e of a){let t=i[e],n=r.data[e];s.push({key:{status:`valid`,value:e},value:t._parse(new te(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Pe){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of o)s.push({key:{status:`valid`,value:e},value:{status:`valid`,value:r.data[e]}});else if(e===`strict`)o.length>0&&(k(r,{code:b.unrecognized_keys,keys:o}),n.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of o){let n=r.data[t];s.push({key:{status:`valid`,value:t},value:e._parse(new te(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of s){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>A.mergeObjectSync(n,e)):A.mergeObjectSync(n,s)}get shape(){return this._def.shape()}strict(t){return z.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{var r,i,a,o;let s=(a=(i=(r=this._def).errorMap)?.call(r,e,n).message)??n.defaultError;return e.code===`unrecognized_keys`?{message:(o=z.errToObj(t).message)??s}:{message:s}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){let n=new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:q.ZodObject});return n}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};return g.objectKeys(t).forEach(e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])}),new e({...this._def,shape:()=>n})}omit(t){let n={};return g.objectKeys(this.shape).forEach(e=>{t[e]||(n[e]=this.shape[e])}),new e({...this._def,shape:()=>n})}deepPartial(){return Le(this)}partial(t){let n={};return g.objectKeys(this.shape).forEach(e=>{let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}),new e({...this._def,shape:()=>n})}required(t){let n={};return g.objectKeys(this.shape).forEach(e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e],r=t;for(;r instanceof nt;)r=r._def.innerType;n[e]=r}}),new e({...this._def,shape:()=>n})}keyof(){return Ze(g.objectKeys(this.shape))}};Re.create=(e,t)=>new Re({shape:()=>e,unknownKeys:`strip`,catchall:Pe.create(),typeName:q.ZodObject,...H(t)}),Re.strictCreate=(e,t)=>new Re({shape:()=>e,unknownKeys:`strict`,catchall:Pe.create(),typeName:q.ZodObject,...H(t)}),Re.lazycreate=(e,t)=>new Re({shape:e,unknownKeys:`strip`,catchall:Pe.create(),typeName:q.ZodObject,...H(t)});var ze=class extends U{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new S(e.ctx.common.issues));return k(t,{code:b.invalid_union,unionErrors:n}),j}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new S(e));return k(t,{code:b.invalid_union,unionErrors:i}),j}}get options(){return this._def.options}};ze.create=(e,t)=>new ze({options:e,typeName:q.ZodUnion,...H(t)});const Be=e=>e instanceof Ye?Be(e.schema):e instanceof tt?Be(e.innerType()):e instanceof Xe?[e.value]:e instanceof Qe?e.options:e instanceof $e?g.objectValues(e.enum):e instanceof it?Be(e._def.innerType):e instanceof Ae?[void 0]:e instanceof je?[null]:e instanceof nt?[void 0,...Be(e.unwrap())]:e instanceof rt?[null,...Be(e.unwrap())]:e instanceof ct||e instanceof ut?Be(e.unwrap()):e instanceof at?Be(e._def.innerType):[];var Ve=class e extends U{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==v.object)return k(t,{code:b.invalid_type,expected:v.object,received:t.parsedType}),j;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(k(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),j)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Be(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:q.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...H(r)})}};function He(e,t){let n=y(e),r=y(t);if(e===t)return{valid:!0,data:e};if(n===v.object&&r===v.object){let n=g.objectKeys(t),r=g.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=He(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===v.array&&r===v.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=He(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===v.date&&r===v.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var Ue=class extends U{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(P(e)||P(r))return j;let i=He(e.value,r.value);return i.valid?((F(e)||F(r))&&t.dirty(),{status:t.value,value:i.data}):(k(n,{code:b.invalid_intersection_types}),j)};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(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ue.create=(e,t,n)=>new Ue({left:e,right:t,typeName:q.ZodIntersection,...H(n)});var We=class e extends U{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.array)return k(n,{code:b.invalid_type,expected:v.array,received:n.parsedType}),j;if(n.data.length<this._def.items.length)return k(n,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),j;let r=this._def.rest;!r&&n.data.length>this._def.items.length&&(k(n,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let i=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new te(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(i).then(e=>A.mergeArray(t,e)):A.mergeArray(t,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};We.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new We({items:e,typeName:q.ZodTuple,rest:null,...H(t)})};var Ge=class e extends U{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!==v.object)return k(n,{code:b.invalid_type,expected:v.object,received:n.parsedType}),j;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new te(n,e,n.path,e)),value:a._parse(new te(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?A.mergeObjectAsync(t,r):A.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof U?new e({keyType:t,valueType:n,typeName:q.ZodRecord,...H(r)}):new e({keyType:Ce.create(),valueType:t,typeName:q.ZodRecord,...H(n)})}},Ke=class extends U{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!==v.map)return k(n,{code:b.invalid_type,expected:v.map,received:n.parsedType}),j;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new te(n,e,n.path,[a,`key`])),value:i._parse(new te(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return j;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return j;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Ke.create=(e,t,n)=>new Ke({valueType:t,keyType:e,typeName:q.ZodMap,...H(n)});var qe=class e extends U{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.set)return k(n,{code:b.invalid_type,expected:v.set,received:n.parsedType}),j;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(k(n,{code:b.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(k(n,{code:b.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return j;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new te(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:z.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:z.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};qe.create=(e,t)=>new qe({valueType:e,minSize:null,maxSize:null,typeName:q.ZodSet,...H(t)});var Je=class e extends U{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==v.function)return k(t,{code:b.invalid_type,expected:v.function,received:t.parsedType}),j;function n(e,n){return D({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,E(),C].filter(e=>!!e),issueData:{code:b.invalid_arguments,argumentsError:n}})}function r(e,n){return D({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,E(),C].filter(e=>!!e),issueData:{code:b.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof et){let e=this;return N(async function(...t){let o=new S([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s),l=await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o});return l})}else{let e=this;return N(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new S([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new S([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:We.create(t).rest(Ne.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){let t=this.parse(e);return t}strictImplement(e){let t=this.parse(e);return t}static create(t,n,r){return new e({args:t||We.create([]).rest(Ne.create()),returns:n||Ne.create(),typeName:q.ZodFunction,...H(r)})}},Ye=class extends U{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.getter();return n._parse({data:t.data,path:t.path,parent:t})}