@volverjs/form-vue 1.1.0-beta.1 → 1.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,12 +32,12 @@ export declare function defineFormFieldsGroup<Schema extends FormSchema, Type =
32
32
  }>[];
33
33
  }>;
34
34
  hasProps: import('vue').ComputedRef<{
35
+ modelValue: Record<string, any>;
35
36
  names: {};
36
37
  invalid: boolean;
37
38
  invalids: Record<string, boolean>;
38
39
  valid: boolean | undefined;
39
40
  invalidLabels: Record<string, string[]> | undefined;
40
- modelValue: Record<string, any>;
41
41
  readonly: boolean;
42
42
  }>;
43
43
  invalid: import('vue').ComputedRef<boolean>;
package/dist/index.d.ts CHANGED
@@ -298,12 +298,12 @@ declare function _formType<Schema extends FormSchema, Type>(schema: Schema, opti
298
298
  }>[];
299
299
  }>;
300
300
  hasProps: import('vue').ComputedRef<{
301
+ modelValue: Record<string, any>;
301
302
  names: {};
302
303
  invalid: boolean;
303
304
  invalids: Record<string, boolean>;
304
305
  valid: boolean | undefined;
305
306
  invalidLabels: Record<string, string[]> | undefined;
306
- modelValue: Record<string, any>;
307
307
  readonly: boolean;
308
308
  }>;
309
309
  invalid: import('vue').ComputedRef<boolean>;
@@ -788,12 +788,12 @@ export declare function formType<Schema extends FormSchema, Type>(schema: Schema
788
788
  }>[];
789
789
  }>;
790
790
  hasProps: import('vue').ComputedRef<{
791
+ modelValue: Record<string, any>;
791
792
  names: {};
792
793
  invalid: boolean;
793
794
  invalids: Record<string, boolean>;
794
795
  valid: boolean | undefined;
795
796
  invalidLabels: Record<string, string[]> | undefined;
796
- modelValue: Record<string, any>;
797
797
  readonly: boolean;
798
798
  }>;
799
799
  invalid: import('vue').ComputedRef<boolean>;
package/dist/index.es.js CHANGED
@@ -2705,13 +2705,7 @@ const _t = (r, e) => {
2705
2705
  }), Object.defineProperty(r, "issues", {
2706
2706
  value: e,
2707
2707
  enumerable: !1
2708
- }), Object.defineProperty(r, "message", {
2709
- get() {
2710
- return JSON.stringify(e, lr, 2);
2711
- },
2712
- enumerable: !0
2713
- // configurable: false,
2714
- }), Object.defineProperty(r, "toString", {
2708
+ }), r.message = JSON.stringify(e, lr, 2), Object.defineProperty(r, "toString", {
2715
2709
  value: () => r.message,
2716
2710
  enumerable: !1
2717
2711
  });
@@ -2779,7 +2773,9 @@ class wt {
2779
2773
  const t = e._zod.parent;
2780
2774
  if (t) {
2781
2775
  const s = { ...this.get(t) ?? {} };
2782
- return delete s.id, { ...s, ...this._map.get(e) };
2776
+ delete s.id;
2777
+ const n = { ...s, ...this._map.get(e) };
2778
+ return Object.keys(n).length ? n : void 0;
2783
2779
  }
2784
2780
  return this._map.get(e);
2785
2781
  }
@@ -4081,12 +4077,13 @@ function Ir(r, e, t) {
4081
4077
  })), It = Z(() => ({
4082
4078
  ...Nt.value,
4083
4079
  ...Q.value,
4080
+ ...m.value,
4081
+ modelValue: m.value,
4084
4082
  names: Q.value.name ?? d.value,
4085
4083
  invalid: N.value,
4086
4084
  invalids: P.value,
4087
4085
  valid: s.showValid ? !!(!N.value && m.value) : void 0,
4088
4086
  invalidLabels: j.value,
4089
- modelValue: m.value,
4090
4087
  readonly: Je.value
4091
4088
  }));
