payvessel-checkout
Version:
A simple checkout integration for Payvessel.
1 lines • 61.4 kB
JavaScript
"use strict";function e(e,t,s,a){return new(s||(s=Promise))((function(n,r){function i(e){try{o(a.next(e))}catch(e){r(e)}}function d(e){try{o(a.throw(e))}catch(e){r(e)}}function o(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(i,d)}o((a=a.apply(e,t||[])).next())}))}var t,s;"function"==typeof SuppressedError&&SuppressedError,function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},e.getValidEnumValues=t=>{const s=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),a={};for(const e of s)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},e.find=(e,t)=>{for(const s of e)if(t(s))return s},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(t||(t={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(s||(s={}));const a=t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),n=e=>{switch(typeof e){case"undefined":return a.undefined;case"string":return a.string;case"number":return Number.isNaN(e)?a.nan:a.number;case"boolean":return a.boolean;case"function":return a.function;case"bigint":return a.bigint;case"symbol":return a.symbol;case"object":return Array.isArray(e)?a.array:null===e?a.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?a.promise:"undefined"!=typeof Map&&e instanceof Map?a.map:"undefined"!=typeof Set&&e instanceof Set?a.set:"undefined"!=typeof Date&&e instanceof Date?a.date:a.object;default:return a.unknown}},r=t.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class i 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]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},s={_errors:[]},a=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(a);else if("invalid_return_type"===n.code)a(n.returnTypeError);else if("invalid_arguments"===n.code)a(n.argumentsError);else if(0===n.path.length)s._errors.push(t(n));else{let e=s,a=0;for(;a<n.path.length;){const s=n.path[a];a===n.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(n))):e[s]=e[s]||{_errors:[]},e=e[s],a++}}};return a(this),s}static assert(e){if(!(e instanceof i))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,t.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},s=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):s.push(e(a));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}i.create=e=>new i(e);const d=(e,s)=>{let n;switch(e.code){case r.invalid_type:n=e.received===a.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case r.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,t.jsonStringifyReplacer)}`;break;case r.unrecognized_keys:n=`Unrecognized key(s) in object: ${t.joinValues(e.keys,", ")}`;break;case r.invalid_union:n="Invalid input";break;case r.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${t.joinValues(e.options)}`;break;case r.invalid_enum_value:n=`Invalid enum value. Expected ${t.joinValues(e.options)}, received '${e.received}'`;break;case r.invalid_arguments:n="Invalid function arguments";break;case r.invalid_return_type:n="Invalid function return type";break;case r.invalid_date:n="Invalid date";break;case r.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(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}"`:t.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case r.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`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 r.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case r.custom:n="Invalid input";break;case r.invalid_intersection_types:n="Intersection results could not be merged";break;case r.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case r.not_finite:n="Number must be finite";break;default:n=s.defaultError,t.assertNever(e)}return{message:n}};let o=d;function c(e,t){const s=o,a=(e=>{const{data:t,path:s,errorMaps:a,issueData:n}=e,r=[...s,...n.path||[]],i={...n,path:r};if(void 0!==n.message)return{...n,path:r,message:n.message};let d="";const o=a.filter((e=>!!e)).slice().reverse();for(const e of o)d=e(i,{data:t,defaultError:d}).message;return{...n,path:r,message:d}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,s,s===d?void 0:d].filter((e=>!!e))});e.common.issues.push(a)}class u{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const a of t){if("aborted"===a.status)return l;"dirty"===a.status&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t){const t=await e.key,a=await e.value;s.push({key:t,value:a})}return u.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const a of t){const{key:t,value:n}=a;if("aborted"===t.status)return l;if("aborted"===n.status)return l;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!a.alwaysSet||(s[t.value]=n.value)}return{status:e.value,value:s}}}const l=Object.freeze({status:"aborted"}),h=e=>({status:"dirty",value:e}),p=e=>({status:"valid",value:e}),m=e=>"aborted"===e.status,f=e=>"dirty"===e.status,y=e=>"valid"===e.status,v=e=>"undefined"!=typeof Promise&&e instanceof Promise;var _;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:e?.message}(_||(_={}));class g{constructor(e,t,s,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const k=(e,t)=>{if(y(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new i(e.common.issues);return this._error=t,this._error}}};function x(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:a,description:n}=e;if(t&&(s||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{const{message:r}=e;return"invalid_enum_value"===t.code?{message:r??n.defaultError}:void 0===n.data?{message:r??a??n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:r??s??n.defaultError}},description:n}}class b{get description(){return this._def.description}_getType(e){return n(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u,ctx:{common:e.parent.common,data:e.data,parsedType:n(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(v(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){const s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},a=this._parseSync({data:e,path:s.path,parent:s});return k(s,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return y(s)?{value:s.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((e=>y(e)?{value:e.value}:{issues:t.common.issues}))}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:n(e)},a=this._parse({data:e,path:s.path,parent:s}),r=await(v(a)?a:Promise.resolve(a));return k(s,r)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,a)=>{const n=e(t),i=()=>a.addIssue({code:r.custom,...s(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then((e=>!!e||(i(),!1))):!!n||(i(),!1)}))}refinement(e,t){return this._refinement(((s,a)=>!!e(s)||(a.addIssue("function"==typeof t?t(s,a):t),!1)))}_refinement(e){return new ge({schema:this,typeName:Ne.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return ke.create(this,this._def)}nullable(){return xe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ae.create(this)}promise(){return _e.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new ge({...x(this._def),schema:this,typeName:Ne.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new be({...x(this._def),innerType:this,defaultValue:t,typeName:Ne.ZodDefault})}brand(){return new Ze({typeName:Ne.ZodBranded,type:this,...x(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new we({...x(this._def),innerType:this,catchValue:t,typeName:Ne.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ce.create(this,e)}readonly(){return Oe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const w=/^c[^\s-]{8,}$/i,T=/^[0-9a-z]+$/,Z=/^[0-9A-HJKMNP-TV-Z]{26}$/i,C=/^[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,O=/^[a-z0-9_-]{21}$/i,N=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,A=/^[-+]?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)?)??$/,S=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let j;const E=/^(?:(?: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])$/,I=/^(?:(?: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])$/,R=/^(([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]))$/,$=/^(([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])$/,P=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,z=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,F="((\\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])))",L=new RegExp(`^${F}$`);function M(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function D(e){let t=`${F}T${M(e)}`;const s=[];return s.push(e.local?"Z?":"Z"),e.offset&&s.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${s.join("|")})`,new RegExp(`^${t}$`)}function V(e,t){if(!N.test(e))return!1;try{const[s]=e.split("."),a=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),n=JSON.parse(atob(a));return"object"==typeof n&&null!==n&&((!("typ"in n)||"JWT"===n?.typ)&&(!!n.alg&&(!t||n.alg===t)))}catch{return!1}}function q(e,t){return!("v4"!==t&&t||!I.test(e))||!("v6"!==t&&t||!$.test(e))}class B extends b{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==a.string){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.string,received:t.parsedType}),l}const s=new u;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:r.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if("max"===a.kind)e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:r.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if("length"===a.kind){const t=e.data.length>a.value,i=e.data.length<a.value;(t||i)&&(n=this._getOrReturnCtx(e,n),t?c(n,{code:r.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&c(n,{code:r.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if("email"===a.kind)S.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"email",code:r.invalid_string,message:a.message}),s.dirty());else if("emoji"===a.kind)j||(j=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),j.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"emoji",code:r.invalid_string,message:a.message}),s.dirty());else if("uuid"===a.kind)C.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"uuid",code:r.invalid_string,message:a.message}),s.dirty());else if("nanoid"===a.kind)O.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"nanoid",code:r.invalid_string,message:a.message}),s.dirty());else if("cuid"===a.kind)w.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"cuid",code:r.invalid_string,message:a.message}),s.dirty());else if("cuid2"===a.kind)T.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"cuid2",code:r.invalid_string,message:a.message}),s.dirty());else if("ulid"===a.kind)Z.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"ulid",code:r.invalid_string,message:a.message}),s.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),c(n,{validation:"url",code:r.invalid_string,message:a.message}),s.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"regex",code:r.invalid_string,message:a.message}),s.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),c(n,{code:r.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),c(n,{code:r.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),c(n,{code:r.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty());else if("datetime"===a.kind){D(a).test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{code:r.invalid_string,validation:"datetime",message:a.message}),s.dirty())}else if("date"===a.kind){L.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{code:r.invalid_string,validation:"date",message:a.message}),s.dirty())}else if("time"===a.kind){new RegExp(`^${M(a)}$`).test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{code:r.invalid_string,validation:"time",message:a.message}),s.dirty())}else"duration"===a.kind?A.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"duration",code:r.invalid_string,message:a.message}),s.dirty()):"ip"===a.kind?(i=e.data,("v4"!==(d=a.version)&&d||!E.test(i))&&("v6"!==d&&d||!R.test(i))&&(n=this._getOrReturnCtx(e,n),c(n,{validation:"ip",code:r.invalid_string,message:a.message}),s.dirty())):"jwt"===a.kind?V(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"jwt",code:r.invalid_string,message:a.message}),s.dirty()):"cidr"===a.kind?q(e.data,a.version)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"cidr",code:r.invalid_string,message:a.message}),s.dirty()):"base64"===a.kind?P.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"base64",code:r.invalid_string,message:a.message}),s.dirty()):"base64url"===a.kind?z.test(e.data)||(n=this._getOrReturnCtx(e,n),c(n,{validation:"base64url",code:r.invalid_string,message:a.message}),s.dirty()):t.assertNever(a);var i,d;return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:r.invalid_string,..._.errToObj(s)})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",..._.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",..._.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,..._.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,..._.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,..._.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,..._.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,..._.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,..._.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,..._.errToObj(t)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new B({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new B({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new B({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function U(e,t){const s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,n=s>a?s:a;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}B.create=e=>new B({checks:[],typeName:Ne.ZodString,coerce:e?.coerce??!1,...x(e)});class K extends b{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));if(this._getType(e)!==a.number){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.number,received:t.parsedType}),l}let s;const n=new u;for(const a of this._def.checks)if("int"===a.kind)t.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:r.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:r.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:r.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==U(e.data,a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:r.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),c(s,{code:r.not_finite,message:a.message}),n.dirty()):t.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,s,a){return new K({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:_.toString(a)}]})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&t.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}K.create=e=>new K({checks:[],typeName:Ne.ZodNumber,coerce:e?.coerce||!1,...x(e)});class W extends b{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)!==a.bigint)return this._getInvalidInput(e);let s;const n=new u;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:r.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),c(s,{code:r.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),c(s,{code:r.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):t.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.bigint,received:t.parsedType}),l}gte(e,t){return this.setLimit("min",e,!0,_.toString(t))}gt(e,t){return this.setLimit("min",e,!1,_.toString(t))}lte(e,t){return this.setLimit("max",e,!0,_.toString(t))}lt(e,t){return this.setLimit("max",e,!1,_.toString(t))}setLimit(e,t,s,a){return new W({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:_.toString(a)}]})}_addCheck(e){return new W({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}W.create=e=>new W({checks:[],typeName:Ne.ZodBigInt,coerce:e?.coerce??!1,...x(e)});class Y extends b{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==a.boolean){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.boolean,received:t.parsedType}),l}return p(e.data)}}Y.create=e=>new Y({typeName:Ne.ZodBoolean,coerce:e?.coerce||!1,...x(e)});class J extends b{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==a.date){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.date,received:t.parsedType}),l}if(Number.isNaN(e.data.getTime())){return c(this._getOrReturnCtx(e),{code:r.invalid_date}),l}const s=new u;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:r.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),c(n,{code:r.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):t.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}J.create=e=>new J({checks:[],coerce:e?.coerce||!1,typeName:Ne.ZodDate,...x(e)});class H extends b{_parse(e){if(this._getType(e)!==a.symbol){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.symbol,received:t.parsedType}),l}return p(e.data)}}H.create=e=>new H({typeName:Ne.ZodSymbol,...x(e)});class G extends b{_parse(e){if(this._getType(e)!==a.undefined){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.undefined,received:t.parsedType}),l}return p(e.data)}}G.create=e=>new G({typeName:Ne.ZodUndefined,...x(e)});class X extends b{_parse(e){if(this._getType(e)!==a.null){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.null,received:t.parsedType}),l}return p(e.data)}}X.create=e=>new X({typeName:Ne.ZodNull,...x(e)});class Q extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return p(e.data)}}Q.create=e=>new Q({typeName:Ne.ZodAny,...x(e)});class ee extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return p(e.data)}}ee.create=e=>new ee({typeName:Ne.ZodUnknown,...x(e)});class te extends b{_parse(e){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.never,received:t.parsedType}),l}}te.create=e=>new te({typeName:Ne.ZodNever,...x(e)});class se extends b{_parse(e){if(this._getType(e)!==a.undefined){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.void,received:t.parsedType}),l}return p(e.data)}}se.create=e=>new se({typeName:Ne.ZodVoid,...x(e)});class ae extends b{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==a.array)return c(t,{code:r.invalid_type,expected:a.array,received:t.parsedType}),l;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,a=t.data.length<n.exactLength.value;(e||a)&&(c(t,{code:e?r.too_big:r.too_small,minimum:a?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(c(t,{code:r.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(c(t,{code:r.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map(((e,s)=>n.type._parseAsync(new g(t,e,t.path,s))))).then((e=>u.mergeArray(s,e)));const i=[...t.data].map(((e,s)=>n.type._parseSync(new g(t,e,t.path,s))));return u.mergeArray(s,i)}get element(){return this._def.type}min(e,t){return new ae({...this._def,minLength:{value:e,message:_.toString(t)}})}max(e,t){return new ae({...this._def,maxLength:{value:e,message:_.toString(t)}})}length(e,t){return new ae({...this._def,exactLength:{value:e,message:_.toString(t)}})}nonempty(e){return this.min(1,e)}}function ne(e){if(e instanceof re){const t={};for(const s in e.shape){const a=e.shape[s];t[s]=ke.create(ne(a))}return new re({...e._def,shape:()=>t})}return e instanceof ae?new ae({...e._def,type:ne(e.element)}):e instanceof ke?ke.create(ne(e.unwrap())):e instanceof xe?xe.create(ne(e.unwrap())):e instanceof ce?ce.create(e.items.map((e=>ne(e)))):e}ae.create=(e,t)=>new ae({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ne.ZodArray,...x(t)});class re extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),s=t.objectKeys(e);return this._cached={shape:e,keys:s},this._cached}_parse(e){if(this._getType(e)!==a.object){const t=this._getOrReturnCtx(e);return c(t,{code:r.invalid_type,expected:a.object,received:t.parsedType}),l}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),d=[];if(!(this._def.catchall instanceof te&&"strip"===this._def.unknownKeys))for(const e in s.data)i.includes(e)||d.push(e);const o=[];for(const e of i){const t=n[e],a=s.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new g(s,a,s.path,e)),alwaysSet:e in s.data})}if(this._def.catchall instanceof te){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of d)o.push({key:{status:"valid",value:e},value:{status:"valid",value:s.data[e]}});else if("strict"===e)d.length>0&&(c(s,{code:r.unrecognized_keys,keys:d}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of d){const a=s.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new g(s,a,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const s=await t.key,a=await t.value;e.push({key:s,value:a,alwaysSet:t.alwaysSet})}return e})).then((e=>u.mergeObjectSync(t,e))):u.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new re({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{const a=this._def.errorMap?.(t,s).message??s.defaultError;return"unrecognized_keys"===t.code?{message:_.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new re({...this._def,unknownKeys:"strip"})}passthrough(){return new re({...this._def,unknownKeys:"passthrough"})}extend(e){return new re({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new re({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ne.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new re({...this._def,catchall:e})}pick(e){const s={};for(const a of t.objectKeys(e))e[a]&&this.shape[a]&&(s[a]=this.shape[a]);return new re({...this._def,shape:()=>s})}omit(e){const s={};for(const a of t.objectKeys(this.shape))e[a]||(s[a]=this.shape[a]);return new re({...this._def,shape:()=>s})}deepPartial(){return ne(this)}partial(e){const s={};for(const a of t.objectKeys(this.shape)){const t=this.shape[a];e&&!e[a]?s[a]=t:s[a]=t.optional()}return new re({...this._def,shape:()=>s})}required(e){const s={};for(const a of t.objectKeys(this.shape))if(e&&!e[a])s[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof ke;)e=e._def.innerType;s[a]=e}return new re({...this._def,shape:()=>s})}keyof(){return fe(t.objectKeys(this.shape))}}re.create=(e,t)=>new re({shape:()=>e,unknownKeys:"strip",catchall:te.create(),typeName:Ne.ZodObject,...x(t)}),re.strictCreate=(e,t)=>new re({shape:()=>e,unknownKeys:"strict",catchall:te.create(),typeName:Ne.ZodObject,...x(t)}),re.lazycreate=(e,t)=>new re({shape:e,unknownKeys:"strip",catchall:te.create(),typeName:Ne.ZodObject,...x(t)});class ie extends b{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map((e=>new i(e.ctx.common.issues)));return c(t,{code:r.invalid_union,unionErrors:s}),l}));{let e;const a=[];for(const n of s){const s={...t,common:{...t.common,issues:[]},parent:null},r=n._parseSync({data:t.data,path:t.path,parent:s});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=a.map((e=>new i(e)));return c(t,{code:r.invalid_union,unionErrors:n}),l}}get options(){return this._def.options}}function de(e,s){const r=n(e),i=n(s);if(e===s)return{valid:!0,data:e};if(r===a.object&&i===a.object){const a=t.objectKeys(s),n=t.objectKeys(e).filter((e=>-1!==a.indexOf(e))),r={...e,...s};for(const t of n){const a=de(e[t],s[t]);if(!a.valid)return{valid:!1};r[t]=a.data}return{valid:!0,data:r}}if(r===a.array&&i===a.array){if(e.length!==s.length)return{valid:!1};const t=[];for(let a=0;a<e.length;a++){const n=de(e[a],s[a]);if(!n.valid)return{valid:!1};t.push(n.data)}return{valid:!0,data:t}}return r===a.date&&i===a.date&&+e===+s?{valid:!0,data:e}:{valid:!1}}ie.create=(e,t)=>new ie({options:e,typeName:Ne.ZodUnion,...x(t)});class oe extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),a=(e,a)=>{if(m(e)||m(a))return l;const n=de(e.value,a.value);return n.valid?((f(e)||f(a))&&t.dirty(),{status:t.value,value:n.data}):(c(s,{code:r.invalid_intersection_types}),l)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([e,t])=>a(e,t))):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}oe.create=(e,t,s)=>new oe({left:e,right:t,typeName:Ne.ZodIntersection,...x(s)});class ce extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==a.array)return c(s,{code:r.invalid_type,expected:a.array,received:s.parsedType}),l;if(s.data.length<this._def.items.length)return c(s,{code:r.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l;!this._def.rest&&s.data.length>this._def.items.length&&(c(s,{code:r.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map(((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new g(s,e,s.path,t)):null})).filter((e=>!!e));return s.common.async?Promise.all(n).then((e=>u.mergeArray(t,e))):u.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ce({...this._def,rest:e})}}ce.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ce({items:e,typeName:Ne.ZodTuple,rest:null,...x(t)})};class ue extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==a.object)return c(s,{code:r.invalid_type,expected:a.object,received:s.parsedType}),l;const n=[],i=this._def.keyType,d=this._def.valueType;for(const e in s.data)n.push({key:i._parse(new g(s,e,s.path,e)),value:d._parse(new g(s,s.data[e],s.path,e)),alwaysSet:e in s.data});return s.common.async?u.mergeObjectAsync(t,n):u.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return new ue(t instanceof b?{keyType:e,valueType:t,typeName:Ne.ZodRecord,...x(s)}:{keyType:B.create(),valueType:e,typeName:Ne.ZodRecord,...x(t)})}}class le extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==a.map)return c(s,{code:r.invalid_type,expected:a.map,received:s.parsedType}),l;const n=this._def.keyType,i=this._def.valueType,d=[...s.data.entries()].map((([e,t],a)=>({key:n._parse(new g(s,e,s.path,[a,"key"])),value:i._parse(new g(s,t,s.path,[a,"value"]))})));if(s.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of d){const a=await s.key,n=await s.value;if("aborted"===a.status||"aborted"===n.status)return l;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of d){const a=s.key,n=s.value;if("aborted"===a.status||"aborted"===n.status)return l;"dirty"!==a.status&&"dirty"!==n.status||t.dirty(),e.set(a.value,n.value)}return{status:t.value,value:e}}}}le.create=(e,t,s)=>new le({valueType:t,keyType:e,typeName:Ne.ZodMap,...x(s)});class he extends b{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==a.set)return c(s,{code:r.invalid_type,expected:a.set,received:s.parsedType}),l;const n=this._def;null!==n.minSize&&s.data.size<n.minSize.value&&(c(s,{code:r.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&s.data.size>n.maxSize.value&&(c(s,{code:r.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const i=this._def.valueType;function d(e){const s=new Set;for(const a of e){if("aborted"===a.status)return l;"dirty"===a.status&&t.dirty(),s.add(a.value)}return{status:t.value,value:s}}const o=[...s.data.values()].map(((e,t)=>i._parse(new g(s,e,s.path,t))));return s.common.async?Promise.all(o).then((e=>d(e))):d(o)}min(e,t){return new he({...this._def,minSize:{value:e,message:_.toString(t)}})}max(e,t){return new he({...this._def,maxSize:{value:e,message:_.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}he.create=(e,t)=>new he({valueType:e,minSize:null,maxSize:null,typeName:Ne.ZodSet,...x(t)});class pe extends b{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}pe.create=(e,t)=>new pe({getter:e,typeName:Ne.ZodLazy,...x(t)});class me extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return c(t,{received:t.data,code:r.invalid_literal,expected:this._def.value}),l}return{status:"valid",value:e.data}}get value(){return this._def.value}}function fe(e,t){return new ye({values:e,typeName:Ne.ZodEnum,...x(t)})}me.create=(e,t)=>new me({value:e,typeName:Ne.ZodLiteral,...x(t)});class ye extends b{_parse(e){if("string"!=typeof e.data){const s=this._getOrReturnCtx(e),a=this._def.values;return c(s,{expected:t.joinValues(a),received:s.parsedType,code:r.invalid_type}),l}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return c(t,{received:t.data,code:r.invalid_enum_value,options:s}),l}return p(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ye.create(e,{...this._def,...t})}exclude(e,t=this._def){return ye.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}ye.create=fe;class ve extends b{_parse(e){const s=t.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==a.string&&n.parsedType!==a.number){const e=t.objectValues(s);return c(n,{expected:t.joinValues(e),received:n.parsedType,code:r.invalid_type}),l}if(this._cache||(this._cache=new Set(t.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=t.objectValues(s);return c(n,{received:n.data,code:r.invalid_enum_value,options:e}),l}return p(e.data)}get enum(){return this._def.values}}ve.create=(e,t)=>new ve({values:e,typeName:Ne.ZodNativeEnum,...x(t)});class _e extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==a.promise&&!1===t.common.async)return c(t,{code:r.invalid_type,expected:a.promise,received:t.parsedType}),l;const s=t.parsedType===a.promise?t.data:Promise.resolve(t.data);return p(s.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}_e.create=(e,t)=>new _e({type:e,typeName:Ne.ZodPromise,...x(t)});class ge extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ne.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:s,ctx:a}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:e=>{c(a,e),e.fatal?s.abort():s.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(a.data,r);if(a.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===s.value)return l;const t=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===t.status?l:"dirty"===t.status||"dirty"===s.value?h(t.value):t}));{if("aborted"===s.value)return l;const t=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===t.status?l:"dirty"===t.status||"dirty"===s.value?h(t.value):t}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?l:("dirty"===t.status&&s.dirty(),e(t.value),{status:s.value,value:t.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((t=>"aborted"===t.status?l:("dirty"===t.status&&s.dirty(),e(t.value).then((()=>({status:s.value,value:t.value}))))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!y(e))return l;const t=n.transform(e.value,r);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:t}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>y(e)?Promise.resolve(n.transform(e.value,r)).then((e=>({status:s.value,value:e}))):l))}t.assertNe