4092
4089
  return Ve(t, {
package/dist/index.umd.js CHANGED
@@ -1,3 +1,3 @@
1
- (function(U,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],u):(U=typeof globalThis<"u"?globalThis:U||self,u(U["@volverjs/form-vue"]={},U.Vue,U.VueUseCore))})(this,function(U,u,Ve){"use strict";var E=(r=>(r.text="text",r.number="number",r.email="email",r.password="password",r.tel="tel",r.url="url",r.search="search",r.date="date",r.time="time",r.datetimeLocal="datetime-local",r.month="month",r.week="week",r.color="color",r.select="select",r.checkbox="checkbox",r.radio="radio",r.textarea="textarea",r.radioGroup="radioGroup",r.checkboxGroup="checkboxGroup",r.combobox="combobox",r.custom="custom",r))(E||{}),L=(r=>(r.invalid="invalid",r.valid="valid",r.submitting="submitting",r.reset="reset",r.updated="updated",r.unknown="unknown",r))(L||{}),V;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(const i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(V||(V={}));var Ze;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ze||(Ze={}));const g=V.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Y=r=>{switch(typeof r){case"undefined":return g.undefined;case"string":return g.string;case"number":return Number.isNaN(r)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(r)?g.array:r===null?g.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?g.promise:typeof Map<"u"&&r instanceof Map?g.map:typeof Set<"u"&&r instanceof Set?g.set:typeof Date<"u"&&r instanceof Date?g.date:g.object;default:return g.unknown}},m=V.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 W extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};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(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(this),s}static assert(e){if(!(e instanceof W))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,V.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}W.create=r=>new W(r);const Se=(r,e)=>{let t;switch(r.code){case m.invalid_type:r.received===g.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case m.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,V.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:t=`Unrecognized key(s) in object: ${V.joinValues(r.keys,", ")}`;break;case m.invalid_union:t="Invalid input";break;case m.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${V.joinValues(r.options)}`;break;case m.invalid_enum_value:t=`Invalid enum value. Expected ${V.joinValues(r.options)}, received '${r.received}'`;break;case m.invalid_arguments:t="Invalid function arguments";break;case m.invalid_return_type:t="Invalid function return type";break;case m.invalid_date:t="Invalid date";break;case m.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:V.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case m.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case m.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case m.custom:t="Invalid input";break;case m.invalid_intersection_types:t="Intersection results could not be merged";break;case m.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case m.not_finite:t="Number must be finite";break;default:t=e.defaultError,V.assertNever(r)}return{message:t}};let mt=Se;function yt(){return mt}const vt=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const c=s.filter(l=>!!l).slice().reverse();for(const l of c)o=l(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function v(r,e){const t=yt(),s=vt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Se?void 0:Se].filter(n=>!!n)});r.common.issues.push(s)}class M{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return j;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return M.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return j;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const j=Object.freeze({status:"aborted"}),oe=r=>({status:"dirty",value:r}),F=r=>({status:"valid",value:r}),$e=r=>r.status==="aborted",Pe=r=>r.status==="dirty",re=r=>r.status==="valid",fe=r=>typeof Promise<"u"&&r instanceof Promise;var b;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(b||(b={}));class q{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}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 De=(r,e)=>{if(re(e))return{success:!0,data:e.value};if(!r.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 W(r.common.issues);return this._error=t,this._error}}};function T(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:n}}class N{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 M,ctx:{common:e.parent.common,data:e.data,parsedType:Y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(fe(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:Y(e)},n=this._parseSync({data:e,path:s.path,parent:s});return De(s,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return re(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>re(s)?{value:s.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:Y(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(fe(n)?n:Promise.resolve(n));return De(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:m.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new Q({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return G.create(this,this._def)}nullable(){return X.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this)}promise(){return ve.create(this,this._def)}or(e){return pe.create([this,e],this._def)}and(e){return me.create(this,e,this._def)}transform(e){return new Q({...T(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ge({...T(this._def),innerType:this,defaultValue:t,typeName:S.ZodDefault})}brand(){return new Mt({typeName:S.ZodBranded,type:this,...T(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ce({...T(this._def),innerType:this,catchValue:t,typeName:S.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ne.create(this,e)}readonly(){return Re.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gt=/^c[^\s-]{8,}$/i,_t=/^[0-9a-z]+$/,bt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xt=/^[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,kt=/^[a-z0-9_-]{21}$/i,wt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ot=/^[-+]?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)?)??$/,St=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let je;const Tt=/^(?:(?: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])$/,Ct=/^(?:(?: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])$/,Nt=/^(([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]))$/,Rt=/^(([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])$/,It=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Et=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ze="((\\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])))",At=new RegExp(`^${ze}$`);function Me(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Vt(r){return new RegExp(`^${Me(r)}$`)}function Zt(r){let e=`${ze}T${Me(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function $t(r,e){return!!((e==="v4"||!e)&&Tt.test(r)||(e==="v6"||!e)&&Nt.test(r))}function Pt(r,e){if(!wt.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Dt(r,e){return!!((e==="v4"||!e)&&Ct.test(r)||(e==="v6"||!e)&&Rt.test(r))}class K extends N{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const a=this._getOrReturnCtx(e);return v(a,{code:m.invalid_type,expected:g.string,received:a.parsedType}),j}const s=new M;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:m.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:m.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?v(n,{code:m.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&v(n,{code:m.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")St.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"email",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")je||(je=new RegExp(jt,"u")),je.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"emoji",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")xt.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"uuid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")kt.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"nanoid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")gt.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")_t.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid2",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")bt.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ulid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),v(n,{validation:"url",code:m.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"regex",code:m.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?Zt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?At.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Vt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"duration",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?$t(e.data,a.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ip",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Pt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"jwt",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Dt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cidr",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?It.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Et.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64url",code:m.invalid_string,message:a.message}),s.dirty()):V.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:m.invalid_string,...b.errToObj(s)})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...b.errToObj(e)})}url(e){return this._addCheck({kind:"url",...b.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...b.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...b.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...b.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...b.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...b.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...b.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...b.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...b.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...b.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...b.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...b.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...b.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...b.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...b.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...b.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...b.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...b.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...b.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...b.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...b.errToObj(t)})}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new K({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new K({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new K({...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(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}K.create=r=>new K({checks:[],typeName:S.ZodString,coerce:r?.coerce??!1,...T(r)});function zt(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class ce extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const a=this._getOrReturnCtx(e);return v(a,{code:m.invalid_type,expected:g.number,received:a.parsedType}),j}let s;const n=new M;for(const a of this._def.checks)a.kind==="int"?V.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),v(s,{code:m.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?zt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),v(s,{code:m.not_finite,message:a.message}),n.dirty()):V.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,s,n){return new ce({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:b.toString(n)}]})}_addCheck(e){return new ce({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const 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"&&V.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ce.create=r=>new ce({checks:[],typeName:S.ZodNumber,coerce:r?.coerce||!1,...T(r)});class ue extends N{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)!==g.bigint)return this._getInvalidInput(e);let s;const n=new M;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):V.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return v(t,{code:m.invalid_type,expected:g.bigint,received:t.parsedType}),j}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,s,n){return new ue({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:b.toString(n)}]})}_addCheck(e){return new ue({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ue.create=r=>new ue({checks:[],typeName:S.ZodBigInt,coerce:r?.coerce??!1,...T(r)});class Le extends N{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.boolean,received:s.parsedType}),j}return F(e.data)}}Le.create=r=>new Le({typeName:S.ZodBoolean,coerce:r?.coerce||!1,...T(r)});class he extends N{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const a=this._getOrReturnCtx(e);return v(a,{code:m.invalid_type,expected:g.date,received:a.parsedType}),j}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return v(a,{code:m.invalid_date}),j}const s=new M;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:m.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:m.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):V.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}he.create=r=>new he({checks:[],coerce:r?.coerce||!1,typeName:S.ZodDate,...T(r)});class Ue extends N{_parse(e){if(this._getType(e)!==g.symbol){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.symbol,received:s.parsedType}),j}return F(e.data)}}Ue.create=r=>new Ue({typeName:S.ZodSymbol,...T(r)});class Fe extends N{_parse(e){if(this._getType(e)!==g.undefined){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.undefined,received:s.parsedType}),j}return F(e.data)}}Fe.create=r=>new Fe({typeName:S.ZodUndefined,...T(r)});class Be extends N{_parse(e){if(this._getType(e)!==g.null){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.null,received:s.parsedType}),j}return F(e.data)}}Be.create=r=>new Be({typeName:S.ZodNull,...T(r)});class Je extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return F(e.data)}}Je.create=r=>new Je({typeName:S.ZodAny,...T(r)});class We extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return F(e.data)}}We.create=r=>new We({typeName:S.ZodUnknown,...T(r)});class H extends N{_parse(e){const t=this._getOrReturnCtx(e);return v(t,{code:m.invalid_type,expected:g.never,received:t.parsedType}),j}}H.create=r=>new H({typeName:S.ZodNever,...T(r)});class qe extends N{_parse(e){if(this._getType(e)!==g.undefined){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.void,received:s.parsedType}),j}return F(e.data)}}qe.create=r=>new qe({typeName:S.ZodVoid,...T(r)});class B extends N{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==g.array)return v(t,{code:m.invalid_type,expected:g.array,received:t.parsedType}),j;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(v(t,{code:i?m.too_big:m.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(v(t,{code:m.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(v(t,{code:m.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((i,o)=>n.type._parseAsync(new q(t,i,t.path,o)))).then(i=>M.mergeArray(s,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new q(t,i,t.path,o)));return M.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new B({...this._def,minLength:{value:e,message:b.toString(t)}})}max(e,t){return new B({...this._def,maxLength:{value:e,message:b.toString(t)}})}length(e,t){return new B({...this._def,exactLength:{value:e,message:b.toString(t)}})}nonempty(e){return this.min(1,e)}}B.create=(r,e)=>new B({type:r,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...T(e)});function ne(r){if(r instanceof $){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=G.create(ne(s))}return new $({...r._def,shape:()=>e})}else return r instanceof B?new B({...r._def,type:ne(r.element)}):r instanceof G?G.create(ne(r.unwrap())):r instanceof X?X.create(ne(r.unwrap())):r instanceof te?te.create(r.items.map(e=>ne(e))):r}class $ extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=V.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==g.object){const l=this._getOrReturnCtx(e);return v(l,{code:m.invalid_type,expected:g.object,received:l.parsedType}),j}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof H&&this._def.unknownKeys==="strip"))for(const l in n.data)i.includes(l)||o.push(l);const c=[];for(const l of i){const f=a[l],h=n.data[l];c.push({key:{status:"valid",value:l},value:f._parse(new q(n,h,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof H){const l=this._def.unknownKeys;if(l==="passthrough")for(const f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:n.data[f]}});else if(l==="strict")o.length>0&&(v(n,{code:m.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const f of o){const h=n.data[f];c.push({key:{status:"valid",value:f},value:l._parse(new q(n,h,n.path,f)),alwaysSet:f in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const f of c){const h=await f.key,w=await f.value;l.push({key:h,value:w,alwaysSet:f.alwaysSet})}return l}).then(l=>M.mergeObjectSync(s,l)):M.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return b.errToObj,new $({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:b.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new $({...this._def,unknownKeys:"strip"})}passthrough(){return new $({...this._def,unknownKeys:"passthrough"})}extend(e){return new $({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:S.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new $({...this._def,catchall:e})}pick(e){const t={};for(const s of V.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new $({...this._def,shape:()=>t})}omit(e){const t={};for(const s of V.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new $({...this._def,shape:()=>t})}deepPartial(){return ne(this)}partial(e){const t={};for(const s of V.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new $({...this._def,shape:()=>t})}required(e){const t={};for(const s of V.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof G;)a=a._def.innerType;t[s]=a}return new $({...this._def,shape:()=>t})}keyof(){return He(V.objectKeys(this.shape))}}$.create=(r,e)=>new $({shape:()=>r,unknownKeys:"strip",catchall:H.create(),typeName:S.ZodObject,...T(e)}),$.strictCreate=(r,e)=>new $({shape:()=>r,unknownKeys:"strict",catchall:H.create(),typeName:S.ZodObject,...T(e)}),$.lazycreate=(r,e)=>new $({shape:r,unknownKeys:"strip",catchall:H.create(),typeName:S.ZodObject,...T(e)});class pe extends N{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new W(o.ctx.common.issues));return v(t,{code:m.invalid_union,unionErrors:i}),j}if(t.common.async)return Promise.all(s.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const c of s){const l={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new W(c));return v(t,{code:m.invalid_union,unionErrors:o}),j}}get options(){return this._def.options}}pe.create=(r,e)=>new pe({options:r,typeName:S.ZodUnion,...T(e)});function Te(r,e){const t=Y(r),s=Y(e);if(r===e)return{valid:!0,data:r};if(t===g.object&&s===g.object){const n=V.objectKeys(e),a=V.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=Te(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===g.array&&s===g.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=Te(i,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===g.date&&s===g.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class me extends N{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if($e(a)||$e(i))return j;const o=Te(a.value,i.value);return o.valid?((Pe(a)||Pe(i))&&t.dirty(),{status:t.value,value:o.data}):(v(s,{code:m.invalid_intersection_types}),j)};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(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}me.create=(r,e,t)=>new me({left:r,right:e,typeName:S.ZodIntersection,...T(t)});class te extends N{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==g.array)return v(s,{code:m.invalid_type,expected:g.array,received:s.parsedType}),j;if(s.data.length<this._def.items.length)return v(s,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),j;!this._def.rest&&s.data.length>this._def.items.length&&(v(s,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new q(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>M.mergeArray(t,i)):M.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new te({...this._def,rest:e})}}te.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new te({items:r,typeName:S.ZodTuple,rest:null,...T(e)})};class ye extends N{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!==g.object)return v(s,{code:m.invalid_type,expected:g.object,received:s.parsedType}),j;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new q(s,o,s.path,o)),value:i._parse(new q(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?M.mergeObjectAsync(t,n):M.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof N?new ye({keyType:e,valueType:t,typeName:S.ZodRecord,...T(s)}):new ye({keyType:K.create(),valueType:e,typeName:S.ZodRecord,...T(t)})}}class Ge extends N{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!==g.map)return v(s,{code:m.invalid_type,expected:g.map,received:s.parsedType}),j;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,c],l)=>({key:n._parse(new q(s,o,s.path,[l,"key"])),value:a._parse(new q(s,c,s.path,[l,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const l=await c.key,f=await c.value;if(l.status==="aborted"||f.status==="aborted")return j;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(l.value,f.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const l=c.key,f=c.value;if(l.status==="aborted"||f.status==="aborted")return j;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(l.value,f.value)}return{status:t.value,value:o}}}}Ge.create=(r,e,t)=>new Ge({valueType:e,keyType:r,typeName:S.ZodMap,...T(t)});class de extends N{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==g.set)return v(s,{code:m.invalid_type,expected:g.set,received:s.parsedType}),j;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(v(s,{code:m.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(v(s,{code:m.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const l=new Set;for(const f of c){if(f.status==="aborted")return j;f.status==="dirty"&&t.dirty(),l.add(f.value)}return{status:t.value,value:l}}const o=[...s.data.values()].map((c,l)=>a._parse(new q(s,c,s.path,l)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new de({...this._def,minSize:{value:e,message:b.toString(t)}})}max(e,t){return new de({...this._def,maxSize:{value:e,message:b.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}de.create=(r,e)=>new de({valueType:r,minSize:null,maxSize:null,typeName:S.ZodSet,...T(e)});class Ke extends N{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})}}Ke.create=(r,e)=>new Ke({getter:r,typeName:S.ZodLazy,...T(e)});class Ye extends N{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ye.create=(r,e)=>new Ye({value:r,typeName:S.ZodLiteral,...T(e)});function He(r,e){return new se({values:r,typeName:S.ZodEnum,...T(e)})}class se extends N{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return v(t,{expected:V.joinValues(s),received:t.parsedType,code:m.invalid_type}),j}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 v(t,{received:t.data,code:m.invalid_enum_value,options:s}),j}return F(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 se.create(e,{...this._def,...t})}exclude(e,t=this._def){return se.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}se.create=He;class Qe extends N{_parse(e){const t=V.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==g.string&&s.parsedType!==g.number){const n=V.objectValues(t);return v(s,{expected:V.joinValues(n),received:s.parsedType,code:m.invalid_type}),j}if(this._cache||(this._cache=new Set(V.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=V.objectValues(t);return v(s,{received:s.data,code:m.invalid_enum_value,options:n}),j}return F(e.data)}get enum(){return this._def.values}}Qe.create=(r,e)=>new Qe({values:r,typeName:S.ZodNativeEnum,...T(e)});class ve extends N{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&t.common.async===!1)return v(t,{code:m.invalid_type,expected:g.promise,received:t.parsedType}),j;const s=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return F(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ve.create=(r,e)=>new ve({type:r,typeName:S.ZodPromise,...T(e)});class Q extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{v(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return j;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?j:c.status==="dirty"||t.value==="dirty"?oe(c.value):c});{if(t.value==="aborted")return j;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?j:o.status==="dirty"||t.value==="dirty"?oe(o.value):o}}if(n.type==="refinement"){const i=o=>{const c=n.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!re(i))return j;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>re(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):j);V.assertNever(n)}}Q.create=(r,e,t)=>new Q({schema:r,typeName:S.ZodEffects,effect:e,...T(t)}),Q.createWithPreprocess=(r,e,t)=>new Q({schema:e,effect:{type:"preprocess",transform:r},typeName:S.ZodEffects,...T(t)});class G extends N{_parse(e){return this._getType(e)===g.undefined?F(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}G.create=(r,e)=>new G({innerType:r,typeName:S.ZodOptional,...T(e)});class X extends N{_parse(e){return this._getType(e)===g.null?F(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}X.create=(r,e)=>new X({innerType:r,typeName:S.ZodNullable,...T(e)});class ge extends N{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===g.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ge.create=(r,e)=>new ge({innerType:r,typeName:S.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});class Ce extends N{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return fe(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new W(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new W(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Ce.create=(r,e)=>new Ce({innerType:r,typeName:S.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});class Xe extends N{_parse(e){if(this._getType(e)!==g.nan){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.nan,received:s.parsedType}),j}return{status:"valid",value:e.data}}}Xe.create=r=>new Xe({typeName:S.ZodNaN,...T(r)});class Mt extends N{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ne extends N{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?j:a.status==="dirty"?(t.dirty(),oe(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?j:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new Ne({in:e,out:t,typeName:S.ZodPipeline})}}class Re extends N{_parse(e){const t=this._def.innerType._parse(e),s=n=>(re(n)&&(n.value=Object.freeze(n.value)),n);return fe(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}Re.create=(r,e)=>new Re({innerType:r,typeName:S.ZodReadonly,...T(e)});var S;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(S||(S={})),K.create,H.create,B.create,pe.create,me.create,te.create,se.create,ve.create,G.create,X.create;function et(r,e,t){function s(o,c){var l;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(l=o._zod).traits??(l.traits=new Set),o._zod.traits.add(r),e(o,c);for(const f in i.prototype)f in o||Object.defineProperty(o,f,{value:i.prototype[f].bind(o)});o._zod.constr=i,o._zod.def=c}const n=t?.Parent??Object;class a extends n{}Object.defineProperty(a,"name",{value:r});function i(o){var c;const l=t?.Parent?new a:this;s(l,o),(c=l._zod).deferred??(c.deferred=[]);for(const f of l._zod.deferred)f();return l}return Object.defineProperty(i,"init",{value:s}),Object.defineProperty(i,Symbol.hasInstance,{value:o=>t?.Parent&&o instanceof t.Parent?!0:o?._zod?.traits?.has(r)}),Object.defineProperty(i,"name",{value:r}),i}class Lt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Ut={};function tt(r){return Ut}function Ft(r){const e=Object.values(r).filter(s=>typeof s=="number");return Object.entries(r).filter(([s,n])=>e.indexOf(+s)===-1).map(([s,n])=>n)}function Bt(r,e){return typeof e=="bigint"?e.toString():e}function _e(r){return typeof r=="string"?r:r?.message}function rt(r,e,t){const s={...r,path:r.path??[]};if(!r.message){const n=_e(r.inst?._zod.def?.error?.(r))??_e(e?.error?.(r))??_e(t.customError?.(r))??_e(t.localeError?.(r))??"Invalid input";s.message=n}return delete s.inst,delete s.continue,e?.reportInput||delete s.input,s}const nt=(r,e)=>{r.name="$ZodError",Object.defineProperty(r,"_zod",{value:r._zod,enumerable:!1}),Object.defineProperty(r,"issues",{value:e,enumerable:!1}),Object.defineProperty(r,"message",{get(){return JSON.stringify(e,Bt,2)},enumerable:!0}),Object.defineProperty(r,"toString",{value:()=>r.message,enumerable:!1})},st=et("$ZodError",nt),at=et("$ZodError",nt,{Parent:Error});function it(r,e){const t=function(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>n({issues:o}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(r),s}const Jt=(r=>(e,t,s)=>{const n=s?{...s,async:!1}:{async:!1},a=e._zod.run({value:t,issues:[]},n);if(a instanceof Promise)throw new Lt;return a.issues.length?{success:!1,error:new(r??st)(a.issues.map(i=>rt(i,n,tt())))}:{success:!0,data:a.value}})(at),Wt=(r=>async(e,t,s)=>{const n=s?Object.assign(s,{async:!0}):{async:!0};let a=e._zod.run({value:t,issues:[]},n);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new r(a.issues.map(i=>rt(i,n,tt())))}:{success:!0,data:a.value}})(at);class ot{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const s=t[0];if(this._map.set(e,s),s&&typeof s=="object"&&"id"in s){if(this._idmap.has(s.id))throw new Error(`ID ${s.id} already exists in the registry`);this._idmap.set(s.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const s={...this.get(t)??{}};return delete s.id,{...s,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function qt(){return new ot}const Gt=qt();class ct{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Gt,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var s;const n=e._zod.def,a={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,t.schemaPath.includes(e)&&(i.cycle=t.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,o);const c=e._zod.toJSONSchema?.();if(c)o.schema=c;else{const h={...t,schemaPath:[...t.schemaPath,e],path:t.path},w=e._zod.parent;if(w)o.ref=w,this.process(w,h),this.seen.get(w).isParent=!0;else{const x=o.schema;switch(n.type){case"string":{const d=x;d.type="string";const{minimum:p,maximum:y,format:k,patterns:C,contentEncoding:R}=e._zod.bag;if(typeof p=="number"&&(d.minLength=p),typeof y=="number"&&(d.maxLength=y),k&&(d.format=a[k]??k,d.format===""&&delete d.format),R&&(d.contentEncoding=R),C&&C.size>0){const P=[...C];P.length===1?d.pattern=P[0].source:P.length>1&&(o.schema.allOf=[...P.map(A=>({...this.target==="draft-7"?{type:"string"}:{},pattern:A.source}))])}break}case"number":{const d=x,{minimum:p,maximum:y,format:k,multipleOf:C,exclusiveMaximum:R,exclusiveMinimum:P}=e._zod.bag;typeof k=="string"&&k.includes("int")?d.type="integer":d.type="number",typeof P=="number"&&(d.exclusiveMinimum=P),typeof p=="number"&&(d.minimum=p,typeof P=="number"&&(P>=p?delete d.minimum:delete d.exclusiveMinimum)),typeof R=="number"&&(d.exclusiveMaximum=R),typeof y=="number"&&(d.maximum=y,typeof R=="number"&&(R<=y?delete d.maximum:delete d.exclusiveMaximum)),typeof C=="number"&&(d.multipleOf=C);break}case"boolean":{const d=x;d.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{x.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{x.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const d=x,{minimum:p,maximum:y}=e._zod.bag;typeof p=="number"&&(d.minItems=p),typeof y=="number"&&(d.maxItems=y),d.type="array",d.items=this.process(n.element,{...h,path:[...h.path,"items"]});break}case"object":{const d=x;d.type="object",d.properties={};const p=n.shape;for(const C in p)d.properties[C]=this.process(p[C],{...h,path:[...h.path,"properties",C]});const y=new Set(Object.keys(p)),k=new Set([...y].filter(C=>{const R=n.shape[C]._zod;return this.io==="input"?R.optin===void 0:R.optout===void 0}));k.size>0&&(d.required=Array.from(k)),n.catchall?._zod.def.type==="never"?d.additionalProperties=!1:n.catchall?n.catchall&&(d.additionalProperties=this.process(n.catchall,{...h,path:[...h.path,"additionalProperties"]})):this.io==="output"&&(d.additionalProperties=!1);break}case"union":{const d=x;d.anyOf=n.options.map((p,y)=>this.process(p,{...h,path:[...h.path,"anyOf",y]}));break}case"intersection":{const d=x,p=this.process(n.left,{...h,path:[...h.path,"allOf",0]}),y=this.process(n.right,{...h,path:[...h.path,"allOf",1]}),k=R=>"allOf"in R&&Object.keys(R).length===1,C=[...k(p)?p.allOf:[p],...k(y)?y.allOf:[y]];d.allOf=C;break}case"tuple":{const d=x;d.type="array";const p=n.items.map((C,R)=>this.process(C,{...h,path:[...h.path,"prefixItems",R]}));if(this.target==="draft-2020-12"?d.prefixItems=p:d.items=p,n.rest){const C=this.process(n.rest,{...h,path:[...h.path,"items"]});this.target==="draft-2020-12"?d.items=C:d.additionalItems=C}n.rest&&(d.items=this.process(n.rest,{...h,path:[...h.path,"items"]}));const{minimum:y,maximum:k}=e._zod.bag;typeof y=="number"&&(d.minItems=y),typeof k=="number"&&(d.maxItems=k);break}case"record":{const d=x;d.type="object",d.propertyNames=this.process(n.keyType,{...h,path:[...h.path,"propertyNames"]}),d.additionalProperties=this.process(n.valueType,{...h,path:[...h.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const d=x,p=Ft(n.entries);p.every(y=>typeof y=="number")&&(d.type="number"),p.every(y=>typeof y=="string")&&(d.type="string"),d.enum=p;break}case"literal":{const d=x,p=[];for(const y of n.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");p.push(Number(y))}else p.push(y);if(p.length!==0)if(p.length===1){const y=p[0];d.type=y===null?"null":typeof y,d.const=y}else p.every(y=>typeof y=="number")&&(d.type="number"),p.every(y=>typeof y=="string")&&(d.type="string"),p.every(y=>typeof y=="boolean")&&(d.type="string"),p.every(y=>y===null)&&(d.type="null"),d.enum=p;break}case"file":{const d=x,p={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:k,mime:C}=e._zod.bag;y!==void 0&&(p.minLength=y),k!==void 0&&(p.maxLength=k),C?C.length===1?(p.contentMediaType=C[0],Object.assign(d,p)):d.anyOf=C.map(R=>({...p,contentMediaType:R})):Object.assign(d,p);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const d=this.process(n.innerType,h);x.anyOf=[d,{type:"null"}];break}case"nonoptional":{this.process(n.innerType,h),o.ref=n.innerType;break}case"success":{const d=x;d.type="boolean";break}case"default":{this.process(n.innerType,h),o.ref=n.innerType,x.default=JSON.parse(JSON.stringify(n.defaultValue));break}case"prefault":{this.process(n.innerType,h),o.ref=n.innerType,this.io==="input"&&(x._prefault=JSON.parse(JSON.stringify(n.defaultValue)));break}case"catch":{this.process(n.innerType,h),o.ref=n.innerType;let d;try{d=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}x.default=d;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const d=x,p=e._zod.pattern;if(!p)throw new Error("Pattern not found in template literal");d.type="string",d.pattern=p.source;break}case"pipe":{const d=this.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;this.process(d,h),o.ref=d;break}case"readonly":{this.process(n.innerType,h),o.ref=n.innerType,x.readOnly=!0;break}case"promise":{this.process(n.innerType,h),o.ref=n.innerType;break}case"optional":{this.process(n.innerType,h),o.ref=n.innerType;break}case"lazy":{const d=e._zod.innerType;this.process(d,h),o.ref=d;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const l=this.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),this.io==="input"&&z(e)&&(delete o.schema.examples,delete o.schema.default),this.io==="input"&&o.schema._prefault&&((s=o.schema).default??(s.default=o.schema._prefault)),delete o.schema._prefault,this.seen.get(e).schema}emit(e,t){const s={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},n=this.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=f=>{const h=this.target==="draft-2020-12"?"$defs":"definitions";if(s.external){const p=s.external.registry.get(f[0])?.id,y=s.external.uri??(C=>C);if(p)return{ref:y(p)};const k=f[1].defId??f[1].schema.id??`schema${this.counter++}`;return f[1].defId=k,{defId:k,ref:`${y("__shared")}#/${h}/${k}`}}if(f[1]===n)return{ref:"#"};const x=`#/${h}/`,d=f[1].schema.id??`__schema${this.counter++}`;return{defId:d,ref:x+d}},i=f=>{if(f[1].schema.$ref)return;const h=f[1],{ref:w,defId:x}=a(f);h.def={...h.schema},x&&(h.defId=x);const d=h.schema;for(const p in d)delete d[p];d.$ref=w};if(s.cycles==="throw")for(const f of this.seen.entries()){const h=f[1];if(h.cycle)throw new Error(`Cycle detected: #/${h.cycle?.join("/")}/<root>
1
+ (function(U,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],u):(U=typeof globalThis<"u"?globalThis:U||self,u(U["@volverjs/form-vue"]={},U.Vue,U.VueUseCore))})(this,function(U,u,Ve){"use strict";var E=(r=>(r.text="text",r.number="number",r.email="email",r.password="password",r.tel="tel",r.url="url",r.search="search",r.date="date",r.time="time",r.datetimeLocal="datetime-local",r.month="month",r.week="week",r.color="color",r.select="select",r.checkbox="checkbox",r.radio="radio",r.textarea="textarea",r.radioGroup="radioGroup",r.checkboxGroup="checkboxGroup",r.combobox="combobox",r.custom="custom",r))(E||{}),L=(r=>(r.invalid="invalid",r.valid="valid",r.submitting="submitting",r.reset="reset",r.updated="updated",r.unknown="unknown",r))(L||{}),V;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{const a={};for(const i of n)a[i]=i;return a},r.getValidEnumValues=n=>{const a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const a=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(const i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(V||(V={}));var Ze;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ze||(Ze={}));const g=V.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Y=r=>{switch(typeof r){case"undefined":return g.undefined;case"string":return g.string;case"number":return Number.isNaN(r)?g.nan:g.number;case"boolean":return g.boolean;case"function":return g.function;case"bigint":return g.bigint;case"symbol":return g.symbol;case"object":return Array.isArray(r)?g.array:r===null?g.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?g.promise:typeof Map<"u"&&r instanceof Map?g.map:typeof Set<"u"&&r instanceof Set?g.set:typeof Date<"u"&&r instanceof Date?g.date:g.object;default:return g.unknown}},m=V.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 W extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};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(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(this),s}static assert(e){if(!(e instanceof W))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,V.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}W.create=r=>new W(r);const Se=(r,e)=>{let t;switch(r.code){case m.invalid_type:r.received===g.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case m.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,V.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:t=`Unrecognized key(s) in object: ${V.joinValues(r.keys,", ")}`;break;case m.invalid_union:t="Invalid input";break;case m.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${V.joinValues(r.options)}`;break;case m.invalid_enum_value:t=`Invalid enum value. Expected ${V.joinValues(r.options)}, received '${r.received}'`;break;case m.invalid_arguments:t="Invalid function arguments";break;case m.invalid_return_type:t="Invalid function return type";break;case m.invalid_date:t="Invalid date";break;case m.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:V.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case m.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case m.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case m.custom:t="Invalid input";break;case m.invalid_intersection_types:t="Intersection results could not be merged";break;case m.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case m.not_finite:t="Number must be finite";break;default:t=e.defaultError,V.assertNever(r)}return{message:t}};let mt=Se;function yt(){return mt}const vt=r=>{const{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="";const c=s.filter(l=>!!l).slice().reverse();for(const l of c)o=l(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}};function v(r,e){const t=yt(),s=vt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Se?void 0:Se].filter(n=>!!n)});r.common.issues.push(s)}class M{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if(n.status==="aborted")return j;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const n of t){const a=await n.key,i=await n.value;s.push({key:a,value:i})}return M.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return j;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const j=Object.freeze({status:"aborted"}),oe=r=>({status:"dirty",value:r}),F=r=>({status:"valid",value:r}),$e=r=>r.status==="aborted",Pe=r=>r.status==="dirty",re=r=>r.status==="valid",fe=r=>typeof Promise<"u"&&r instanceof Promise;var b;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(b||(b={}));class q{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}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 De=(r,e)=>{if(re(e))return{success:!0,data:e.value};if(!r.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 W(r.common.issues);return this._error=t,this._error}}};function T(r){if(!r)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{const{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:n}}class N{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 M,ctx:{common:e.parent.common,data:e.data,parsedType:Y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(fe(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:Y(e)},n=this._parseSync({data:e,path:s.path,parent:s});return De(s,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)};if(!this["~standard"].async)try{const s=this._parseSync({data:e,path:[],parent:t});return re(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>re(s)?{value:s.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:Y(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(fe(n)?n:Promise.resolve(n));return De(s,a)}refine(e,t){const s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{const i=e(n),o=()=>a.addIssue({code:m.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new Q({schema:this,typeName:S.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return G.create(this,this._def)}nullable(){return X.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return B.create(this)}promise(){return ve.create(this,this._def)}or(e){return pe.create([this,e],this._def)}and(e){return me.create(this,e,this._def)}transform(e){return new Q({...T(this._def),schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ge({...T(this._def),innerType:this,defaultValue:t,typeName:S.ZodDefault})}brand(){return new Mt({typeName:S.ZodBranded,type:this,...T(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ce({...T(this._def),innerType:this,catchValue:t,typeName:S.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ne.create(this,e)}readonly(){return Re.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gt=/^c[^\s-]{8,}$/i,_t=/^[0-9a-z]+$/,bt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xt=/^[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,kt=/^[a-z0-9_-]{21}$/i,wt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ot=/^[-+]?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)?)??$/,St=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,jt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let je;const Tt=/^(?:(?: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])$/,Ct=/^(?:(?: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])$/,Nt=/^(([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]))$/,Rt=/^(([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])$/,It=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Et=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ze="((\\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])))",At=new RegExp(`^${ze}$`);function Me(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);const t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Vt(r){return new RegExp(`^${Me(r)}$`)}function Zt(r){let e=`${ze}T${Me(r)}`;const t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function $t(r,e){return!!((e==="v4"||!e)&&Tt.test(r)||(e==="v6"||!e)&&Nt.test(r))}function Pt(r,e){if(!wt.test(r))return!1;try{const[t]=r.split(".");if(!t)return!1;const s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Dt(r,e){return!!((e==="v4"||!e)&&Ct.test(r)||(e==="v6"||!e)&&Rt.test(r))}class K extends N{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==g.string){const a=this._getOrReturnCtx(e);return v(a,{code:m.invalid_type,expected:g.string,received:a.parsedType}),j}const s=new M;let n;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:m.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:m.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?v(n,{code:m.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&v(n,{code:m.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")St.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"email",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")je||(je=new RegExp(jt,"u")),je.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"emoji",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")xt.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"uuid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")kt.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"nanoid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")gt.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")_t.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cuid2",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")bt.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ulid",code:m.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),v(n,{validation:"url",code:m.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"regex",code:m.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?Zt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?At.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Vt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{code:m.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"duration",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?$t(e.data,a.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"ip",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Pt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"jwt",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Dt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"cidr",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?It.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64",code:m.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Et.test(e.data)||(n=this._getOrReturnCtx(e,n),v(n,{validation:"base64url",code:m.invalid_string,message:a.message}),s.dirty()):V.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:m.invalid_string,...b.errToObj(s)})}_addCheck(e){return new K({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...b.errToObj(e)})}url(e){return this._addCheck({kind:"url",...b.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...b.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...b.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...b.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...b.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...b.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...b.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...b.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...b.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...b.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...b.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...b.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...b.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...b.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...b.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...b.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...b.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...b.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...b.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...b.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...b.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...b.errToObj(t)})}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new K({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new K({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new K({...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(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}K.create=r=>new K({checks:[],typeName:S.ZodString,coerce:r?.coerce??!1,...T(r)});function zt(r,e){const t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}class ce extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==g.number){const a=this._getOrReturnCtx(e);return v(a,{code:m.invalid_type,expected:g.number,received:a.parsedType}),j}let s;const n=new M;for(const a of this._def.checks)a.kind==="int"?V.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),v(s,{code:m.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?zt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),v(s,{code:m.not_finite,message:a.message}),n.dirty()):V.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,s,n){return new ce({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:b.toString(n)}]})}_addCheck(e){return new ce({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const 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"&&V.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ce.create=r=>new ce({checks:[],typeName:S.ZodNumber,coerce:r?.coerce||!1,...T(r)});class ue extends N{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)!==g.bigint)return this._getInvalidInput(e);let s;const n=new M;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),v(s,{code:m.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):V.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return v(t,{code:m.invalid_type,expected:g.bigint,received:t.parsedType}),j}gte(e,t){return this.setLimit("min",e,!0,b.toString(t))}gt(e,t){return this.setLimit("min",e,!1,b.toString(t))}lte(e,t){return this.setLimit("max",e,!0,b.toString(t))}lt(e,t){return this.setLimit("max",e,!1,b.toString(t))}setLimit(e,t,s,n){return new ue({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:b.toString(n)}]})}_addCheck(e){return new ue({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}ue.create=r=>new ue({checks:[],typeName:S.ZodBigInt,coerce:r?.coerce??!1,...T(r)});class Le extends N{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==g.boolean){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.boolean,received:s.parsedType}),j}return F(e.data)}}Le.create=r=>new Le({typeName:S.ZodBoolean,coerce:r?.coerce||!1,...T(r)});class he extends N{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==g.date){const a=this._getOrReturnCtx(e);return v(a,{code:m.invalid_type,expected:g.date,received:a.parsedType}),j}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return v(a,{code:m.invalid_date}),j}const s=new M;let n;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:m.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),v(n,{code:m.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):V.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}he.create=r=>new he({checks:[],coerce:r?.coerce||!1,typeName:S.ZodDate,...T(r)});class Ue extends N{_parse(e){if(this._getType(e)!==g.symbol){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.symbol,received:s.parsedType}),j}return F(e.data)}}Ue.create=r=>new Ue({typeName:S.ZodSymbol,...T(r)});class Fe extends N{_parse(e){if(this._getType(e)!==g.undefined){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.undefined,received:s.parsedType}),j}return F(e.data)}}Fe.create=r=>new Fe({typeName:S.ZodUndefined,...T(r)});class Be extends N{_parse(e){if(this._getType(e)!==g.null){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.null,received:s.parsedType}),j}return F(e.data)}}Be.create=r=>new Be({typeName:S.ZodNull,...T(r)});class Je extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return F(e.data)}}Je.create=r=>new Je({typeName:S.ZodAny,...T(r)});class We extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return F(e.data)}}We.create=r=>new We({typeName:S.ZodUnknown,...T(r)});class H extends N{_parse(e){const t=this._getOrReturnCtx(e);return v(t,{code:m.invalid_type,expected:g.never,received:t.parsedType}),j}}H.create=r=>new H({typeName:S.ZodNever,...T(r)});class qe extends N{_parse(e){if(this._getType(e)!==g.undefined){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.void,received:s.parsedType}),j}return F(e.data)}}qe.create=r=>new qe({typeName:S.ZodVoid,...T(r)});class B extends N{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==g.array)return v(t,{code:m.invalid_type,expected:g.array,received:t.parsedType}),j;if(n.exactLength!==null){const i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(v(t,{code:i?m.too_big:m.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(v(t,{code:m.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(v(t,{code:m.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((i,o)=>n.type._parseAsync(new q(t,i,t.path,o)))).then(i=>M.mergeArray(s,i));const a=[...t.data].map((i,o)=>n.type._parseSync(new q(t,i,t.path,o)));return M.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new B({...this._def,minLength:{value:e,message:b.toString(t)}})}max(e,t){return new B({...this._def,maxLength:{value:e,message:b.toString(t)}})}length(e,t){return new B({...this._def,exactLength:{value:e,message:b.toString(t)}})}nonempty(e){return this.min(1,e)}}B.create=(r,e)=>new B({type:r,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray,...T(e)});function ne(r){if(r instanceof $){const e={};for(const t in r.shape){const s=r.shape[t];e[t]=G.create(ne(s))}return new $({...r._def,shape:()=>e})}else return r instanceof B?new B({...r._def,type:ne(r.element)}):r instanceof G?G.create(ne(r.unwrap())):r instanceof X?X.create(ne(r.unwrap())):r instanceof te?te.create(r.items.map(e=>ne(e))):r}class $ extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=V.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==g.object){const l=this._getOrReturnCtx(e);return v(l,{code:m.invalid_type,expected:g.object,received:l.parsedType}),j}const{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof H&&this._def.unknownKeys==="strip"))for(const l in n.data)i.includes(l)||o.push(l);const c=[];for(const l of i){const f=a[l],h=n.data[l];c.push({key:{status:"valid",value:l},value:f._parse(new q(n,h,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof H){const l=this._def.unknownKeys;if(l==="passthrough")for(const f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:n.data[f]}});else if(l==="strict")o.length>0&&(v(n,{code:m.unrecognized_keys,keys:o}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const f of o){const h=n.data[f];c.push({key:{status:"valid",value:f},value:l._parse(new q(n,h,n.path,f)),alwaysSet:f in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const f of c){const h=await f.key,w=await f.value;l.push({key:h,value:w,alwaysSet:f.alwaysSet})}return l}).then(l=>M.mergeObjectSync(s,l)):M.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return b.errToObj,new $({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{const n=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:b.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new $({...this._def,unknownKeys:"strip"})}passthrough(){return new $({...this._def,unknownKeys:"passthrough"})}extend(e){return new $({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new $({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:S.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new $({...this._def,catchall:e})}pick(e){const t={};for(const s of V.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new $({...this._def,shape:()=>t})}omit(e){const t={};for(const s of V.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new $({...this._def,shape:()=>t})}deepPartial(){return ne(this)}partial(e){const t={};for(const s of V.objectKeys(this.shape)){const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new $({...this._def,shape:()=>t})}required(e){const t={};for(const s of V.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof G;)a=a._def.innerType;t[s]=a}return new $({...this._def,shape:()=>t})}keyof(){return He(V.objectKeys(this.shape))}}$.create=(r,e)=>new $({shape:()=>r,unknownKeys:"strip",catchall:H.create(),typeName:S.ZodObject,...T(e)}),$.strictCreate=(r,e)=>new $({shape:()=>r,unknownKeys:"strict",catchall:H.create(),typeName:S.ZodObject,...T(e)}),$.lazycreate=(r,e)=>new $({shape:r,unknownKeys:"strip",catchall:H.create(),typeName:S.ZodObject,...T(e)});class pe extends N{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new W(o.ctx.common.issues));return v(t,{code:m.invalid_union,unionErrors:i}),j}if(t.common.async)return Promise.all(s.map(async a=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a;const i=[];for(const c of s){const l={...t,common:{...t.common,issues:[]},parent:null},f=c._parseSync({data:t.data,path:t.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new W(c));return v(t,{code:m.invalid_union,unionErrors:o}),j}}get options(){return this._def.options}}pe.create=(r,e)=>new pe({options:r,typeName:S.ZodUnion,...T(e)});function Te(r,e){const t=Y(r),s=Y(e);if(r===e)return{valid:!0,data:r};if(t===g.object&&s===g.object){const n=V.objectKeys(e),a=V.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(const o of a){const c=Te(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===g.array&&s===g.array){if(r.length!==e.length)return{valid:!1};const n=[];for(let a=0;a<r.length;a++){const i=r[a],o=e[a],c=Te(i,o);if(!c.valid)return{valid:!1};n.push(c.data)}return{valid:!0,data:n}}else return t===g.date&&s===g.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}class me extends N{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if($e(a)||$e(i))return j;const o=Te(a.value,i.value);return o.valid?((Pe(a)||Pe(i))&&t.dirty(),{status:t.value,value:o.data}):(v(s,{code:m.invalid_intersection_types}),j)};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(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}me.create=(r,e,t)=>new me({left:r,right:e,typeName:S.ZodIntersection,...T(t)});class te extends N{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==g.array)return v(s,{code:m.invalid_type,expected:g.array,received:s.parsedType}),j;if(s.data.length<this._def.items.length)return v(s,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),j;!this._def.rest&&s.data.length>this._def.items.length&&(v(s,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new q(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>M.mergeArray(t,i)):M.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new te({...this._def,rest:e})}}te.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new te({items:r,typeName:S.ZodTuple,rest:null,...T(e)})};class ye extends N{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!==g.object)return v(s,{code:m.invalid_type,expected:g.object,received:s.parsedType}),j;const n=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)n.push({key:a._parse(new q(s,o,s.path,o)),value:i._parse(new q(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?M.mergeObjectAsync(t,n):M.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof N?new ye({keyType:e,valueType:t,typeName:S.ZodRecord,...T(s)}):new ye({keyType:K.create(),valueType:e,typeName:S.ZodRecord,...T(t)})}}class Ge extends N{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!==g.map)return v(s,{code:m.invalid_type,expected:g.map,received:s.parsedType}),j;const n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,c],l)=>({key:n._parse(new q(s,o,s.path,[l,"key"])),value:a._parse(new q(s,c,s.path,[l,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const l=await c.key,f=await c.value;if(l.status==="aborted"||f.status==="aborted")return j;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(l.value,f.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const c of i){const l=c.key,f=c.value;if(l.status==="aborted"||f.status==="aborted")return j;(l.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(l.value,f.value)}return{status:t.value,value:o}}}}Ge.create=(r,e,t)=>new Ge({valueType:e,keyType:r,typeName:S.ZodMap,...T(t)});class de extends N{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==g.set)return v(s,{code:m.invalid_type,expected:g.set,received:s.parsedType}),j;const n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(v(s,{code:m.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(v(s,{code:m.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const l=new Set;for(const f of c){if(f.status==="aborted")return j;f.status==="dirty"&&t.dirty(),l.add(f.value)}return{status:t.value,value:l}}const o=[...s.data.values()].map((c,l)=>a._parse(new q(s,c,s.path,l)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new de({...this._def,minSize:{value:e,message:b.toString(t)}})}max(e,t){return new de({...this._def,maxSize:{value:e,message:b.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}de.create=(r,e)=>new de({valueType:r,minSize:null,maxSize:null,typeName:S.ZodSet,...T(e)});class Ke extends N{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})}}Ke.create=(r,e)=>new Ke({getter:r,typeName:S.ZodLazy,...T(e)});class Ye extends N{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),j}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ye.create=(r,e)=>new Ye({value:r,typeName:S.ZodLiteral,...T(e)});function He(r,e){return new se({values:r,typeName:S.ZodEnum,...T(e)})}class se extends N{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return v(t,{expected:V.joinValues(s),received:t.parsedType,code:m.invalid_type}),j}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 v(t,{received:t.data,code:m.invalid_enum_value,options:s}),j}return F(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 se.create(e,{...this._def,...t})}exclude(e,t=this._def){return se.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}}se.create=He;class Qe extends N{_parse(e){const t=V.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==g.string&&s.parsedType!==g.number){const n=V.objectValues(t);return v(s,{expected:V.joinValues(n),received:s.parsedType,code:m.invalid_type}),j}if(this._cache||(this._cache=new Set(V.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const n=V.objectValues(t);return v(s,{received:s.data,code:m.invalid_enum_value,options:n}),j}return F(e.data)}get enum(){return this._def.values}}Qe.create=(r,e)=>new Qe({values:r,typeName:S.ZodNativeEnum,...T(e)});class ve extends N{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==g.promise&&t.common.async===!1)return v(t,{code:m.invalid_type,expected:g.promise,received:t.parsedType}),j;const s=t.parsedType===g.promise?t.data:Promise.resolve(t.data);return F(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}}ve.create=(r,e)=>new ve({type:r,typeName:S.ZodPromise,...T(e)});class Q extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{v(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){const i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return j;const c=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?j:c.status==="dirty"||t.value==="dirty"?oe(c.value):c});{if(t.value==="aborted")return j;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?j:o.status==="dirty"||t.value==="dirty"?oe(o.value):o}}if(n.type==="refinement"){const i=o=>{const c=n.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?j:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!re(i))return j;const o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>re(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):j);V.assertNever(n)}}Q.create=(r,e,t)=>new Q({schema:r,typeName:S.ZodEffects,effect:e,...T(t)}),Q.createWithPreprocess=(r,e,t)=>new Q({schema:e,effect:{type:"preprocess",transform:r},typeName:S.ZodEffects,...T(t)});class G extends N{_parse(e){return this._getType(e)===g.undefined?F(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}G.create=(r,e)=>new G({innerType:r,typeName:S.ZodOptional,...T(e)});class X extends N{_parse(e){return this._getType(e)===g.null?F(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}X.create=(r,e)=>new X({innerType:r,typeName:S.ZodNullable,...T(e)});class ge extends N{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===g.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ge.create=(r,e)=>new ge({innerType:r,typeName:S.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});class Ce extends N{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return fe(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new W(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new W(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Ce.create=(r,e)=>new Ce({innerType:r,typeName:S.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});class Xe extends N{_parse(e){if(this._getType(e)!==g.nan){const s=this._getOrReturnCtx(e);return v(s,{code:m.invalid_type,expected:g.nan,received:s.parsedType}),j}return{status:"valid",value:e.data}}}Xe.create=r=>new Xe({typeName:S.ZodNaN,...T(r)});class Mt extends N{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ne extends N{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?j:a.status==="dirty"?(t.dirty(),oe(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{const n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?j:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new Ne({in:e,out:t,typeName:S.ZodPipeline})}}class Re extends N{_parse(e){const t=this._def.innerType._parse(e),s=n=>(re(n)&&(n.value=Object.freeze(n.value)),n);return fe(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}}Re.create=(r,e)=>new Re({innerType:r,typeName:S.ZodReadonly,...T(e)});var S;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(S||(S={})),K.create,H.create,B.create,pe.create,me.create,te.create,se.create,ve.create,G.create,X.create;function et(r,e,t){function s(o,c){var l;Object.defineProperty(o,"_zod",{value:o._zod??{},enumerable:!1}),(l=o._zod).traits??(l.traits=new Set),o._zod.traits.add(r),e(o,c);for(const f in i.prototype)f in o||Object.defineProperty(o,f,{value:i.prototype[f].bind(o)});o._zod.constr=i,o._zod.def=c}const n=t?.Parent??Object;class a extends n{}Object.defineProperty(a,"name",{value:r});function i(o){var c;const l=t?.Parent?new a:this;s(l,o),(c=l._zod).deferred??(c.deferred=[]);for(const f of l._zod.deferred)f();return l}return Object.defineProperty(i,"init",{value:s}),Object.defineProperty(i,Symbol.hasInstance,{value:o=>t?.Parent&&o instanceof t.Parent?!0:o?._zod?.traits?.has(r)}),Object.defineProperty(i,"name",{value:r}),i}class Lt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Ut={};function tt(r){return Ut}function Ft(r){const e=Object.values(r).filter(s=>typeof s=="number");return Object.entries(r).filter(([s,n])=>e.indexOf(+s)===-1).map(([s,n])=>n)}function Bt(r,e){return typeof e=="bigint"?e.toString():e}function _e(r){return typeof r=="string"?r:r?.message}function rt(r,e,t){const s={...r,path:r.path??[]};if(!r.message){const n=_e(r.inst?._zod.def?.error?.(r))??_e(e?.error?.(r))??_e(t.customError?.(r))??_e(t.localeError?.(r))??"Invalid input";s.message=n}return delete s.inst,delete s.continue,e?.reportInput||delete s.input,s}const nt=(r,e)=>{r.name="$ZodError",Object.defineProperty(r,"_zod",{value:r._zod,enumerable:!1}),Object.defineProperty(r,"issues",{value:e,enumerable:!1}),r.message=JSON.stringify(e,Bt,2),Object.defineProperty(r,"toString",{value:()=>r.message,enumerable:!1})},st=et("$ZodError",nt),at=et("$ZodError",nt,{Parent:Error});function it(r,e){const t=function(a){return a.message},s={_errors:[]},n=a=>{for(const i of a.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(o=>n({issues:o}));else if(i.code==="invalid_key")n({issues:i.issues});else if(i.code==="invalid_element")n({issues:i.issues});else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const l=i.path[c];c===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(t(i))):o[l]=o[l]||{_errors:[]},o=o[l],c++}}};return n(r),s}const Jt=(r=>(e,t,s)=>{const n=s?{...s,async:!1}:{async:!1},a=e._zod.run({value:t,issues:[]},n);if(a instanceof Promise)throw new Lt;return a.issues.length?{success:!1,error:new(r??st)(a.issues.map(i=>rt(i,n,tt())))}:{success:!0,data:a.value}})(at),Wt=(r=>async(e,t,s)=>{const n=s?Object.assign(s,{async:!0}):{async:!0};let a=e._zod.run({value:t,issues:[]},n);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new r(a.issues.map(i=>rt(i,n,tt())))}:{success:!0,data:a.value}})(at);class ot{constructor(){this._map=new Map,this._idmap=new Map}add(e,...t){const s=t[0];if(this._map.set(e,s),s&&typeof s=="object"&&"id"in s){if(this._idmap.has(s.id))throw new Error(`ID ${s.id} already exists in the registry`);this._idmap.set(s.id,e)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const s={...this.get(t)??{}};delete s.id;const n={...s,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function qt(){return new ot}const Gt=qt();class ct{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??Gt,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var s;const n=e._zod.def,a={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(e);if(i)return i.count++,t.schemaPath.includes(e)&&(i.cycle=t.path),i.schema;const o={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,o);const c=e._zod.toJSONSchema?.();if(c)o.schema=c;else{const h={...t,schemaPath:[...t.schemaPath,e],path:t.path},w=e._zod.parent;if(w)o.ref=w,this.process(w,h),this.seen.get(w).isParent=!0;else{const x=o.schema;switch(n.type){case"string":{const d=x;d.type="string";const{minimum:p,maximum:y,format:k,patterns:C,contentEncoding:R}=e._zod.bag;if(typeof p=="number"&&(d.minLength=p),typeof y=="number"&&(d.maxLength=y),k&&(d.format=a[k]??k,d.format===""&&delete d.format),R&&(d.contentEncoding=R),C&&C.size>0){const P=[...C];P.length===1?d.pattern=P[0].source:P.length>1&&(o.schema.allOf=[...P.map(A=>({...this.target==="draft-7"?{type:"string"}:{},pattern:A.source}))])}break}case"number":{const d=x,{minimum:p,maximum:y,format:k,multipleOf:C,exclusiveMaximum:R,exclusiveMinimum:P}=e._zod.bag;typeof k=="string"&&k.includes("int")?d.type="integer":d.type="number",typeof P=="number"&&(d.exclusiveMinimum=P),typeof p=="number"&&(d.minimum=p,typeof P=="number"&&(P>=p?delete d.minimum:delete d.exclusiveMinimum)),typeof R=="number"&&(d.exclusiveMaximum=R),typeof y=="number"&&(d.maximum=y,typeof R=="number"&&(R<=y?delete d.maximum:delete d.exclusiveMaximum)),typeof C=="number"&&(d.multipleOf=C);break}case"boolean":{const d=x;d.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{x.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{x.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const d=x,{minimum:p,maximum:y}=e._zod.bag;typeof p=="number"&&(d.minItems=p),typeof y=="number"&&(d.maxItems=y),d.type="array",d.items=this.process(n.element,{...h,path:[...h.path,"items"]});break}case"object":{const d=x;d.type="object",d.properties={};const p=n.shape;for(const C in p)d.properties[C]=this.process(p[C],{...h,path:[...h.path,"properties",C]});const y=new Set(Object.keys(p)),k=new Set([...y].filter(C=>{const R=n.shape[C]._zod;return this.io==="input"?R.optin===void 0:R.optout===void 0}));k.size>0&&(d.required=Array.from(k)),n.catchall?._zod.def.type==="never"?d.additionalProperties=!1:n.catchall?n.catchall&&(d.additionalProperties=this.process(n.catchall,{...h,path:[...h.path,"additionalProperties"]})):this.io==="output"&&(d.additionalProperties=!1);break}case"union":{const d=x;d.anyOf=n.options.map((p,y)=>this.process(p,{...h,path:[...h.path,"anyOf",y]}));break}case"intersection":{const d=x,p=this.process(n.left,{...h,path:[...h.path,"allOf",0]}),y=this.process(n.right,{...h,path:[...h.path,"allOf",1]}),k=R=>"allOf"in R&&Object.keys(R).length===1,C=[...k(p)?p.allOf:[p],...k(y)?y.allOf:[y]];d.allOf=C;break}case"tuple":{const d=x;d.type="array";const p=n.items.map((C,R)=>this.process(C,{...h,path:[...h.path,"prefixItems",R]}));if(this.target==="draft-2020-12"?d.prefixItems=p:d.items=p,n.rest){const C=this.process(n.rest,{...h,path:[...h.path,"items"]});this.target==="draft-2020-12"?d.items=C:d.additionalItems=C}n.rest&&(d.items=this.process(n.rest,{...h,path:[...h.path,"items"]}));const{minimum:y,maximum:k}=e._zod.bag;typeof y=="number"&&(d.minItems=y),typeof k=="number"&&(d.maxItems=k);break}case"record":{const d=x;d.type="object",d.propertyNames=this.process(n.keyType,{...h,path:[...h.path,"propertyNames"]}),d.additionalProperties=this.process(n.valueType,{...h,path:[...h.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const d=x,p=Ft(n.entries);p.every(y=>typeof y=="number")&&(d.type="number"),p.every(y=>typeof y=="string")&&(d.type="string"),d.enum=p;break}case"literal":{const d=x,p=[];for(const y of n.values)if(y===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof y=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");p.push(Number(y))}else p.push(y);if(p.length!==0)if(p.length===1){const y=p[0];d.type=y===null?"null":typeof y,d.const=y}else p.every(y=>typeof y=="number")&&(d.type="number"),p.every(y=>typeof y=="string")&&(d.type="string"),p.every(y=>typeof y=="boolean")&&(d.type="string"),p.every(y=>y===null)&&(d.type="null"),d.enum=p;break}case"file":{const d=x,p={type:"string",format:"binary",contentEncoding:"binary"},{minimum:y,maximum:k,mime:C}=e._zod.bag;y!==void 0&&(p.minLength=y),k!==void 0&&(p.maxLength=k),C?C.length===1?(p.contentMediaType=C[0],Object.assign(d,p)):d.anyOf=C.map(R=>({...p,contentMediaType:R})):Object.assign(d,p);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const d=this.process(n.innerType,h);x.anyOf=[d,{type:"null"}];break}case"nonoptional":{this.process(n.innerType,h),o.ref=n.innerType;break}case"success":{const d=x;d.type="boolean";break}case"default":{this.process(n.innerType,h),o.ref=n.innerType,x.default=JSON.parse(JSON.stringify(n.defaultValue));break}case"prefault":{this.process(n.innerType,h),o.ref=n.innerType,this.io==="input"&&(x._prefault=JSON.parse(JSON.stringify(n.defaultValue)));break}case"catch":{this.process(n.innerType,h),o.ref=n.innerType;let d;try{d=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}x.default=d;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const d=x,p=e._zod.pattern;if(!p)throw new Error("Pattern not found in template literal");d.type="string",d.pattern=p.source;break}case"pipe":{const d=this.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;this.process(d,h),o.ref=d;break}case"readonly":{this.process(n.innerType,h),o.ref=n.innerType,x.readOnly=!0;break}case"promise":{this.process(n.innerType,h),o.ref=n.innerType;break}case"optional":{this.process(n.innerType,h),o.ref=n.innerType;break}case"lazy":{const d=e._zod.innerType;this.process(d,h),o.ref=d;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const l=this.metadataRegistry.get(e);return l&&Object.assign(o.schema,l),this.io==="input"&&z(e)&&(delete o.schema.examples,delete o.schema.default),this.io==="input"&&o.schema._prefault&&((s=o.schema).default??(s.default=o.schema._prefault)),delete o.schema._prefault,this.seen.get(e).schema}emit(e,t){const s={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},n=this.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=f=>{const h=this.target==="draft-2020-12"?"$defs":"definitions";if(s.external){const p=s.external.registry.get(f[0])?.id,y=s.external.uri??(C=>C);if(p)return{ref:y(p)};const k=f[1].defId??f[1].schema.id??`schema${this.counter++}`;return f[1].defId=k,{defId:k,ref:`${y("__shared")}#/${h}/${k}`}}if(f[1]===n)return{ref:"#"};const x=`#/${h}/`,d=f[1].schema.id??`__schema${this.counter++}`;return{defId:d,ref:x+d}},i=f=>{if(f[1].schema.$ref)return;const h=f[1],{ref:w,defId:x}=a(f);h.def={...h.schema},x&&(h.defId=x);const d=h.schema;for(const p in d)delete d[p];d.$ref=w};if(s.cycles==="throw")for(const f of this.seen.entries()){const h=f[1];if(h.cycle)throw new Error(`Cycle detected: #/${h.cycle?.join("/")}/<root>
2
2
 
3
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of this.seen.entries()){const h=f[1];if(e===f[0]){i(f);continue}if(s.external){const x=s.external.registry.get(f[0])?.id;if(e!==f[0]&&x){i(f);continue}}if(this.metadataRegistry.get(f[0])?.id){i(f);continue}if(h.cycle){i(f);continue}if(h.count>1&&s.reused==="ref"){i(f);continue}}const o=(f,h)=>{const w=this.seen.get(f),x=w.def??w.schema,d={...x};if(w.ref===null)return;const p=w.ref;if(w.ref=null,p){o(p,h);const y=this.seen.get(p).schema;y.$ref&&h.target==="draft-7"?(x.allOf=x.allOf??[],x.allOf.push(y)):(Object.assign(x,y),Object.assign(x,d))}w.isParent||this.override({zodSchema:f,jsonSchema:x,path:w.path??[]})};for(const f of[...this.seen.entries()].reverse())o(f[0],{target:this.target});const c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),s.external?.uri){const f=s.external.registry.get(e)?.id;if(!f)throw new Error("Schema is missing an `id` property");c.$id=s.external.uri(f)}Object.assign(c,n.def);const l=s.external?.defs??{};for(const f of this.seen.entries()){const h=f[1];h.def&&h.defId&&(l[h.defId]=h.def)}s.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?c.$defs=l:c.definitions=l);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}}function Kt(r,e){if(r instanceof ot){const s=new ct(e),n={};for(const o of r._idmap.entries()){const[c,l]=o;s.process(l)}const a={},i={registry:r,uri:e?.uri,defs:n};for(const o of r._idmap.entries()){const[c,l]=o;a[c]=s.emit(l,{...e,external:i})}if(Object.keys(n).length>0){const o=s.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[o]:n}}return{schemas:a}}const t=new ct(e);return t.process(r),t.emit(r,e)}function z(r,e){const t=e??{seen:new Set};if(t.seen.has(r))return!1;t.seen.add(r);const n=r._zod.def;switch(n.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return z(n.element,t);case"object":{for(const a in n.shape)if(z(n.shape[a],t))return!0;return!1}case"union":{for(const a of n.options)if(z(a,t))return!0;return!1}case"intersection":return z(n.left,t)||z(n.right,t);case"tuple":{for(const a of n.items)if(z(a,t))return!0;return!!(n.rest&&z(n.rest,t))}case"record":return z(n.keyType,t)||z(n.valueType,t);case"map":return z(n.keyType,t)||z(n.valueType,t);case"set":return z(n.valueType,t);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return z(n.innerType,t);case"lazy":return z(n.getter(),t);case"default":return z(n.innerType,t);case"prefault":return z(n.innerType,t);case"custom":return!1;case"transform":return!0;case"pipe":return z(n.in,t)||z(n.out,t);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${n.type}`)}const be=r=>{let e=r;for(;e instanceof Q;)e=e.innerType();return e instanceof G&&(e=e._def.innerType),e},Yt=r=>{let e=r;for(;e instanceof Q;)e=e.innerType();return e instanceof G||e instanceof X};function Ht(r){return Array.isArray(r)?"array":r===null?"null":typeof r}function Qt(r,e){const t=Ht(r);return e.type?e.type===t||e.type==="integer"&&t==="number"&&Number.isInteger(r):!0}function ae(r,e){if(r.anyOf&&Array.isArray(r.anyOf)){if(e!==void 0){for(const i of r.anyOf)if(Qt(e,i))return ae(i,e);for(const i of r.anyOf){const o=i;if(!o.type||o.type==="object")return ae(o,e)}}return ae(r.anyOf[0],e)}if(r.type!=="object"||!r.properties)switch(r.type){case"string":return typeof e=="string"?e:r.default;case"number":case"integer":return typeof e=="number"?e:r.default;case"boolean":return typeof e=="boolean"?e:r.default;case"null":return e===null?e:r.default;case"array":return Array.isArray(e)&&r.items?e.map(i=>ae(r.items,i)):r.default;default:return r.default}const t=r.properties,n=e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,a={};for(const i in t){const o=n?.[i];a[i]=ae(t[i],o)}if(n&&r.additionalProperties!==!1){const i=new Set(Object.keys(t));for(const[o,c]of Object.entries(n))i.has(o)||(a[o]=c)}return a}const xe=r=>"_zod"in r;function le(r,e={}){if(xe(r)){const n=Kt(r);if(n.type!=="object"||!n.properties)return e;const a=Jt(r,e);return ae(n,a.success?a.data:e)}const t=be(r);return t instanceof $?{...(t instanceof $?t._def.unknownKeys==="passthrough":!1)?e:{},...Object.fromEntries(("shape"in t?Object.entries(t.shape):[]).map(([n,a])=>{const i=e[n],o=Yt(a);let c=be(a),l;if(c instanceof ge&&(l=c._def.defaultValue(),c=c._def.innerType),i===null&&c instanceof X)return[n,i];if(i==null&&o)return[n,l];if(c instanceof N){const f=a.safeParse(i);if(f.success)return[n,f.data??l]}if(c instanceof B&&Array.isArray(i)&&i.length){const f=be(c._def.type);if(f instanceof $)return[n,i.map(h=>le(f,h&&typeof h=="object"?h:void 0))]}if(c instanceof ye&&i){const f=be(c._def.valueType);if(f instanceof $)return[n,Object.keys(i).reduce((h,w)=>(h[w]=le(f,i[w]),h),{})]}return c instanceof $?[n,le(c,i&&typeof i=="object"?i:l)]:[n,l]}))}:e}const Xt=(r,e)=>xe(r)?Wt(r,e):r.safeParseAsync(e),er=(r,e)=>xe(r)?it(e):e.format(),tr=(r,e)=>xe(r)?it(new st(e)):new W(e).format();function rr(r,e,t,s,n){const a=u.ref(),i=u.ref(),o=u.computed(()=>i.value===L.invalid),c=u.ref(),l=u.ref(!1);let f;const h=A=>{const D=le(r,A);if(t?.class){const _=t.class;return new _(D)}return D},w=async(A=c.value,D)=>{if(f=D?.fields,l.value)return!0;const _=await Xt(r,A);if(!_.success){if(i.value=L.invalid,!f?.size)return a.value=er(r,_.error),!1;const Z=_.error.issues.filter(ee=>f?.has(ee.path.join(".")));return Z.length?(a.value=tr(r,Z),!1):(a.value=void 0,!0)}return a.value=void 0,i.value=L.valid,c.value=h(_.data),!0},x=()=>{a.value=void 0,i.value=void 0,f=void 0},d=()=>{c.value=h(),x(),i.value=L.reset},p=async A=>l.value||!await w(void 0,A)?!1:(i.value=L.submitting,!0),{ignoreUpdates:y,stop:k}=Ve.watchIgnorable(c,()=>{i.value=L.updated},{deep:!0,eventFilter:Ve.throttleFilter(t?.updateThrottle??500)}),C=u.readonly(a),R=u.readonly(i),P=u.defineComponent({name:"VvForm",props:{continuousValidation:{type:Boolean,default:!1},modelValue:{type:Object,default:()=>({})},readonly:{type:Boolean,default:t?.readonly},tag:{type:String,default:"form"},template:{type:[Array,Function],default:void 0},superRefine:{type:Function,default:void 0},validateFields:{type:Array,default:void 0}},emits:["invalid","submit","update:modelValue","update:readonly","valid","reset"],expose:["errors","invalid","readonly","status","submit","tag","template","valid","validate","clear","reset"],slots:Object,setup(A,{emit:D}){return c.value=h(u.toRaw(A.modelValue)),u.watch(()=>A.modelValue,_=>{if(_){const Z=u.isProxy(_)?u.toRaw(_):_;if(JSON.stringify(Z)===JSON.stringify(u.toRaw(c.value)))return;c.value=typeof Z?.clone=="function"?Z.clone():JSON.parse(JSON.stringify(Z))}},{deep:!0}),u.watch(i,async _=>{if(_===L.invalid){const Z=u.toRaw(a.value);D("invalid",Z),t?.onInvalid?.(Z);return}if(_===L.valid){const Z=u.toRaw(c.value);D("valid",Z),t?.onValid?.(Z),D("update:modelValue",Z),t?.onUpdate?.(Z);return}if(_===L.submitting){const Z=u.toRaw(c.value);D("submit",Z),t?.onSubmit?.(Z);return}if(_===L.reset){const Z=u.toRaw(c.value);D("reset",Z),t?.onReset?.(Z);return}if(_===L.updated){if((a.value||t?.continuousValidation||A.continuousValidation)&&await w(void 0,{superRefine:A.superRefine,fields:f??new Set(A.validateFields)}),!c.value||!A.modelValue||JSON.stringify(c.value)!==JSON.stringify(A.modelValue)){const Z=u.toRaw(c.value);D("update:modelValue",Z),t?.onUpdate?.(Z)}i.value===L.updated&&(i.value=L.unknown)}}),u.onMounted(()=>{A.readonly!==void 0&&(l.value=A.readonly)}),u.watch(()=>A.readonly,_=>{l.value=_}),u.watch(l,_=>{_!==A.readonly&&D("update:readonly",l.value)}),u.provide(e,{clear:x,errors:C,formData:c,ignoreUpdates:y,invalid:o,readonly:l,reset:d,status:R,stopUpdatesWatch:k,submit:p,validate:w,wrappers:n}),{clear:x,errors:C,formData:c,ignoreUpdates:y,invalid:o,isReadonly:l,reset:d,status:R,stopUpdatesWatch:k,submit:()=>p({superRefine:A.superRefine,fields:new Set(A.validateFields)}),validate:w,wrappers:n}},render(){const A=()=>this.$slots?.default?.({errors:C.value,formData:c.value,invalid:o.value,readonly:l.value,status:R.value,wrappers:n,clear:x,ignoreUpdates:y,reset:d,stopUpdatesWatch:k,submit:p,validate:w})??this.$slots.default;return u.h(this.tag,{onSubmit:u.withModifiers(this.submit,["prevent"]),onReset:u.withModifiers(this.reset,["prevent"])},(this.template??t?.template)&&s?[u.h(s,{schema:this.template??t?.template},{default:A})]:{default:A})}});return{clear:x,errors:a,formData:c,ignoreUpdates:y,invalid:o,readonly:l,reset:d,status:i,wrappers:n,stopUpdatesWatch:k,submit:p,validate:w,VvForm:P}}function Ie(r){return Array.isArray(r)}function nr(r){return!1}function ut(r){return r===null}function dt(r){return typeof r=="object"}function lt(r){return typeof r=="string"}function ke(r){return typeof r>"u"}const sr=/^[0-9]+$/,ar=["__proto__","prototype","constructor"];function ie(r,e,t){const s=nr()?t:void 0;if(!dt(r)||!lt(e))return s;const n=ft(e);if(n.length!==0){for(const a of n){if(a==="*")continue;const i=function(o){return o.map(c=>ke(c)||ut(c)?c:Ie(c)?i(c):c[a])};if(Ie(r)&&!sr.test(a)?r=i(r):r=r[a],ke(r)||ut(r))break}return ke(r)?s:r}}function Ee(r,e,t){if(!dt(r)||!lt(e))return;const s=ft(e);if(s.length===0)return;const n=s.length;for(let a=0;a<n;a++){const i=s[a];if(a===n-1){r[i]=t;return}if(i==="*"&&Ie(r)){const o=s.slice(a+1).join(".");for(const c of r)Ee(c,o,t);return}ke(r[i])&&(r[i]={}),r=r[i]}}function ft(r){const e=r.split(/[.]|(?:\[(\d|\*)\])/).filter(t=>!!t);return e.some(t=>ar.indexOf(t)!==-1)?[]:e}function ir(r,e,t,s){return u.defineComponent({name:"VvFormField",props:{type:{type:String,validator:n=>Object.values(E).includes(n),default:E.custom},is:{type:[Object,String],default:void 0},name:{type:[String,Number,Boolean,Symbol],required:!0},props:{type:[Object,Function],default:()=>({})},showValid:{type:Boolean,default:!1},defaultValue:{type:[String,Number,Boolean,Array,Object],default:void 0},lazyLoad:{type:Boolean,default:!1},readonly:{type:Boolean,default:void 0}},emits:["invalid","update:formData","update:modelValue","valid"],expose:["component","errors","hasProps","invalid","invalidLabel","is","type"],slots:Object,setup(n,{slots:a,emit:i}){const{props:o,name:c}=u.toRefs(n),l=u.useId(),f=u.inject(e,void 0);f&&f.fields.value.set(l,n.name);const h=u.inject(r),w=u.computed({get(){if(h?.formData)return ie(new Object(h.formData.value),String(n.name))},set(_){h?.formData&&(Ee(new Object(h.formData.value),String(n.name),_),i("update:modelValue",{newValue:w.value,formData:h?.formData}))}});u.onMounted(()=>{w.value===void 0&&n.defaultValue!==void 0&&(w.value=n.defaultValue)}),u.onBeforeUnmount(()=>{f&&f.fields.value.delete(l)});const x=u.computed(()=>{if(h?.errors.value)return ie(h.errors.value,String(n.name))}),d=u.computed(()=>x.value?._errors),p=u.computed(()=>x.value!==void 0),y=u.watch(p,_=>{if(_){i("invalid",x.value),f&&f.errors.value.set(String(n.name),x.value);return}i("valid",w.value),f&&f.errors.value.delete(n.name)}),k=u.watch(()=>h?.formData,()=>{i("update:formData",h?.formData)},{deep:!0});u.onBeforeUnmount(()=>{y(),k()});const C=_=>{_ instanceof InputEvent&&(_=_.target.value),w.value=_},R=u.computed(()=>{let _=o.value;return typeof _=="function"&&(_=_(h?.formData)),Object.keys(_).reduce((Z,ee)=>(Z[ee]=u.unref(_[ee]),Z),{})}),P=u.computed(()=>h?.readonly.value||f?.readonly.value?!0:R.value.readonly??n.readonly),A=u.computed(()=>({...R.value,name:R.value.name??n.name,invalid:p.value,valid:n.showValid?!!(!p.value&&w.value):void 0,type:(_=>{if([E.color,E.date,E.datetimeLocal,E.email,E.month,E.number,E.password,E.search,E.tel,E.text,E.time,E.url,E.week].includes(_))return _})(n.type),invalidLabel:d.value,modelValue:w.value,readonly:P.value,"onUpdate:modelValue":C}));return u.provide(t,{name:u.readonly(c),errors:u.readonly(x)}),{component:u.computed(()=>{if(n.type===E.custom)return{render(){return a.default?.({errors:x.value,formData:h?.formData.value,formErrors:h?.errors.value,invalid:p.value,invalidLabel:d.value,modelValue:w.value,readonly:P.value,onUpdate:C,submit:h?.submit,validate:h?.validate})??a.default}};if(!(s?.lazyLoad??n.lazyLoad)){let _;switch(n.type){case E.select:_=u.resolveComponent("VvSelect");break;case E.checkbox:_=u.resolveComponent("VvCheckbox");break;case E.radio:_=u.resolveComponent("VvRadio");break;case E.textarea:_=u.resolveComponent("VvTextarea");break;case E.radioGroup:_=u.resolveComponent("VvRadioGroup");break;case E.checkboxGroup:_=u.resolveComponent("VvCheckboxGroup");break;case E.combobox:_=u.resolveComponent("VvCombobox");break;default:_=u.resolveComponent("VvInputText")}if(typeof _!="string")return _;console.warn(`[@volverjs/form-vue]: ${_} not found, the component will be loaded asynchronously. To avoid this warning, please set "lazyLoad" option.`)}return u.defineAsyncComponent(async()=>{switch(s?.sideEffects&&await Promise.resolve(s.sideEffects(n.type)),n.type){case E.textarea:return import("@volverjs/ui-vue/vv-textarea");case E.radio:return import("@volverjs/ui-vue/vv-radio");case E.radioGroup:return import("@volverjs/ui-vue/vv-radio-group");case E.checkbox:return import("@volverjs/ui-vue/vv-checkbox");case E.checkboxGroup:return import("@volverjs/ui-vue/vv-checkbox-group");case E.select:return import("@volverjs/ui-vue/vv-select");case E.combobox:return import("@volverjs/ui-vue/vv-combobox")}return import("@volverjs/ui-vue/vv-input-text")})}),hasProps:A,invalid:p}},render(){return this.is?u.h(this.is,this.hasProps,this.$slots):this.type===E.custom?u.h(this.component,null,this.$slots):u.h(this.component,this.hasProps,this.$slots)}})}function or(r,e,t){return u.defineComponent({name:"VvFormFieldsGroup",props:{is:{type:[Object,String],default:void 0},names:{type:[Array,Object],required:!0},props:{type:[Object,Function],default:()=>({})},showValid:{type:Boolean,default:!1},defaultValues:{type:[Object],default:void 0},readonly:{type:Boolean,default:void 0}},emits:["invalid","update:formData","update:modelValue","valid"],expose:["component","errors","hasProps","invalid","invalidLabels","is"],slots:Object,setup(s,{slots:n,emit:a}){const{props:i,names:o,defaultValues:c}=u.toRefs(s),l=u.useId(),f=u.computed(()=>Array.isArray(o.value)?o.value:Object.values(o.value)),h=u.computed(()=>Array.isArray(o.value)?o.value:Object.keys(o.value)),w=u.computed(()=>Array.isArray(o.value)?o.value.reduce((O,I)=>(O[String(I)]=I,O),{}):o.value),x=u.computed(()=>Object.keys(w.value).reduce((O,I)=>(O[String(w.value[I])]=I,O),{})),d=u.inject(e,void 0);d&&f.value.forEach(O=>{d.fields.value.set(`${l}-${O}`,O)});const p=u.inject(r),y=u.computed({get(){return p?.formData?h.value.reduce((O,I)=>(O[I]=ie(new Object(p.formData.value),w.value[I]),O),{}):{}},set(O){p?.formData&&(h.value.forEach(I=>{Ee(new Object(p.formData.value),w.value[I],O?.[I])}),a("update:modelValue",{newValue:y.value,formData:p?.formData}))}});u.onMounted(()=>{c.value&&f.value.forEach(O=>{c.value?.[O]!==void 0&&y.value[O]===void 0&&(y.value={...y.value,[O]:c.value?.[O]})})}),u.onBeforeUnmount(()=>{d&&f.value.forEach(O=>{d.fields.value.delete(`${l}-${O}`)})});const k=u.computed(()=>{if(!p?.errors.value)return;const O=f.value.reduce((I,J)=>{if(!p.errors.value)return I;const pt=ie(p.errors.value,String(J));return pt===void 0||(I[String(J)]=pt),I},{});if(Object.keys(O).length!==0)return O}),C=u.computed(()=>{if(!k.value)return;const O=Object.keys(k.value).reduce((I,J)=>(k.value?.[J]&&(I[x.value[J]]=k.value[J]._errors),I),{});if(Object.keys(O).length!==0)return O}),R=u.computed(()=>k.value!==void 0),P=u.computed(()=>h.value.reduce((O,I)=>(O[I]=!!k.value?.[x.value[I]],O),{})),A=u.watch(R,()=>{if(R.value){a("invalid",k.value),d&&f.value.forEach(O=>{if(!k.value?.[O]){d.errors.value.delete(O);return}d.errors.value.set(O,k.value?.[O])});return}a("valid",y.value),d&&f.value.forEach(O=>{d.errors.value.delete(O)})}),D=u.watch(()=>p?.formData,()=>{a("update:formData",p?.formData)},{deep:!0});u.onBeforeUnmount(()=>{A(),D()});const _=O=>{y.value=O},Z=(O,I)=>{I instanceof InputEvent&&(I=I.target.value),h.value.includes(O)&&(y.value={...y.value,[O]:I})},ee=u.computed(()=>{let O=i.value;return typeof O=="function"&&(O=O(p?.formData)),Object.keys(O).reduce((I,J)=>(I[J]=u.unref(O[J]),I),{})}),ht=u.computed(()=>p?.readonly.value?!0:ee.value.readonly??s.readonly),hr=u.computed(()=>h.value.reduce((O,I)=>(O[`onUpdate:${I}`]=J=>{Z(I,J)},O),{"onUpdate:modelValue":_})),pr=u.computed(()=>({...hr.value,...ee.value,names:ee.value.name??f.value,invalid:R.value,invalids:P.value,valid:s.showValid?!!(!R.value&&y.value):void 0,invalidLabels:C.value,modelValue:y.value,readonly:ht.value}));return u.provide(t,{names:u.readonly(o),errors:u.readonly(k)}),{component:u.computed(()=>({render(){return n.default?.({errors:k.value,formData:p?.formData.value,formErrors:p?.errors.value,invalid:R.value,invalids:P.value,invalidLabels:C.value,modelValue:y.value,onUpdate:_,onUpdateField:Z,readonly:ht.value,submit:p?.submit,validate:p?.validate})??n.default}})),hasProps:pr,invalid:R}},render(){return this.is?u.h(this.is,this.hasProps,this.$slots):u.h(this.component,null,this.$slots)}})}function cr(r,e){return u.defineComponent({name:"VvFormWrapper",props:{name:{type:String,required:!0},tag:{type:String,default:void 0},readonly:{type:Boolean,default:!1}},emits:["invalid","valid"],expose:["clear","errors","fields","fieldsErrors","formData","invalid","readonly","reset","submit","tag","validate","validateWrapper"],slots:Object,setup(t,{emit:s}){const n=u.inject(r),a=u.inject(e,void 0),i=u.ref(new Map),o=u.ref(new Map),{name:c}=u.toRefs(t),l=u.computed(()=>n?.invalid.value?o.value.size>0:!1);u.watch(l,d=>{if(d){s("invalid");return}s("valid")});const f=u.computed(()=>n?.readonly.value||t.readonly),h={name:u.readonly(c),errors:o,invalid:u.readonly(l),readonly:u.readonly(f),fields:i};u.provide(e,h);const w=u.computed(()=>new Map(i.value));u.watch(w,(d,p)=>{a?.fields&&(p.forEach((y,k)=>{d.has(k)||a?.fields.value.delete(k)}),d.forEach((y,k)=>{a?.fields.value.has(k)||a?.fields.value.set(k,y)}))},{deep:!0}),u.watch(o,d=>{a?.errors&&i.value.forEach(p=>{if(d.has(p)||a.errors.value.delete(p),d.has(p)){const y=d.get(p);y&&a.errors.value.set(p,y)}})},{deep:!0}),u.onMounted(()=>{if(!n?.wrappers||!c.value){console.warn("[@volverjs/form-vue]: Invalid wrapper registration state");return}if(n.wrappers.has(c.value)){console.warn(`[@volverjs/form-vue]: wrapper name "${c.value}" is already used`);return}n.wrappers.set(c.value,h)}),u.onBeforeUnmount(()=>{n?.wrappers&&c.value&&n.wrappers.delete(c.value)});const x=()=>n?.validate(void 0,{fields:new Set(i.value.values())})??Promise.resolve(!0);return{errors:n?.errors,fields:i,fieldsErrors:o,formData:n?.formData,invalid:l,readonly:f,clear:n?.clear,reset:n?.reset,submit:n?.submit,validate:n?.validate,validateWrapper:x}},render(){const t=()=>this.$slots.default?.({errors:this.errors,fieldsErrors:this.fieldsErrors,formData:this.formData,invalid:this.invalid,readonly:this.readonly,clear:this.clear,reset:this.reset,submit:this.submit,validate:this.validate,validateWrapper:this.validateWrapper});return this.tag?u.h(this.tag,null,{default:t}):t()}})}function ur(r,e){const t=u.defineComponent({name:"VvFormTemplate",props:{schema:{type:[Array,Function],required:!0},scope:{type:Object,default:()=>({})}},slots:Object,setup(s,{slots:n}){const a=u.inject(r);if(a?.formData)return()=>{const i=typeof s.schema=="function"?s.schema(a,s.scope):s.schema;let o;const c=i.reduce((l,f)=>{const h=typeof f=="function"?f(a,s.scope):f,{vvIs:w,vvName:x,vvSlots:d,vvChildren:p,vvIf:y,vvElseIf:k,vvType:C,vvDefaultValue:R,vvShowValid:P,vvContent:A,...D}=h;if(y!==void 0){if(typeof y=="string"?o=!!ie(new Object(a.formData.value),y):typeof y=="function"?o=u.unref(y(a)):o=u.unref(y),!o)return l}else if(k!==void 0&&o!==void 0){if(o||(typeof k=="string"?o=!!ie(new Object(a.formData.value),k):typeof k=="function"?o=u.unref(k(a)):o=u.unref(k),!o))return l}else o=void 0;let _;return p&&(typeof w=="string"?_=u.h(t,{schema:p}):_={default:Z=>u.h(t,{schema:p,scope:Z})}),x?(l.push(u.h(e,{name:x,is:w,type:C,defaultValue:R,showValid:P,props:D},d??_??A)),l):w?(l.push(u.h(w,D,d??_??A)),l):(_&&("default"in _?l.push(_.default(s.scope)):l.push(_)),l)},[]);return c.push(n?.default?.({errors:a?.errors.value,formData:a?.formData.value,invalid:a?.invalid.value,status:a?.status.value,submit:a?.submit,validate:a?.validate,clear:a?.clear,reset:a?.reset})),c}}});return t}function we(r,e={}){const t=Symbol("formInjectionKey"),s=Symbol("formWrapperInjectionKey"),n=Symbol("formFieldInjectionKey"),a=Symbol("formFieldsGroupInjectionKey"),i=cr(t,s),o=ir(t,s,n,e),c=or(t,s,a),l=ur(t,o),f=new Map,{clear:h,errors:w,formData:x,ignoreUpdates:d,invalid:p,readonly:y,reset:k,status:C,stopUpdatesWatch:R,submit:P,validate:A,VvForm:D}=rr(r,t,e,l,f);return{clear:h,errors:w,formData:x,formFieldInjectionKey:n,formInjectionKey:t,formWrapperInjectionKey:s,ignoreUpdates:d,invalid:p,readonly:y,reset:k,status:C,stopUpdatesWatch:R,submit:P,validate:A,wrappers:f,VvForm:D,VvFormField:o,VvFormFieldsGroup:c,VvFormTemplate:l,VvFormWrapper:i}}const Ae=Symbol("pluginInjectionKey");function dr(r){let e={};return r.schema&&(e=we(r.schema,r)),{...e,install(t,{global:s=!1}={}){t.provide(Ae,r),s&&(t.config.globalProperties.$vvForm=r,e?.VvForm&&t.component("VvForm",e.VvForm),e?.VvFormWrapper&&t.component("VvFormWrapper",e.VvFormWrapper),e?.VvFormField&&t.component("VvFormField",e.VvFormField),e?.VvFormFieldsGroup&&t.component("VvFormFieldsGroup",e.VvFormFieldsGroup),e?.VvFormTemplate&&t.component("VvFormTemplate",e.VvFormTemplate))}}}const Oe=new Map;function lr(r,e={}){if(e.scope&&Oe.has(e.scope))return Oe.get(e.scope);if(!u.getCurrentInstance()){const s=we(r,e);return e.scope&&Oe.set(e.scope,s),s}const t=we(r,{...u.inject(Ae,{}),...e});return e.scope&&Oe.set(e.scope,t),t}function fr(r,e={}){return we(r,e)}U.FormFieldType=E,U.createForm=dr,U.defaultObjectBySchema=le,U.formType=fr,U.pluginInjectionKey=Ae,U.useForm=lr,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})});
3
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of this.seen.entries()){const h=f[1];if(e===f[0]){i(f);continue}if(s.external){const x=s.external.registry.get(f[0])?.id;if(e!==f[0]&&x){i(f);continue}}if(this.metadataRegistry.get(f[0])?.id){i(f);continue}if(h.cycle){i(f);continue}if(h.count>1&&s.reused==="ref"){i(f);continue}}const o=(f,h)=>{const w=this.seen.get(f),x=w.def??w.schema,d={...x};if(w.ref===null)return;const p=w.ref;if(w.ref=null,p){o(p,h);const y=this.seen.get(p).schema;y.$ref&&h.target==="draft-7"?(x.allOf=x.allOf??[],x.allOf.push(y)):(Object.assign(x,y),Object.assign(x,d))}w.isParent||this.override({zodSchema:f,jsonSchema:x,path:w.path??[]})};for(const f of[...this.seen.entries()].reverse())o(f[0],{target:this.target});const c={};if(this.target==="draft-2020-12"?c.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?c.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),s.external?.uri){const f=s.external.registry.get(e)?.id;if(!f)throw new Error("Schema is missing an `id` property");c.$id=s.external.uri(f)}Object.assign(c,n.def);const l=s.external?.defs??{};for(const f of this.seen.entries()){const h=f[1];h.def&&h.defId&&(l[h.defId]=h.def)}s.external||Object.keys(l).length>0&&(this.target==="draft-2020-12"?c.$defs=l:c.definitions=l);try{return JSON.parse(JSON.stringify(c))}catch{throw new Error("Error converting schema to JSON.")}}}function Kt(r,e){if(r instanceof ot){const s=new ct(e),n={};for(const o of r._idmap.entries()){const[c,l]=o;s.process(l)}const a={},i={registry:r,uri:e?.uri,defs:n};for(const o of r._idmap.entries()){const[c,l]=o;a[c]=s.emit(l,{...e,external:i})}if(Object.keys(n).length>0){const o=s.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[o]:n}}return{schemas:a}}const t=new ct(e);return t.process(r),t.emit(r,e)}function z(r,e){const t=e??{seen:new Set};if(t.seen.has(r))return!1;t.seen.add(r);const n=r._zod.def;switch(n.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return z(n.element,t);case"object":{for(const a in n.shape)if(z(n.shape[a],t))return!0;return!1}case"union":{for(const a of n.options)if(z(a,t))return!0;return!1}case"intersection":return z(n.left,t)||z(n.right,t);case"tuple":{for(const a of n.items)if(z(a,t))return!0;return!!(n.rest&&z(n.rest,t))}case"record":return z(n.keyType,t)||z(n.valueType,t);case"map":return z(n.keyType,t)||z(n.valueType,t);case"set":return z(n.valueType,t);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return z(n.innerType,t);case"lazy":return z(n.getter(),t);case"default":return z(n.innerType,t);case"prefault":return z(n.innerType,t);case"custom":return!1;case"transform":return!0;case"pipe":return z(n.in,t)||z(n.out,t);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${n.type}`)}const be=r=>{let e=r;for(;e instanceof Q;)e=e.innerType();return e instanceof G&&(e=e._def.innerType),e},Yt=r=>{let e=r;for(;e instanceof Q;)e=e.innerType();return e instanceof G||e instanceof X};function Ht(r){return Array.isArray(r)?"array":r===null?"null":typeof r}function Qt(r,e){const t=Ht(r);return e.type?e.type===t||e.type==="integer"&&t==="number"&&Number.isInteger(r):!0}function ae(r,e){if(r.anyOf&&Array.isArray(r.anyOf)){if(e!==void 0){for(const i of r.anyOf)if(Qt(e,i))return ae(i,e);for(const i of r.anyOf){const o=i;if(!o.type||o.type==="object")return ae(o,e)}}return ae(r.anyOf[0],e)}if(r.type!=="object"||!r.properties)switch(r.type){case"string":return typeof e=="string"?e:r.default;case"number":case"integer":return typeof e=="number"?e:r.default;case"boolean":return typeof e=="boolean"?e:r.default;case"null":return e===null?e:r.default;case"array":return Array.isArray(e)&&r.items?e.map(i=>ae(r.items,i)):r.default;default:return r.default}const t=r.properties,n=e&&typeof e=="object"&&!Array.isArray(e)?e:void 0,a={};for(const i in t){const o=n?.[i];a[i]=ae(t[i],o)}if(n&&r.additionalProperties!==!1){const i=new Set(Object.keys(t));for(const[o,c]of Object.entries(n))i.has(o)||(a[o]=c)}return a}const xe=r=>"_zod"in r;function le(r,e={}){if(xe(r)){const n=Kt(r);if(n.type!=="object"||!n.properties)return e;const a=Jt(r,e);return ae(n,a.success?a.data:e)}const t=be(r);return t instanceof $?{...(t instanceof $?t._def.unknownKeys==="passthrough":!1)?e:{},...Object.fromEntries(("shape"in t?Object.entries(t.shape):[]).map(([n,a])=>{const i=e[n],o=Yt(a);let c=be(a),l;if(c instanceof ge&&(l=c._def.defaultValue(),c=c._def.innerType),i===null&&c instanceof X)return[n,i];if(i==null&&o)return[n,l];if(c instanceof N){const f=a.safeParse(i);if(f.success)return[n,f.data??l]}if(c instanceof B&&Array.isArray(i)&&i.length){const f=be(c._def.type);if(f instanceof $)return[n,i.map(h=>le(f,h&&typeof h=="object"?h:void 0))]}if(c instanceof ye&&i){const f=be(c._def.valueType);if(f instanceof $)return[n,Object.keys(i).reduce((h,w)=>(h[w]=le(f,i[w]),h),{})]}return c instanceof $?[n,le(c,i&&typeof i=="object"?i:l)]:[n,l]}))}:e}const Xt=(r,e)=>xe(r)?Wt(r,e):r.safeParseAsync(e),er=(r,e)=>xe(r)?it(e):e.format(),tr=(r,e)=>xe(r)?it(new st(e)):new W(e).format();function rr(r,e,t,s,n){const a=u.ref(),i=u.ref(),o=u.computed(()=>i.value===L.invalid),c=u.ref(),l=u.ref(!1);let f;const h=A=>{const D=le(r,A);if(t?.class){const _=t.class;return new _(D)}return D},w=async(A=c.value,D)=>{if(f=D?.fields,l.value)return!0;const _=await Xt(r,A);if(!_.success){if(i.value=L.invalid,!f?.size)return a.value=er(r,_.error),!1;const Z=_.error.issues.filter(ee=>f?.has(ee.path.join(".")));return Z.length?(a.value=tr(r,Z),!1):(a.value=void 0,!0)}return a.value=void 0,i.value=L.valid,c.value=h(_.data),!0},x=()=>{a.value=void 0,i.value=void 0,f=void 0},d=()=>{c.value=h(),x(),i.value=L.reset},p=async A=>l.value||!await w(void 0,A)?!1:(i.value=L.submitting,!0),{ignoreUpdates:y,stop:k}=Ve.watchIgnorable(c,()=>{i.value=L.updated},{deep:!0,eventFilter:Ve.throttleFilter(t?.updateThrottle??500)}),C=u.readonly(a),R=u.readonly(i),P=u.defineComponent({name:"VvForm",props:{continuousValidation:{type:Boolean,default:!1},modelValue:{type:Object,default:()=>({})},readonly:{type:Boolean,default:t?.readonly},tag:{type:String,default:"form"},template:{type:[Array,Function],default:void 0},superRefine:{type:Function,default:void 0},validateFields:{type:Array,default:void 0}},emits:["invalid","submit","update:modelValue","update:readonly","valid","reset"],expose:["errors","invalid","readonly","status","submit","tag","template","valid","validate","clear","reset"],slots:Object,setup(A,{emit:D}){return c.value=h(u.toRaw(A.modelValue)),u.watch(()=>A.modelValue,_=>{if(_){const Z=u.isProxy(_)?u.toRaw(_):_;if(JSON.stringify(Z)===JSON.stringify(u.toRaw(c.value)))return;c.value=typeof Z?.clone=="function"?Z.clone():JSON.parse(JSON.stringify(Z))}},{deep:!0}),u.watch(i,async _=>{if(_===L.invalid){const Z=u.toRaw(a.value);D("invalid",Z),t?.onInvalid?.(Z);return}if(_===L.valid){const Z=u.toRaw(c.value);D("valid",Z),t?.onValid?.(Z),D("update:modelValue",Z),t?.onUpdate?.(Z);return}if(_===L.submitting){const Z=u.toRaw(c.value);D("submit",Z),t?.onSubmit?.(Z);return}if(_===L.reset){const Z=u.toRaw(c.value);D("reset",Z),t?.onReset?.(Z);return}if(_===L.updated){if((a.value||t?.continuousValidation||A.continuousValidation)&&await w(void 0,{superRefine:A.superRefine,fields:f??new Set(A.validateFields)}),!c.value||!A.modelValue||JSON.stringify(c.value)!==JSON.stringify(A.modelValue)){const Z=u.toRaw(c.value);D("update:modelValue",Z),t?.onUpdate?.(Z)}i.value===L.updated&&(i.value=L.unknown)}}),u.onMounted(()=>{A.readonly!==void 0&&(l.value=A.readonly)}),u.watch(()=>A.readonly,_=>{l.value=_}),u.watch(l,_=>{_!==A.readonly&&D("update:readonly",l.value)}),u.provide(e,{clear:x,errors:C,formData:c,ignoreUpdates:y,invalid:o,readonly:l,reset:d,status:R,stopUpdatesWatch:k,submit:p,validate:w,wrappers:n}),{clear:x,errors:C,formData:c,ignoreUpdates:y,invalid:o,isReadonly:l,reset:d,status:R,stopUpdatesWatch:k,submit:()=>p({superRefine:A.superRefine,fields:new Set(A.validateFields)}),validate:w,wrappers:n}},render(){const A=()=>this.$slots?.default?.({errors:C.value,formData:c.value,invalid:o.value,readonly:l.value,status:R.value,wrappers:n,clear:x,ignoreUpdates:y,reset:d,stopUpdatesWatch:k,submit:p,validate:w})??this.$slots.default;return u.h(this.tag,{onSubmit:u.withModifiers(this.submit,["prevent"]),onReset:u.withModifiers(this.reset,["prevent"])},(this.template??t?.template)&&s?[u.h(s,{schema:this.template??t?.template},{default:A})]:{default:A})}});return{clear:x,errors:a,formData:c,ignoreUpdates:y,invalid:o,readonly:l,reset:d,status:i,wrappers:n,stopUpdatesWatch:k,submit:p,validate:w,VvForm:P}}function Ie(r){return Array.isArray(r)}function nr(r){return!1}function ut(r){return r===null}function dt(r){return typeof r=="object"}function lt(r){return typeof r=="string"}function ke(r){return typeof r>"u"}const sr=/^[0-9]+$/,ar=["__proto__","prototype","constructor"];function ie(r,e,t){const s=nr()?t:void 0;if(!dt(r)||!lt(e))return s;const n=ft(e);if(n.length!==0){for(const a of n){if(a==="*")continue;const i=function(o){return o.map(c=>ke(c)||ut(c)?c:Ie(c)?i(c):c[a])};if(Ie(r)&&!sr.test(a)?r=i(r):r=r[a],ke(r)||ut(r))break}return ke(r)?s:r}}function Ee(r,e,t){if(!dt(r)||!lt(e))return;const s=ft(e);if(s.length===0)return;const n=s.length;for(let a=0;a<n;a++){const i=s[a];if(a===n-1){r[i]=t;return}if(i==="*"&&Ie(r)){const o=s.slice(a+1).join(".");for(const c of r)Ee(c,o,t);return}ke(r[i])&&(r[i]={}),r=r[i]}}function ft(r){const e=r.split(/[.]|(?:\[(\d|\*)\])/).filter(t=>!!t);return e.some(t=>ar.indexOf(t)!==-1)?[]:e}function ir(r,e,t,s){return u.defineComponent({name:"VvFormField",props:{type:{type:String,validator:n=>Object.values(E).includes(n),default:E.custom},is:{type:[Object,String],default:void 0},name:{type:[String,Number,Boolean,Symbol],required:!0},props:{type:[Object,Function],default:()=>({})},showValid:{type:Boolean,default:!1},defaultValue:{type:[String,Number,Boolean,Array,Object],default:void 0},lazyLoad:{type:Boolean,default:!1},readonly:{type:Boolean,default:void 0}},emits:["invalid","update:formData","update:modelValue","valid"],expose:["component","errors","hasProps","invalid","invalidLabel","is","type"],slots:Object,setup(n,{slots:a,emit:i}){const{props:o,name:c}=u.toRefs(n),l=u.useId(),f=u.inject(e,void 0);f&&f.fields.value.set(l,n.name);const h=u.inject(r),w=u.computed({get(){if(h?.formData)return ie(new Object(h.formData.value),String(n.name))},set(_){h?.formData&&(Ee(new Object(h.formData.value),String(n.name),_),i("update:modelValue",{newValue:w.value,formData:h?.formData}))}});u.onMounted(()=>{w.value===void 0&&n.defaultValue!==void 0&&(w.value=n.defaultValue)}),u.onBeforeUnmount(()=>{f&&f.fields.value.delete(l)});const x=u.computed(()=>{if(h?.errors.value)return ie(h.errors.value,String(n.name))}),d=u.computed(()=>x.value?._errors),p=u.computed(()=>x.value!==void 0),y=u.watch(p,_=>{if(_){i("invalid",x.value),f&&f.errors.value.set(String(n.name),x.value);return}i("valid",w.value),f&&f.errors.value.delete(n.name)}),k=u.watch(()=>h?.formData,()=>{i("update:formData",h?.formData)},{deep:!0});u.onBeforeUnmount(()=>{y(),k()});const C=_=>{_ instanceof InputEvent&&(_=_.target.value),w.value=_},R=u.computed(()=>{let _=o.value;return typeof _=="function"&&(_=_(h?.formData)),Object.keys(_).reduce((Z,ee)=>(Z[ee]=u.unref(_[ee]),Z),{})}),P=u.computed(()=>h?.readonly.value||f?.readonly.value?!0:R.value.readonly??n.readonly),A=u.computed(()=>({...R.value,name:R.value.name??n.name,invalid:p.value,valid:n.showValid?!!(!p.value&&w.value):void 0,type:(_=>{if([E.color,E.date,E.datetimeLocal,E.email,E.month,E.number,E.password,E.search,E.tel,E.text,E.time,E.url,E.week].includes(_))return _})(n.type),invalidLabel:d.value,modelValue:w.value,readonly:P.value,"onUpdate:modelValue":C}));return u.provide(t,{name:u.readonly(c),errors:u.readonly(x)}),{component:u.computed(()=>{if(n.type===E.custom)return{render(){return a.default?.({errors:x.value,formData:h?.formData.value,formErrors:h?.errors.value,invalid:p.value,invalidLabel:d.value,modelValue:w.value,readonly:P.value,onUpdate:C,submit:h?.submit,validate:h?.validate})??a.default}};if(!(s?.lazyLoad??n.lazyLoad)){let _;switch(n.type){case E.select:_=u.resolveComponent("VvSelect");break;case E.checkbox:_=u.resolveComponent("VvCheckbox");break;case E.radio:_=u.resolveComponent("VvRadio");break;case E.textarea:_=u.resolveComponent("VvTextarea");break;case E.radioGroup:_=u.resolveComponent("VvRadioGroup");break;case E.checkboxGroup:_=u.resolveComponent("VvCheckboxGroup");break;case E.combobox:_=u.resolveComponent("VvCombobox");break;default:_=u.resolveComponent("VvInputText")}if(typeof _!="string")return _;console.warn(`[@volverjs/form-vue]: ${_} not found, the component will be loaded asynchronously. To avoid this warning, please set "lazyLoad" option.`)}return u.defineAsyncComponent(async()=>{switch(s?.sideEffects&&await Promise.resolve(s.sideEffects(n.type)),n.type){case E.textarea:return import("@volverjs/ui-vue/vv-textarea");case E.radio:return import("@volverjs/ui-vue/vv-radio");case E.radioGroup:return import("@volverjs/ui-vue/vv-radio-group");case E.checkbox:return import("@volverjs/ui-vue/vv-checkbox");case E.checkboxGroup:return import("@volverjs/ui-vue/vv-checkbox-group");case E.select:return import("@volverjs/ui-vue/vv-select");case E.combobox:return import("@volverjs/ui-vue/vv-combobox")}return import("@volverjs/ui-vue/vv-input-text")})}),hasProps:A,invalid:p}},render(){return this.is?u.h(this.is,this.hasProps,this.$slots):this.type===E.custom?u.h(this.component,null,this.$slots):u.h(this.component,this.hasProps,this.$slots)}})}function or(r,e,t){return u.defineComponent({name:"VvFormFieldsGroup",props:{is:{type:[Object,String],default:void 0},names:{type:[Array,Object],required:!0},props:{type:[Object,Function],default:()=>({})},showValid:{type:Boolean,default:!1},defaultValues:{type:[Object],default:void 0},readonly:{type:Boolean,default:void 0}},emits:["invalid","update:formData","update:modelValue","valid"],expose:["component","errors","hasProps","invalid","invalidLabels","is"],slots:Object,setup(s,{slots:n,emit:a}){const{props:i,names:o,defaultValues:c}=u.toRefs(s),l=u.useId(),f=u.computed(()=>Array.isArray(o.value)?o.value:Object.values(o.value)),h=u.computed(()=>Array.isArray(o.value)?o.value:Object.keys(o.value)),w=u.computed(()=>Array.isArray(o.value)?o.value.reduce((O,I)=>(O[String(I)]=I,O),{}):o.value),x=u.computed(()=>Object.keys(w.value).reduce((O,I)=>(O[String(w.value[I])]=I,O),{})),d=u.inject(e,void 0);d&&f.value.forEach(O=>{d.fields.value.set(`${l}-${O}`,O)});const p=u.inject(r),y=u.computed({get(){return p?.formData?h.value.reduce((O,I)=>(O[I]=ie(new Object(p.formData.value),w.value[I]),O),{}):{}},set(O){p?.formData&&(h.value.forEach(I=>{Ee(new Object(p.formData.value),w.value[I],O?.[I])}),a("update:modelValue",{newValue:y.value,formData:p?.formData}))}});u.onMounted(()=>{c.value&&f.value.forEach(O=>{c.value?.[O]!==void 0&&y.value[O]===void 0&&(y.value={...y.value,[O]:c.value?.[O]})})}),u.onBeforeUnmount(()=>{d&&f.value.forEach(O=>{d.fields.value.delete(`${l}-${O}`)})});const k=u.computed(()=>{if(!p?.errors.value)return;const O=f.value.reduce((I,J)=>{if(!p.errors.value)return I;const pt=ie(p.errors.value,String(J));return pt===void 0||(I[String(J)]=pt),I},{});if(Object.keys(O).length!==0)return O}),C=u.computed(()=>{if(!k.value)return;const O=Object.keys(k.value).reduce((I,J)=>(k.value?.[J]&&(I[x.value[J]]=k.value[J]._errors),I),{});if(Object.keys(O).length!==0)return O}),R=u.computed(()=>k.value!==void 0),P=u.computed(()=>h.value.reduce((O,I)=>(O[I]=!!k.value?.[x.value[I]],O),{})),A=u.watch(R,()=>{if(R.value){a("invalid",k.value),d&&f.value.forEach(O=>{if(!k.value?.[O]){d.errors.value.delete(O);return}d.errors.value.set(O,k.value?.[O])});return}a("valid",y.value),d&&f.value.forEach(O=>{d.errors.value.delete(O)})}),D=u.watch(()=>p?.formData,()=>{a("update:formData",p?.formData)},{deep:!0});u.onBeforeUnmount(()=>{A(),D()});const _=O=>{y.value=O},Z=(O,I)=>{I instanceof InputEvent&&(I=I.target.value),h.value.includes(O)&&(y.value={...y.value,[O]:I})},ee=u.computed(()=>{let O=i.value;return typeof O=="function"&&(O=O(p?.formData)),Object.keys(O).reduce((I,J)=>(I[J]=u.unref(O[J]),I),{})}),ht=u.computed(()=>p?.readonly.value?!0:ee.value.readonly??s.readonly),hr=u.computed(()=>h.value.reduce((O,I)=>(O[`onUpdate:${I}`]=J=>{Z(I,J)},O),{"onUpdate:modelValue":_})),pr=u.computed(()=>({...hr.value,...ee.value,...y.value,modelValue:y.value,names:ee.value.name??f.value,invalid:R.value,invalids:P.value,valid:s.showValid?!!(!R.value&&y.value):void 0,invalidLabels:C.value,readonly:ht.value}));return u.provide(t,{names:u.readonly(o),errors:u.readonly(k)}),{component:u.computed(()=>({render(){return n.default?.({errors:k.value,formData:p?.formData.value,formErrors:p?.errors.value,invalid:R.value,invalids:P.value,invalidLabels:C.value,modelValue:y.value,onUpdate:_,onUpdateField:Z,readonly:ht.value,submit:p?.submit,validate:p?.validate})??n.default}})),hasProps:pr,invalid:R}},render(){return this.is?u.h(this.is,this.hasProps,this.$slots):u.h(this.component,null,this.$slots)}})}function cr(r,e){return u.defineComponent({name:"VvFormWrapper",props:{name:{type:String,required:!0},tag:{type:String,default:void 0},readonly:{type:Boolean,default:!1}},emits:["invalid","valid"],expose:["clear","errors","fields","fieldsErrors","formData","invalid","readonly","reset","submit","tag","validate","validateWrapper"],slots:Object,setup(t,{emit:s}){const n=u.inject(r),a=u.inject(e,void 0),i=u.ref(new Map),o=u.ref(new Map),{name:c}=u.toRefs(t),l=u.computed(()=>n?.invalid.value?o.value.size>0:!1);u.watch(l,d=>{if(d){s("invalid");return}s("valid")});const f=u.computed(()=>n?.readonly.value||t.readonly),h={name:u.readonly(c),errors:o,invalid:u.readonly(l),readonly:u.readonly(f),fields:i};u.provide(e,h);const w=u.computed(()=>new Map(i.value));u.watch(w,(d,p)=>{a?.fields&&(p.forEach((y,k)=>{d.has(k)||a?.fields.value.delete(k)}),d.forEach((y,k)=>{a?.fields.value.has(k)||a?.fields.value.set(k,y)}))},{deep:!0}),u.watch(o,d=>{a?.errors&&i.value.forEach(p=>{if(d.has(p)||a.errors.value.delete(p),d.has(p)){const y=d.get(p);y&&a.errors.value.set(p,y)}})},{deep:!0}),u.onMounted(()=>{if(!n?.wrappers||!c.value){console.warn("[@volverjs/form-vue]: Invalid wrapper registration state");return}if(n.wrappers.has(c.value)){console.warn(`[@volverjs/form-vue]: wrapper name "${c.value}" is already used`);return}n.wrappers.set(c.value,h)}),u.onBeforeUnmount(()=>{n?.wrappers&&c.value&&n.wrappers.delete(c.value)});const x=()=>n?.validate(void 0,{fields:new Set(i.value.values())})??Promise.resolve(!0);return{errors:n?.errors,fields:i,fieldsErrors:o,formData:n?.formData,invalid:l,readonly:f,clear:n?.clear,reset:n?.reset,submit:n?.submit,validate:n?.validate,validateWrapper:x}},render(){const t=()=>this.$slots.default?.({errors:this.errors,fieldsErrors:this.fieldsErrors,formData:this.formData,invalid:this.invalid,readonly:this.readonly,clear:this.clear,reset:this.reset,submit:this.submit,validate:this.validate,validateWrapper:this.validateWrapper});return this.tag?u.h(this.tag,null,{default:t}):t()}})}function ur(r,e){const t=u.defineComponent({name:"VvFormTemplate",props:{schema:{type:[Array,Function],required:!0},scope:{type:Object,default:()=>({})}},slots:Object,setup(s,{slots:n}){const a=u.inject(r);if(a?.formData)return()=>{const i=typeof s.schema=="function"?s.schema(a,s.scope):s.schema;let o;const c=i.reduce((l,f)=>{const h=typeof f=="function"?f(a,s.scope):f,{vvIs:w,vvName:x,vvSlots:d,vvChildren:p,vvIf:y,vvElseIf:k,vvType:C,vvDefaultValue:R,vvShowValid:P,vvContent:A,...D}=h;if(y!==void 0){if(typeof y=="string"?o=!!ie(new Object(a.formData.value),y):typeof y=="function"?o=u.unref(y(a)):o=u.unref(y),!o)return l}else if(k!==void 0&&o!==void 0){if(o||(typeof k=="string"?o=!!ie(new Object(a.formData.value),k):typeof k=="function"?o=u.unref(k(a)):o=u.unref(k),!o))return l}else o=void 0;let _;return p&&(typeof w=="string"?_=u.h(t,{schema:p}):_={default:Z=>u.h(t,{schema:p,scope:Z})}),x?(l.push(u.h(e,{name:x,is:w,type:C,defaultValue:R,showValid:P,props:D},d??_??A)),l):w?(l.push(u.h(w,D,d??_??A)),l):(_&&("default"in _?l.push(_.default(s.scope)):l.push(_)),l)},[]);return c.push(n?.default?.({errors:a?.errors.value,formData:a?.formData.value,invalid:a?.invalid.value,status:a?.status.value,submit:a?.submit,validate:a?.validate,clear:a?.clear,reset:a?.reset})),c}}});return t}function we(r,e={}){const t=Symbol("formInjectionKey"),s=Symbol("formWrapperInjectionKey"),n=Symbol("formFieldInjectionKey"),a=Symbol("formFieldsGroupInjectionKey"),i=cr(t,s),o=ir(t,s,n,e),c=or(t,s,a),l=ur(t,o),f=new Map,{clear:h,errors:w,formData:x,ignoreUpdates:d,invalid:p,readonly:y,reset:k,status:C,stopUpdatesWatch:R,submit:P,validate:A,VvForm:D}=rr(r,t,e,l,f);return{clear:h,errors:w,formData:x,formFieldInjectionKey:n,formInjectionKey:t,formWrapperInjectionKey:s,ignoreUpdates:d,invalid:p,readonly:y,reset:k,status:C,stopUpdatesWatch:R,submit:P,validate:A,wrappers:f,VvForm:D,VvFormField:o,VvFormFieldsGroup:c,VvFormTemplate:l,VvFormWrapper:i}}const Ae=Symbol("pluginInjectionKey");function dr(r){let e={};return r.schema&&(e=we(r.schema,r)),{...e,install(t,{global:s=!1}={}){t.provide(Ae,r),s&&(t.config.globalProperties.$vvForm=r,e?.VvForm&&t.component("VvForm",e.VvForm),e?.VvFormWrapper&&t.component("VvFormWrapper",e.VvFormWrapper),e?.VvFormField&&t.component("VvFormField",e.VvFormField),e?.VvFormFieldsGroup&&t.component("VvFormFieldsGroup",e.VvFormFieldsGroup),e?.VvFormTemplate&&t.component("VvFormTemplate",e.VvFormTemplate))}}}const Oe=new Map;function lr(r,e={}){if(e.scope&&Oe.has(e.scope))return Oe.get(e.scope);if(!u.getCurrentInstance()){const s=we(r,e);return e.scope&&Oe.set(e.scope,s),s}const t=we(r,{...u.inject(Ae,{}),...e});return e.scope&&Oe.set(e.scope,t),t}function fr(r,e={}){return we(r,e)}U.FormFieldType=E,U.createForm=dr,U.defaultObjectBySchema=le,U.formType=fr,U.pluginInjectionKey=Ae,U.useForm=lr,Object.defineProperty(U,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@volverjs/form-vue",
3
3
  "type": "module",
4
- "version": "1.1.0-beta.1",
4
+ "version": "1.1.0-beta.2",
5
5
  "description": "Vue 3 Forms with @volverjs/ui-vue",
6
6
  "author": "8 Wave S.r.l.",
7
7
  "license": "MIT",
@@ -57,15 +57,15 @@
57
57
  "zod": "^3.25.0 || ^4.0.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@antfu/eslint-config": "^4.17.0",
60
+ "@antfu/eslint-config": "^5.0.0",
61
61
  "@nabla/vite-plugin-eslint": "^2.0.5",
62
62
  "@playwright/experimental-ct-vue": "^1.54.1",
63
63
  "@testing-library/vue": "^8.1.0",
64
64
  "@vitejs/plugin-vue": "^6.0.0",
65
65
  "@volverjs/style": "^0.1.20",
66
66
  "@volverjs/ui-vue": "^0.0.9",
67
- "@vue/compiler-sfc": "^3.5.17",
68
- "@vue/runtime-core": "^3.5.17",
67
+ "@vue/compiler-sfc": "^3.5.18",
68
+ "@vue/runtime-core": "^3.5.18",
69
69
  "@vue/test-utils": "^2.4.6",
70
70
  "@vueuse/core": "^13.5.0",
71
71
  "copy": "^0.3.2",
@@ -73,12 +73,12 @@
73
73
  "happy-dom": "^18.0.1",
74
74
  "ts-dot-prop": "^2.1.4",
75
75
  "typescript": "^5.8.3",
76
- "vite": "^7.0.5",
76
+ "vite": "^7.0.6",
77
77
  "vite-plugin-dts": "^4.5.4",
78
78
  "vite-plugin-externalize-deps": "^0.9.0",
79
79
  "vitest": "^3.2.4",
80
- "vue": "^3.5.17",
81
- "zod": "^4.0.5"
80
+ "vue": "^3.5.18",
81
+ "zod": "^4.0.10"
82
82
  },
83
83
  "scripts": {
84
84
  "lint": "eslint .",
@@ -331,6 +331,8 @@ export function defineFormFieldsGroup<Schema extends FormSchema, Type = undefine
331
331
  const hasProps = computed(() => ({
332
332
  ...onUpdateEvents.value,
333
333
  ...hasFieldProps.value,
334
+ ...modelValue.value,
335
+ modelValue: modelValue.value,
334
336
  names: hasFieldProps.value.name ?? names.value,
335
337
  invalid: invalid.value,
336
338
  invalids: invalids.value,
@@ -338,7 +340,6 @@ export function defineFormFieldsGroup<Schema extends FormSchema, Type = undefine
338
340
  ? Boolean(!invalid.value && modelValue.value)
339
341
  : undefined,
340
342
  invalidLabels: invalidLabels.value,
341
- modelValue: modelValue.value,
342
343
  readonly: isReadonly.value,
343
344
  }))
344
345